diff options
author | Tom Rini <trini@konsulko.com> | 2019-10-14 07:30:16 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-10-14 07:30:16 -0400 |
commit | cd5ffc5de5a26f5b785e25654977fee25779b3e4 (patch) | |
tree | 7b63fdbb8683a9c3258f1901573c4633deec98c7 /drivers/video/sandbox_dsi_host.c | |
parent | fae79480111be47944cf66a9c052ff3934a09ce5 (diff) | |
parent | d68ed0fad6bb880bd2bbcc1d86cfc9ba971f856f (diff) |
Merge tag 'video-for-2020.01' of https://gitlab.denx.de/u-boot/custodians/u-boot-video
- panel bridge support in stm32 ltdc
- DSI host uclass
- sandbox DSI host uclass test driver and DSI host test
- MIPI DSI helpers
- Synopsys Designware MIPI DSI host bridge driver
- STM32 DSI controller driver
- OTM800A and RM68200 panel support
- DSI host updates for stm32f769 and stm32mp1 dtsi files
- splash screen for stm32f769 and stm32mp1 boards
- stm32 defconfig updates for display support
Diffstat (limited to 'drivers/video/sandbox_dsi_host.c')
-rw-r--r-- | drivers/video/sandbox_dsi_host.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/video/sandbox_dsi_host.c b/drivers/video/sandbox_dsi_host.c new file mode 100644 index 0000000000..cd644ec0b4 --- /dev/null +++ b/drivers/video/sandbox_dsi_host.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* + * Copyright (C) 2019, STMicroelectronics - All Rights Reserved + */ + +#include <common.h> +#include <display.h> +#include <dm.h> +#include <dsi_host.h> + +/** + * struct sandbox_dsi_host_priv - private data for driver + * @device: DSI peripheral device + * @timing: Display timings + * @max_data_lanes: maximum number of data lines + * @phy_ops: set of function pointers for performing physical operations + */ +struct sandbox_dsi_host_priv { + struct mipi_dsi_device *device; + struct display_timing *timings; + unsigned int max_data_lanes; + const struct mipi_dsi_phy_ops *phy_ops; +}; + +static int sandbox_dsi_host_init(struct udevice *dev, + struct mipi_dsi_device *device, + struct display_timing *timings, + unsigned int max_data_lanes, + const struct mipi_dsi_phy_ops *phy_ops) +{ + struct sandbox_dsi_host_priv *priv = dev_get_priv(dev); + + if (!device) + return -1; + + if (!timings) + return -2; + + if (max_data_lanes == 0) + return -3; + + if (!phy_ops) + return -4; + + if (!phy_ops->init || !phy_ops->get_lane_mbps || + !phy_ops->post_set_mode) + return -5; + + priv->max_data_lanes = max_data_lanes; + priv->phy_ops = phy_ops; + priv->timings = timings; + priv->device = device; + + return 0; +} + +static int sandbox_dsi_host_enable(struct udevice *dev) +{ + struct sandbox_dsi_host_priv *priv = dev_get_priv(dev); + unsigned int lane_mbps; + int ret; + + priv->phy_ops->init(priv->device); + ret = priv->phy_ops->get_lane_mbps(priv->device, priv->timings, 2, + MIPI_DSI_FMT_RGB888, &lane_mbps); + if (ret) + return -1; + + priv->phy_ops->post_set_mode(priv->device, MIPI_DSI_MODE_VIDEO); + + return 0; +} + +struct dsi_host_ops sandbox_dsi_host_ops = { + .init = sandbox_dsi_host_init, + .enable = sandbox_dsi_host_enable, +}; + +static const struct udevice_id sandbox_dsi_host_ids[] = { + { .compatible = "sandbox,dsi-host"}, + { } +}; + +U_BOOT_DRIVER(sandbox_dsi_host) = { + .name = "sandbox-dsi-host", + .id = UCLASS_DSI_HOST, + .of_match = sandbox_dsi_host_ids, + .ops = &sandbox_dsi_host_ops, + .priv_auto_alloc_size = sizeof(struct sandbox_dsi_host_priv), +}; |