mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-11 13:56:30 +00:00
eab314f590
The current display class only allow to get timing from edid. So add a operation to get timing directly from driver. In driver, I will use fdtdec_decode_display_timing to get timing. Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com> Acked-by: Simon Glass <sjg@chromium.org>
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <display.h>
|
|
#include <edid.h>
|
|
#include <errno.h>
|
|
|
|
int display_read_edid(struct udevice *dev, u8 *buf, int buf_size)
|
|
{
|
|
struct dm_display_ops *ops = display_get_ops(dev);
|
|
|
|
if (!ops || !ops->read_edid)
|
|
return -ENOSYS;
|
|
return ops->read_edid(dev, buf, buf_size);
|
|
}
|
|
|
|
int display_enable(struct udevice *dev, int panel_bpp,
|
|
const struct display_timing *timing)
|
|
{
|
|
struct dm_display_ops *ops = display_get_ops(dev);
|
|
|
|
if (!ops || !ops->enable)
|
|
return -ENOSYS;
|
|
return ops->enable(dev, panel_bpp, timing);
|
|
}
|
|
|
|
int display_read_timing(struct udevice *dev, struct display_timing *timing)
|
|
{
|
|
struct dm_display_ops *ops = display_get_ops(dev);
|
|
int panel_bits_per_colour;
|
|
u8 buf[EDID_EXT_SIZE];
|
|
int ret;
|
|
|
|
if (ops && ops->read_timing)
|
|
return ops->read_timing(dev, timing);
|
|
|
|
if (!ops || !ops->read_edid)
|
|
return -ENOSYS;
|
|
ret = ops->read_edid(dev, buf, sizeof(buf));
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
|
|
}
|
|
|
|
UCLASS_DRIVER(display) = {
|
|
.id = UCLASS_DISPLAY,
|
|
.name = "display",
|
|
.per_device_platdata_auto_alloc_size = sizeof(struct display_plat),
|
|
};
|