Skip to contentSkip to conversation

u8500: led and backlight driver

PATCH Superseded Arun Murthy 2 participants 5 messages Aug 26, 2010

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover u8500: led and backlight driver

Arun Murthy (3):
mfd: ab8500-pwm: ab8500 pwm management
backlight: u8500: backlight driver based on ab8500 pwm
leds: ab8500-led: led driver based on ab8500 pwm

 drivers/leds/Kconfig                  |    9 ++
 drivers/leds/Makefile                 |    1 +
 drivers/leds/leds-ab8500.c            |  201 +++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig                   |    8 ++
 drivers/mfd/Makefile                  |    1 +
 drivers/mfd/ab8500-core.c             |    7 +-
 drivers/mfd/ab8500-pwm.c              |  191 ++++++++++++++++++++++++++++++
 drivers/video/backlight/Kconfig       |   10 ++
 drivers/video/backlight/Makefile      |    2 +-
 drivers/video/backlight/ab8500_bl.c   |  209 +++++++++++++++++++++++++++++++++
 include/linux/mfd/ab8500.h            |    5 +
 include/linux/mfd/abx500/ab8500-pwm.h |   32 +++++
 12 files changed, 674 insertions(+), 2 deletions(-)
 create mode 100644 drivers/leds/leds-ab8500.c
 create mode 100644 drivers/mfd/ab8500-pwm.c
 create mode 100644 drivers/video/backlight/ab8500_bl.c
 create mode 100644 include/linux/mfd/abx500/ab8500-pwm.h
#1 lore raw

PATCH 1/3 mfd: ab8500-pwm: ab8500 pwm management

This patch exports functions to set and get ab8500 pwm intensity, which in turn is used by backlight/led driver.

---
 drivers/mfd/Kconfig                   |    8 ++
 drivers/mfd/Makefile                  |    1 +
 drivers/mfd/ab8500-pwm.c              |  191 +++++++++++++++++++++++++++++++++
 include/linux/mfd/abx500/ab8500-pwm.h |   32 ++++++
 4 files changed, 232 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/ab8500-pwm.c
 create mode 100644 include/linux/mfd/abx500/ab8500-pwm.h
drivers/mfd/Kconfig +8 -0
index 82d013f..6e73227 100644
@@ -515,6 +515,14 @@ config AB3550_CORE
 	  LEDs, vibrator, system power and temperature, power management
 	  and ALSA sound.
 
+config AB8500_PWM
+	bool
+	depends on AB8500_CORE
+	help
+	  This driver exports function to set and get AB8500 Pulse
+	  Width Modulation pwm intensity in Analog Baseband chip AB8500.
+	  It is used to control the led and lcd backlight intensity.
+
 config MFD_TIMBERDALE
 	tristate "Support for the Timberdale FPGA"
 	select MFD_CORE
drivers/mfd/Makefile +1 -0
index 9aa8a2d..949c5bb 100644
@@ -71,6 +71,7 @@ obj-$(CONFIG_AB3550_CORE)	+= ab3550-core.o
 obj-$(CONFIG_AB8500_CORE)	+= ab8500-core.o ab8500-spi.o
 obj-$(CONFIG_AB8500_I2C_CORE)	+= ab8500-i2c.o
 obj-$(CONFIG_AB8500_DEBUG)	+= ab8500-debugfs.o
+obj-$(CONFIG_AB8500_PWM)	+= ab8500-pwm.o
 obj-$(CONFIG_MFD_TIMBERDALE)    += timberdale.o
 obj-$(CONFIG_PMIC_ADP5520)	+= adp5520.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
drivers/mfd/ab8500-pwm.c new file +191 -0

191 lines not on this page · raw message

include/linux/mfd/abx500/ab8500-pwm.h new file +32 -0
new file mode 100644
index 0000000..f891c70
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010
+ *
+ * Author: Dushyanth S R <[email protected]>
+ * Author: Arun Murthy <[email protected]>
+ * License Terms: GNU General Public License v2
+ */
+#ifndef MFD_AB8500_PWM_H
+#define MFD_AB8500_PWM_H
+
+#define PWM1		1
+#define PWM2		2
+#define PWM3		3
+#define TOTAL_NO_PWM	3
+#define MAX_PWM_CTRL	2
+
+struct ab8500_pwm_pdata {
+	int pwm_no[MAX_PWM_CTRL];
+	int max_intensity;
+	char *name;
+};
+
+int ab8500_pwm_set_int(struct device *dev,
+		unsigned int max_brightness,
+		unsigned int intensity,
+		int pwm);
+
+int ab8500_pwm_get_int(struct device *dev,
+		int max_brightness,
+		int pwm);
+
+#endif /* MFD_AB8500_PWM_H */
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/3 backlight: u8500: backlight driver based on ab8500 pwm

