Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1393429pxu; Sat, 24 Oct 2020 09:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2Bi4TJC7U6QgKAFpvEEVtI0i3YIJT45GxkIat0MjNlIGN85wSrAH7vJUDWOca8UkGVWGX X-Received: by 2002:aa7:ce04:: with SMTP id d4mr4807697edv.130.1603556117401; Sat, 24 Oct 2020 09:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603556117; cv=none; d=google.com; s=arc-20160816; b=WUgdJuWlNEdSbmf5jV5PtgDyGzbLtPmpV88zmhU3Z5WvYs1o/SAmX2s4viipfs3cpw Im60mvbBUaqcOYNQRCLO37LMPNyrM7GXSnvF2lf/wyHXKb/wICVfCqwv29ko7ej4LXKv EP1WiD5KVVdfd5j2kK0LmgPLP8tb0w/0Mv/NO4pWa34KgN6k/df+dwkOY7nDPB7uN57n reTehBlhXMnj+dgxZexRpTAJBvMcBGMR24esX7pfoZ7eG1fnMYZYRgz92ZsFgt4kzcZA ju+ihpE/VzApHBpWMUsT8JXuZa+kXaxr3EUaX1Rm174RN2IfCE3IGWFiwRgInnK2eo+9 uD0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=zwO0NZazIqdLTFcMo32vMvCuTuxEKiNEc8hOZBA+2/Q=; b=wSp/4ksXUwAA25OFZmtbo2FpqR1J9OZx1DJns3aQ3CkCUyh5UQBFr+CidcTTdCdEkh dQUsPfrX79R1jkxCCD4uM/AS18yXN0hv07mWFxiKDfq6KvZ1ozB3BNU7ejuwgOs36dKA ktU4caEfmCF4X3FXKnGP/z+vtlPbN6HW6iS8CF+a+hgqi6BJDmUNQ4hPaLNHMnt6w7d5 nUQ91D+sItfpBtTfxB2AAkYRUiOa3hWMllAx1zzkX9CB7EI7PpBiRYcDqw4/fh6SzdFi QHR+ed6dpaM7YtALoFydbzyI0D+8Dn3AIITMO1alytjnlZVYVg6Kc2fsg1USecTgzq3Y avww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si3206538edw.472.2020.10.24.09.14.54; Sat, 24 Oct 2020 09:15:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760081AbgJXIba (ORCPT + 99 others); Sat, 24 Oct 2020 04:31:30 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44711 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755842AbgJXIb2 (ORCPT ); Sat, 24 Oct 2020 04:31:28 -0400 X-Originating-IP: 93.29.109.196 Received: from aptenodytes (196.109.29.93.rev.sfr.net [93.29.109.196]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 3C7846000E; Sat, 24 Oct 2020 08:31:22 +0000 (UTC) Date: Sat, 24 Oct 2020 10:31:21 +0200 From: Paul Kocialkowski To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-sunxi@googlegroups.com, Mauro Carvalho Chehab , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Yong Deng , Kishon Vijay Abraham I , Vinod Koul , Helen Koike , Greg Kroah-Hartman , Philipp Zabel , Hans Verkuil , Sakari Ailus , Thomas Petazzoni , Hans Verkuil , kevin.lhopital@hotmail.com Subject: Re: [linux-sunxi] [PATCH 01/14] phy: Distinguish between Rx and Tx for MIPI D-PHY with submodes Message-ID: <20201024083121.GB1739@aptenodytes> References: <20201023174546.504028-1-paul.kocialkowski@bootlin.com> <20201023174546.504028-2-paul.kocialkowski@bootlin.com> <7673189.jqQXtdQLJ6@kista> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SkvwRMAIpAhPCcCJ" Content-Disposition: inline In-Reply-To: <7673189.jqQXtdQLJ6@kista> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --SkvwRMAIpAhPCcCJ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jernej, On Fri 23 Oct 20, 20:18, Jernej =C5=A0krabec wrote: > Dne petek, 23. oktober 2020 ob 19:45:33 CEST je Paul Kocialkowski napisal= (a): > > As some D-PHY controllers support both Rx and Tx mode, we need a way for > > users to explicitly request one or the other. For instance, Rx mode can > > be used along with MIPI CSI-2 while Tx mode can be used with MIPI DSI. > >=20 > > Introduce new MIPI D-PHY PHY submodes to use with PHY_MODE_MIPI_DPHY. > > The default (zero value) is kept to Tx so only the rkisp1 driver, which > > uses D-PHY in Rx mode, needs to be adapted. > >=20 > > Signed-off-by: Paul Kocialkowski > > --- > > drivers/staging/media/rkisp1/rkisp1-isp.c | 3 ++- > > include/linux/phy/phy-mipi-dphy.h | 13 +++++++++++++ >=20 > I think some changes are missing in this patch. For example,=20 > phy_set_mode_ext() must be modified to take another argument, otherwise c= hange=20 > of rkisp1-isp driver doesn't make much sense. Thanks for looking into this! As you can see in: https://elixir.bootlin.com/linux/latest/source/include/linux/phy/phy.h#L213 phy_set_mode_ext already takes a submode argument (which is already used for USB mode selection, for instance) and phy_set_mode is just a macro which ca= lls phy_set_mode_ext with submode set to 0. In our case, that means that most current users of phy_set_mode with PHY_MODE_MIPI_DPHY will select Tx mode by default, so there is no particular need for adaptation. Only the rkisp1 driver uses PHY_MODE_MIPI_DPHY for Rx, so this one was changed to use phy_set_mode_ext with PHY_MIPI_DPHY_SUBMODE_= RX instead. As a result, there should be no missing changes. Do you agree? Cheers, Paul > Best regards, > Jernej >=20 > > 2 files changed, 15 insertions(+), 1 deletion(-) > >=20 > > diff --git a/drivers/staging/media/rkisp1/rkisp1-isp.c b/drivers/stagin= g/ > media/rkisp1/rkisp1-isp.c > > index 6ec1e9816e9f..0afbce00121e 100644 > > --- a/drivers/staging/media/rkisp1/rkisp1-isp.c > > +++ b/drivers/staging/media/rkisp1/rkisp1-isp.c > > @@ -902,7 +902,8 @@ static int rkisp1_mipi_csi2_start(struct rkisp1_isp= =20 > *isp, > > =20 > > phy_mipi_dphy_get_default_config(pixel_clock, isp->sink_fmt- > >bus_width, > > sensor->lanes, cfg); > > - phy_set_mode(sensor->dphy, PHY_MODE_MIPI_DPHY); > > + phy_set_mode_ext(cdev->dphy, PHY_MODE_MIPI_DPHY, > > + PHY_MIPI_DPHY_SUBMODE_RX); > > phy_configure(sensor->dphy, &opts); > > phy_power_on(sensor->dphy); > > =20 > > diff --git a/include/linux/phy/phy-mipi-dphy.h b/include/linux/phy/phy-= mipi- > dphy.h > > index a877ffee845d..0f57ef46a8b5 100644 > > --- a/include/linux/phy/phy-mipi-dphy.h > > +++ b/include/linux/phy/phy-mipi-dphy.h > > @@ -6,6 +6,19 @@ > > #ifndef __PHY_MIPI_DPHY_H_ > > #define __PHY_MIPI_DPHY_H_ > > =20 > > +/** > > + * enum phy_mipi_dphy_submode - MIPI D-PHY sub-mode > > + * > > + * A MIPI D-PHY can be used to transmit or receive data. > > + * Since some controllers can support both, the direction to enable is= =20 > specified > > + * with the PHY sub-mode. Transmit is assumed by default with phy_set_= mode. > > + */ > > + > > +enum phy_mipi_dphy_submode { > > + PHY_MIPI_DPHY_SUBMODE_TX =3D 0, > > + PHY_MIPI_DPHY_SUBMODE_RX, > > +}; > > + > > /** > > * struct phy_configure_opts_mipi_dphy - MIPI D-PHY configuration set > > * > > --=20 > > 2.28.0 > >=20 > > --=20 > > You received this message because you are subscribed to the Google Grou= ps=20 > "linux-sunxi" group. > > To unsubscribe from this group and stop receiving emails from it, send = an=20 > email to linux-sunxi+unsubscribe@googlegroups.com. > > To view this discussion on the web, visit https://groups.google.com/d/m= sgid/ > linux-sunxi/20201023174546.504028-2-paul.kocialkowski%40bootlin.com. > >=20 >=20 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --SkvwRMAIpAhPCcCJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAl+T5lkACgkQ3cLmz3+f v9Ev9Qf/SwpZnjc+n98ehFg0OUFmpeLOPDBC9zc+f+m5G+tx0pVb1W9yIqiLKv3z zgq/ppkkOpTXztICfPBpp15wNNMQJ737VkB/Q9H71XlX2oaIH0f1P1LWm+TFIjQg zhMRa4NVdYrhfgQeaLL2WvA4cFVpduz63Mqr3bJ8u1+9mnX9toq9xTGaLNJcKnb6 Pjb92gXs04D9uBSCnRSpTuKPdsDRrG+qV3IoI6NtD6cfCv9A10t5DlGaWOEqz+No xFNzGzKb7g4V44dCjo4wHeyhjOHQ/6mAmBrgmGbBB477uUIrf+VzfH6yrDssk8Rt 1ksyv89f0fPrRa5JRekEVVAsY+sj9Q== =zcV3 -----END PGP SIGNATURE----- --SkvwRMAIpAhPCcCJ--