Received: by 10.223.176.46 with SMTP id f43csp2057102wra; Thu, 25 Jan 2018 04:18:23 -0800 (PST) X-Google-Smtp-Source: AH8x227VAL0/E8oyZagE/nmyWbOYYkNemGrFvgK+AqYC9IeDOkj0gzh8c4K+0xjEOSuuyKsC9836 X-Received: by 10.98.198.139 with SMTP id x11mr16035204pfk.127.1516882703828; Thu, 25 Jan 2018 04:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516882703; cv=none; d=google.com; s=arc-20160816; b=QEwaIAPBemBuOE47lfjZD63DdXHOa7JKf95NQ154dd4S0uUN+EZnQLir68NQWg+ESG fbsdnhIBEKSJZfaXd9B+DajBx6MkRXsxqFul++KBhu2EEtKybFMl9MOSSIjOqKSMo2tl 2yx+uMnAafLEsI8eDjMKMEM/7tZkxmJnCTvgBOVAtg8869Jm8JIoPUk7jzevdbxh6SzG 9pm8Q1iFaUOE8rFCrE9Y2O4TAq8gVOa3tmjXR3Q3EooETblCyKHuVvm3wIZeyCKCaUIn GbHe0K5FUOx8gczgSQ2cRQKknNFemwT9M6SBBw/Xsn8nWXtrU2eKRFcD2YTQTkX1Q7im VL9g== 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:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=vQndHApRQ8dE58CRQjJBfPuJd6/61Whp2jTYx24jX/8=; b=KrlHivk99FfXW35DkZzlORK5nqAXD0hYNC05etkc60UyijZOxW16Uu7SP4Be+L7NUK WHf2xnY7ka6+TyPQqdrpbGCSAmmU8Qwfw+3OKr5oSLCPv9CyIsOEScjzJVaH4NQPlYE7 1SxxtHWfPByLs+5SKxP3ak/H1tYJ2U8qgc4jPoBC6TqEBBl1bYJX7lX4xmZlrEKQ64yJ 4sS68dYjEO/3xuqx0kPU9Ex1J3Atz0N9v6NpiRi4SRYse4kM65PxVJtEcFdwSM8W8r6j tbf7tmkoJ3/d3S4KtNfzARBCO9qg4RguCPdqSEvk5OE4n5AmhWTiGVrgmRm0S79Cv8je r5fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jnL6DMEx; 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 u8-v6si1889015plh.41.2018.01.25.04.18.05; Thu, 25 Jan 2018 04:18:23 -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=jnL6DMEx; 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 S1752071AbeAYMQT (ORCPT + 99 others); Thu, 25 Jan 2018 07:16:19 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:53604 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbeAYMQQ (ORCPT ); Thu, 25 Jan 2018 07:16:16 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180125121614euoutp024f34b96648ffb0bb90b4d64bc2dd2409~NDKoeFRYW2079420794euoutp02-; Thu, 25 Jan 2018 12:16:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180125121614euoutp024f34b96648ffb0bb90b4d64bc2dd2409~NDKoeFRYW2079420794euoutp02- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1516882574; bh=vQndHApRQ8dE58CRQjJBfPuJd6/61Whp2jTYx24jX/8=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=jnL6DMEx6TUoCZp3OksBI+jJiJ9v7Dr6zhCzkx/U4iJ+axTerQirHTMgnLZAUk2ME IvmcBXQtcyIL3Ip207/chLNx7hI9BWIgCPsNOjSKIRXigFFWacv6VRl9fV/VkBrfZj 1YRyQcWzUN2Rm5mjt3OhEFRTAlnAI0bv2O1+HXFM= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180125121613eucas1p1f922600464c4d2e66f3fd772a218146e~NDKnpMNhj1242812428eucas1p1P; Thu, 25 Jan 2018 12:16:13 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 23.6A.12907.C8AC96A5; Thu, 25 Jan 2018 12:16:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180125121612eucas1p1a59214264289832f1ab955238a2a7cf2~NDKms5Z7Z0812908129eucas1p1j; Thu, 25 Jan 2018 12:16:12 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-af-5a69ca8cbae9 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 38.C5.18832.C8AC96A5; Thu, 25 Jan 2018 12:16:12 +0000 (GMT) Received: from [106.120.43.17] by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P34008TI22Z2T20@eusync4.samsung.com>; Thu, 25 Jan 2018 12:16:12 +0000 (GMT) Subject: Re: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value To: Brian Norris , Philippe CORNU Cc: Bhumika Goyal , Alexandre TORGUE , David Airlie , Linux Kernel , "dri-devel@lists.freedesktop.org" , Yannick FERTRE , "open list:ARM/Rockchip SoC..." , Laurent Pinchart , Maxime Coquelin , Ludovic BARRE , Mickael REULIER , Vincent ABRIOU , "linux-arm-kernel@lists.infradead.org" , Thierry Reding From: Andrzej Hajda Message-id: <61a3e22a-811b-53e5-f735-534dfd9f67da@samsung.com> Date: Thu, 25 Jan 2018 13:16:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-version: 1.0 In-reply-to: <20180124183748.l5iqoiyqxy4o2pyk@ban.mtv.corp.google.com> Content-type: text/plain; charset="utf-8" Content-transfer-encoding: 7bit Content-language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKKsWRmVeSWpSXmKPExsWy7djP87q9pzKjDJYvYbToPXeSyWLjk9OM Fp/u9bNZbPr4ntXiytf3bBadE5ewW2x6fI3V4vKuOWwWnx78Z7Y4csDRYt7ftawWpw4eYrJ4 0PKC1eLnrnksFmeuHmCxaO9sZXMQ8JjdcJHFY+esu+wesztmsnps//aA1eN+93Emj81L6j2e /tjL7PF5k1wARxSXTUpqTmZZapG+XQJXxtbjuQXX5SquHldpYDws0cXIySEhYCIx48MyJghb TOLCvfVsILaQwFJGidcPayHsz4wSL3/EdDFygNXfOqnUxcgFFF7GKHH3/GNGCOcZo0TT9Y2M IEXCAjESH57EgPSKCIRKfFh1nh2khllgD6vE5A+3mUESbAKaEn833wRbxitgJ9GxcCPYESwC qhJLls9lBbFFBSIkup7tYoWoEZT4MfkeC4jNKeAm8e7ZfLB6ZqA5L75MYoGw5SU2r3nLDGGL SzS33mQBWSwhsI5dYv3XL2wQX7pIzN/9jxHCFpZ4dXwLO4QtI9HZcZAJoqGbUeJT/wl2CGcK o8S/DzOYIaqsJQ4fv8gKsYJPYtK26cyQcOGV6G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T7EKM3BoiTO27tndaSQ QHpiSWp2ampBahFMlomDU6qBUWbmhnqeyEj1SQbnEk52TFyQaLx6K7f57VNHGJc47RXVvyg2 59GNXS+36nW81H9mpNVbtWW59bt891htiVl/v26//3Pli0M7n15JlLzRMnlFso35R80/b+zY NBfvip/XtfBq/gauiTXZ/lYX7PTOHpZQ2zK9dcazvQbRXYFznp6/3rRYe+HphAYlluKMREMt 5qLiRABOUlolvQIAAA== X-CMS-MailID: 20180125121612eucas1p1a59214264289832f1ab955238a2a7cf2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180124183757epcas5p2e8296b5712fc0f2004eb81111693e166 X-RootMTR: 20180124183757epcas5p2e8296b5712fc0f2004eb81111693e166 References: <20180123142618.28384-1-philippe.cornu@st.com> <20180123142618.28384-2-philippe.cornu@st.com> <4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com> <20180124183748.l5iqoiyqxy4o2pyk@ban.mtv.corp.google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.01.2018 19:37, Brian Norris wrote: > Hi Philippe, > > On Wed, Jan 24, 2018 at 01:33:54PM +0000, Philippe CORNU wrote: >> On 01/23/2018 10:38 PM, Brian Norris wrote: >>> Hi Philippe, >>> >>> On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu wrote: >>>> The dw_mipi_dsi_host_transfer() must return the number of >>>> bytes transmitted/received on success instead of 0. >>> I'm a little confused. As of the latest drm-misc-next I'm looking at, >>> this still has conflicting documentation. >>> >>> For ->transfer(): >>> >>> On success it shall return the number of bytes >>> * transmitted for write packets or the number of bytes received for read >>> * packets. >>> >>> While mipi_dsi_generic_read() says: >>> >>> * Return: The number of bytes successfully read or a negative error code on >>> * failure. >>> >>> But it just returns the value that ->transfer() returns. >>> >> Not sure to follow you here: mipi_dsi_generic_read() will trig a dsi >> generic read so it has to return "the number of bytes received for read >> packets" as explained for the ->transfer() function... so it looks >> "coherent"... >> >> But maybe you want to point out something different? > Actually, reading back what I wrote, I'm not sure it made sense. I think > *I* was confusing "supporting TX only" with "supporting TX and RX". I > believe the documentation isn't conflicting, but your current patch is a > little misleading. > > With your current patch, you're returning the 'mipi_dsi_packet::size', > which is the sum of both TX and RX. I did not found docs saying mipi_dsi_packet::size is a sum of tx and rx. tx and rx packets are two different packets, so they do not sum up. But thanks for bringing it up, it shows docs are incomplete/misleading. > Since we only support TX right now, > I suppose that actually is fine (because 'rx_len == 0'). But if we start > supporting RX too, then this field is not the right one to return. > > Anyway, maybe this patch was fine as it was. But when you get RX > support, this will have to be something like: > > if (msg->rx_len) > return msg->rx_len; > else > return packet.size; > > BTW, does anyone actually care about seeing the number of TX bytes > returned? That seems weird, because I wouldn't expect you'd get a good > result from a partial TX (dunno about partial RX). And I also see that > there are other drivers that get this all wrong too. See > mtk_dsi_host_transfer(), which only returns 0 for TX and 'recv_cnt' for > RX. As far as I remember MIPI DSI standard does not allow partial TX, it is all-or-nothing operation. > > So all-in-all, maybe my problem isn't that the documentation is > conflicting, exactly, but that the requirements are somewhat odd, such > that either implementations get it wrong (2 of 3 that I've looked at!), > or they have to write somewhat odd special-casing. mipi_dsi_host_ops::transfer in case of write sends only tx packet, in case of read it sends tx packets and receives rx packet, so it can be confusing what it should return in case of read. IMO changing mipi_dsi_host_ops::transfer to always return number of bytes RECEIVED or error should make it clearer and simpler. +CC Thierry Regards Andrzej > >>> So I'm not sure whether the documentation is still wrong, or if the >>> implementation is. >>> >>> Anyway, I guess maybe that isn't super-critical to *this* patch, since >>> we don't have RX support yet... >>> >> The main reason why I want to "fix" this is because I do not want to >> explain to our customers (writing dsi panel drivers) why we have a >> different returned value compare to other platforms : ) > Brian > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel