mbox series

[v5,0/4] Improve pwm-ir-tx precision

Message ID cover.1700323916.git.sean@mess.org
Headers show
Series Improve pwm-ir-tx precision | expand

Message

Sean Young Nov. 18, 2023, 4:16 p.m. UTC
The pwm-ir-tx driver has to turn the pwm signal on and off, and suffers
from delays as this is done in process context. Make this work in atomic
context.

changes:

v5:
 - Use dev_err_probe() as Uwe suggested
 - rebase

v4:
 - Split out the pwm_apply_state() rename into seperate commit
 - Atomic pwm function is called pwm_apply_atomic() and sleeping
   counterpart pwm_apply_cansleep()
 - Fix commit messages

v3:
 - Renamed pwm_apply_state() to pwm_apply_cansleep()
 - Moved pwm atomic to struct pwm_chip
 - Fixed pwm docs
 - Other minor code review comments

v2:
 - Simplified the pwm ir tx based on Ivaylo Dimitrov suggestions
 - Renamed pwm_can_sleep() to pwm_is_atomic
 - Fix sleeping issue in pwm-bcm2835 (clk_get_rate() can sleep)
 - use non_block_start() in pwm to check atomic-ness


Sean Young (4):
  pwm: rename pwm_apply_state() to pwm_apply_cansleep()
  pwm: make it possible to apply pwm changes in atomic context
  pwm: bcm2835: allow pwm driver to be used in atomic context
  media: pwm-ir-tx: trigger edges from hrtimer interrupt context

 Documentation/driver-api/pwm.rst              | 17 +++-
 .../gpu/drm/i915/display/intel_backlight.c    |  6 +-
 drivers/gpu/drm/solomon/ssd130x.c             |  2 +-
 drivers/hwmon/pwm-fan.c                       |  8 +-
 drivers/input/misc/da7280.c                   |  4 +-
 drivers/input/misc/pwm-beeper.c               |  4 +-
 drivers/input/misc/pwm-vibra.c                |  8 +-
 drivers/leds/leds-pwm.c                       |  2 +-
 drivers/leds/rgb/leds-pwm-multicolor.c        |  4 +-
 drivers/media/rc/pwm-ir-tx.c                  | 83 +++++++++++++++++--
 drivers/platform/x86/lenovo-yogabook.c        |  2 +-
 drivers/pwm/core.c                            | 75 +++++++++++++----
 drivers/pwm/pwm-bcm2835.c                     | 31 ++++---
 drivers/pwm/pwm-renesas-tpu.c                 |  1 -
 drivers/pwm/pwm-twl-led.c                     |  2 +-
 drivers/pwm/pwm-vt8500.c                      |  2 +-
 drivers/pwm/sysfs.c                           | 10 +--
 drivers/regulator/pwm-regulator.c             |  4 +-
 drivers/video/backlight/lm3630a_bl.c          |  2 +-
 drivers/video/backlight/lp855x_bl.c           |  2 +-
 drivers/video/backlight/pwm_bl.c              | 12 +--
 drivers/video/fbdev/ssd1307fb.c               |  2 +-
 include/linux/pwm.h                           | 57 +++++++++----
 23 files changed, 248 insertions(+), 92 deletions(-)

Comments

Sean Young Nov. 22, 2023, 8:51 a.m. UTC | #1
On Sat, Nov 18, 2023 at 04:16:16PM +0000, Sean Young wrote:
> The pwm-ir-tx driver has to turn the pwm signal on and off, and suffers
> from delays as this is done in process context. Make this work in atomic
> context.

Hi Uwe,

Do you have any comments on this series?

I hope you don't dislike the pwm_apply_atomic()/pwm_apply_cansleep(), I am
not wedded to this name, it's just me reading the room and thinking that
would be the most acceptable to everyone - I may have misread this.

Thank you for any feedback

Sean

