Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3902637imj; Tue, 12 Feb 2019 06:39:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IbdXD4pwYxxdnn9yKtz3PkSq4kquMWQ0bLeboYrY92aXj6ctlg0jycGDNF2zHSq+CPCvlOS X-Received: by 2002:a17:902:8a91:: with SMTP id p17mr4388977plo.316.1549982342657; Tue, 12 Feb 2019 06:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549982342; cv=none; d=google.com; s=arc-20160816; b=plLmktAyerCBn+Ds03XI0e8OpdUoV4jh8iwhw6XNjdNW4YHFPGZVi0GqlV6KwcBihE aJt6juL5Q8QDGz/HyFEYxwr+QiHe6fOmMz45K8qgXD+5CaFrnGSEBjKef9E9MWcTdB1j AUgqhKlOKw+cJUh6+i6uUhI1X9FMX8m9tjQwf+oMyWFApgBoQB4xZkEoOedWsG7dVnek woHrEOdbT/cYvhD91kzsZnGqWhot5dzCQJt4MfKBdbEB8+pbFkXNTPUhZmLlIc4iNXgL 4KpaM5zZwn9KpBtMcXm1auzkRy+/HB+HIiYgAOp+kR37a5Qiv2H61knKICDEVUoU2mu3 yY1Q== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sIw97tkhWlllQG1pxd0wE2hfAhpSFvjCOkf4ZEZxyxo=; b=JRgMC9VrzIB/0eZ9gQSWA9k/5PjJxVgmiJO1VsGj8zVEGJH/vidU/uPnxGYDW3eVYo EJykzjFzHGm62B3J4RtUdlw8Jlfd01fHJHDte8gE05Ft0yiCIYSCFgteQmERA+nO+n3c nxHmyCnhqynvVeUEqv1lUfNRrP+YJv3RdN/128TKPuExJIhCQE4vR2YrAU2gUqKrDMI0 Vuj0LejONQImdWXSG2SpiV+uOSAq8ixNheRE7cIxG29D8hcyGJqnbInK6HQM/dxZSflH JswzTrvElXwEaHHK6NAvkMR8KUFNOxN0fyltLxTU8mur13fZu1MOTkQcf5ew8wkfNVcP 3gYQ== 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 h6si12176782pgc.589.2019.02.12.06.38.31; Tue, 12 Feb 2019 06:39:02 -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; 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 S1730155AbfBLO2z (ORCPT + 99 others); Tue, 12 Feb 2019 09:28:55 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:50713 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729989AbfBLO2z (ORCPT ); Tue, 12 Feb 2019 09:28:55 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gtZ3K-0000mM-Rr; Tue, 12 Feb 2019 15:28:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gtZ3K-00037h-5g; Tue, 12 Feb 2019 15:28:50 +0100 Date: Tue, 12 Feb 2019 15:28:50 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Mathieu Othacehe Cc: thierry.reding@gmail.com, 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: <20190212142850.iwgi4n6v6oep4oin@pengutronix.de> References: <20190212094927.5900-1-m.othacehe@gmail.com> <20190212094927.5900-2-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190212094927.5900-2-m.othacehe@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Signed-off-by: Mathieu Othacehe > --- > drivers/pwm/pwm-hibvt.c | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) > > 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; > }; > > struct hibvt_pwm_soc { > @@ -56,6 +57,7 @@ struct hibvt_pwm_soc { > }; > > static const struct hibvt_pwm_soc pwm_soc[2] = { > + { .num_pwms = 2 }, > { .num_pwms = 4 }, > { .num_pwms = 8 }, The members of this struct are used as of-data (in struct of_device_id::data below). When looking at the usage: { .compatible = "hisilicon,hi3516cv300-pwm", .data = &pwm_soc[1] }, { .compatible = "hisilicon,hi3519v100-pwm", .data = &pwm_soc[2] }, { .compatible = "hisilicon,hi3559v100-shub-pwm", .data = &pwm_soc[2] }, { .compatible = "hisilicon,hi3559v100-pwm", .data = &pwm_soc[0] }, this isn't exactly easy to understand. I would prefer to do it as follows: static const struct hibvt_pwm_soc hi3516cv300_soc_info = { .num_pwms = 2, }; ... static const struct of_device_id hibvt_pwm_of_match[] = { { .compatible = "hisilicon,hi3516cv300-pwm", .data = &hi3516cv300_soc_info }, ... }; 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. @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. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |