Re: [PATCH v8 3/8] Loongson: YeeLoong: add backlight driver

Wu Zhangjin <[email protected]>
Newsgroups gmane.linux.laptop,gmane.linux.ports.mips.general,gmane.linux.kernel
Organization DSLab, Lanzhou University, China
Message-ID <[email protected]>
On Sun, 2009-12-06 at 15:01 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <[email protected]>
> 
> This patch adds YeeLoong Backlight Driver, it provides standard
> interface(/sys/class/backlight/) for user-space applications(e.g.
> kpowersave, gnome-power-manager) to control the brightness of the
> backlight.
[...]
> +static int yeeloong_set_brightness(struct backlight_device *bd)
> +{
> +	unsigned int level, current_level;
> +	static unsigned int old_level;
> +
> +	level = (bd->props.fb_blank == FB_BLANK_UNBLANK &&
> +		 bd->props.power == FB_BLANK_UNBLANK) ?
> +	    bd->props.brightness : 0;
> +
> +	if (level > MAX_BRIGHTNESS)
> +		level = MAX_BRIGHTNESS;
> +	else if (level < 0)
> +		level = 0;
> +
> +	/* Avoid to modify the brightness when EC is tuning it */
> +	if (old_level != level) {
> +		current_level = ec_read(REG_DISPLAY_BRIGHTNESS);
> +		if (old_level == current_level)
> +			ec_write(REG_DISPLAY_BRIGHTNESS, level);
> +	}
> +	old_level = level;

Will move the above line into the end of "if { ... }".

Regards,
	Wu Zhangjin

--
To unsubscribe from this list: send the line "unsubscribe linux-laptop" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.