> 
> changes:
> 
> v5:
>  - Use dev_err_probe() as Uwe suggested
>  - rebase
> 
> v4:
>  - Split out the pwm_apply_state() rename into seperate commit
>  - Atomic pwm function is called pwm_apply_atomic() and sleeping
>    counterpart pwm_apply_cansleep()
>  - Fix commit messages
> 
> v3:
>  - Renamed pwm_apply_state() to pwm_apply_cansleep()
>  - Moved pwm atomic to struct pwm_chip
>  - Fixed pwm docs
>  - Other minor code review comments
> 
> v2:
>  - Simplified the pwm ir tx based on Ivaylo Dimitrov suggestions
>  - Renamed pwm_can_sleep() to pwm_is_atomic
>  - Fix sleeping issue in pwm-bcm2835 (clk_get_rate() can sleep)
>  - use non_block_start() in pwm to check atomic-ness
> 
> 
> Sean Young (4):
>   pwm: rename pwm_apply_state() to pwm_apply_cansleep()
>   pwm: make it possible to apply pwm changes in atomic context
>   pwm: bcm2835: allow pwm driver to be used in atomic context
>   media: pwm-ir-tx: trigger edges from hrtimer interrupt context
> 
>  Documentation/driver-api/pwm.rst              | 17 +++-
>  .../gpu/drm/i915/display/intel_backlight.c    |  6 +-
>  drivers/gpu/drm/solomon/ssd130x.c             |  2 +-
>  drivers/hwmon/pwm-fan.c                       |  8 +-
>  drivers/input/misc/da7280.c                   |  4 +-
>  drivers/input/misc/pwm-beeper.c               |  4 +-
>  drivers/input/misc/pwm-vibra.c                |  8 +-
>  drivers/leds/leds-pwm.c                       |  2 +-
>  drivers/leds/rgb/leds-pwm-multicolor.c        |  4 +-
>  drivers/media/rc/pwm-ir-tx.c                  | 83 +++++++++++++++++--
>  drivers/platform/x86/lenovo-yogabook.c        |  2 +-
>  drivers/pwm/core.c                            | 75 +++++++++++++----
>  drivers/pwm/pwm-bcm2835.c                     | 31 ++++---
>  drivers/pwm/pwm-renesas-tpu.c                 |  1 -
>  drivers/pwm/pwm-twl-led.c                     |  2 +-
>  drivers/pwm/pwm-vt8500.c                      |  2 +-
>  drivers/pwm/sysfs.c                           | 10 +--
>  drivers/regulator/pwm-regulator.c             |  4 +-
>  drivers/video/backlight/lm3630a_bl.c          |  2 +-
>  drivers/video/backlight/lp855x_bl.c           |  2 +-
>  drivers/video/backlight/pwm_bl.c              | 12 +--
>  drivers/video/fbdev/ssd1307fb.c               |  2 +-
>  include/linux/pwm.h                           | 57 +++++++++----
>  23 files changed, 248 insertions(+), 92 deletions(-)
> 
> -- 
> 2.42.1
>
Uwe Kleine-König Nov. 23, 2023, 4:58 p.m. UTC | #2
Hello,

On Wed, Nov 22, 2023 at 08:51:51AM +0000, Sean Young wrote:
> On Sat, Nov 18, 2023 at 04:16:16PM +0000, Sean Young wrote:
> > The pwm-ir-tx driver has to turn the pwm signal on and off, and suffers
> > from delays as this is done in process context. Make this work in atomic
> > context.
> 
> Hi Uwe,
> 
> Do you have any comments on this series?
> 
> I hope you don't dislike the pwm_apply_atomic()/pwm_apply_cansleep(), I am
> not wedded to this name, it's just me reading the room and thinking that
> would be the most acceptable to everyone - I may have misread this.
> 
> Thank you for any feedback

I didn't find much time to look into it. Skimming over it, I like it.
I'll take a deeper look soon.

Best regards
Uwe
Sean Young Nov. 24, 2023, 8:37 a.m. UTC | #3
Hello,

On Thu, Nov 23, 2023 at 05:58:42PM +0100, Uwe Kleine-König wrote:
> On Wed, Nov 22, 2023 at 08:51:51AM +0000, Sean Young wrote:
> > On Sat, Nov 18, 2023 at 04:16:16PM +0000, Sean Young wrote:
> > > The pwm-ir-tx driver has to turn the pwm signal on and off, and suffers
> > > from delays as this is done in process context. Make this work in atomic
> > > context.
> > 
> > Hi Uwe,
> > 
> > Do you have any comments on this series?
> > 
> > I hope you don't dislike the pwm_apply_atomic()/pwm_apply_cansleep(), I am
> > not wedded to this name, it's just me reading the room and thinking that
> > would be the most acceptable to everyone - I may have misread this.
> > 
> > Thank you for any feedback
> 
> I didn't find much time to look into it. Skimming over it, I like it.
> I'll take a deeper look soon.

Great, thanks! No rush just wanted to make sure it wasn't forgotten.


Sean