Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1964025imm; Fri, 7 Sep 2018 08:46:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ1x31WNDPt3E478Pa9buwy9bFl+D6+aHNZ0AGPyl83vxlequOkjkgpgoIsxxXdPrhIEhI9 X-Received: by 2002:a62:34c4:: with SMTP id b187-v6mr9153722pfa.15.1536335183065; Fri, 07 Sep 2018 08:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536335183; cv=none; d=google.com; s=arc-20160816; b=hP1rDuc4LsuBv3bl1Z53BHOj/0MVw1ifhk0Y7nF2GiGnLSw9FEHixCtZCp8rXVVrJV Al3oo0yOXQciwfqt2rx57svmRXxj20+awzdF2ZxEV3YAUvlj2DBrh53bPu7be16acM/l kVrV8frrs0Ng/c+cl63jFwUL1fXlR/bMk0wiGYU657jRWdiKP9c+PkHlcwRdhAJ8DFuF dWAvZd2CEZpPukdS0gTIhe1WNJYFCD+mx4WS9DZuTMouLe0vrdx2aD4Z4PNFEVlEzMWL OZrfWKcri1gFwGcTapnGm1j+hUB7bYPAP7FIM0HP2ndhAB/opk+yftQKDbX3ynRSaXBB ItbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=x63va/nFGlsoNbe4yZ7h9/gmIhpjn+Jm1oArS2JIXNQ=; b=wz04YWziIr95UDFRs790GXWGTw4Jry3XcVk/spUpmbT5HLhYolW42Rtd5MB1+Bhd9S H+HnGC7RZwRZeXF8qLz9ofKp/5LybnYCnLNRb8HLjb/nWk056/NHf8wtT5WJ+hyL5OG5 deLHJx7mcZOPePNoi94t4rZpJP0TH7Y7bY7hjkL5OGPXvTgfNw77KU0EGktMMC3ntwYo VxBBhn0KhrshOZ384+rXF3L9BxQfjgUKvKydpT6ve7IJevIvMLgOKbjJ/INukf9yvbkQ dS624tZVidVv9yYPSXDNCZUTl2hNbjBDkRF4dAGS7FdMt9G7V2xPfPS7YMrbbPSFuQxP Imqg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n65-v6si8538733pfn.320.2018.09.07.08.46.07; Fri, 07 Sep 2018 08:46:23 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729272AbeIGSSv (ORCPT + 99 others); Fri, 7 Sep 2018 14:18:51 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42887 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbeIGSSv (ORCPT ); Fri, 7 Sep 2018 14:18:51 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id E629D207AD; Fri, 7 Sep 2018 15:37:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (AAubervilliers-681-1-30-219.w90-88.abo.wanadoo.fr [90.88.15.219]) by mail.bootlin.com (Postfix) with ESMTPSA id B53F420379; Fri, 7 Sep 2018 15:37:39 +0200 (CEST) Date: Fri, 7 Sep 2018 15:37:39 +0200 From: Maxime Ripard To: Laurent Pinchart Cc: Kishon Vijay Abraham I , Boris Brezillon , Thomas Petazzoni , linux-media@vger.kernel.org, Archit Taneja , Andrzej Hajda , Chen-Yu Tsai , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Krzysztof Witos , Rafal Ciepiela Subject: Re: [PATCH 04/10] phy: dphy: Add configuration helpers Message-ID: <20180907133739.6lvlw7wsdk4ffeua@flea> References: <3617916.Vq2Smf1hnZ@avalon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xzvsx53ec7kgrpz7" Content-Disposition: inline In-Reply-To: <3617916.Vq2Smf1hnZ@avalon> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --xzvsx53ec7kgrpz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 05, 2018 at 04:46:05PM +0300, Laurent Pinchart wrote: > Hi Maxime, >=20 > Thank you for the patch. >=20 > On Wednesday, 5 September 2018 12:16:35 EEST Maxime Ripard wrote: > > The MIPI D-PHY spec defines default values and boundaries for most of t= he > > parameters it defines. Introduce helpers to help drivers get meaningful > > values based on their current parameters, and validate the boundaries of > > these parameters if needed. > >=20 > > Signed-off-by: Maxime Ripard > > --- > > drivers/phy/Kconfig | 8 ++- > > drivers/phy/Makefile | 1 +- > > drivers/phy/phy-core-mipi-dphy.c | 160 ++++++++++++++++++++++++++++++= +- > > include/linux/phy/phy-mipi-dphy.h | 6 +- > > 4 files changed, 175 insertions(+) > > create mode 100644 drivers/phy/phy-core-mipi-dphy.c > >=20 > > diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig > > index 5c8d452e35e2..06bd22bd1f4a 100644 > > --- a/drivers/phy/Kconfig > > +++ b/drivers/phy/Kconfig > > @@ -15,6 +15,14 @@ config GENERIC_PHY > > phy users can obtain reference to the PHY. All the users of this > > framework should select this config. > >=20 > > +config GENERIC_PHY_MIPI_DPHY > > + bool "MIPI D-PHY support" > > + help > > + Generic MIPI D-PHY support. > > + > > + Provides a number of helpers a core functions for MIPI D-PHY > > + drivers to us. >=20 > Do we really need to make this user-selectable ? Probably not :) > > config PHY_LPC18XX_USB_OTG > > tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver" > > depends on OF && (ARCH_LPC18XX || COMPILE_TEST) > > diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile > > index 84e3bd9c5665..71c29d2b9af7 100644 > > --- a/drivers/phy/Makefile > > +++ b/drivers/phy/Makefile > > @@ -4,6 +4,7 @@ > > # > >=20 > > obj-$(CONFIG_GENERIC_PHY) +=3D phy-core.o > > +obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) +=3D phy-core-mipi-dphy.o > > obj-$(CONFIG_PHY_LPC18XX_USB_OTG) +=3D phy-lpc18xx-usb-otg.o > > obj-$(CONFIG_PHY_XGENE) +=3D phy-xgene.o > > obj-$(CONFIG_PHY_PISTACHIO_USB) +=3D phy-pistachio-usb.o > > diff --git a/drivers/phy/phy-core-mipi-dphy.c > > b/drivers/phy/phy-core-mipi-dphy.c new file mode 100644 > > index 000000000000..6c1ddc7734a2 > > --- /dev/null > > +++ b/drivers/phy/phy-core-mipi-dphy.c > > @@ -0,0 +1,160 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright (C) 2013 NVIDIA Corporation > > + * Copyright (C) 2018 Cadence Design Systems Inc. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > + > > +/* > > + * Default D-PHY timings based on MIPI D-PHY specification. Derived fr= om > > the > > + * valid ranges specified in Section 6.9, Table 14, Page 40 of the D-P= HY > > + * specification (v1.2) with minor adjustments. >=20 > Could you list those adjustments ? I will. This was taken from the Tegra DSI driver, so I'm not sure what these are exactly, but that should be addressed. > > + */ > > +int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, > > + unsigned int bpp, > > + unsigned int lanes, > > + struct phy_configure_opts_mipi_dphy *cfg) > > +{ > > + unsigned long hs_clk_rate; > > + unsigned long ui; > > + > > + if (!cfg) > > + return -EINVAL; >=20 > Should we really expect cfg to be NULL ? It avoids a kernel panic and it's not in a hot patch, so I'd say yes? Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --xzvsx53ec7kgrpz7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAluSfyIACgkQ0rTAlCFN r3Q6NQ//Vo9VNwq0Q/E3MGCE7xJc1frQHdbAlZyUse7WtZGymhiUpubD+2lyTw6B zW5tfjExaFs3h4oOW/hTPJ8h2enIc0ySTT1I+DPgTEGetfMng/D5YjwZKL8iosX5 lsrLbWS4Mq5H9qsEvjA8r/iJ7IvTvkFbiKlPKRgq9OsZgUivMi3bt5L2nt4udM6y zXxjRZczTw0e/OowYACXQ6twJ9K2QgwqOowgJcHf9ojXy7qacLI9vo+fb1zepAyp fmxaxzj8e+knukbFMXRc+d32yzA2Rrichy0aDSjKDH1Nxmiv+pyvGBxhR5NYe9U4 /uM8XXgGi8JWsqDEwZqj3LgSHBWeiiHkGuRP+9fDhi05FaCN7nrK3ZtXPKqvlNNX xii8lXarAm/gQmERTFtU4kTH5kGOJkMaC8Ssklv47lfBXBeyiQLCv1xIZ/JOA4vb oI8E46WUCPKyjQAmcIz9xIVUICageXA++Yf7SALIhvObv8Jyh8EaMK6nyor78hnv 91LHJ80PG+LzDXWAIM77fG6gYUXx4BbWJ67yJNj+lRxo1D5oYWTBUKs96PnZmSKA q+ftBvNmBlPKTG2tF5O9Xe+LCkgDVN7P2tnCq8UPDib+331hMG6hHwbLbjjfVZbD YZKGPrz4L8mMBfERQSAE4ee3byygfdnU0IoS6r6vMpII7WsRuc4= =RxIg -----END PGP SIGNATURE----- --xzvsx53ec7kgrpz7--