Linux-LEDs Archive on lore.kernel.org
 help / color / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Martin Botka <martin.botka1@gmail.com>
Cc: Fenglin Wu <fenglinw@codeaurora.org>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-pwm@vger.kernel.org
Subject: Re: [PATCH RFC 3/6] pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module
Date: Tue, 28 Jul 2020 09:08:01 +0200
Message-ID: <20200728070801.evcfnq25a2f5d55r@pengutronix.de> (raw)
In-Reply-To: <CADQ2G_EMUdf2BEwjDOCyz_ccMTsjMBM3GmpRe+n6V9-DJGr-Kg@mail.gmail.com>


[-- Attachment #1: Type: text/plain, Size: 4680 bytes --]

Hello Martin,

On Mon, Jul 27, 2020 at 11:16:57PM +0200, Martin Botka wrote:
> Mo 27. 7. 2020 at 22:10 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> >
> > On Fri, Jul 24, 2020 at 11:36:53PM +0200, Martin Botka wrote:
> > > From: Fenglin Wu <fenglinw@codeaurora.org>
> > >
> > > Add pwm_chip to support QTI LPG module and export LPG channels as
> > > PWM devices for consumer drivers' usage.
> > >
> > > Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
> > > [martin.botka1@gmail.com: Fast-forward the driver from kernel 4.14 to 5.8]
> > > Signed-off-by: Martin Botka <martin.botka1@gmail.com>
> > > ---
> > >  drivers/pwm/Kconfig       |   10 +
> > >  drivers/pwm/Makefile      |    1 +
> > >  drivers/pwm/pwm-qti-lpg.c | 1284 +++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 1295 insertions(+)
> > >  create mode 100644 drivers/pwm/pwm-qti-lpg.c
> > >
> > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> > > index cb8d739067d2..8a52d6884a9a 100644
> > > --- a/drivers/pwm/Kconfig
> > > +++ b/drivers/pwm/Kconfig
> > > @@ -399,6 +399,16 @@ config PWM_RCAR
> > >         To compile this driver as a module, choose M here: the module
> > >         will be called pwm-rcar.
> > >
> > > +config PWM_QTI_LPG
> > > +     tristate "Qualcomm Technologies, Inc. LPG driver"
> > > +     depends on  MFD_SPMI_PMIC && OF
> > > +     help
> > > +       This driver supports the LPG (Light Pulse Generator) module found in
> > > +       Qualcomm Technologies, Inc. PMIC chips. Each LPG channel can be
> > > +       configured to operate in PWM mode to output a fixed amplitude with
> > > +       variable duty cycle or in LUT (Look up table) mode to output PWM
> > > +       signal with a modulated amplitude.
> > > +
> > >  config PWM_RENESAS_TPU
> > >       tristate "Renesas TPU PWM support"
> > >       depends on ARCH_RENESAS || COMPILE_TEST
> > > diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
> > > index a59c710e98c7..3555a6aa3f33 100644
> > > --- a/drivers/pwm/Makefile
> > > +++ b/drivers/pwm/Makefile
> > > @@ -37,6 +37,7 @@ obj-$(CONFIG_PWM_PCA9685)   += pwm-pca9685.o
> > >  obj-$(CONFIG_PWM_PUV3)               += pwm-puv3.o
> > >  obj-$(CONFIG_PWM_PXA)                += pwm-pxa.o
> > >  obj-$(CONFIG_PWM_RCAR)               += pwm-rcar.o
> > > +obj-$(CONFIG_PWM_QTI_LPG)    += pwm-qti-lpg.o
> >
> > Please keep this list alphabetically sorted.
> 
> OK
> 
> >
> > >  obj-$(CONFIG_PWM_RENESAS_TPU)        += pwm-renesas-tpu.o
> > >  obj-$(CONFIG_PWM_ROCKCHIP)   += pwm-rockchip.o
> > >  obj-$(CONFIG_PWM_SAMSUNG)    += pwm-samsung.o
> > > diff --git a/drivers/pwm/pwm-qti-lpg.c b/drivers/pwm/pwm-qti-lpg.c
> > > new file mode 100644
> > > index 000000000000..d24c3b3a3d8c
> > > --- /dev/null
> > > +++ b/drivers/pwm/pwm-qti-lpg.c
> > > @@ -0,0 +1,1284 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * Copyright (c) 2020, The Linux Foundation. All rights reserved.
> > > + */
> > > +
> > > +#define pr_fmt(fmt) "%s: " fmt, __func__
> >
> > This smells like debug stuff. Please drop this.
> 
> What do you mean ?
> The #define pr_fmt(fmt) or the tons of REG definitions ?

Either drop pr_fmt or at least don't have __func__ in it. This doesn't
belong into the kernel log (in the non-debug case at least).
(For debugging I like:

	#define pr_fmt(fmt) "%s:%d: " fmt, __func__, __LINE__

which helps finding the right printk line in the code from a given
output in functions with many printks.)

I don't mind the REG definitions, though aligning the values vertically
is common.

> > > +static const struct pwm_ops qpnp_lpg_pwm_ops = {
> > > +     .config = qpnp_lpg_pwm_config,
> > > +     .config_extend = qpnp_lpg_pwm_config_extend,
> > > +     .get_output_type_supported = qpnp_lpg_pwm_output_types_supported,
> > > +     .set_output_type = qpnp_lpg_pwm_set_output_type,
> > > +     .set_output_pattern = qpnp_lpg_pwm_set_output_pattern,
> > > +     .enable = qpnp_lpg_pwm_enable,
> > > +     .disable = qpnp_lpg_pwm_disable,
> >
> > As already noted in the former patch: Please implement .apply() and
> > .get_state().
> 
> So drop:
>     .get_output_type_supported = qpnp_lpg_pwm_output_types_supported,
>     .set_output_type = qpnp_lpg_pwm_set_output_type,
>     .set_output_pattern = qpnp_lpg_pwm_set_output_pattern,
> 
> Ad implement implement .apply and .get_state if i understood you correctly.
> Right ?

ack

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply index

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 21:36 [PATCH RFC 0/6] Add QCOM pwm-lpg and tri-led drivers Martin Botka
2020-07-24 21:36 ` [PATCH RCC 1/6] pwm: Add different PWM output types support Martin Botka
2020-07-27 20:10   ` Uwe Kleine-König
2020-07-27 20:56     ` Martin Botka
2020-07-28  7:52       ` Uwe Kleine-König
2020-07-27 21:46   ` Guru Das Srinagesh
2020-07-24 21:36 ` [PATCH RFC 2/6] pwm: core: Add option to config PWM duty/period with u64 data length Martin Botka
2020-07-25 14:55   ` Martin Botka
2020-07-25 15:24     ` Pavel Machek
2020-07-25 15:30       ` Martin Botka
2020-07-26  9:04   ` Andy Shevchenko
2020-07-26  9:12     ` Martin Botka
2020-07-27  7:29       ` Martin Botka
2020-07-27  7:32         ` Martin Botka
2020-07-27  7:52         ` Uwe Kleine-König
2020-07-27  7:58           ` Martin Botka
2020-07-27  8:34             ` Uwe Kleine-König
2020-07-24 21:36 ` [PATCH RFC 3/6] pwm: pwm-qti-lpg: Add PWM driver for QTI LPG module Martin Botka
2020-07-27 20:09   ` Uwe Kleine-König
2020-07-27 21:16     ` Martin Botka
2020-07-28  7:08       ` Uwe Kleine-König [this message]
2020-07-24 21:36 ` [PATCH RFC 4/6] leds: leds-qti-tri-led: Add LED driver for QTI TRI_LED module Martin Botka
2020-07-26 17:25   ` Martin Botka
2020-07-24 21:36 ` [PATCH RFC 5/6] Documentation: Add binding for qti-tri-led Martin Botka
2020-07-24 21:36 ` [PATCH RFC 6/6] Documentation: Add binding for pwm-qti-lpg Martin Botka
2020-07-24 22:05 ` [PATCH RFC 0/6] Add QCOM pwm-lpg and tri-led drivers Pavel Machek
2020-07-24 22:26   ` Martin Botka
2020-07-24 22:32     ` Pavel Machek
2020-07-24 22:48       ` Martin Botka
     [not found]   ` <CADQ2G_HbysJbiQKSRmA6HDRfjPYPiDjbZfeuUjM1mNV-BBBC-A@mail.gmail.com>
2020-07-24 22:31     ` Pavel Machek
2020-07-24 22:46       ` Martin Botka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200728070801.evcfnq25a2f5d55r@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=fenglinw@codeaurora.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=martin.botka1@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-LEDs Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-leds/0 linux-leds/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-leds linux-leds/ https://lore.kernel.org/linux-leds \
		linux-leds@vger.kernel.org
	public-inbox-index linux-leds

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-leds


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git