예제 #1
0
void ktd2026_set_brightness(struct led_classdev *cdev,
			enum led_brightness brightness)
{
		struct ktd2026_led *led = cdev_to_led(cdev);
		led->brightness = (u8)brightness;
		schedule_work(&led->brightness_work);
}
예제 #2
0
static ssize_t led_delay_off_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct ktd2026_led *led = cdev_to_led(led_cdev);

	return sprintf(buf, "%lu\n", led->delay_off_time_ms);
}
/* Set brightness of a single LED */
static void lm2755_brightness_set(struct led_classdev *cdev,
			     enum led_brightness brightness)
{
	struct lm2755_led *led = cdev_to_led(cdev);
	struct lm2755_data *data = led_to_lm2755(led);

	pr_access("%s, value = %d\n", cdev->name, brightness);

	mutex_lock(&data->lock);
	led->level = lm2755_scale(brightness, data->max_level);
	mutex_unlock(&data->lock);
	schedule_work(&led->work);
}
예제 #4
0
static ssize_t led_delay_on_store(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t len)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct ktd2026_led *led = cdev_to_led(led_cdev);
	unsigned long time;

	if (kstrtoul(buf, 0, &time))
		return -EINVAL;

	led->delay_on_time_ms = (int)time;
	return len;
}
예제 #5
0
static ssize_t led_blink_store(struct device *dev,
			struct device_attribute *attr,
			const char *buf, size_t len)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct ktd2026_led *led = cdev_to_led(led_cdev);
	unsigned long blink_set;

	if (kstrtoul(buf, 0, &blink_set))
		return -EINVAL;

	if (!blink_set) {
		led->delay_on_time_ms = LED_OFF;
		ktd2026_set_brightness(led_cdev, LED_OFF);
	}

	led_blink_set(led_cdev,
		&led->delay_on_time_ms, &led->delay_off_time_ms);

	return len;
}
static enum led_brightness lm2755_brightness_get(struct led_classdev *cdev)
{
	struct lm2755_led *led = cdev_to_led(cdev);

	return led->level;
}