Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3665044imc; Thu, 14 Mar 2019 02:23:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1xYK/cZlQHnc0Stj9df0M+KdsRQi8/qFBDZulmHpFQg74ECYPULjYA5csZo5vk61K9Va/ X-Received: by 2002:a62:4290:: with SMTP id h16mr14930447pfd.8.1552555394083; Thu, 14 Mar 2019 02:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552555394; cv=none; d=google.com; s=arc-20160816; b=ig9Svb0fCnO+F7plugGtzpQyZWvS0hURDVrJFAf8MOau3W2N6A1K17dB9QDatCSaTo 9k4WkdpTklq031fvw09f7d86Cjv+siOfU/Pk2kneneHC4ZKg/AnUn/clJQqs/bDIfTXo dNiectR3W1qsdhu2FYEtwj5Uo4Dw6+NK8nIKW9ZHf/zoGb5Fa4prMsC3okJq+kNajEEo cdRD+dWtdgLz0Scxg4YZkyvYOyuwGb6owxFtY/JAd9Otcd6o3iF9Ui5YmrE+uKdsR9vW Eba0Yr4wt9djgCUfdFK51dyt3daRJqvgC5gtV/qiSoJEmM399ley7QEyH9gTa7kFwQvB sheg== 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=ZlX+yK74/RPXI8WDLBtko4hQYOoz80i/iI9a8/dO+7Q=; b=mpggB7aTI+BHhqywhhLbsowDcBwI358oStt8MGaii7ssGFP1xrLlvkkH2v71Q1e9cY 4aNVrqRte5AkofU+tOugcTdErO+6qCCSHGg0lQRTcW7a1FtkYoqV3KDHRLVnfDcZ8Peq b3N8uq4kW7BpLylhCd9eCH48IOZHbnqTr8wpQED/bMLtH/k5mrFN31ikSvXutbSKRmHR 1/6Qd/6gJbSqzf0HuHdrvAC0DFW9GkvCfv8VhK+FYIWNYms5zJwHaICSscKZsM7ruWxu BKlhi7iChUfpUY61GxzIyfusI4J3LSy38YotfkkfiHc2QI7FEs6wawb1tOh/1YZkdYxw DC+w== 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 33si13358092ply.361.2019.03.14.02.22.58; Thu, 14 Mar 2019 02:23:14 -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 S1726776AbfCNJWV (ORCPT + 99 others); Thu, 14 Mar 2019 05:22:21 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:52541 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726284AbfCNJWV (ORCPT ); Thu, 14 Mar 2019 05:22:21 -0400 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 1h4MZ2-0001xW-Dx; Thu, 14 Mar 2019 10:22:12 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1h4MZ1-0001Fo-Qe; Thu, 14 Mar 2019 10:22:11 +0100 Date: Thu, 14 Mar 2019 10:22:11 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Anson Huang Cc: "thierry.reding@gmail.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux@armlinux.org.uk" , "stefan@agner.ch" , "otavio@ossystems.com.br" , Leonard Crestez , "schnitzeltony@gmail.com" , "jan.tuerk@emtrion.com" , Robin Gong , "linux-pwm@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH V3 2/5] pwm: Add i.MX TPM PWM driver support Message-ID: <20190314092211.rt36ynjjsdesszut@pengutronix.de> References: <1552544534-5295-1-git-send-email-Anson.Huang@nxp.com> <1552544534-5295-3-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1552544534-5295-3-git-send-email-Anson.Huang@nxp.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 Thu, Mar 14, 2019 at 06:27:20AM +0000, Anson Huang wrote: > i.MX7ULP has TPM(Low Power Timer/Pulse Width Modulation Module) > inside, add TPM PWM driver support. > > Signed-off-by: Anson Huang > --- > Changes since V2: > - Add "IMX_" as prefix to macro define as TPM is already used; > - Use macro define for channel registers address instead of calculation in everywhere. > - Add limitations statement in copyright. > --- > drivers/pwm/Kconfig | 10 ++ > drivers/pwm/Makefile | 1 + > drivers/pwm/pwm-imx-tpm.c | 343 ++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 354 insertions(+) > create mode 100644 drivers/pwm/pwm-imx-tpm.c > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig > index a8f47df..c1cbb43 100644 > --- a/drivers/pwm/Kconfig > +++ b/drivers/pwm/Kconfig > @@ -201,6 +201,16 @@ config PWM_IMX > To compile this driver as a module, choose M here: the module > will be called pwm-imx. > > +config PWM_IMX_TPM > + tristate "i.MX TPM PWM support" > + depends on ARCH_MXC > + help > + Generic PWM framework driver for i.MX7ULP TPM module, TPM's full > + name is Low Power Timer/Pulse Width Modulation Module. > + > + To compile this driver as a module, choose M here: the module > + will be called pwm-imx-tpm. > + > config PWM_JZ4740 > tristate "Ingenic JZ47xx PWM support" > depends on MACH_INGENIC > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile > index 9c676a0..64e036c 100644 > --- a/drivers/pwm/Makefile > +++ b/drivers/pwm/Makefile > @@ -18,6 +18,7 @@ obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o > obj-$(CONFIG_PWM_HIBVT) += pwm-hibvt.o > obj-$(CONFIG_PWM_IMG) += pwm-img.o > obj-$(CONFIG_PWM_IMX) += pwm-imx.o > +obj-$(CONFIG_PWM_IMX_TPM) += pwm-imx-tpm.o > obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o > obj-$(CONFIG_PWM_LP3943) += pwm-lp3943.o > obj-$(CONFIG_PWM_LPC18XX_SCT) += pwm-lpc18xx-sct.o > diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c > new file mode 100644 > index 0000000..cdb29f6 > --- /dev/null > +++ b/drivers/pwm/pwm-imx-tpm.c > @@ -0,0 +1,343 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright 2018-2019 NXP. > + * > + * Limitations: > + * - The TPM counter and period counter are shared between > + * multiple channels, so all channels should use same period > + * settings. > + * - When a channel is disabled, its polarity settings will be > + * saved and its output will be disabled by clearing polarity > + * setting, when channel is enabled, polarity settings will be > + * restored and output will be enabled again. > + * - ONLY when all channels are disabled, then TPM counter will > + * be disabled. I wouldn't list the last two items in this section. These are implementation details that a PWM consumer doesn't need to bother with. These are fine to be noted in a code comment at the appropriate place. Other than that please look at my feedback for the previous series that I just sent out. I think most things still apply to this version. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |