Received: by 10.223.176.5 with SMTP id f5csp2329820wra; Mon, 5 Feb 2018 02:08:33 -0800 (PST) X-Google-Smtp-Source: AH8x226zGK0vDHR5F8HR0Ql+uvDqNmdj1KPd6jLsRIzm27otcPGfENdJ4kiIuj46vYJZyVObLMB9 X-Received: by 10.99.142.66 with SMTP id k63mr8727965pge.278.1517825313454; Mon, 05 Feb 2018 02:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517825313; cv=none; d=google.com; s=arc-20160816; b=0nSWtCw/5akvfextH//5aHNi6Bhx6thnl6/87Y9DENHJW7K+WxSXbhIcjdc/MatX3E uuhRmkqaajenaNGeYhYOyPi6xS9uBXlr7/o3wh0IaAA19HXh1sBzguJWI4tiwC9nFY6Y eBgopWlOeXPuxvFB8BSI38fNBvIvy8MDRnI/Oxg3FqTBiuQqnI8AEQ15zdSq299/glUj ALOw0Xt3HDjAtkQJIne11xvJhsI6Bsm23QWr8aiyOAxzBJ2/3OfZEmMSN+bx2vI4iop6 0HdeZy2Hl7zx1KAivx1xJaec7EdVEEecFLVymkcB2JAZs7YSvJj78A8mrmrBkObsVHiQ /t2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:user-agent:date:message-id :from:cc:to:subject:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=MhvyamO+yc6niP+L4kI8743vhpQUnBpXZnHcK7oUDNs=; b=P9zZ7ru23dJjrj5xwSPMktAIBhhm+pY7xktFIPcN5Da1pbd016JvT2L/t/6kSt/ZYW 818ljrISC4ByPrKiY5LFyJuFVfuCC540c08J5tb7A2iCrfvTTPzzRmCPJk3b8SZ9F6CY 279BD4pkp1+lUdM0I5m294p95EcQP0X7QAhoA4VboJN4xeygjiiH/AJqnL3bnbCwZCi6 Omrz7xTSE7NAyXfm2UJWTcmKziCeWA0J7bSjQ3JnQsqFaIan4If/qC0hREJ6aIp0gV+a FKmyLGur7ENx8SDAYRVZi3K6ScmxAktdJVLWVehIT5L/r9aONG5PFo2/Z+VYaZ3rsYL1 jysQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lohx/uqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si5300524pgq.223.2018.02.05.02.08.18; Mon, 05 Feb 2018 02:08:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lohx/uqy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbeBEKHg (ORCPT + 99 others); Mon, 5 Feb 2018 05:07:36 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:45438 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752317AbeBEKH2 (ORCPT ); Mon, 5 Feb 2018 05:07:28 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180205100726euoutp0264f21ee923b0e49038a0f526df08741d~QZgUOWqR30466304663euoutp02X; Mon, 5 Feb 2018 10:07:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180205100726euoutp0264f21ee923b0e49038a0f526df08741d~QZgUOWqR30466304663euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1517825246; bh=MhvyamO+yc6niP+L4kI8743vhpQUnBpXZnHcK7oUDNs=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=lohx/uqyBTqIcaIZBcDXh8hEzdX05zaD7m4VxasPdSxqyzIOs0OLeOMHg/5vBXDm3 OKeKRfCS07oYh8PVLgNj2NHwp7W8iMsx4OKPyh82rEn5aeMqabW8ow7sp4jAw17/+Q AUKde5v1vCX+3MOqGdNs2unJP64voBZhlEjaSrmQ= Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180205100725eucas1p29bd169e7fcebebe7ad1c6f3b349fdacd~QZgTmb4oG1272112721eucas1p2r; Mon, 5 Feb 2018 10:07:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 41.16.30163.DDC287A5; Mon, 5 Feb 2018 10:07:25 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180205100724eucas1p2d8879483c71424965f76c25d09395268~QZgS5OaS81268412684eucas1p2l; Mon, 5 Feb 2018 10:07:24 +0000 (GMT) X-AuditID: cbfec7f4-f790c6d0000075d3-58-5a782cddb4ca Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E5.5A.18832.CDC287A5; Mon, 5 Feb 2018 10:07:24 +0000 (GMT) MIME-version: 1.0 Content-type: text/plain; charset="utf-8" Received: from [106.120.43.17] by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P3O009PQ9GCVB60@eusync3.samsung.com>; Mon, 05 Feb 2018 10:07:24 +0000 (GMT) Subject: Re: [PATCH] drm/bridge/synopsys: dsi: Add read feature To: Philippe Cornu , Archit Taneja , Laurent Pinchart , David Airlie , Brian Norris , Benjamin Gaignard , Bhumika Goyal , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sandy Huang , Heiko Stubner , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Cc: Yannick Fertre , Vincent Abriou , Alexandre Torgue From: Andrzej Hajda Message-id: <81cb1f26-96f0-bdc6-28bc-4a7bda5a9459@samsung.com> Date: Mon, 05 Feb 2018 11:07:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-reply-to: <20180204213104.17834-1-philippe.cornu@st.com> Content-transfer-encoding: 8bit Content-language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0hTcRTmt/vY1Vxc5+uUkbEIepgmSVzSnkTc7I+M+qNGYEMvGjmVXZ+B OWeWj0wz07xqZa4s/5F8G1k6w6nzmTYR1CSbRmVWalSUtu0a+N93zved851zOBQmnyXWUxei YjlNlCpSQTriDR2/+neOeycqd6X3eTA5fV0S5ul7E2J0GbMEozN0k8z3iVySqfk2RzDDi3Mk s/zuE8GU5SczmTf1UqZmykwwQ89KrbLJZYyZvPKBYHretOLMtcx08iDNlmgHcXboRo6EbRbG pWxJRjHBjpmfk2zjj0mCfZttlLC1+hT2r/ASZxvNdzHW8rMFY+drNgY7KR0Dw7jIC/Gcxnf/ eceIoi8eMe3rEn9XtEi1aN4lCzlQQPtD9688QsTuMDBRTWYhR0pOP0RgXGonxGAeweLMFPpf UdncuEI8QnC9yYLbCBntDD9vTdgxRm+DDwv5uCiaRjBpLrN7uNAHoL81TWIjXGkdDub3pZgt wGgtgumyQtKmIq3lf2tHrZiytt0P76ZSbGmc3gIm0yN7Izf6DJTftthHcqADYPaesOLsBW3D MyvYA9LSR+1TAN0thVzL25UdjkBhn04iYhf4aKyTingDZGa0ScSCbATfczulYlCAYOnrHUxU BUC7cZAQLdZCfkMRZpsUaBlkXJWLEhZ0w+O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I4UE0hNLUrNTUwtSi2CyTBycUg2MU0O9xLyl9Y/tlTny QqvEvPMz24wrGkxTwu49kl1xo2lhyNTekNaOvHlp66dq7WMuWhj7ITcrXcfu8RKVTu9JRc+C 5NrZAxc+mpvmx/Tmi8iLKJVrx2z4Jvq2LE82j3iZyWH8UcV5vmGxmFM/05mt35Nd78Ufibhi 9b49XPaSdcekhd5Wpg1KLMUZiYZazEXFiQCmT1RW0gIAAA== X-CMS-MailID: 20180205100724eucas1p2d8879483c71424965f76c25d09395268 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180204213219epcas2p429434ba0c87a0544dc5294facd80529b X-RootMTR: 20180204213219epcas2p429434ba0c87a0544dc5294facd80529b References: <20180204213104.17834-1-philippe.cornu@st.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04.02.2018 22:31, Philippe Cornu wrote: > This patch adds the DCS/GENERIC DSI read feature. > > Signed-off-by: Philippe Cornu Reviewed-by: Andrzej Hajda If there will be no objections I will merge it at the end of the week.  -- Regards Andrzej > --- > Extra notes: > DSI read tests have been performed with DCS & GENERIC, short & long > commands, on two different panels. > The maximum fifo size (32*32-bit = 128 bytes on stm32) has been > verified too. > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 58 +++++++++++++++++++++------ > 1 file changed, 45 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index e9422d05e897..65aeb3f78b48 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -397,18 +397,46 @@ static int dw_mipi_dsi_write(struct dw_mipi_dsi *dsi, > return dw_mipi_dsi_gen_pkt_hdr_write(dsi, le32_to_cpu(word)); > } > > +static int dw_mipi_dsi_read(struct dw_mipi_dsi *dsi, > + const struct mipi_dsi_msg *msg) > +{ > + int i, j, ret, len = msg->rx_len; > + u8 *buf = msg->rx_buf; > + u32 val; > + > + /* Wait end of the read operation */ > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS, > + val, !(val & GEN_RD_CMD_BUSY), > + 1000, CMD_PKT_STATUS_TIMEOUT_US); > + if (ret) { > + dev_err(dsi->dev, "Timeout during read operation\n"); > + return ret; > + } > + > + for (i = 0; i < len; i += 4) { > + /* Read fifo must not be empty before all bytes are read */ > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS, > + val, !(val & GEN_PLD_R_EMPTY), > + 1000, CMD_PKT_STATUS_TIMEOUT_US); > + if (ret) { > + dev_err(dsi->dev, "Read payload FIFO is empty\n"); > + return ret; > + } > + > + val = dsi_read(dsi, DSI_GEN_PLD_DATA); > + for (j = 0; j < 4 && j + i < len; j++) > + buf[i + j] = val >> (8 * j); > + } > + > + return ret; > +} > + > static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, > const struct mipi_dsi_msg *msg) > { > struct dw_mipi_dsi *dsi = host_to_dsi(host); > struct mipi_dsi_packet packet; > - int ret; > - > - if (msg->rx_buf || msg->rx_len) { > - /* TODO dw drv improvements: implement read feature */ > - dev_warn(dsi->dev, "read operations not yet implemented\n"); > - return -EINVAL; > - } > + int ret, nb_bytes; > > ret = mipi_dsi_create_packet(&packet, msg); > if (ret) { > @@ -422,12 +450,16 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, > if (ret) > return ret; > > - /* > - * TODO Only transmitted size is returned as actual driver does > - * not support dcs/generic reads. Please update return value when > - * delivering the read feature. > - */ > - return packet.size; > + if (msg->rx_buf && msg->rx_len) { > + ret = dw_mipi_dsi_read(dsi, msg); > + if (ret) > + return ret; > + nb_bytes = msg->rx_len; > + } else { > + nb_bytes = packet.size; > + } > + > + return nb_bytes; > } > > static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {