blob: d0a08d4aaa8f6e35b0891c776eeec161a95d5354 [file] [log] [blame]
Simon Glass2dcf1432016-01-21 19:45:00 -07001/*
2 * Copyright 2014 Google Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _DISPLAY_H
8#define _DISPLAY_H
9
10struct udevice;
11struct 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 Glass1b682832016-11-13 14:22:07 -070019 * @in_use: Display is being used
Simon Glass2dcf1432016-01-21 19:45:00 -070020 */
21struct display_plat {
22 int source_id;
23 struct udevice *src_dev;
Simon Glass1b682832016-11-13 14:22:07 -070024 bool in_use;
Simon Glass2dcf1432016-01-21 19:45:00 -070025};
26
27/**
Jacob Cheneab314f2016-03-14 11:20:14 +080028 * display_read_timing() - Read timing information
Simon Glass2dcf1432016-01-21 19:45:00 -070029 *
30 * @dev: Device to read from
31 * @return 0 if OK, -ve on error
32 */
33int 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 */
43int display_enable(struct udevice *dev, int panel_bpp,
44 const struct display_timing *timing);
45
Simon Glass1b682832016-11-13 14:22:07 -070046/**
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 */
52bool display_in_use(struct udevice *dev);
53
Simon Glass2dcf1432016-01-21 19:45:00 -070054struct dm_display_ops {
55 /**
Jacob Cheneab314f2016-03-14 11:20:14 +080056 * 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 Glass2dcf1432016-01-21 19:45:00 -070065 * 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