* [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
@ 2024-02-14 9:30 ` Uwe Kleine-König
2024-02-14 12:49 ` Andy Shevchenko
2024-02-14 9:31 ` [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
` (4 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 9:30 UTC (permalink / raw)
To: Jonathan Corbet, Jonathan Cameron, James Clark, Andy Shevchenko,
Mark Brown, linux-pwm, Hector Martin, Sven Peter, Claudiu Beznea,
Nicolas Ferre, Alexandre Belloni, Florian Fainelli, Ray Jui,
Scott Branden, Alexander Shiyan, Benson Leung, Shawn Guo,
Sascha Hauer, Paul Cercueil, Vladimir Zapolskiy, Mika Westerberg,
Andy Shevchenko, Linus Walleij, Hans de Goede, Ilpo Järvinen,
Matthias Brugger, AngeloGioacchino Del Regno, Neil Armstrong,
Kevin Hilman, Conor Dooley, Daire McNamara,
Jonathan Neuschäfer, Heiko Stuebner, Krzysztof Kozlowski,
Palmer Dabbelt, Paul Walmsley, Michael Walle, Orson Zhai,
Baolin Wang, Chunyan Zhang, Fabrice Gasnier, Maxime Coquelin,
Alexandre Torgue, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hammer Hsieh, Thierry Reding, Jonathan Hunter, Nobuhiro Iwamatsu,
Sean Anderson, Michal Simek, Bartosz Golaszewski, Pavel Machek,
Lee Jones, Anjelique Melendez, Bjorn Andersson, Kees Cook,
Rob Herring
Cc: linux-doc, kernel, Alyssa Rosenzweig, asahi, linux-arm-kernel,
Broadcom internal kernel review list, linux-rpi-kernel,
Guenter Roeck, chrome-platform, Fabio Estevam, NXP Linux Team,
linux-mips, linux-gpio, platform-driver-x86, linux-mediatek,
Jerome Brunet, Martin Blumenstingl, linux-amlogic, linux-riscv,
linux-rockchip, Alim Akhtar, linux-samsung-soc, linux-stm32,
linux-sunxi, linux-tegra, linux-leds
This function allocates a struct pwm_chip and driver data. Compared to
the status quo the split into pwm_chip and driver data is new, otherwise
it doesn't change anything relevant (yet).
The intention is that after all drivers are switched to use this
allocation function, its possible to add a struct device to struct
pwm_chip to properly track the latter's lifetime without touching all
drivers again. Proper lifetime tracking is a necessary precondition to
introduce character device support for PWMs (that implements atomic
setting and doesn't suffer from the sysfs overhead of the /sys/class/pwm
userspace support).
The new function pwmchip_priv() (obviously?) only works for chips
allocated with pwmchip_alloc().
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
.../driver-api/driver-model/devres.rst | 1 +
Documentation/driver-api/pwm.rst | 11 ++--
drivers/pwm/core.c | 58 +++++++++++++++++++
include/linux/pwm.h | 22 +++++++
4 files changed, 87 insertions(+), 5 deletions(-)
diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index c5f99d834ec5..e4df72c408d2 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -420,6 +420,7 @@ POWER
devm_reboot_mode_unregister()
PWM
+ devm_pwmchip_alloc()
devm_pwmchip_add()
devm_pwm_get()
devm_fwnode_pwm_get()
diff --git a/Documentation/driver-api/pwm.rst b/Documentation/driver-api/pwm.rst
index 3c28ccc4b611..b41b1c56477f 100644
--- a/Documentation/driver-api/pwm.rst
+++ b/Documentation/driver-api/pwm.rst
@@ -143,11 +143,12 @@ to implement the pwm_*() functions itself. This means that it's impossible
to have multiple PWM drivers in the system. For this reason it's mandatory
for new drivers to use the generic PWM framework.
-A new PWM controller/chip can be added using pwmchip_add() and removed
-again with pwmchip_remove(). pwmchip_add() takes a filled in struct
-pwm_chip as argument which provides a description of the PWM chip, the
-number of PWM devices provided by the chip and the chip-specific
-implementation of the supported PWM operations to the framework.
+A new PWM controller/chip can be allocated using pwmchip_alloc(), then
+registered using pwmchip_add() and removed again with pwmchip_remove(). To undo
+pwmchip_alloc() use pwmchip_put(). pwmchip_add() takes a filled in struct
+pwm_chip as argument which provides a description of the PWM chip, the number
+of PWM devices provided by the chip and the chip-specific implementation of the
+supported PWM operations to the framework.
When implementing polarity support in a PWM driver, make sure to respect the
signal conventions in the PWM framework. By definition, normal polarity
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 830a697826af..9fc6f4fa71d6 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -454,6 +454,64 @@ of_pwm_single_xlate(struct pwm_chip *chip, const struct of_phandle_args *args)
}
EXPORT_SYMBOL_GPL(of_pwm_single_xlate);
+#define PWMCHIP_ALIGN ARCH_DMA_MINALIGN
+
+static void *pwmchip_priv(struct pwm_chip *chip)
+{
+ return (void *)chip + ALIGN(sizeof(*chip), PWMCHIP_ALIGN);
+}
+
+/* This is the counterpart to pwmchip_alloc */
+void pwmchip_put(struct pwm_chip *chip)
+{
+ kfree(chip);
+}
+EXPORT_SYMBOL_GPL(pwmchip_put);
+
+struct pwm_chip *pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv)
+{
+ struct pwm_chip *chip;
+ size_t alloc_size;
+
+ alloc_size = size_add(ALIGN(sizeof(*chip), PWMCHIP_ALIGN), sizeof_priv);
+
+ chip = kzalloc(alloc_size, GFP_KERNEL);
+ if (!chip)
+ return ERR_PTR(-ENOMEM);
+
+ chip->dev = parent;
+ chip->npwm = npwm;
+
+ pwmchip_set_drvdata(chip, pwmchip_priv(chip));
+
+ return chip;
+}
+EXPORT_SYMBOL_GPL(pwmchip_alloc);
+
+static void devm_pwmchip_put(void *data)
+{
+ struct pwm_chip *chip = data;
+
+ pwmchip_put(chip);
+}
+
+struct pwm_chip *devm_pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv)
+{
+ struct pwm_chip *chip;
+ int ret;
+
+ chip = pwmchip_alloc(parent, npwm, sizeof_priv);
+ if (IS_ERR(chip))
+ return chip;
+
+ ret = devm_add_action_or_reset(parent, devm_pwmchip_put, chip);
+ if (ret)
+ return ERR_PTR(ret);
+
+ return chip;
+}
+EXPORT_SYMBOL_GPL(devm_pwmchip_alloc);
+
static void of_pwmchip_add(struct pwm_chip *chip)
{
if (!pwmchip_parent(chip) || !pwmchip_parent(chip)->of_node)
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 29a7d9140f77..4a6568dfdf3f 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -403,6 +403,10 @@ static inline bool pwm_might_sleep(struct pwm_device *pwm)
int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
unsigned long timeout);
+void pwmchip_put(struct pwm_chip *chip);
+struct pwm_chip *pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv);
+struct pwm_chip *devm_pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv);
+
int __pwmchip_add(struct pwm_chip *chip, struct module *owner);
#define pwmchip_add(chip) __pwmchip_add(chip, THIS_MODULE)
void pwmchip_remove(struct pwm_chip *chip);
@@ -475,6 +479,24 @@ static inline int pwm_capture(struct pwm_device *pwm,
return -EINVAL;
}
+static inline void pwmchip_put(struct pwm_chip *chip)
+{
+}
+
+static inline struct pwm_chip *pwmchip_alloc(struct device *parent,
+ unsigned int npwm,
+ size_t sizeof_priv)
+{
+ return ERR_PTR(-EINVAL);
+}
+
+static inline struct pwm_chip *devm_pwmchip_alloc(struct device *parent,
+ unsigned int npwm,
+ size_t sizeof_priv)
+{
+ return pwmchip_alloc(parent, npwm, sizeof_priv);
+}
+
static inline int pwmchip_add(struct pwm_chip *chip)
{
return -EINVAL;
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
2024-02-14 9:30 ` [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it Uwe Kleine-König
@ 2024-02-14 12:49 ` Andy Shevchenko
2024-02-15 12:01 ` Uwe Kleine-König
0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2024-02-14 12:49 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Corbet, Jonathan Cameron, James Clark, Mark Brown,
linux-pwm, Hector Martin, Sven Peter, Claudiu Beznea,
Nicolas Ferre, Alexandre Belloni, Florian Fainelli, Ray Jui,
Scott Branden, Alexander Shiyan, Benson Leung, Shawn Guo,
Sascha Hauer, Paul Cercueil, Vladimir Zapolskiy, Mika Westerberg,
Linus Walleij, Hans de Goede, Ilpo Järvinen,
Matthias Brugger, AngeloGioacchino Del Regno, Neil Armstrong,
Kevin Hilman, Conor Dooley, Daire McNamara,
Jonathan Neuschäfer, Heiko Stuebner, Krzysztof Kozlowski,
Palmer Dabbelt, Paul Walmsley, Michael Walle, Orson Zhai,
Baolin Wang, Chunyan Zhang, Fabrice Gasnier, Maxime Coquelin,
Alexandre Torgue, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hammer Hsieh, Thierry Reding, Jonathan Hunter, Nobuhiro Iwamatsu,
Sean Anderson, Michal Simek, Bartosz Golaszewski, Pavel Machek,
Lee Jones, Anjelique Melendez, Bjorn Andersson, Kees Cook,
Rob Herring, linux-doc, kernel, Alyssa Rosenzweig, asahi,
linux-arm-kernel, Broadcom internal kernel review list,
linux-rpi-kernel, Guenter Roeck, chrome-platform, Fabio Estevam,
NXP Linux Team, linux-mips, linux-gpio, platform-driver-x86,
linux-mediatek, Jerome Brunet, Martin Blumenstingl, linux-amlogic,
linux-riscv, linux-rockchip, Alim Akhtar, linux-samsung-soc,
linux-stm32, linux-sunxi, linux-tegra, linux-leds
On Wed, Feb 14, 2024 at 10:30:50AM +0100, Uwe Kleine-König wrote:
> This function allocates a struct pwm_chip and driver data. Compared to
> the status quo the split into pwm_chip and driver data is new, otherwise
> it doesn't change anything relevant (yet).
>
> The intention is that after all drivers are switched to use this
> allocation function, its possible to add a struct device to struct
> pwm_chip to properly track the latter's lifetime without touching all
> drivers again. Proper lifetime tracking is a necessary precondition to
> introduce character device support for PWMs (that implements atomic
> setting and doesn't suffer from the sysfs overhead of the /sys/class/pwm
> userspace support).
>
> The new function pwmchip_priv() (obviously?) only works for chips
> allocated with pwmchip_alloc().
...
> +#define PWMCHIP_ALIGN ARCH_DMA_MINALIGN
> +
> +static void *pwmchip_priv(struct pwm_chip *chip)
> +{
> + return (void *)chip + ALIGN(sizeof(*chip), PWMCHIP_ALIGN);
> +}
Why not use dma_get_cache_alignment() ?
...
> +/* This is the counterpart to pwmchip_alloc */
pwmchip_alloc()
...
> +EXPORT_SYMBOL_GPL(pwmchip_put);
> +EXPORT_SYMBOL_GPL(pwmchip_alloc);
> +EXPORT_SYMBOL_GPL(devm_pwmchip_alloc);
Are these exported via namespace? If no, can they be from day 1?
...
> +static inline void pwmchip_put(struct pwm_chip *chip)
> +{
> +}
Can be one line, but it's up to the present style in this header.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
2024-02-14 12:49 ` Andy Shevchenko
@ 2024-02-15 12:01 ` Uwe Kleine-König
2024-02-15 13:51 ` Nuno Sá
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-15 12:01 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Alexandre Belloni, Michael Walle, Heiko Stuebner, linux-doc,
Linus Walleij, Paul Walmsley, Alexandre Torgue, Nicolas Ferre,
Paul Cercueil, linux-tegra, Conor Dooley, Thierry Reding,
James Clark, Pavel Machek, Broadcom internal kernel review list,
Guenter Roeck, chrome-platform, Nobuhiro Iwamatsu, Fabio Estevam,
linux-riscv, Alyssa Rosenzweig, Jerome Brunet, Rob Herring,
Samuel Holland, linux-samsung-soc, Bjorn Andersson,
Florian Fainelli, Jonathan Corbet, Sean Anderson, Benson Leung,
Bartosz Golaszewski, Lee Jones, Jernej Skrabec, Jonathan Hunter,
Hammer Hsieh, linux-rockchip, Chen-Yu Tsai, Michal Simek,
NXP Linux Team, linux-leds, Ilpo Järvinen, Alim Akhtar,
linux-mips, linux-sunxi, platform-driver-x86, linux-pwm,
Kees Cook, Sven Peter, Martin Blumenstingl, Ray Jui, Sascha Hauer,
Jonathan Neuschäfer, Vladimir Zapolskiy, Hans de Goede,
Mark Brown, linux-mediatek, linux-rpi-kernel, Baolin Wang,
Jonathan Cameron, Matthias Brugger, linux-amlogic, Orson Zhai,
Mika Westerberg, kernel, linux-arm-kernel,
AngeloGioacchino Del Regno, Neil Armstrong, Alexander Shiyan,
Scott Branden, linux-gpio, Daire McNamara, Chunyan Zhang,
Hector Martin, linux-stm32, Claudiu Beznea, Krzysztof Kozlowski,
Fabrice Gasnier, Palmer Dabbelt, asahi, Maxime Coquelin,
Kevin Hilman, Shawn Guo, Anjelique Melendez
[-- Attachment #1: Type: text/plain, Size: 2225 bytes --]
On Wed, Feb 14, 2024 at 02:49:26PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 14, 2024 at 10:30:50AM +0100, Uwe Kleine-König wrote:
> > This function allocates a struct pwm_chip and driver data. Compared to
> > the status quo the split into pwm_chip and driver data is new, otherwise
> > it doesn't change anything relevant (yet).
> >
> > The intention is that after all drivers are switched to use this
> > allocation function, its possible to add a struct device to struct
> > pwm_chip to properly track the latter's lifetime without touching all
> > drivers again. Proper lifetime tracking is a necessary precondition to
> > introduce character device support for PWMs (that implements atomic
> > setting and doesn't suffer from the sysfs overhead of the /sys/class/pwm
> > userspace support).
> >
> > The new function pwmchip_priv() (obviously?) only works for chips
> > allocated with pwmchip_alloc().
>
> ...
>
> > +#define PWMCHIP_ALIGN ARCH_DMA_MINALIGN
> > +
> > +static void *pwmchip_priv(struct pwm_chip *chip)
> > +{
> > + return (void *)chip + ALIGN(sizeof(*chip), PWMCHIP_ALIGN);
> > +}
>
> Why not use dma_get_cache_alignment() ?
Hmm, that function returns 1 if ARCH_HAS_DMA_MINALIGN isn't defined. The
idea of using ARCH_DMA_MINALIGN was to ensure that the priv data has the
same minimal alignment as kmalloc(). Took my inspriration from
https://lore.kernel.org/r/20240209-counter-align-fix-v2-1-5777ea0a2722@analog.com
. The implementation of dma_get_cache_alignment suggests that not all
archs provide ARCH_DMA_MINALIGN? Also there is ARCH_KMALLOC_MINALIGN.
Hmm, don't know yet what to do here.
> > +/* This is the counterpart to pwmchip_alloc */
>
> pwmchip_alloc()
Ack.
> > +EXPORT_SYMBOL_GPL(pwmchip_put);
>
> > +EXPORT_SYMBOL_GPL(pwmchip_alloc);
>
> > +EXPORT_SYMBOL_GPL(devm_pwmchip_alloc);
>
> Are these exported via namespace? If no, can they be from day 1?
I added that to my todo list for all pwm functions. Will address that
separately.
Thanks for your feedback
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 --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
2024-02-15 12:01 ` Uwe Kleine-König
@ 2024-02-15 13:51 ` Nuno Sá
0 siblings, 0 replies; 15+ messages in thread
From: Nuno Sá @ 2024-02-15 13:51 UTC (permalink / raw)
To: Uwe Kleine-König, Andy Shevchenko
Cc: Alexandre Belloni, Michael Walle, Heiko Stuebner, linux-doc,
Linus Walleij, Paul Walmsley, Alexandre Torgue, Nicolas Ferre,
Paul Cercueil, linux-tegra, Conor Dooley, Thierry Reding,
James Clark, Pavel Machek, Broadcom internal kernel review list,
Guenter Roeck, chrome-platform, Nobuhiro Iwamatsu, Fabio Estevam,
linux-riscv, Alyssa Rosenzweig, Jerome Brunet, Rob Herring,
Samuel Holland, linux-samsung-soc, Bjorn Andersson,
Florian Fainelli, Jonathan Corbet, Sean Anderson, Benson Leung,
Bartosz Golaszewski, Lee Jones, Jernej Skrabec, Jonathan Hunter,
Hammer Hsieh, linux-rockchip, Chen-Yu Tsai, Michal Simek,
NXP Linux Team, linux-leds, Ilpo Järvinen, Alim Akhtar,
linux-mips, linux-sunxi, platform-driver-x86, linux-pwm,
Kees Cook, Sven Peter, Martin Blumenstingl, Ray Jui, Sascha Hauer,
Jonathan Neuschäfer, Vladimir Zapolskiy, Hans de Goede,
Mark Brown, linux-mediatek, linux-rpi-kernel, Baolin Wang,
Jonathan Cameron, Matthias Brugger, linux-amlogic, Orson Zhai,
Mika Westerberg, kernel, linux-arm-kernel,
AngeloGioacchino Del Regno, Neil Armstrong, Alexander Shiyan,
Scott Branden, linux-gpio, Daire McNamara, Chunyan Zhang,
Hector Martin, linux-stm32, Claudiu Beznea, Krzysztof Kozlowski,
Fabrice Gasnier, Palmer Dabbelt, asahi, Maxime Coquelin,
Kevin Hilman, Shawn Guo, Anjelique Melendez
On Thu, 2024-02-15 at 13:01 +0100, Uwe Kleine-König wrote:
> On Wed, Feb 14, 2024 at 02:49:26PM +0200, Andy Shevchenko wrote:
> > On Wed, Feb 14, 2024 at 10:30:50AM +0100, Uwe Kleine-König wrote:
> > > This function allocates a struct pwm_chip and driver data. Compared to
> > > the status quo the split into pwm_chip and driver data is new, otherwise
> > > it doesn't change anything relevant (yet).
> > >
> > > The intention is that after all drivers are switched to use this
> > > allocation function, its possible to add a struct device to struct
> > > pwm_chip to properly track the latter's lifetime without touching all
> > > drivers again. Proper lifetime tracking is a necessary precondition to
> > > introduce character device support for PWMs (that implements atomic
> > > setting and doesn't suffer from the sysfs overhead of the /sys/class/pwm
> > > userspace support).
> > >
> > > The new function pwmchip_priv() (obviously?) only works for chips
> > > allocated with pwmchip_alloc().
> >
> > ...
> >
> > > +#define PWMCHIP_ALIGN ARCH_DMA_MINALIGN
> > > +
> > > +static void *pwmchip_priv(struct pwm_chip *chip)
> > > +{
> > > + return (void *)chip + ALIGN(sizeof(*chip), PWMCHIP_ALIGN);
> > > +}
> >
> > Why not use dma_get_cache_alignment() ?
>
> Hmm, that function returns 1 if ARCH_HAS_DMA_MINALIGN isn't defined. The
> idea of using ARCH_DMA_MINALIGN was to ensure that the priv data has the
> same minimal alignment as kmalloc(). Took my inspriration from
> https://lore.kernel.org/r/20240209-counter-align-fix-v2-1-5777ea0a2722@analog.com
> . The implementation of dma_get_cache_alignment suggests that not all
> archs provide ARCH_DMA_MINALIGN? Also there is ARCH_KMALLOC_MINALIGN.
> Hmm, don't know yet what to do here.
Here it goes my 2 cents... AFAIK, ARCH_DMA_MINALIGN gives you the same alignment
guarantees than devm_kmalloc() for instance. In some archs it will effectively be the
same as ARCH_KMALLOC_MINALIGN. Now, I think it only matters if the owners of private
data intend to have a DMA safe buffer in their structs. If that is the case, we need
to ensure a proper alignment for that structure. In IIO for example, the construct is
like this:
https://elixir.bootlin.com/linux/latest/source/drivers/iio/dac/ltc2688.c#L96
The buffers should come last in the struct so they are alone in the line. In IIO,
Jonathan has a strict policy for this. Like, even if you just want to transfer 2/4
bytes via spi, we need to make the buffer safe (apparently there are some controllers
only doing DMA - even for small transfers).
I would say that if unsure, go with ARCH_DMA_MINALIGN. You just might waste some
space in some archs. OTOH, if you think DMA is not really a thing for pwm chips, you
might go ARCH_KMALLOC_MINALIGN. And since you already have your own PWMCHIP_ALIGN, it
should be easy to change the requirements down the road (if needed).
That said, I'm not familiar with dma_get_cache_alignment().
- Nuno Sá
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
2024-02-14 9:30 ` [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it Uwe Kleine-König
@ 2024-02-14 9:31 ` Uwe Kleine-König
2024-02-14 12:46 ` Andy Shevchenko
2024-02-14 15:39 ` Uwe Kleine-König
2024-02-14 9:33 ` [PATCH v6 151/164] gpio: mvebu: " Uwe Kleine-König
` (3 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 9:31 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, linux-pwm
Cc: linux-gpio, kernel, platform-driver-x86
This prepares the pwm-lpc drivers to further changes of the pwm core
outlined in the commit introducing devm_pwmchip_alloc(). There is no
intended semantical change and the driver should behave as before.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pinctrl/intel/pinctrl-intel.c | 6 +++---
drivers/pwm/pwm-lpss-pci.c | 8 ++++----
drivers/pwm/pwm-lpss-platform.c | 8 ++++----
drivers/pwm/pwm-lpss.c | 20 ++++++++++----------
drivers/pwm/pwm-lpss.h | 1 -
include/linux/platform_data/x86/pwm-lpss.h | 4 ++--
6 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index d6f29e6faab7..89bd7ce6711a 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1492,7 +1492,7 @@ static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl,
.base_unit_bits = 22,
.bypass = true,
};
- struct pwm_lpss_chip *pwm;
+ struct pwm_chip *chip;
if (!(community->features & PINCTRL_FEATURE_PWM))
return 0;
@@ -1500,8 +1500,8 @@ static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl,
if (!IS_REACHABLE(CONFIG_PWM_LPSS))
return 0;
- pwm = devm_pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info);
- return PTR_ERR_OR_ZERO(pwm);
+ chip = devm_pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info);
+ return PTR_ERR_OR_ZERO(chip);
}
int intel_pinctrl_probe(struct platform_device *pdev,
diff --git a/drivers/pwm/pwm-lpss-pci.c b/drivers/pwm/pwm-lpss-pci.c
index 34acfe99b74f..25045c229520 100644
--- a/drivers/pwm/pwm-lpss-pci.c
+++ b/drivers/pwm/pwm-lpss-pci.c
@@ -18,7 +18,7 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,
const struct pci_device_id *id)
{
const struct pwm_lpss_boardinfo *info;
- struct pwm_lpss_chip *lpwm;
+ struct pwm_chip *chip;
int err;
err = pcim_enable_device(pdev);
@@ -30,9 +30,9 @@ static int pwm_lpss_probe_pci(struct pci_dev *pdev,
return err;
info = (struct pwm_lpss_boardinfo *)id->driver_data;
- lpwm = devm_pwm_lpss_probe(&pdev->dev, pcim_iomap_table(pdev)[0], info);
- if (IS_ERR(lpwm))
- return PTR_ERR(lpwm);
+ chip = devm_pwm_lpss_probe(&pdev->dev, pcim_iomap_table(pdev)[0], info);
+ if (IS_ERR(chip))
+ return PTR_ERR(chip);
pm_runtime_put(&pdev->dev);
pm_runtime_allow(&pdev->dev);
diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index 5f6ee300e342..dbc9f5b17bdc 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -20,7 +20,7 @@
static int pwm_lpss_probe_platform(struct platform_device *pdev)
{
const struct pwm_lpss_boardinfo *info;
- struct pwm_lpss_chip *lpwm;
+ struct pwm_chip *chip;
void __iomem *base;
info = device_get_match_data(&pdev->dev);
@@ -31,9 +31,9 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
if (IS_ERR(base))
return PTR_ERR(base);
- lpwm = devm_pwm_lpss_probe(&pdev->dev, base, info);
- if (IS_ERR(lpwm))
- return PTR_ERR(lpwm);
+ chip = devm_pwm_lpss_probe(&pdev->dev, base, info);
+ if (IS_ERR(chip))
+ return PTR_ERR(chip);
/*
* On Cherry Trail devices the GFX0._PS0 AML checks if the controller
diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 394c768f5a5f..b79fd3405e15 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(pwm_lpss_tng_info);
static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)
{
- return container_of(chip, struct pwm_lpss_chip, chip);
+ return pwmchip_get_drvdata(chip);
}
static inline u32 pwm_lpss_read(const struct pwm_device *pwm)
@@ -245,9 +245,10 @@ static const struct pwm_ops pwm_lpss_ops = {
.get_state = pwm_lpss_get_state,
};
-struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
+struct pwm_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
const struct pwm_lpss_boardinfo *info)
{
+ struct pwm_chip *chip;
struct pwm_lpss_chip *lpwm;
unsigned long c;
int i, ret;
@@ -256,9 +257,10 @@ struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base
if (WARN_ON(info->npwm > LPSS_MAX_PWMS))
return ERR_PTR(-ENODEV);
- lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL);
- if (!lpwm)
+ chip = devm_pwmchip_alloc(dev, info->npwm, sizeof(*lpwm));
+ if (!chip)
return ERR_PTR(-ENOMEM);
+ lpwm = to_lpwm(chip);
lpwm->regs = base;
lpwm->info = info;
@@ -267,23 +269,21 @@ struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base
if (!c)
return ERR_PTR(-EINVAL);
- lpwm->chip.dev = dev;
- lpwm->chip.ops = &pwm_lpss_ops;
- lpwm->chip.npwm = info->npwm;
+ chip->ops = &pwm_lpss_ops;
- ret = devm_pwmchip_add(dev, &lpwm->chip);
+ ret = devm_pwmchip_add(dev, chip);
if (ret) {
dev_err(dev, "failed to add PWM chip: %d\n", ret);
return ERR_PTR(ret);
}
for (i = 0; i < lpwm->info->npwm; i++) {
- ctrl = pwm_lpss_read(&lpwm->chip.pwms[i]);
+ ctrl = pwm_lpss_read(&chip->pwms[i]);
if (ctrl & PWM_ENABLE)
pm_runtime_get(dev);
}
- return lpwm;
+ return chip;
}
EXPORT_SYMBOL_GPL(devm_pwm_lpss_probe);
diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h
index bf841250385f..b5267ab5193b 100644
--- a/drivers/pwm/pwm-lpss.h
+++ b/drivers/pwm/pwm-lpss.h
@@ -18,7 +18,6 @@
#define LPSS_MAX_PWMS 4
struct pwm_lpss_chip {
- struct pwm_chip chip;
void __iomem *regs;
const struct pwm_lpss_boardinfo *info;
};
diff --git a/include/linux/platform_data/x86/pwm-lpss.h b/include/linux/platform_data/x86/pwm-lpss.h
index c852fe24fe2a..752c06b47cc8 100644
--- a/include/linux/platform_data/x86/pwm-lpss.h
+++ b/include/linux/platform_data/x86/pwm-lpss.h
@@ -27,7 +27,7 @@ struct pwm_lpss_boardinfo {
bool other_devices_aml_touches_pwm_regs;
};
-struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
- const struct pwm_lpss_boardinfo *info);
+struct pwm_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
+ const struct pwm_lpss_boardinfo *info);
#endif /* __PLATFORM_DATA_X86_PWM_LPSS_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 9:31 ` [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
@ 2024-02-14 12:46 ` Andy Shevchenko
2024-02-14 16:01 ` Uwe Kleine-König
2024-02-14 15:39 ` Uwe Kleine-König
1 sibling, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2024-02-14 12:46 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Mika Westerberg, Linus Walleij, Hans de Goede, Ilpo Järvinen,
linux-pwm, linux-gpio, kernel, platform-driver-x86
On Wed, Feb 14, 2024 at 10:31:54AM +0100, Uwe Kleine-König wrote:
> This prepares the pwm-lpc drivers to further changes of the pwm core
lpc --> lpss
pwm --> PWM
> outlined in the commit introducing devm_pwmchip_alloc(). There is no
> intended semantical change and the driver should behave as before.
...
> -struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
> +struct pwm_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
> const struct pwm_lpss_boardinfo *info)
Missing indentation amendment for the second line.
...
> + struct pwm_chip *chip;
> struct pwm_lpss_chip *lpwm;
> unsigned long c;
> int i, ret;
Please, keep reversed xmas tree order in place.
struct pwm_lpss_chip *lpwm;
struct pwm_chip *chip;
unsigned long c;
int i, ret;
...
With the above being addressed,
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 12:46 ` Andy Shevchenko
@ 2024-02-14 16:01 ` Uwe Kleine-König
2024-02-14 16:09 ` Andy Shevchenko
0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 16:01 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-pwm, linux-gpio, Linus Walleij, platform-driver-x86,
Hans de Goede, kernel, Ilpo Järvinen, Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]
Hello,
On Wed, Feb 14, 2024 at 02:46:17PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 14, 2024 at 10:31:54AM +0100, Uwe Kleine-König wrote:
> > This prepares the pwm-lpc drivers to further changes of the pwm core
>
> lpc --> lpss
> pwm --> PWM
I'd keep pwm in lower case. While I agree that the thing the pwm core is
about is written PWM, I use "pwm" to describe the framework. So the
directory is drivers/pwm (and not drivers/PWM), the subject prefix is
"pwm", the function prefix for pwm functions is pwm_.
Agreed for the other changes. The current state of the patch is
available at:
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git/commit/?h=pwm-lifetime-tracking&id=5b8f3aa33b3def3c8441ce28c93062766f278b09
(i.e. I didn't add your Reviewed-by tag because I didn't capitalize
pwm).
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 --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 16:01 ` Uwe Kleine-König
@ 2024-02-14 16:09 ` Andy Shevchenko
2024-02-14 17:04 ` Uwe Kleine-König
0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2024-02-14 16:09 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Andy Shevchenko, linux-pwm, linux-gpio, Linus Walleij,
platform-driver-x86, Hans de Goede, kernel, Ilpo Järvinen,
Mika Westerberg
On Wed, Feb 14, 2024 at 6:01 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> On Wed, Feb 14, 2024 at 02:46:17PM +0200, Andy Shevchenko wrote:
> (i.e. I didn't add your Reviewed-by tag because I didn't capitalize
> pwm).
Are you expecting me to bikeshed?! :-)
Please, add it there.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 16:09 ` Andy Shevchenko
@ 2024-02-14 17:04 ` Uwe Kleine-König
0 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 17:04 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Andy Shevchenko, linux-pwm, linux-gpio, Linus Walleij,
platform-driver-x86, Hans de Goede, kernel, Ilpo Järvinen,
Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 778 bytes --]
On Wed, Feb 14, 2024 at 06:09:47PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 14, 2024 at 6:01 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> > On Wed, Feb 14, 2024 at 02:46:17PM +0200, Andy Shevchenko wrote:
>
> > (i.e. I didn't add your Reviewed-by tag because I didn't capitalize
> > pwm).
>
> Are you expecting me to bikeshed?! :-)
> Please, add it there.
No, not expecting it, but taking the possibility into account :-)
And I prefer being told that I'm over-cautious and should add it over
being told to have made a wrong assumption and should drop it.
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 --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function
2024-02-14 9:31 ` [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
2024-02-14 12:46 ` Andy Shevchenko
@ 2024-02-14 15:39 ` Uwe Kleine-König
1 sibling, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 15:39 UTC (permalink / raw)
To: Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, linux-pwm
Cc: linux-gpio, kernel, platform-driver-x86
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
Hello,
On Wed, Feb 14, 2024 at 10:31:54AM +0100, Uwe Kleine-König wrote:
> @@ -256,9 +257,10 @@ struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base
> if (WARN_ON(info->npwm > LPSS_MAX_PWMS))
> return ERR_PTR(-ENODEV);
>
> - lpwm = devm_kzalloc(dev, sizeof(*lpwm), GFP_KERNEL);
> - if (!lpwm)
> + chip = devm_pwmchip_alloc(dev, info->npwm, sizeof(*lpwm));
> + if (!chip)
> return ERR_PTR(-ENOMEM);
while adapting the patch for Andy's feedback I noticed this being wrong,
devm_pwmchip_alloc() returns an error pointer and not NULL on failure.
I'll squash the following change into the commit:
diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 3247b420b67a..867e2bc8c601 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -258,8 +258,8 @@ struct pwm_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
return ERR_PTR(-ENODEV);
chip = devm_pwmchip_alloc(dev, info->npwm, sizeof(*lpwm));
- if (!chip)
- return ERR_PTR(-ENOMEM);
+ if (IS_ERR(chip))
+ return chip;
lpwm = to_lpwm(chip);
lpwm->regs = base;
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 --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 151/164] gpio: mvebu: Make use of devm_pwmchip_alloc() function
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
2024-02-14 9:30 ` [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it Uwe Kleine-König
2024-02-14 9:31 ` [PATCH v6 067/164] pwm: lpss-*: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
@ 2024-02-14 9:33 ` Uwe Kleine-König
2024-02-15 11:46 ` [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-14 9:33 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski, linux-pwm; +Cc: linux-gpio, kernel
This prepares the pwm sub-driver to further changes of the pwm core
outlined in the commit introducing devm_pwmchip_alloc(). There is no
intended semantical change and the driver should behave as before.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/gpio/gpio-mvebu.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index a13f3c18ccd4..8cfd3a89c018 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -99,7 +99,6 @@ struct mvebu_pwm {
u32 offset;
unsigned long clk_rate;
struct gpio_desc *gpiod;
- struct pwm_chip chip;
spinlock_t lock;
struct mvebu_gpio_chip *mvchip;
@@ -615,7 +614,7 @@ static const struct regmap_config mvebu_gpio_regmap_config = {
*/
static struct mvebu_pwm *to_mvebu_pwm(struct pwm_chip *chip)
{
- return container_of(chip, struct mvebu_pwm, chip);
+ return pwmchip_get_drvdata(chip);
}
static int mvebu_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
@@ -789,6 +788,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
{
struct device *dev = &pdev->dev;
struct mvebu_pwm *mvpwm;
+ struct pwm_chip *chip;
void __iomem *base;
u32 offset;
u32 set;
@@ -813,9 +813,11 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
if (IS_ERR(mvchip->clk))
return PTR_ERR(mvchip->clk);
- mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL);
- if (!mvpwm)
- return -ENOMEM;
+ chip = devm_pwmchip_alloc(dev, mvchip->chip.ngpio, sizeof(*mvpwm));
+ if (IS_ERR(chip))
+ return PTR_ERR(chip);
+ mvpwm = to_mvebu_pwm(chip);
+
mvchip->mvpwm = mvpwm;
mvpwm->mvchip = mvchip;
mvpwm->offset = offset;
@@ -868,13 +870,11 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
return -EINVAL;
}
- mvpwm->chip.dev = dev;
- mvpwm->chip.ops = &mvebu_pwm_ops;
- mvpwm->chip.npwm = mvchip->chip.ngpio;
+ chip->ops = &mvebu_pwm_ops;
spin_lock_init(&mvpwm->lock);
- return devm_pwmchip_add(dev, &mvpwm->chip);
+ return devm_pwmchip_add(dev, chip);
}
#ifdef CONFIG_DEBUG_FS
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
` (2 preceding siblings ...)
2024-02-14 9:33 ` [PATCH v6 151/164] gpio: mvebu: " Uwe Kleine-König
@ 2024-02-15 11:46 ` Uwe Kleine-König
2024-03-25 1:54 ` patchwork-bot+chrome-platform
2024-03-25 2:13 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2024-02-15 11:46 UTC (permalink / raw)
To: linux-pwm, Jonathan Corbet, Jonathan Cameron, James Clark,
Andy Shevchenko, Mark Brown, Hector Martin, Sven Peter,
Claudiu Beznea, Nicolas Ferre, Alexandre Belloni,
Florian Fainelli, Ray Jui, Scott Branden, Alexander Shiyan,
Benson Leung, Philipp Zabel, Shawn Guo, Sascha Hauer,
Paul Cercueil, Vladimir Zapolskiy, Mika Westerberg,
Andy Shevchenko, Linus Walleij, Hans de Goede, Ilpo Järvinen,
Matthias Brugger, AngeloGioacchino Del Regno, Neil Armstrong,
Kevin Hilman, Conor Dooley, Daire McNamara,
Jonathan Neuschäfer, Heiko Stuebner, Krzysztof Kozlowski,
Palmer Dabbelt, Paul Walmsley, Michael Walle, Orson Zhai,
Baolin Wang, Chunyan Zhang, Fabrice Gasnier, Maxime Coquelin,
Alexandre Torgue, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Hammer Hsieh, Thierry Reding, Jonathan Hunter, Nobuhiro Iwamatsu,
Sean Anderson, Michal Simek, Bartosz Golaszewski, Andrzej Hajda,
Robert Foss, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, Pavel Machek, Lee Jones,
Anjelique Melendez, Bjorn Andersson, Kees Cook, Rob Herring,
Johan Hovold, Alex Elder, Greg Kroah-Hartman
Cc: Douglas Anderson, linux-doc, dri-devel, platform-driver-x86,
Laurent Pinchart, Alim Akhtar, Guenter Roeck, linux-riscv,
Fabio Estevam, linux-stm32, Alyssa Rosenzweig, Jerome Brunet,
chrome-platform, linux-samsung-soc, linux-staging, linux-rockchip,
Broadcom internal kernel review list, NXP Linux Team, linux-leds,
linux-sunxi, Jonas Karlman, Martin Blumenstingl, linux-gpio,
linux-mediatek, linux-rpi-kernel, linux-tegra, linux-amlogic,
linux-arm-kernel, greybus-dev, Gustavo A. R. Silva, linux-mips,
asahi, kernel, linux-hardening
[-- Attachment #1: Type: text/plain, Size: 2539 bytes --]
Hello,
On Wed, Feb 14, 2024 at 10:30:47AM +0100, Uwe Kleine-König wrote:
> this is v6 of the series introducing better lifetime tracking for
> pwmchips that addresses (for now theoretic) lifetime issues of pwm
> chips. Addressing these is a necessary precondition to introduce chardev
> support for PWMs.
>
> Locking got more complicated due to non-sleeping chips, so I dropped
> the character device patch because it got still more incomplete now.
> Also I'm not yet entirely sure about patches #162 and #163 and I expect
> them to change before they can go in. My plan for the next merge window
> is to get the patches in up to #160. After that the addition of chardev
> support (including correct locking) can continue without having to touch
> the lowlevel driver. So the idea of this series is to get the driver
> adaptions out of the way as this requires some cross-tree coordination.
>
> The patches that touch files outside of drivers/pwm include:
>
> - gpio: mvebu: Make use of devm_pwmchip_alloc() function
> It already has an Ack by Linus Walleij.
>
> - drm/bridge: ti-sn65dsi86: Make use of pwmchip_parent() accessor
> - drm/bridge: ti-sn65dsi86: Make use of devm_pwmchip_alloc() function
> The 2nd already has an Ack by Douglas Anderson which I tend to assume
> good enough to merge this via my pwm tree, too. An Ack for the first
> patch would be nice.
>
> - leds: qcom-lpg: Make use of devm_pwmchip_alloc() function
> Already has an Ack by Lee Jones.
>
> - staging: greybus: pwm: Change prototype of helpers to prepare further changes
> - staging: greybus: pwm: Make use of pwmchip_parent() accessor
> - staging: greybus: pwm: Rely on pwm framework to pass a valid hwpwm
> - staging: greybus: pwm: Drop unused gb_connection_set_data()
> - staging: greybus: pwm: Rework how the number of PWM lines is determined
> - staging: greybus: pwm: Make use of devm_pwmchip_alloc() function
> The greybus patches already got an Ack by Greg Kroah-Hartman in an
> earlier series, but I dropped it as the patches changed considerably.
After getting the needed acks, I pushed out this series in
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
up to patch #161.
(But don't let you stop looking at the changes, reviews are still
welcome.)
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 --]
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
` (3 preceding siblings ...)
2024-02-15 11:46 ` [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
@ 2024-03-25 1:54 ` patchwork-bot+chrome-platform
2024-03-25 2:13 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 15+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-03-25 1:54 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: linux-pwm, corbet, Jonathan.Cameron, james.clark,
andriy.shevchenko, broonie, marcan, sven, claudiu.beznea,
nicolas.ferre, alexandre.belloni, florian.fainelli, rjui,
sbranden, shc_work, bleung, p.zabel, shawnguo, s.hauer, paul, vz,
mika.westerberg, andy, linus.walleij, hdegoede, ilpo.jarvinen,
matthias.bgg, angelogioacchino.delregno, neil.armstrong, khilman,
conor.dooley, daire.mcnamara, j.neuschaefer, heiko,
krzysztof.kozlowski, palmer, paul.walmsley, mwalle, orsonzhai,
baolin.wang, zhang.lyra, fabrice.gasnier, mcoquelin.stm32,
alexandre.torgue, wens, jernej.skrabec, samuel, hammerh0314,
thierry.reding, jonathanh, nobuhiro1.iwamatsu, sean.anderson,
michal.simek, brgl, andrzej.hajda, rfoss, maarten.lankhorst,
mripard, tzimmermann, airlied, daniel, pavel, lee, quic_amelende,
quic_bjorande, keescook, robh, johan, elder, gregkh, kernel,
linux-doc, alyssa, asahi, linux-arm-kernel,
bcm-kernel-feedback-list, linux-rpi-kernel, groeck,
chrome-platform, festevam, linux-imx, linux-mips, linux-gpio,
platform-driver-x86, linux-mediatek, jbrunet, martin.blumenstingl,
linux-amlogic, linux-riscv, linux-rockchip, alim.akhtar,
linux-samsung-soc, linux-stm32, linux-sunxi, linux-tegra,
dianders, Laurent.pinchart, jonas, dri-devel, linux-leds,
greybus-dev, linux-staging, gustavoars, linux-hardening
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci)
by Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
On Wed, 14 Feb 2024 10:30:47 +0100 you wrote:
> Hello,
>
> this is v6 of the series introducing better lifetime tracking for
> pwmchips that addresses (for now theoretic) lifetime issues of pwm
> chips. Addressing these is a necessary precondition to introduce chardev
> support for PWMs.
>
> [...]
Here is the summary with links:
- [v6,001/164] pwm: Provide an inline function to get the parent device of a given chip
https://git.kernel.org/chrome-platform/c/4e59267c7a20
- [v6,003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
https://git.kernel.org/chrome-platform/c/024913dbf99f
- [v6,029/164] pwm: cros-ec: Change prototype of helpers to prepare further changes
https://git.kernel.org/chrome-platform/c/7256c2e79b8e
- [v6,030/164] pwm: cros-ec: Make use of pwmchip_parent() accessor
https://git.kernel.org/chrome-platform/c/19a568a8d3c4
- [v6,031/164] pwm: cros-ec: Make use of devm_pwmchip_alloc() function
https://git.kernel.org/chrome-platform/c/452be9421eda
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips
2024-02-14 9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
` (4 preceding siblings ...)
2024-03-25 1:54 ` patchwork-bot+chrome-platform
@ 2024-03-25 2:13 ` patchwork-bot+chrome-platform
5 siblings, 0 replies; 15+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-03-25 2:13 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: linux-pwm, corbet, Jonathan.Cameron, james.clark,
andriy.shevchenko, broonie, marcan, sven, claudiu.beznea,
nicolas.ferre, alexandre.belloni, florian.fainelli, rjui,
sbranden, shc_work, bleung, p.zabel, shawnguo, s.hauer, paul, vz,
mika.westerberg, andy, linus.walleij, hdegoede, ilpo.jarvinen,
matthias.bgg, angelogioacchino.delregno, neil.armstrong, khilman,
conor.dooley, daire.mcnamara, j.neuschaefer, heiko,
krzysztof.kozlowski, palmer, paul.walmsley, mwalle, orsonzhai,
baolin.wang, zhang.lyra, fabrice.gasnier, mcoquelin.stm32,
alexandre.torgue, wens, jernej.skrabec, samuel, hammerh0314,
thierry.reding, jonathanh, nobuhiro1.iwamatsu, sean.anderson,
michal.simek, brgl, andrzej.hajda, rfoss, maarten.lankhorst,
mripard, tzimmermann, airlied, daniel, pavel, lee, quic_amelende,
quic_bjorande, keescook, robh, johan, elder, gregkh, kernel,
linux-doc, alyssa, asahi, linux-arm-kernel,
bcm-kernel-feedback-list, linux-rpi-kernel, groeck,
chrome-platform, festevam, linux-imx, linux-mips, linux-gpio,
platform-driver-x86, linux-mediatek, jbrunet, martin.blumenstingl,
linux-amlogic, linux-riscv, linux-rockchip, alim.akhtar,
linux-samsung-soc, linux-stm32, linux-sunxi, linux-tegra,
dianders, Laurent.pinchart, jonas, dri-devel, linux-leds,
greybus-dev, linux-staging, gustavoars, linux-hardening
Hello:
This series was applied to chrome-platform/linux.git (for-next)
by Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
On Wed, 14 Feb 2024 10:30:47 +0100 you wrote:
> Hello,
>
> this is v6 of the series introducing better lifetime tracking for
> pwmchips that addresses (for now theoretic) lifetime issues of pwm
> chips. Addressing these is a necessary precondition to introduce chardev
> support for PWMs.
>
> [...]
Here is the summary with links:
- [v6,001/164] pwm: Provide an inline function to get the parent device of a given chip
https://git.kernel.org/chrome-platform/c/4e59267c7a20
- [v6,003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it
https://git.kernel.org/chrome-platform/c/024913dbf99f
- [v6,029/164] pwm: cros-ec: Change prototype of helpers to prepare further changes
https://git.kernel.org/chrome-platform/c/7256c2e79b8e
- [v6,030/164] pwm: cros-ec: Make use of pwmchip_parent() accessor
https://git.kernel.org/chrome-platform/c/19a568a8d3c4
- [v6,031/164] pwm: cros-ec: Make use of devm_pwmchip_alloc() function
https://git.kernel.org/chrome-platform/c/452be9421eda
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 15+ messages in thread