Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea541686 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
  leds/acpi: Fix merge fallout from acpi_driver_data change
  leds: Simplify logic in leds-ams-delta
  leds: Fix trigger registration race
  leds: Fix leds-class.c comment
  leds: Add driver for HP harddisk protection LEDs
  leds: leds-pca955x - Mark pca955x_led_set() static
  leds: Remove uneeded leds-cm-x270 driver
  leds: Remove uneeded strlen calls
  leds: Add leds-wrap default-trigger
  leds: Make default trigger fields const
  leds: Add backlight LED trigger
  leds: da903x: Add support for LEDs found on DA9030/DA9034
parents 0d876c6a 601a1b92
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -113,11 +113,12 @@ config LEDS_GPIO
	  outputs. To be useful the particular board must have LEDs
	  and they must be connected to the GPIO lines.

config LEDS_CM_X270
	tristate "LED Support for the CM-X270 LEDs"
	depends on LEDS_CLASS && MACH_ARMCORE
config LEDS_HP_DISK
	tristate "LED Support for disk protection LED on HP notebooks"
	depends on LEDS_CLASS && ACPI
	help
	  This option enables support for the CM-X270 LEDs.
	  This option enable support for disk protection LED, found on
	  newer HP notebooks.

config LEDS_CLEVO_MAIL
	tristate "Mail LED on Clevo notebook (EXPERIMENTAL)"
@@ -157,6 +158,13 @@ config LEDS_PCA955X
	  LED driver chips accessed via the I2C bus.  Supported
	  devices include PCA9550, PCA9551, PCA9552, and PCA9553.

config LEDS_DA903X
	tristate "LED Support for DA9030/DA9034 PMIC"
	depends on LEDS_CLASS && PMIC_DA903X
	help
	  This option enables support for on-chip LED drivers found
	  on Dialog Semiconductor DA9030/DA9034 PMICs.

comment "LED Triggers"

config LEDS_TRIGGERS
@@ -193,6 +201,15 @@ config LEDS_TRIGGER_HEARTBEAT
	  load average.
	  If unsure, say Y.

config LEDS_TRIGGER_BACKLIGHT
	tristate "LED backlight Trigger"
	depends on LEDS_TRIGGERS
	help
	  This allows LEDs to be controlled as a backlight device: they
	  turn off and on when the display is blanked and unblanked.

	  If unsure, say N.

config LEDS_TRIGGER_DEFAULT_ON
	tristate "LED Default ON Trigger"
	depends on LEDS_TRIGGERS
+3 −1
Original line number Diff line number Diff line
@@ -17,14 +17,16 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o
obj-$(CONFIG_LEDS_SUNFIRE)		+= leds-sunfire.o
obj-$(CONFIG_LEDS_PCA9532)		+= leds-pca9532.o
obj-$(CONFIG_LEDS_GPIO)			+= leds-gpio.o
obj-$(CONFIG_LEDS_CM_X270)              += leds-cm-x270.o
obj-$(CONFIG_LEDS_CLEVO_MAIL)		+= leds-clevo-mail.o
obj-$(CONFIG_LEDS_HP6XX)		+= leds-hp6xx.o
obj-$(CONFIG_LEDS_FSG)			+= leds-fsg.o
obj-$(CONFIG_LEDS_PCA955X)		+= leds-pca955x.o
obj-$(CONFIG_LEDS_DA903X)		+= leds-da903x.o
obj-$(CONFIG_LEDS_HP_DISK)		+= leds-hp-disk.o

# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
+5 −7
Original line number Diff line number Diff line
@@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	ssize_t ret = 0;

	/* no lock needed for this */
	led_update_brightness(led_cdev);
	sprintf(buf, "%u\n", led_cdev->brightness);
	ret = strlen(buf) + 1;

	return ret;
	return sprintf(buf, "%u\n", led_cdev->brightness);
}

