[PATCH v6 25/84] drm/omap: dsi: drop custom enable_te() API
Tomi Valkeinen
tomi.valkeinen at ti.com
Tue Dec 15 10:45:58 UTC 2020
From: Sebastian Reichel <sebastian.reichel at collabora.com>
Instead of using the custom enable_te() API, this automatically
enables/disables TE core support when a matching packet is sent
to the panel.
Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
.../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 --
drivers/gpu/drm/omapdrm/dss/dsi.c | 34 ++++++++++++++-----
drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
3 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 0520666a7a77..a79c95a040a8 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -768,7 +768,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
{
- struct omap_dss_device *src = ddata->src;
struct mipi_dsi_device *dsi = ddata->dsi;
int r;
@@ -777,8 +776,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
else
r = mipi_dsi_dcs_set_tear_off(dsi);
- src->ops->dsi.enable_te(src, enable);
-
/* possible panel bug */
msleep(100);
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 9f8e1fd89036..b326ad91c01c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4107,10 +4107,8 @@ static void dsi_display_disable(struct omap_dss_device *dssdev,
mutex_unlock(&dsi->lock);
}
-static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
+static int dsi_enable_te(struct dsi_data *dsi, bool enable)
{
- struct dsi_data *dsi = to_dsi_data(dssdev);
-
dsi->te_enabled = enable;
if (dsi->te_gpio) {
@@ -4720,6 +4718,7 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
{
struct dsi_data *dsi = host_to_omap(host);
struct omap_dss_device *dssdev = &dsi->output;
+ int r;
if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode)
dsi_vc_enable_hs(dssdev, msg->channel,
@@ -4735,16 +4734,35 @@ static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
case MIPI_DSI_DCS_LONG_WRITE:
case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
case MIPI_DSI_NULL_PACKET:
- return dsi_vc_write_common(dssdev, msg);
+ r = dsi_vc_write_common(dssdev, msg);
+ break;
case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
- return dsi_vc_generic_read(dssdev, msg);
+ r = dsi_vc_generic_read(dssdev, msg);
+ break;
case MIPI_DSI_DCS_READ:
- return dsi_vc_dcs_read(dssdev, msg);
+ r = dsi_vc_dcs_read(dssdev, msg);
+ break;
+ default:
+ r = -EINVAL;
+ break;
}
- return -EINVAL;
+ if (r < 0)
+ return r;
+
+ if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
+ msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
+ u8 cmd = ((u8 *)msg->tx_buf)[0];
+
+ if (cmd == MIPI_DCS_SET_TEAR_OFF)
+ dsi_enable_te(dsi, false);
+ else if (cmd == MIPI_DCS_SET_TEAR_ON)
+ dsi_enable_te(dsi, true);
+ }
+
+ return 0;
}
static int dsi_get_clocks(struct dsi_data *dsi)
@@ -4791,8 +4809,6 @@ static const struct omap_dss_device_ops dsi_ops = {
.disable_video_output = dsi_disable_video_output,
.update = dsi_update,
-
- .enable_te = dsi_enable_te,
},
};
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b020e8e57e0e..2525960aa869 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
int (*set_config)(struct omap_dss_device *dssdev,
const struct omap_dss_dsi_config *cfg);
- int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
-
int (*update)(struct omap_dss_device *dssdev, int channel,
void (*callback)(int, void *), void *data);
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
More information about the dri-devel
mailing list