]>
Commit | Line | Data |
---|---|---|
51f2c99e SG |
1 | /* |
2 | * Copyright 2014 Google Inc. | |
3 | * | |
4 | * SPDX-License-Identifier: GPL-2.0+ | |
5 | */ | |
6 | ||
2dcf1433 SG |
7 | #ifndef _DISPLAY_H |
8 | #define _DISPLAY_H | |
51f2c99e SG |
9 | |
10 | struct udevice; | |
11 | struct display_timing; | |
12 | ||
13 | /** | |
2dcf1433 SG |
14 | * Display uclass platform data for each device |
15 | * | |
16 | * @source_id: ID for the source of the display data, typically a video | |
17 | * controller | |
18 | * @src_dev: Source device providing the video | |
1b68283b | 19 | * @in_use: Display is being used |
2dcf1433 SG |
20 | */ |
21 | struct display_plat { | |
22 | int source_id; | |
23 | struct udevice *src_dev; | |
1b68283b | 24 | bool in_use; |
2dcf1433 SG |
25 | }; |
26 | ||
27 | /** | |
eab314f5 | 28 | * display_read_timing() - Read timing information |
51f2c99e SG |
29 | * |
30 | * @dev: Device to read from | |
2dcf1433 | 31 | * @return 0 if OK, -ve on error |
51f2c99e | 32 | */ |
2dcf1433 | 33 | int display_read_timing(struct udevice *dev, struct display_timing *timing); |
51f2c99e SG |
34 | |
35 | /** | |
36 | * display_port_enable() - Enable a display port device | |
37 | * | |
38 | * @dev: Device to enable | |
39 | * @panel_bpp: Number of bits per pixel for panel | |
40 | * @timing: Display timings | |
41 | * @return 0 if OK, -ve on error | |
42 | */ | |
2dcf1433 SG |
43 | int display_enable(struct udevice *dev, int panel_bpp, |
44 | const struct display_timing *timing); | |
51f2c99e | 45 | |
1b68283b SG |
46 | /** |
47 | * display_in_use() - Check if a display is in use by any device | |
48 | * | |
49 | * @return true if the device is in use (display_enable() has been called | |
50 | * successfully), else false | |
51 | */ | |
52 | bool display_in_use(struct udevice *dev); | |
53 | ||
2dcf1433 | 54 | struct dm_display_ops { |
eab314f5 JC |
55 | /** |
56 | * read_timing() - Read information directly | |
57 | * | |
58 | * @dev: Device to read from | |
59 | * @timing: Display timings | |
60 | * @return 0 if OK, -ve on error | |
61 | */ | |
62 | int (*read_timing)(struct udevice *dev, struct display_timing *timing); | |
63 | ||
51f2c99e SG |
64 | /** |
65 | * read_edid() - Read information from EDID | |
66 | * | |
67 | * @dev: Device to read from | |
68 | * @buf: Buffer to read into (should be EDID_SIZE bytes) | |
69 | * @buf_size: Buffer size (should be EDID_SIZE) | |
70 | * @return number of bytes read, <=0 for error | |
71 | */ | |
72 | int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size); | |
73 | ||
74 | /** | |
75 | * enable() - Enable the display port device | |
76 | * | |
77 | * @dev: Device to enable | |
78 | * @panel_bpp: Number of bits per pixel for panel | |
79 | * @timing: Display timings | |
80 | * @return 0 if OK, -ve on error | |
81 | */ | |
82 | int (*enable)(struct udevice *dev, int panel_bpp, | |
83 | const struct display_timing *timing); | |
84 | }; | |
85 | ||
2dcf1433 | 86 | #define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops) |
51f2c99e SG |
87 | |
88 | #endif |