static ssize_t led_brightness_store(struct device *dev,
@@ -113,6 +110,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
	if (rc)
		goto err_out;

#ifdef CONFIG_LEDS_TRIGGERS
	init_rwsem(&led_cdev->trigger_lock);
#endif
	/* add to the list of leds */
	down_write(&leds_list_lock);
	list_add_tail(&led_cdev->node, &leds_list);
@@ -121,8 +121,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
	led_update_brightness(led_cdev);

#ifdef CONFIG_LEDS_TRIGGERS
	init_rwsem(&led_cdev->trigger_lock);

	rc = device_create_file(led_cdev->dev, &dev_attr_trigger);
	if (rc)
		goto err_out_led_list;
@@ -147,7 +145,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
EXPORT_SYMBOL_GPL(led_classdev_register);

/**
 * __led_classdev_unregister - unregisters a object of led_properties class.
 * led_classdev_unregister - unregisters a object of led_properties class.
 * @led_cdev: the led device to unregister
 *
 * Unregisters a previously registered via led_classdev_register object.
+10 −10
Original line number Diff line number Diff line
@@ -107,19 +107,19 @@ static int ams_delta_led_resume(struct platform_device *dev)

static int ams_delta_led_probe(struct platform_device *pdev)
{
	int i;
	int ret;
	int i, ret;

	for (i = ret = 0; ret >= 0 && i < ARRAY_SIZE(ams_delta_leds); i++) {
	for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) {
		ret = led_classdev_register(&pdev->dev,
				&ams_delta_leds[i].cdev);
		if (ret < 0)
			goto fail;
	}

	if (ret < 0 && i > 1) {
		for (i = i - 2; i >= 0; i--)
	return 0;
fail:
	while (--i >= 0)
		led_classdev_unregister(&ams_delta_leds[i].cdev);
	}

	return ret;	
}

@@ -127,7 +127,7 @@ static int ams_delta_led_remove(struct platform_device *pdev)
{
	int i;

	for (i = ARRAY_SIZE(ams_delta_leds) - 1; i >= 0; i--)
	for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i--)
		led_classdev_unregister(&ams_delta_leds[i].cdev);

	return 0;

drivers/leds/leds-cm-x270.c

deleted100644 → 0
+0 −124
Original line number Diff line number Diff line
/*
 * drivers/leds/leds-cm-x270.c
 *
 * Copyright 2007 CompuLab Ltd.
 * Author: Mike Rapoport <mike@compulab.co.il>
 *
 * Based on leds-corgi.c
 * Author: Richard Purdie <rpurdie@openedhand.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/leds.h>

#include <mach/hardware.h>
#include <mach/pxa-regs.h>

#define GPIO_RED_LED			(93)
#define GPIO_GREEN_LED			(94)

static void cmx270_red_set(struct led_classdev *led_cdev,
			   enum led_brightness value)
{
	if (value)
		GPCR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED);
	else
		GPSR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED);
}

static void cmx270_green_set(struct led_classdev *led_cdev,
			     enum led_brightness value)
{
	if (value)
		GPCR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED);
	else
		GPSR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED);
}

static struct led_classdev cmx270_red_led = {
	.name			= "cm-x270:red",
	.default_trigger	= "nand-disk",
	.brightness_set		= cmx270_red_set,
};

static struct led_classdev cmx270_green_led = {
	.name			= "cm-x270:green",
	.default_trigger	= "heartbeat",
	.brightness_set		= cmx270_green_set,
};

#ifdef CONFIG_PM
static int cmx270led_suspend(struct platform_device *dev, pm_message_t state)
{
	led_classdev_suspend(&cmx270_red_led);
	led_classdev_suspend(&cmx270_green_led);
	return 0;
}

static int cmx270led_resume(struct platform_device *dev)
{
	led_classdev_resume(&cmx270_red_led);
	led_classdev_resume(&cmx270_green_led);
	return 0;
}
#endif

static int cmx270led_probe(struct platform_device *pdev)
{
	int ret;

	ret = led_classdev_register(&pdev->dev, &cmx270_red_led);
	if (ret < 0)
		return ret;

	ret = led_classdev_register(&pdev->dev, &cmx270_green_led);
	if (ret < 0)
		led_classdev_unregister(&cmx270_red_led);

	return ret;
}

static int cmx270led_remove(struct platform_device *pdev)
{
	led_classdev_unregister(&cmx270_red_led);
	led_classdev_unregister(&cmx270_green_led);
	return 0;
}

static struct platform_driver cmx270led_driver = {
	.probe		= cmx270led_probe,
	.remove		= cmx270led_remove,
#ifdef CONFIG_PM
	.suspend	= cmx270led_suspend,
	.resume		= cmx270led_resume,
#endif
	.driver		= {
		.name		= "cm-x270-led",
		.owner		= THIS_MODULE,
	},
};

static int __init cmx270led_init(void)
{
	return platform_driver_register(&cmx270led_driver);
}

static void __exit cmx270led_exit(void)
{
	platform_driver_unregister(&cmx270led_driver);
}

module_init(cmx270led_init);
module_exit(cmx270led_exit);

MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
MODULE_DESCRIPTION("CM-x270 LED driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:cm-x270-led");
Loading