1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
12 * struct sandbox_dsi_host_priv - private data for driver
13 * @device: DSI peripheral device
14 * @timing: Display timings
15 * @max_data_lanes: maximum number of data lines
16 * @phy_ops: set of function pointers for performing physical operations
18 struct sandbox_dsi_host_priv
{
19 struct mipi_dsi_device
*device
;
20 struct display_timing
*timings
;
21 unsigned int max_data_lanes
;
22 const struct mipi_dsi_phy_ops
*phy_ops
;
25 static int sandbox_dsi_host_init(struct udevice
*dev
,
26 struct mipi_dsi_device
*device
,
27 struct display_timing
*timings
,
28 unsigned int max_data_lanes
,
29 const struct mipi_dsi_phy_ops
*phy_ops
)
31 struct sandbox_dsi_host_priv
*priv
= dev_get_priv(dev
);
39 if (max_data_lanes
== 0)
45 if (!phy_ops
->init
|| !phy_ops
->get_lane_mbps
||
46 !phy_ops
->post_set_mode
)
49 priv
->max_data_lanes
= max_data_lanes
;
50 priv
->phy_ops
= phy_ops
;
51 priv
->timings
= timings
;
52 priv
->device
= device
;
57 static int sandbox_dsi_host_enable(struct udevice
*dev
)
59 struct sandbox_dsi_host_priv
*priv
= dev_get_priv(dev
);
60 unsigned int lane_mbps
;
63 priv
->phy_ops
->init(priv
->device
);
64 ret
= priv
->phy_ops
->get_lane_mbps(priv
->device
, priv
->timings
, 2,
65 MIPI_DSI_FMT_RGB888
, &lane_mbps
);
69 priv
->phy_ops
->post_set_mode(priv
->device
, MIPI_DSI_MODE_VIDEO
);
74 struct dsi_host_ops sandbox_dsi_host_ops
= {
75 .init
= sandbox_dsi_host_init
,
76 .enable
= sandbox_dsi_host_enable
,
79 static const struct udevice_id sandbox_dsi_host_ids
[] = {
80 { .compatible
= "sandbox,dsi-host"},
84 U_BOOT_DRIVER(sandbox_dsi_host
) = {
85 .name
= "sandbox-dsi-host",
86 .id
= UCLASS_DSI_HOST
,
87 .of_match
= sandbox_dsi_host_ids
,
88 .ops
= &sandbox_dsi_host_ops
,
89 .priv_auto
= sizeof(struct sandbox_dsi_host_priv
),