Commit a5f2dcde authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen

drm/omap: dsi: request VC via mipi_dsi_attach

Drop custom request_vc/release_vc callbacks by using the
generic mipi_dsi_attach/mipi_dsi_detach functions.

To use mipi_dsi_attach() we need to fill in the mipi_dsi_device fields,
and some of these fields overlap with the fields in omap_dss_dsi_config.
In later patches the latter will get dropped.
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-15-tomi.valkeinen@ti.com
parent d4cf1537
...@@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src, ...@@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
struct omap_dss_device *dst) struct omap_dss_device *dst)
{ {
struct panel_drv_data *ddata = to_panel_data(dst); struct panel_drv_data *ddata = to_panel_data(dst);
struct device *dev = &ddata->dsi->dev;
int r;
r = src->ops->dsi.request_vc(src, ddata->channel);
if (r) {
dev_err(dev, "failed to get virtual channel\n");
return r;
}
ddata->src = src; ddata->src = src;
return 0; return 0;
...@@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src, ...@@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
{ {
struct panel_drv_data *ddata = to_panel_data(dst); struct panel_drv_data *ddata = to_panel_data(dst);
src->ops->dsi.release_vc(src, ddata->channel);
ddata->src = NULL; ddata->src = NULL;
} }
...@@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi) ...@@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
goto err_bl; goto err_bl;
} }
dsi->lanes = 2;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
MIPI_DSI_MODE_EOT_PACKET;
dsi->hs_rate = 300000000;
dsi->lp_rate = 10000000;
r = mipi_dsi_attach(dsi);
if (r < 0)
goto err_dsi_attach;
return 0; return 0;
err_dsi_attach:
sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
err_bl: err_bl:
destroy_workqueue(ddata->workqueue); destroy_workqueue(ddata->workqueue);
err_reg: err_reg:
...@@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi) ...@@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
dev_dbg(&dsi->dev, "remove\n"); dev_dbg(&dsi->dev, "remove\n");
mipi_dsi_detach(dsi);
omapdss_device_unregister(dssdev); omapdss_device_unregister(dssdev);
if (omapdss_device_is_enabled(dssdev)) if (omapdss_device_is_enabled(dssdev))
......
...@@ -349,7 +349,7 @@ struct dsi_data { ...@@ -349,7 +349,7 @@ struct dsi_data {
struct { struct {
enum dsi_vc_source source; enum dsi_vc_source source;
struct omap_dss_device *dssdev; struct mipi_dsi_device *dest;
enum fifo_size tx_fifo_size; enum fifo_size tx_fifo_size;
enum fifo_size rx_fifo_size; enum fifo_size rx_fifo_size;
} vc[4]; } vc[4];
...@@ -4689,32 +4689,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi) ...@@ -4689,32 +4689,6 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi)
} }
} }
static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
{
struct dsi_data *dsi = to_dsi_data(dssdev);
if (channel < 0 || channel > 3)
return -EINVAL;
if (dsi->vc[channel].dssdev) {
DSSERR("cannot get VC for display %s", dssdev->name);
return -EBUSY;
}
dsi->vc[channel].dssdev = dssdev;
return 0;
}
static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
{
struct dsi_data *dsi = to_dsi_data(dssdev);
if ((channel >= 0 && channel <= 3) &&
dsi->vc[channel].dssdev == dssdev) {
dsi->vc[channel].dssdev = NULL;
}
}
static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host, static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
const struct mipi_dsi_msg *msg) const struct mipi_dsi_msg *msg)
{ {
...@@ -4791,23 +4765,40 @@ static const struct omap_dss_device_ops dsi_ops = { ...@@ -4791,23 +4765,40 @@ static const struct omap_dss_device_ops dsi_ops = {
.update = dsi_update, .update = dsi_update,
.enable_te = dsi_enable_te, .enable_te = dsi_enable_te,
.request_vc = dsi_request_vc,
.release_vc = dsi_release_vc,
}, },
}; };
static int omap_dsi_host_attach(struct mipi_dsi_host *host, static int omap_dsi_host_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *dsi) struct mipi_dsi_device *client)
{ {
/* TODO: convert driver from custom binding method to this one */ struct dsi_data *dsi = host_to_omap(host);
unsigned int channel = client->channel;
if (channel > 3)
return -EINVAL;
if (dsi->vc[channel].dest) {
DSSERR("cannot get VC for display %s", dev_name(&client->dev));
return -EBUSY;
}
dsi->vc[channel].dest = client;
return 0; return 0;
} }
static int omap_dsi_host_detach(struct mipi_dsi_host *host, static int omap_dsi_host_detach(struct mipi_dsi_host *host,
struct mipi_dsi_device *dsi) struct mipi_dsi_device *client)
{ {
/* TODO: convert driver from custom binding method to this one */ struct dsi_data *dsi = host_to_omap(host);
unsigned int channel = client->channel;
if (channel > 3)
return -EINVAL;
if (dsi->vc[channel].dest != client)
return -EINVAL;
dsi->vc[channel].dest = NULL;
return 0; return 0;
} }
...@@ -5265,7 +5256,7 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -5265,7 +5256,7 @@ static int dsi_probe(struct platform_device *pdev)
/* DSI VCs initialization */ /* DSI VCs initialization */
for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
dsi->vc[i].source = DSI_VC_SOURCE_L4; dsi->vc[i].source = DSI_VC_SOURCE_L4;
dsi->vc[i].dssdev = NULL; dsi->vc[i].dest = NULL;
} }
r = dsi_get_clocks(dsi); r = dsi_get_clocks(dsi);
......
...@@ -304,9 +304,6 @@ struct omapdss_dsi_ops { ...@@ -304,9 +304,6 @@ struct omapdss_dsi_ops {
int (*enable_video_output)(struct omap_dss_device *dssdev, int channel); int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
void (*disable_video_output)(struct omap_dss_device *dssdev, void (*disable_video_output)(struct omap_dss_device *dssdev,
int channel); int channel);
int (*request_vc)(struct omap_dss_device *dssdev, int channel);
void (*release_vc)(struct omap_dss_device *dssdev, int channel);
}; };
struct omap_dss_device_ops { struct omap_dss_device_ops {
......
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