Skip to contentSkip to conversation

led: pm8xxx: Add pm8xxx leds driver

PATCH In review Anirudh Ghayal 2 participants 2 messages Jun 22, 2011 – Jun 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 led: pm8xxx: Add pm8xxx leds driver

Add support for Qualcomm PMIC8XXX keyboard
backlight, flash and low current leds.

---
Changes:
Addressed below comments from Peter.
http://www.mail-archive.com/[email protected]/msg02051.html
Use led_info and led_platform data

 drivers/leds/Kconfig        |   11 ++
 drivers/leds/Makefile       |    1 +
 drivers/leds/leds-pm8xxx.c  |  350 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/leds-pm8xxx.h |   37 +++++
 4 files changed, 399 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/leds-pm8xxx.c
 create mode 100644 include/linux/leds-pm8xxx.h
drivers/leds/Kconfig +11 -0
index 713d43b..90942dc 100644
@@ -269,6 +269,17 @@ config LEDS_PCA955X
 	  LED driver chips accessed via the I2C bus.  Supported
 	  devices include PCA9550, PCA9551, PCA9552, and PCA9553.
 
+config LEDS_PM8XXX
+	tristate "LED Support for Qualcomm PMIC8XXX"
+	depends on MFD_PM8XXX
+	help
+	  This option enables support for LEDs connected over PMIC8XXX
+	  (Power Management IC) chip on Qualcomm reference boards,
+	  for example SURF and FFAs.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called leds-pmic8xxx.
+
 config LEDS_WM831X_STATUS
 	tristate "LED support for status LEDs on WM831x PMICs"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index bbfd2e3..c102ae0 100644
@@ -22,6 +22,7 @@ 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_REGISTER)	+= leds-gpio-register.o
+obj-$(CONFIG_LEDS_PM8XXX)		+= leds-pm8xxx.o
 obj-$(CONFIG_LEDS_GPIO)			+= leds-gpio.o
 obj-$(CONFIG_LEDS_LP3944)		+= leds-lp3944.o
 obj-$(CONFIG_LEDS_LP5521)		+= leds-lp5521.o
drivers/leds/leds-pm8xxx.c new file +350 -0

350 lines not on this page · raw message

include/linux/leds-pm8xxx.h new file +37 -0
new file mode 100644
index 0000000..3a03100
@@ -0,0 +1,37 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LEDS_PM8XXX_H__
+#define __LEDS_PM8XXX_H__
+
+
+#define PM8XXX_LEDS_DEV_NAME	"pm8xxx-led"
+
+/**
+ * enum pm8xxx_leds - PMIC8XXX supported led ids
+ * @PM8XXX_ID_LED_KB_LIGHT - keyboard backlight led
+ * @PM8XXX_ID_LED_0 - First low current led
+ * @PM8XXX_ID_LED_1 - Second low current led
+ * @PM8XXX_ID_LED_2 - Third low current led
+ * @PM8XXX_ID_FLASH_LED_0 - First flash led
+ * @PM8XXX_ID_FLASH_LED_0 - Second flash led
+ */
+enum pm8xxx_leds {
+	PM8XXX_ID_LED_KB_LIGHT = 1,
+	PM8XXX_ID_LED_0,
+	PM8XXX_ID_LED_1,
+	PM8XXX_ID_LED_2,
+	PM8XXX_ID_FLASH_LED_0,
+	PM8XXX_ID_FLASH_LED_1,
+};
+
+#endif /* __LEDS_PM8XXX_H__ */
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

drivers/leds/leds-pm8xxx.c line 61

Quoted 10 lines · Anirudh Ghayal
drivers/leds/leds-pm8xxx.c new file +10 -0
+
+/**
+ * struct pm8xxx_led_data - internal led data structure
+ * @led_classdev - led class device
+ * @id - led index
+ * @led_brightness - led brightness levels
+ * @work - workqueue for led
+ * @lock - to protect the transactions
+ * @reg - cached value of led register
+ */

This isn't kerneldoc notation.

drivers/leds/leds-pm8xxx.c line 301

Quoted 8 lines
drivers/leds/leds-pm8xxx.c new file +8 -0
+fail_id_check:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			int index = pdata->leds[i].flags;
+			mutex_destroy(&led[index].lock);
+			led_classdev_unregister(&led[index].cdev);
+		}
+	}

if (i > 0) is redundant here.

include/linux/leds-pm8xxx.h line 36

Quoted 10 lines
include/linux/leds-pm8xxx.h new file +10 -0
+/**
+ * enum pm8xxx_leds - PMIC8XXX supported led ids
+ * @PM8XXX_ID_LED_KB_LIGHT - keyboard backlight led
+ * @PM8XXX_ID_LED_0 - First low current led
+ * @PM8XXX_ID_LED_1 - Second low current led
+ * @PM8XXX_ID_LED_2 - Third low current led
+ * @PM8XXX_ID_FLASH_LED_0 - First flash led
+ * @PM8XXX_ID_FLASH_LED_0 - Second flash led
+ */
+

This isn't kerneldoc notation.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.