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 |
| 19 | */ |
| 20 | struct display_plat { |
| 21 | int source_id; |
| 22 | struct udevice *src_dev; |
| 23 | }; |
| 24 | |
| 25 | /** |
| 26 | * display_read_timing() - Read timing information from EDID |
| 27 | * |
| 28 | * @dev: Device to read from |
| 29 | * @return 0 if OK, -ve on error |
| 30 | */ |
| 31 | int display_read_timing(struct udevice *dev, struct display_timing *timing); |
| 32 | |
| 33 | /** |
| 34 | * display_port_enable() - Enable a display port device |
| 35 | * |
| 36 | * @dev: Device to enable |
| 37 | * @panel_bpp: Number of bits per pixel for panel |
| 38 | * @timing: Display timings |
| 39 | * @return 0 if OK, -ve on error |
| 40 | */ |
| 41 | int display_enable(struct udevice *dev, int panel_bpp, |
| 42 | const struct display_timing *timing); |
| 43 | |
| 44 | struct dm_display_ops { |
| 45 | /** |
| 46 | * read_edid() - Read information from EDID |
| 47 | * |
| 48 | * @dev: Device to read from |
| 49 | * @buf: Buffer to read into (should be EDID_SIZE bytes) |
| 50 | * @buf_size: Buffer size (should be EDID_SIZE) |
| 51 | * @return number of bytes read, <=0 for error |
| 52 | */ |
| 53 | int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size); |
| 54 | |
| 55 | /** |
| 56 | * enable() - Enable the display port device |
| 57 | * |
| 58 | * @dev: Device to enable |
| 59 | * @panel_bpp: Number of bits per pixel for panel |
| 60 | * @timing: Display timings |
| 61 | * @return 0 if OK, -ve on error |
| 62 | */ |
| 63 | int (*enable)(struct udevice *dev, int panel_bpp, |
| 64 | const struct display_timing *timing); |
| 65 | }; |
| 66 | |
| 67 | #define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops) |
| 68 | |
| 69 | #endif |