1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2014 Google Inc.
12 int display_read_edid(struct udevice *dev, u8 *buf, int buf_size)
14 struct dm_display_ops *ops = display_get_ops(dev);
16 if (!ops || !ops->read_edid)
18 return ops->read_edid(dev, buf, buf_size);
21 int display_enable(struct udevice *dev, int panel_bpp,
22 const struct display_timing *timing)
24 struct dm_display_ops *ops = display_get_ops(dev);
25 struct display_plat *disp_uc_plat;
28 if (!ops || !ops->enable)
30 ret = ops->enable(dev, panel_bpp, timing);
34 disp_uc_plat = dev_get_uclass_platdata(dev);
35 disp_uc_plat->in_use = true;
40 int display_read_timing(struct udevice *dev, struct display_timing *timing)
42 struct dm_display_ops *ops = display_get_ops(dev);
43 int panel_bits_per_colour;
44 u8 buf[EDID_EXT_SIZE];
47 if (ops && ops->read_timing)
48 return ops->read_timing(dev, timing);
50 if (!ops || !ops->read_edid)
52 ret = ops->read_edid(dev, buf, sizeof(buf));
56 return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
59 bool display_in_use(struct udevice *dev)
61 struct display_plat *disp_uc_plat = dev_get_uclass_platdata(dev);
63 return disp_uc_plat->in_use;
66 UCLASS_DRIVER(display) = {
69 .per_device_platdata_auto_alloc_size = sizeof(struct display_plat),