In reply to Arun Murthy

This patch adds backlight driver for u8500 platform. Backlight intensity is controlled by Analog Baseband Chip AB8500 Pulse Width Modulation(pwm).

---
 drivers/mfd/ab8500-core.c           |    4 +-
 drivers/video/backlight/Kconfig     |   10 ++
 drivers/video/backlight/Makefile    |    2 +-
 drivers/video/backlight/ab8500_bl.c |  209 +++++++++++++++++++++++++++++++++++
 include/linux/mfd/ab8500.h          |    4 +
 5 files changed, 227 insertions(+), 2 deletions(-)
 create mode 100644 drivers/video/backlight/ab8500_bl.c
drivers/mfd/ab8500-core.c +3 -1
index 6548f50..b193d45 100644
@@ -394,10 +394,12 @@ static struct mfd_cell ab8500_devs[] = {
 		.num_resources = ARRAY_SIZE(ab8500_rtc_resources),
 		.resources = ab8500_rtc_resources,
 	},
+	{
+		.name = "ab8500-pwm-bl",
+	},
 	{ .name = "ab8500-charger", },
 	{ .name = "ab8500-audio", },
 	{ .name = "ab8500-usb", },
-	{ .name = "ab8500-pwm", },
 	{ .name = "ab8500-regulator", },
 };
 
drivers/video/backlight/Kconfig +10 -0
index e54a337..61bf6c9 100644
@@ -126,6 +126,16 @@ config BACKLIGHT_CLASS_DEVICE
 
 if BACKLIGHT_CLASS_DEVICE
 
+config BACKLIGHT_AB8500_LCD
+	bool "ab8500 lcd backlight control"
+	depends on BACKLIGHT_CLASS_DEVICE && AB8500_CORE
+	select AB8500_PWM
+	help
+	  This provides backlight control to U8500 platform primary
+	  and secondary lcd.
+	  If in doubt, it's safe to enable this option; it doesn't kick
+	  in unless the board's description says it's wired that way.
+
 config BACKLIGHT_ATMEL_LCDC
 	bool "Atmel LCDC Contrast-as-Backlight control"
 	depends on FB_ATMEL
drivers/video/backlight/Makefile +1 -1
index 44c0f81..a796418 100644
@@ -35,4 +35,4 @@ obj-$(CONFIG_BACKLIGHT_ADP5520)	+= adp5520_bl.o
 obj-$(CONFIG_BACKLIGHT_ADP8860)	+= adp8860_bl.o
 obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)	+= pcf50633-backlight.o
-
+obj-$(CONFIG_BACKLIGHT_AB8500_LCD)	+= ab8500_bl.o
drivers/video/backlight/ab8500_bl.c new file +209 -0

209 lines not on this page · raw message

include/linux/mfd/ab8500.h +4 -0
index d63b605..cb8328b 100644
@@ -136,6 +136,9 @@ struct ab8500 {
 
 struct regulator_init_data;
 
+/* forward declaration */
+struct ab8500_pwm_data;
+
 /**
  * struct ab8500_platform_data - AB8500 platform data
  * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
@@ -146,6 +149,7 @@ struct ab8500_platform_data {
 	int irq_base;
 	void (*init) (struct ab8500 *);
 	struct regulator_init_data *regulator[AB8500_NUM_REGULATORS];
+	struct ab8500_pwm_pdata *pwm;
 };
 
 extern int __devinit ab8500_init(struct ab8500 *ab8500);
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 3/3 leds: ab8500-led: led driver based on ab8500 pwm

In reply to Arun Murthy

This patch adds led class driver for controlling u8500 leds and backlight. LED intensity is controlled by by Ananlog Baseband Chip AB8500 Pulse Width Modulation(pwm).

---
 drivers/leds/Kconfig       |    9 ++
 drivers/leds/Makefile      |    1 +
 drivers/leds/leds-ab8500.c |  201 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/ab8500-core.c  |    3 +
 include/linux/mfd/ab8500.h |    1 +
 5 files changed, 215 insertions(+), 0 deletions(-)
 create mode 100644 drivers/leds/leds-ab8500.c
drivers/leds/Kconfig +9 -0
index e411262..8e554af 100644
@@ -26,6 +26,15 @@ config LEDS_88PM860X
 	  This option enables support for on-chip LED drivers found on Marvell
 	  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AB8500
+	bool "ab8500-pwm: led driver"
+	depends on LEDS_CLASS && AB8500_CORE
+	select AB8500_PWM
+	help
+	  This option enables led class driver support for ab8500 pwm devices.
+	  If in doubt, it's safe to enable this option; it doesn't kick
+	  in unless the board's description says it's wired that way.
+
 config LEDS_ATMEL_PWM
 	tristate "LED Support using Atmel PWM outputs"
 	depends on ATMEL_PWM
drivers/leds/Makefile +1 -0
index 7d6b958..7ba6448 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_LEDS_ADP5520)		+= leds-adp5520.o
 obj-$(CONFIG_LEDS_DELL_NETBOOKS)	+= dell-led.o
 obj-$(CONFIG_LEDS_MC13783)		+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2)			+= leds-ns2.o
+obj-$(CONFIG_LEDS_AB8500)		+= leds-ab8500.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_DAC124S085)		+= leds-dac124s085.o
drivers/leds/leds-ab8500.c new file +201 -0

201 lines not on this page · raw message

drivers/mfd/ab8500-core.c +3 -0
index b193d45..84a84a8 100644
@@ -397,6 +397,9 @@ static struct mfd_cell ab8500_devs[] = {
 	{
 		.name = "ab8500-pwm-bl",
 	},
+	{
+		.name = "ab8500-pwm-led",
+	},
 	{ .name = "ab8500-charger", },
 	{ .name = "ab8500-audio", },
 	{ .name = "ab8500-usb", },
include/linux/mfd/ab8500.h +1 -0
index cb8328b..b420dbb 100644
@@ -150,6 +150,7 @@ struct ab8500_platform_data {
 	void (*init) (struct ab8500 *);
 	struct regulator_init_data *regulator[AB8500_NUM_REGULATORS];
 	struct ab8500_pwm_pdata *pwm;
+	struct ab8500_pwm_pdata *led;
 };
 
 extern int __devinit ab8500_init(struct ab8500 *ab8500);
Signature · 1 line
1.6.3.3
#4 lore raw
In reply to Arun Murthy
Quoted 4 lines · Arun Murthy

Arun Murthy (3):
mfd: ab8500-pwm: ab8500 pwm management
backlight: u8500: backlight driver based on ab8500 pwm
leds: ab8500-led: led driver based on ab8500 pwm

There are drivers/leds/leds-pwm.c and drivers/video/backlight/pwm_bl.c that implement led and backlight drivers based on generic pwm interface. Have you considered using those?

Quoted 23 lines
 drivers/leds/Kconfig                  |    9 ++
 drivers/leds/Makefile                 |    1 +
 drivers/leds/leds-ab8500.c            |  201 +++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig                   |    8 ++
 drivers/mfd/Makefile                  |    1 +
 drivers/mfd/ab8500-core.c             |    7 +-
 drivers/mfd/ab8500-pwm.c              |  191 ++++++++++++++++++++++++++++++
 drivers/video/backlight/Kconfig       |   10 ++
 drivers/video/backlight/Makefile      |    2 +-
 drivers/video/backlight/ab8500_bl.c   |  209 +++++++++++++++++++++++++++++++++
 include/linux/mfd/ab8500.h            |    5 +
 include/linux/mfd/abx500/ab8500-pwm.h |   32 +++++
 12 files changed, 674 insertions(+), 2 deletions(-)
 create mode 100644 drivers/leds/leds-ab8500.c
 create mode 100644 drivers/mfd/ab8500-pwm.c
 create mode 100644 drivers/video/backlight/ab8500_bl.c
 create mode 100644 include/linux/mfd/abx500/ab8500-pwm.h

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Sincerely yours,
Mike.