[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728070801.evcfnq25a2f5d55r@pengutronix.de>
Date: Tue, 28 Jul 2020 09:08:01 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Martin Botka <martin.botka1@...il.com>
Cc: Fenglin Wu <fenglinw@...eaurora.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Rob Herring <robh+dt@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-pwm@...r.kernel.org
Subject: Re: [PATCH RFC 3/6] pwm: pwm-qti-lpg: Add PWM driver for QTI LPG
module
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@...gutronix.de> wrote:
> >
> > On Fri, Jul 24, 2020 at 11:36:53PM +0200, Martin Botka wrote:
> > > From: Fenglin Wu <fenglinw@...eaurora.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@...eaurora.org>
> > > [martin.botka1@...il.com: Fast-forward the driver from kernel 4.14 to 5.8]
> > > Signed-off-by: Martin Botka <martin.botka1@...il.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/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists