Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #ifndef _DISPLAY_H |
| 8 | #define _DISPLAY_H |
| 9 | |
| 10 | struct udevice; |
| 11 | struct display_timing; |
| 12 | |
| 13 | /** |
| 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 |
Simon Glass | 365b7f7 | 2016-11-13 14:22:07 -0700 | [diff] [blame^] | 19 | * @in_use: Display is being used |
Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 20 | */ |
| 21 | struct display_plat { |
| 22 | int source_id; |
| 23 | struct udevice *src_dev; |
Simon Glass | 365b7f7 | 2016-11-13 14:22:07 -0700 | [diff] [blame^] | 24 | bool in_use; |
Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | /** |
Jacob Chen | 4b28a90 | 2016-03-14 11:20:14 +0800 | [diff] [blame] | 28 | * display_read_timing() - Read timing information |
Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 29 | * |
| 30 | * @dev: Device to read from |
| 31 | * @return 0 if OK, -ve on error |
| 32 | */ |
| 33 | int display_read_timing(struct udevice *dev, struct display_timing *timing); |
| 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 | */ |
| 43 | int display_enable(struct udevice *dev, int panel_bpp, |
| 44 | const struct display_timing *timing); |
| 45 | |
Simon Glass | 365b7f7 | 2016-11-13 14:22:07 -0700 | [diff] [blame^] | 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 | |
Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 54 | struct dm_display_ops { |
| 55 | /** |
Jacob Chen | 4b28a90 | 2016-03-14 11:20:14 +0800 | [diff] [blame] | 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 | |
| 64 | /** |
Simon Glass | 7d3d776 | 2016-01-21 19:45:00 -0700 | [diff] [blame] | 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 | |
| 86 | #define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops) |
| 87 | |
| 88 | #endif |