Example #1
0
static ssize_t led_brightness_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	ssize_t ret = -EINVAL;
	char *after;
	unsigned long state = simple_strtoul(buf, &after, 10);
	size_t count = after - buf;

    mutex_lock(&thermal_bl_mutex);
    g_brightness = state;

	 led_debug(DEBUG_VERBOSE,"[BL] (%s): user set value = %d \n", __func__,(int)state);

    state = cal_bl_fading_val(state);

	if (isspace(*after))
		count++;

	if (count == size) {
		ret = count;

		if (state == LED_OFF)
			led_trigger_remove(led_cdev);
		if (backlight_mode_state == pad)
			{
				asus_set_bl_brightness(state);
			}
		else if((state >=2000 && state <=2255) ||(state == 1255))
			{
				asus_set_bl_brightness(state);
			}
		else
			{
				led_set_brightness(led_cdev, state);
			}
	}

    mutex_unlock(&thermal_bl_mutex);
	return ret;
}
Example #2
0
static ssize_t led_brightness_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	ssize_t ret = -EINVAL;
	char *after;
	unsigned long state = simple_strtoul(buf, &after, 10);
	size_t count = after - buf;

	//ASUS_BSP +++ Maggie Lee "Backlight Porting"
	led_debug(NO_DEBUG, "[BL] %s +++: led_cdev = %s value = %d\n", __func__, led_cdev->name, (int)state);
	#ifdef CONFIG_ASUS_BACKLIGHT
	g_brightness = state;
	#endif
	//ASUS_BSP --- Maggie Lee "Backlight Porting"

	if (isspace(*after))
		count++;

	if (count == size) {
		ret = count;

		if (state == LED_OFF)
			led_trigger_remove(led_cdev);
		//ASUS_BSP +++ Maggie Lee "Backlight Porting"
		#ifdef CONFIG_ASUS_BACKLIGHT
		if (!strcmp(led_cdev->name, "lcd-backlight")) {
			led_cdev->brightness = state;
			asus_set_bl_brightness(state);
		}
		else
			led_set_brightness(led_cdev, state);
		#else
		led_set_brightness(led_cdev, state);
		#endif
		//ASUS_BSP --- Maggie Lee "Backlight Porting"
	}

	return ret;
}