Commit 578739e8 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen

drm/omap: dsi: simplify pin config

Simplify DSI pin config, which always originates from DT
nowadays. With the code being fully contained in the DSI
encoder, we can drop the public structure.

Since the function is no longer exposed, it now directly
takes the private DSI data pointer. This drops a pointless
conversion and means the pins can be configured earlier.
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201215104657.802264-49-tomi.valkeinen@ti.com
parent 94d73329
...@@ -3570,12 +3570,9 @@ static void dsi_proto_timings(struct dsi_data *dsi) ...@@ -3570,12 +3570,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
} }
} }
static int dsi_configure_pins(struct omap_dss_device *dssdev, static int dsi_configure_pins(struct dsi_data *dsi,
const struct omap_dsi_pin_config *pin_cfg) int num_pins, const u32 *pins)
{ {
struct dsi_data *dsi = to_dsi_data(dssdev);
int num_pins;
const int *pins;
struct dsi_lane_config lanes[DSI_MAX_NR_LANES]; struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
int num_lanes; int num_lanes;
int i; int i;
...@@ -3588,9 +3585,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev, ...@@ -3588,9 +3585,6 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
DSI_LANE_DATA4, DSI_LANE_DATA4,
}; };
num_pins = pin_cfg->num_pins;
pins = pin_cfg->pins;
if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2 if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
|| num_pins % 2 != 0) || num_pins % 2 != 0)
return -EINVAL; return -EINVAL;
...@@ -3602,15 +3596,15 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev, ...@@ -3602,15 +3596,15 @@ static int dsi_configure_pins(struct omap_dss_device *dssdev,
for (i = 0; i < num_pins; i += 2) { for (i = 0; i < num_pins; i += 2) {
u8 lane, pol; u8 lane, pol;
int dx, dy; u32 dx, dy;
dx = pins[i]; dx = pins[i];
dy = pins[i + 1]; dy = pins[i + 1];
if (dx < 0 || dx >= dsi->num_lanes_supported * 2) if (dx >= dsi->num_lanes_supported * 2)
return -EINVAL; return -EINVAL;
if (dy < 0 || dy >= dsi->num_lanes_supported * 2) if (dy >= dsi->num_lanes_supported * 2)
return -EINVAL; return -EINVAL;
if (dx & 1) { if (dx & 1) {
...@@ -5477,9 +5471,8 @@ static int dsi_probe_of(struct dsi_data *dsi) ...@@ -5477,9 +5471,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
struct property *prop; struct property *prop;
u32 lane_arr[10]; u32 lane_arr[10];
int len, num_pins; int len, num_pins;
int r, i; int r;
struct device_node *ep; struct device_node *ep;
struct omap_dsi_pin_config pin_cfg;
ep = of_graph_get_endpoint_by_regs(node, 0, 0); ep = of_graph_get_endpoint_by_regs(node, 0, 0);
if (!ep) if (!ep)
...@@ -5507,11 +5500,7 @@ static int dsi_probe_of(struct dsi_data *dsi) ...@@ -5507,11 +5500,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
goto err; goto err;
} }
pin_cfg.num_pins = num_pins; r = dsi_configure_pins(dsi, num_pins, lane_arr);
for (i = 0; i < num_pins; ++i)
pin_cfg.pins[i] = (int)lane_arr[i];
r = dsi_configure_pins(&dsi->output, &pin_cfg);
if (r) { if (r) {
dev_err(dsi->dev, "failed to configure pins"); dev_err(dsi->dev, "failed to configure pins");
goto err; goto err;
...@@ -5724,6 +5713,12 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -5724,6 +5713,12 @@ static int dsi_probe(struct platform_device *pdev)
dsi->host.ops = &omap_dsi_host_ops; dsi->host.ops = &omap_dsi_host_ops;
dsi->host.dev = &pdev->dev; dsi->host.dev = &pdev->dev;
r = dsi_probe_of(dsi);
if (r) {
DSSERR("Invalid DSI DT data\n");
goto err_pm_disable;
}
r = mipi_dsi_host_register(&dsi->host); r = mipi_dsi_host_register(&dsi->host);
if (r < 0) { if (r < 0) {
dev_err(&pdev->dev, "failed to register DSI host: %d\n", r); dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
...@@ -5734,12 +5729,6 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -5734,12 +5729,6 @@ static int dsi_probe(struct platform_device *pdev)
if (r) if (r)
goto err_dsi_host_unregister; goto err_dsi_host_unregister;
r = dsi_probe_of(dsi);
if (r) {
DSSERR("Invalid DSI DT data\n");
goto err_uninit_output;
}
r = component_add(&pdev->dev, &dsi_component_ops); r = component_add(&pdev->dev, &dsi_component_ops);
if (r) if (r)
goto err_uninit_output; goto err_uninit_output;
......
...@@ -246,21 +246,6 @@ struct omap_overlay_manager_info { ...@@ -246,21 +246,6 @@ struct omap_overlay_manager_info {
struct omap_dss_cpr_coefs cpr_coefs; struct omap_dss_cpr_coefs cpr_coefs;
}; };
/* 22 pins means 1 clk lane and 10 data lanes */
#define OMAP_DSS_MAX_DSI_PINS 22
struct omap_dsi_pin_config {
int num_pins;
/*
* pin numbers in the following order:
* clk+, clk-
* data1+, data1-
* data2+, data2-
* ...
*/
int pins[OMAP_DSS_MAX_DSI_PINS];
};
struct omap_dss_writeback_info { struct omap_dss_writeback_info {
u32 paddr; u32 paddr;
u32 p_uv_addr; u32 p_uv_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment