Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1706140 > unrolled thread

Re: [PATCH v3 3/5] pwm-backlight: add support for PWM delays proprieties.

Started byPavel Machek <pavel@ucw.cz>
First post2017-08-08 10:20 +0200
Last post2017-08-08 10:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 3/5] pwm-backlight: add support for PWM delays  proprieties. Pavel Machek <pavel@ucw.cz> - 2017-08-08 10:20 +0200

#1706140 — Re: [PATCH v3 3/5] pwm-backlight: add support for PWM delays proprieties.

FromPavel Machek <pavel@ucw.cz>
Date2017-08-08 10:20 +0200
SubjectRe: [PATCH v3 3/5] pwm-backlight: add support for PWM delays proprieties.
Message-ID<uc7U6-5eH-27@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Thu 2017-07-20 11:37:17, Daniel Thompson wrote:
> On 20/07/17 09:06, Pavel Machek wrote:
> >Hi!
> >
> >>>--- a/drivers/video/backlight/pwm_bl.c
> >>>+++ b/drivers/video/backlight/pwm_bl.c
> >>>@@ -10,6 +10,7 @@
> >>>   * published by the Free Software Foundation.
> >>>   */
> >>>+#include <linux/delay.h>
> >>>  #include <linux/gpio/consumer.h>
> >>>  #include <linux/gpio.h>
> >>>  #include <linux/module.h>
> >>>@@ -35,6 +36,7 @@ struct pwm_bl_data {
> >>>  	struct gpio_desc	*enable_gpio;
> >>>  	unsigned int		scale;
> >>>  	bool			legacy;
> >>>+	unsigned int		pwm_delay[2];
> >>
> >>Two named members would be better here (eliminating the "magic" 0
> >>and 1).
> >
> >My thought, too.
> >
> >>>@@ -56,6 +58,9 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness)
> >>>  	pwm_enable(pb->pwm);
> >>>+	if (pb->pwm_delay[0])
> >>>+		usleep_range(pb->pwm_delay[0], pb->pwm_delay[0] * 2);
> >
> >Plus I'd just do the delay unconditionally :-).
> 
> ... does this still apply if this code is switched to msleep()?

No.

> msleep() has no wait avoidance[1] and if lots of drivers are reckless about
> sleeping for 10ms it soon starts to show up in the boot time (especially
> optimized ones).
...
> [1] As it happens I can't see that many early bail out paths in
>     usleep_range() either.

Well, in usleep_range(1,2) should be fast enough operation, and
usleep_range(0,0) should be similar to usleep_range(1,2) at worst :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web