From patchwork Tue Nov 24 12:44:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 11928271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19495C2D0E4 for ; Tue, 24 Nov 2020 12:46:48 +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 ACDBB2073C for ; Tue, 24 Nov 2020 12:46:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="c/iMugQh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACDBB2073C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.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 E6D106E3E3; Tue, 24 Nov 2020 12:46:44 +0000 (UTC) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2987A6E3BB for ; Tue, 24 Nov 2020 12:46:33 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AOCkQUT122991; Tue, 24 Nov 2020 06:46:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1606221986; bh=gBSPZKXra7r/LqnOaUxdIvt/gaWGTIlVE4TEl8J4pu8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=c/iMugQhqjbRTxXWyV9LB6IV5n4f9rwpiSQKbHVLRRIQZXRu8AbWnr2cxNWP1+VKl UOjEhbxsQIWkwoPvy2w3z+lcdeI31ndtQLyX3238061EgCz0e7yBYVzTS1hfNVFWIS lloDO2Jvqx9YkHN+P5Q8P2AgLN96ryj7gHzZQYKU= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AOCkQ06045006 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Nov 2020 06:46:26 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 24 Nov 2020 06:46:26 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 24 Nov 2020 06:46:26 -0600 Received: from deskari.lan (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AOCjmp3040922; Tue, 24 Nov 2020 06:46:23 -0600 From: Tomi Valkeinen To: Sebastian Reichel , Laurent Pinchart , Nikhil Devshatwar , , Subject: [PATCH v4 14/80] drm/omap: dsi: request VC via mipi_dsi_attach Date: Tue, 24 Nov 2020 14:44:32 +0200 Message-ID: <20201124124538.660710-15-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201124124538.660710-1-tomi.valkeinen@ti.com> References: <20201124124538.660710-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tony Lindgren , hns@goldelico.com, Tomi Valkeinen , Sekhar Nori , Sebastian Reichel Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sebastian Reichel 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: Sebastian Reichel Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 24 +++++--- drivers/gpu/drm/omapdrm/dss/dsi.c | 61 ++++++++----------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 - 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index ec36e62ddc3a..0a8f289176ab 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src, struct omap_dss_device *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; return 0; @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src, { struct panel_drv_data *ddata = to_panel_data(dst); - src->ops->dsi.release_vc(src, ddata->channel); ddata->src = NULL; } @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi) 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; +err_dsi_attach: + sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group); err_bl: destroy_workqueue(ddata->workqueue); err_reg: @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device *dsi) dev_dbg(&dsi->dev, "remove\n"); + mipi_dsi_detach(dsi); + omapdss_device_unregister(dssdev); if (omapdss_device_is_enabled(dssdev)) diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index 2ba56ca12213..25d2af1e1a00 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -349,7 +349,7 @@ struct dsi_data { struct { enum dsi_vc_source source; - struct omap_dss_device *dssdev; + struct mipi_dsi_device *dest; enum fifo_size tx_fifo_size; enum fifo_size rx_fifo_size; } vc[4]; @@ -4691,32 +4691,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, const struct mipi_dsi_msg *msg) { @@ -4793,23 +4767,40 @@ static const struct omap_dss_device_ops dsi_ops = { .update = dsi_update, .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, - 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; } 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; } @@ -5267,7 +5258,7 @@ static int dsi_probe(struct platform_device *pdev) /* DSI VCs initialization */ 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].dest = NULL; } r = dsi_get_clocks(dsi); diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 8cd2c800922e..78041ef922cc 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -301,9 +301,6 @@ struct omapdss_dsi_ops { int (*enable_video_output)(struct omap_dss_device *dssdev, int channel); void (*disable_video_output)(struct omap_dss_device *dssdev, 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 {