From patchwork Sun Nov 17 02:39:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 11247953 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 34FC2184C for ; Sun, 17 Nov 2019 02:41:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D5C22075C for ; Sun, 17 Nov 2019 02:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726174AbfKQCls (ORCPT ); Sat, 16 Nov 2019 21:41:48 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:49084 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfKQClq (ORCPT ); Sat, 16 Nov 2019 21:41:46 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id A078228F765 Received: by earth.universe (Postfix, from userid 1000) id A965A3C0C7F; Sun, 17 Nov 2019 03:41:39 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Laurent Pinchart , Tomi Valkeinen Cc: Tony Lindgren , Merlijn Wajer , "H. Nikolaus Schaller" , linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com, Sebastian Reichel Subject: [RFCv1 07/42] drm/omap: dsi: drop virtual channel logic Date: Sun, 17 Nov 2019 03:39:53 +0100 Message-Id: <20191117024028.2233-8-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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This drops the virtual channel logic. Afterwards DSI clients request their channel number and get the virtual channel with the same number or -EBUSY if already in use. Signed-off-by: Sebastian Reichel --- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 11 ++--- drivers/gpu/drm/omapdrm/dss/dsi.c | 46 ++++--------------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 4 +- 3 files changed, 12 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 05974059f231..b505bfd221fc 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -769,19 +769,12 @@ static int dsicm_connect(struct omap_dss_device *src, struct device *dev = &ddata->pdev->dev; int r; - r = src->ops->dsi.request_vc(src, &ddata->channel); + r = src->ops->dsi.request_vc(src, ddata->channel); if (r) { dev_err(dev, "failed to get virtual channel\n"); return r; } - r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH); - if (r) { - dev_err(dev, "failed to set VC_ID\n"); - src->ops->dsi.release_vc(src, ddata->channel); - return r; - } - ddata->src = src; return 0; } @@ -1216,6 +1209,8 @@ static int dsicm_probe_of(struct platform_device *pdev) struct display_timing timing; int err; + ddata->channel = TCH; + ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ddata->reset_gpio)) { err = PTR_ERR(ddata->reset_gpio); diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index de4ec6055490..4d55e7c9cd65 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -350,7 +350,6 @@ struct dsi_data { struct omap_dss_device *dssdev; enum fifo_size tx_fifo_size; enum fifo_size rx_fifo_size; - int vc_id; } vc[4]; struct mutex lock; @@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct dsi_data *dsi, int channel, WARN_ON(!dsi_bus_is_locked(dsi)); - data_id = data_type | dsi->vc[channel].vc_id << 6; + data_id = data_type | channel << 6; val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) | FLD_VAL(ecc, 31, 24); @@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type, return -EINVAL; } - data_id = data_type | dsi->vc[channel].vc_id << 6; + data_id = data_type | channel << 6; r = (data_id << 0) | (data << 8) | (ecc << 24); @@ -4783,45 +4782,19 @@ static enum omap_channel dsi_get_channel(struct dsi_data *dsi) } } -static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel) +static int dsi_request_vc(struct omap_dss_device *dssdev, int channel) { struct dsi_data *dsi = to_dsi_data(dssdev); - int i; - - for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { - if (!dsi->vc[i].dssdev) { - dsi->vc[i].dssdev = dssdev; - *channel = i; - return 0; - } - } - DSSERR("cannot get VC for display %s", dssdev->name); - return -ENOSPC; -} - -static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id) -{ - struct dsi_data *dsi = to_dsi_data(dssdev); - - if (vc_id < 0 || vc_id > 3) { - DSSERR("VC ID out of range\n"); - return -EINVAL; - } - - if (channel < 0 || channel > 3) { - DSSERR("Virtual Channel out of range\n"); + if (channel < 0 || channel > 3) return -EINVAL; - } - if (dsi->vc[channel].dssdev != dssdev) { - DSSERR("Virtual Channel not allocated to display %s\n", - dssdev->name); - return -EINVAL; + if (dsi->vc[channel].dssdev) { + DSSERR("cannot get VC for display %s", dssdev->name); + return -EBUSY; } - dsi->vc[channel].vc_id = vc_id; - + dsi->vc[channel].dssdev = dssdev; return 0; } @@ -4832,7 +4805,6 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel) if ((channel >= 0 && channel <= 3) && dsi->vc[channel].dssdev == dssdev) { dsi->vc[channel].dssdev = NULL; - dsi->vc[channel].vc_id = 0; } } @@ -4937,7 +4909,6 @@ static const struct omap_dss_device_ops dsi_ops = { .enable_te = dsi_enable_te, .request_vc = dsi_request_vc, - .set_vc_id = dsi_set_vc_id, .release_vc = dsi_release_vc, .transfer = omap_dsi_transfer, @@ -5393,7 +5364,6 @@ static int dsi_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { dsi->vc[i].source = DSI_VC_SOURCE_L4; dsi->vc[i].dssdev = NULL; - dsi->vc[i].vc_id = 0; } r = dsi_get_clocks(dsi); diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 79ae4073c35f..143ff346c311 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -308,9 +308,7 @@ struct omapdss_dsi_ops { void (*disable_video_output)(struct omap_dss_device *dssdev, int channel); - int (*request_vc)(struct omap_dss_device *dssdev, int *channel); - int (*set_vc_id)(struct omap_dss_device *dssdev, int channel, - int vc_id); + int (*request_vc)(struct omap_dss_device *dssdev, int channel); void (*release_vc)(struct omap_dss_device *dssdev, int channel); /* data transfer */