2 * Copyright 2014 Google Inc.
4 * SPDX-License-Identifier: GPL-2.0+
13 int display_read_edid(struct udevice *dev, u8 *buf, int buf_size)
15 struct dm_display_ops *ops = display_get_ops(dev);
17 if (!ops || !ops->read_edid)
19 return ops->read_edid(dev, buf, buf_size);
22 int display_enable(struct udevice *dev, int panel_bpp,
23 const struct display_timing *timing)
25 struct dm_display_ops *ops = display_get_ops(dev);
26 struct display_plat *disp_uc_plat;
29 if (!ops || !ops->enable)
31 ret = ops->enable(dev, panel_bpp, timing);
35 disp_uc_plat = dev_get_uclass_platdata(dev);
36 disp_uc_plat->in_use = true;
41 int display_read_timing(struct udevice *dev, struct display_timing *timing)
43 struct dm_display_ops *ops = display_get_ops(dev);
44 int panel_bits_per_colour;
45 u8 buf[EDID_EXT_SIZE];
48 if (ops && ops->read_timing)
49 return ops->read_timing(dev, timing);
51 if (!ops || !ops->read_edid)
53 ret = ops->read_edid(dev, buf, sizeof(buf));
57 return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
60 bool display_in_use(struct udevice *dev)
62 struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
64 return disp_uc_plat->in_use;
67 UCLASS_DRIVER(display) = {
70 .per_device_platdata_auto_alloc_size = sizeof(struct display_plat),