From patchwork Sun Nov 17 02:40:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 11248113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 243C114DB for ; Sun, 17 Nov 2019 11:44:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C39C20730 for ; Sun, 17 Nov 2019 11:44:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C39C20730 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F24B6E312; Sun, 17 Nov 2019 11:44:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A5816E279 for ; Sun, 17 Nov 2019 07:11:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 08EDE28FC58 Received: by earth.universe (Postfix, from userid 1000) id 3A37E3C0CAB; Sun, 17 Nov 2019 03:41:40 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Laurent Pinchart , Tomi Valkeinen Subject: [RFCv1 31/42] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations Date: Sun, 17 Nov 2019 03:40:17 +0100 Message-Id: <20191117024028.2233-32-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191117024028.2233-1-sebastian.reichel@collabora.com> References: <20191117024028.2233-1-sebastian.reichel@collabora.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 17 Nov 2019 11:44:18 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@collabora.com, Tony Lindgren , "H. Nikolaus Schaller" , Merlijn Wajer , Sebastian Reichel , dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Complete the direction reversal of the DSS device enable/disable operations started by 19b4200d8f4b ("drm/omap: Reverse direction of the DSS device enable/disable operations"). This effectively drops the requirement of calling DSS specific code from the DSI panel driver moving it a bit further to a standard drm_panel driver. Signed-off-by: Sebastian Reichel --- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 75 ++++++++++--------- drivers/gpu/drm/omapdrm/omap_encoder.c | 20 ++--- 2 files changed, 44 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 9bfc262f5c5a..18020ac43a83 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata) struct omap_dss_device *src = ddata->src; u8 id1, id2, id3; int r; - struct omap_dss_dsi_config dsi_config = { - .vm = &ddata->vm, - .hs_clk_min = 150000000, - .hs_clk_max = 300000000, - .lp_clk_min = 7000000, - .lp_clk_max = 10000000, - }; - - r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies); - if (r) { - dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r); - return r; - } - - r = src->ops->dsi.set_config(src, &dsi_config); - if (r) { - dev_err(&ddata->dsi->dev, "failed to configure DSI\n"); - goto err_regulators; - } - - src->ops->enable(src); dsicm_hw_reset(ddata); @@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata) dsicm_hw_reset(ddata); - src->ops->disable(src); -err_regulators: - r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies); - if (r) - dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r); - return r; } @@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata) struct omap_dss_device *src = ddata->src; int r; + ddata->enabled = 0; + src->ops->dsi.disable_video_output(src, ddata->dsi->channel); r = mipi_dsi_dcs_set_display_off(ddata->dsi); @@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata) "error disabling panel, issuing HW reset\n"); dsicm_hw_reset(ddata); } - - src->ops->disable(src); - - r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies); - if (r) - dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r); - - ddata->enabled = 0; } static int dsicm_connect(struct omap_dss_device *src, @@ -415,6 +382,30 @@ static void dsicm_disconnect(struct omap_dss_device *src, ddata->src = NULL; } +static void dsicm_pre_enable(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + struct omap_dss_device *src = ddata->src; + int r; + struct omap_dss_dsi_config dsi_config = { + .vm = &ddata->vm, + .hs_clk_min = 150000000, + .hs_clk_max = 300000000, + .lp_clk_min = 7000000, + .lp_clk_max = 10000000, + }; + + r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies); + if (r) { + dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r); + } + + r = src->ops->dsi.set_config(src, &dsi_config); + if (r) { + dev_err(&ddata->dsi->dev, "failed to configure DSI\n"); + } +} + static void dsicm_enable(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); @@ -449,6 +440,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev) mutex_unlock(&ddata->lock); } +static void dsicm_post_disable(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + int r; + + r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies); + if (r) + dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", r); +} + static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable) { struct mipi_dsi_device *dsi = ddata->dsi; @@ -502,8 +503,10 @@ static const struct omap_dss_device_ops dsicm_ops = { .connect = dsicm_connect, .disconnect = dsicm_disconnect, + .pre_enable = dsicm_pre_enable, .enable = dsicm_enable, .disable = dsicm_disable, + .post_disable = dsicm_post_disable, .get_modes = dsicm_get_modes, .check_timings = dsicm_check_timings, @@ -666,8 +669,6 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi) omapdss_device_unregister(dssdev); - if (omapdss_device_is_enabled(dssdev)) - dsicm_disable(dssdev); omapdss_device_disconnect(ddata->src, dssdev); sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group); diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c index 24bbe9f2a32e..98f4df48a1f3 100644 --- a/drivers/gpu/drm/omapdrm/omap_encoder.c +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c @@ -171,14 +171,10 @@ static void omap_encoder_disable(struct drm_encoder *encoder) omapdss_device_disable(dssdev->next); /* - * Disable the internal encoder. This will disable the DSS output. The - * DSI is treated as an exception as DSI pipelines still use the legacy - * flow where the pipeline output controls the encoder. + * Disable the internal encoder. This will disable the DSS output. */ - if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) { - dssdev->ops->disable(dssdev); - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; - } + dssdev->ops->disable(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; /* * Perform the post-disable operations on the chain of external devices @@ -199,14 +195,10 @@ static void omap_encoder_enable(struct drm_encoder *encoder) omapdss_device_pre_enable(dssdev->next); /* - * Enable the internal encoder. This will enable the DSS output. The - * DSI is treated as an exception as DSI pipelines still use the legacy - * flow where the pipeline output controls the encoder. + * Enable the internal encoder. This will enable the DSS output. */ - if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) { - dssdev->ops->enable(dssdev); - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - } + dssdev->ops->enable(dssdev); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; /* * Enable the chain of external devices, starting at the one at the