Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp144833imj; Wed, 13 Feb 2019 06:08:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ0OWt3v0X3UES86XMA/MB/ilulMKGTv9L+fuAHEqylIWj+jX7/374V5K6a397Nwi+OS+8N X-Received: by 2002:a17:902:5601:: with SMTP id h1mr760962pli.160.1550066883758; Wed, 13 Feb 2019 06:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550066883; cv=none; d=google.com; s=arc-20160816; b=mN5mJZ714u6gURLu50qYdoSRzKYmk1eLEAQKy0dtz7h0JqQh9ngjzv16pupbYlirfg k9b+qnpfTOpSjVK4oOUi+RhUlYlPuUzDIYjFEwX5tf/lllMm0nmCgTNxK/KwYCrc3Xww c2cfaZzzZ3ejbc/DpdaLjyYX+nG1n00bfgiIuV9SqMeqPly1SRW9K7bGJAOZvCNnlZro bSXmX/7Acv57ijd7X2dCch809mQuW8dybSSC0xTht9cGP+ZU2Q3Qmn7B51trGa+5CJCb 2pgrD/is6hvzZe1ZJ0dEKMucSi3gBljpLEWLWiyPwU6e08Df/Upb8UNf6WpOC6Zi/St8 JJOQ== 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:dkim-signature; bh=Z8Pbw8nsn78pX+cUzXYH4ai9XOvErZm+J21VGm9bB2U=; b=CbbPpS+QXv/yLswooEkW3h16tqBTEH6JZoEIKkYNG2N5DQxSSt2fc/nNPIdAT78YpR IOV6OEH1vEhOXFCyTm/OKUSrCN+wi9P32tFT5Tq3/OAjov7YbzUu5j5xt3PpPbKb0mEr gHBP7EbLbc59Aq2/J3/Y7I5yHeP1yMd3QLidUzeU0KU1iiITHewYAiC4Wz6IX4mn7K1J GWOemGfyHnKYnXTXHqTR57vrWfcp0HN44dkJlrQ2TlQXoNMntXvAu8nUawSfNuaCgw5m 23v+rv6uXvUrLEp5uT4xsEELH8ObTU1OA4VNgpwSATwmX0yYhJNu2Migfp/zdzFbHvXW nJTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Gf8/mNzJ"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si15827133pfm.71.2019.02.13.06.07.37; Wed, 13 Feb 2019 06:08:03 -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=@gmail.com header.s=20161025 header.b="Gf8/mNzJ"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404078AbfBMMaI (ORCPT + 99 others); Wed, 13 Feb 2019 07:30:08 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52837 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbfBMMaH (ORCPT ); Wed, 13 Feb 2019 07:30:07 -0500 Received: by mail-wm1-f68.google.com with SMTP id m1so2257549wml.2; Wed, 13 Feb 2019 04:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z8Pbw8nsn78pX+cUzXYH4ai9XOvErZm+J21VGm9bB2U=; b=Gf8/mNzJvDyCeyfkJ9kJbCAoKog0jwzDY/FHKypZkk1ByZ1Ssdf/NhWdkL4lHAjF4c vU+Tb536ODysTmykrP5pOlqJ9qZkO8GnWbl0rR/6YdEGmvGPZwIfLhcTon9sVlwOejCf iZlfEL5ss/CqdI3tqHl5k6pd6qevpVsRTABo/DpG77nTYDln0dOP4jIPpF9fKoaB3ZkX DeprHJMfwTnLRrsm0O3aBEIArzKSYT757jn0VKhHdQr0CwQzvWkBHEBPVE5gGp18ncSZ iXFpRR4Na+ktSweByGsdWaUuzsKekUOmC1ZOB8ujufv5lPJdVP/J4PzPSsN5LwJM0Ynu dDdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z8Pbw8nsn78pX+cUzXYH4ai9XOvErZm+J21VGm9bB2U=; b=BQ4tNOQ/u/1yEWmAJ1Afjxze5OhFL21VZ913HaNwN9uWoBRnn5Yd7a3eWqoF8MwZws YEFAsUjYWknbH/xAHU4VBUKf5KV76f1sULr5ugUM/Lqu7TMxCDZzt8opTZw+aqi54NAn wGdXCy5oZjosaXCNqd8rLLMhAUoDrxtO17ljCCbDv1dHMxST7YPwzWx1MbaPs/FYOUDz AEtCaVBI05qxvGsLqPEZvZO0pUph+WwwPqlvyt5laiKfdC5bDX7lN8pKoLH/XSgg55hv elavXYkYYk9VImoIpJWht7ssaQxV7iTxIvKKzallXXJ3tqmG+1VROfHqlcd+memv1Mvr NRGA== X-Gm-Message-State: AHQUAuZesrFDWvE1vsYlzvVDQqsO+o2zP02IyvimcOnokxoUnDV7Ll8S A/U2K+HxRgkRLmPHHJp9gps= X-Received: by 2002:a1c:2787:: with SMTP id n129mr140725wmn.128.1550061004863; Wed, 13 Feb 2019 04:30:04 -0800 (PST) Received: from localhost (pD9E51D2D.dip0.t-ipconnect.de. [217.229.29.45]) by smtp.gmail.com with ESMTPSA id d16sm14083801wru.52.2019.02.13.04.30.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Feb 2019 04:30:03 -0800 (PST) Date: Wed, 13 Feb 2019 13:30:02 +0100 From: Thierry Reding To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: Mathieu Othacehe , robh+dt@kernel.org, mark.rutland@arm.com, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] pwm: hibvt: Add hi3559v100 support Message-ID: <20190213123002.GC647@ulmo> References: <20190212094927.5900-1-m.othacehe@gmail.com> <20190212094927.5900-2-m.othacehe@gmail.com> <20190212142850.iwgi4n6v6oep4oin@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kVXhAStRUZ/+rrGn" Content-Disposition: inline In-Reply-To: <20190212142850.iwgi4n6v6oep4oin@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --kVXhAStRUZ/+rrGn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 12, 2019 at 03:28:50PM +0100, Uwe Kleine-K=C3=B6nig wrote: > On Tue, Feb 12, 2019 at 10:49:27AM +0100, Mathieu Othacehe wrote: > > Add support for hi3559v100-shub-pwm and hisilicon,hi3559v100-pwm > > platforms. They require a special quirk: pwm has to be enabled again > > to force duty_cycle refresh. > >=20 > > Signed-off-by: Mathieu Othacehe > > --- > > drivers/pwm/pwm-hibvt.c | 26 +++++++++++++++++++++++--- > > 1 file changed, 23 insertions(+), 3 deletions(-) > >=20 > > diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c > > index 27c107e78d59..bf33aa24433c 100644 > > --- a/drivers/pwm/pwm-hibvt.c > > +++ b/drivers/pwm/pwm-hibvt.c > > @@ -49,6 +49,7 @@ struct hibvt_pwm_chip { > > struct clk *clk; > > void __iomem *base; > > struct reset_control *rstc; > > + bool quirk_force_enable; > > }; > > =20 > > struct hibvt_pwm_soc { > > @@ -56,6 +57,7 @@ struct hibvt_pwm_soc { > > }; > > =20 > > static const struct hibvt_pwm_soc pwm_soc[2] =3D { > > + { .num_pwms =3D 2 }, > > { .num_pwms =3D 4 }, > > { .num_pwms =3D 8 }, >=20 > The members of this struct are used as of-data (in struct > of_device_id::data below). When looking at the usage: >=20 > { .compatible =3D "hisilicon,hi3516cv300-pwm", .data =3D &pwm_soc[1] }, > { .compatible =3D "hisilicon,hi3519v100-pwm", .data =3D &pwm_soc[2] }, > { .compatible =3D "hisilicon,hi3559v100-shub-pwm", .data =3D &pwm_soc[2]= }, > { .compatible =3D "hisilicon,hi3559v100-pwm", .data =3D &pwm_soc[0] }, >=20 > this isn't exactly easy to understand. I would prefer to do it as > follows: >=20 > static const struct hibvt_pwm_soc hi3516cv300_soc_info =3D { > .num_pwms =3D 2, > }; > ... >=20 > static const struct of_device_id hibvt_pwm_of_match[] =3D { > { .compatible =3D "hisilicon,hi3516cv300-pwm", .data =3D &hi3516cv300_s= oc_info }, > ... > }; >=20 > Then you could also add a member to hibvt_pwm_soc to signal if that > force_enable quirk is necessary and would not need to use > of_device_is_compatible() to determine this. The result is that you have > a description of all relevant differences in a single place. >=20 > @Thierry: Also this is yet another driver instance where a num-pwms > property would simplify the driver because up to before this patch this > was the only difference between the different variants. We don't need the num-pwms in device tree if it can be derived from the compatible string. Thierry --kVXhAStRUZ/+rrGn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlxkDcgACgkQ3SOs138+ s6FumA//UXRbb4IpLIkxjoOLtrXebSP9Ky4IE3i9sgcBnKi9gOF5vYGNTzD+phlk nqyuxFjBZjQ0hEF7FFJYnpk2TdWta7YgNBn94L/rYP9mPWUmAiO2cZjgKrUsqcU5 bMYYARdcP02FHPQdtyB/mM6cCcnrVCDx1UOI23U+C23dm3T/SwPEqlIFnKiayOeQ 0HzXG7Gkbj6sSPG+NL+4pZVkFAMdNiAhyVwWWgCFKm09vLkbuzD4w+YMHnA/LAea SGUAlgkw2L79ytpDDiEVcqkfccBCrOQktqozG5v2EDjbyDb+aG7aAje0wfqaVKWu HeJW+I3TaPeM3I+k8uJ7akUXQAXBRPrjpfYzfavIdIg8j1/YmhZrLGs3tsY6ZDCF 7SLqCrHa8QHQje+auoHJ1nN22WiHj2Nfrm6QEIIXuXz2FcwAXpvxecAAaheAUSDr R/1kHB5Bcf/XmMPv5ixbInHCg5rmDw3l9s+gCRmLzO9oPkFlL7/BZFqYBw7j5Tk5 w/HVP8MUO2FjouJBbnCopozSyhKsmluI3t8lGxQIEDPU2x9poIB6wlwSuf3+nIUY 83W4KDT9M9weSSUBv4EZyq7Y4H7m0QtLcVt46a0w2jk7SFqiOT38eOaR6N6ihaaA LUThRR9KasBfWMuoz6nvLrczNpkrFNiFh3j4b5TkKWuJYLEnST0= =2fgf -----END PGP SIGNATURE----- --kVXhAStRUZ/+rrGn--