linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight
@ 2011-02-26  4:29 Banajit Goswami
  2011-02-26  4:29 ` [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung Banajit Goswami
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support PWM backlight for S5P SoCs.

1. Move PWM timer code from plat-s3c24xx to plat-samsung for common useability
2. Add PWM backlight support for SMDK6410/6440/6450/C100 and SMDKV210

Note: The modification of GPIO F for S5P64X0 patch should be merged first as
there is a dependency for PWM on S5P64X0.

[PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung
[PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410
[PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440
[PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450
[PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100
[PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-26  4:29 ` [PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410 Banajit Goswami
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch does the following:
1. It moves file pwm.c from plat-s3c24xx to plat-samsung. This will
   enable all machines with Samsung SoCs to make use of the same code.
2. The device definitions have been separated to a new file dev-pwm.c
   for better clarity and structure.
3. It will enable all Samsung S3C and S5P series SoC's to use common
   PWM Kconfig definition.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s3c64xx/Kconfig   |    4 +-
 arch/arm/plat-s3c24xx/Kconfig   |    7 -----
 arch/arm/plat-samsung/Kconfig   |   13 +++++++++
 arch/arm/plat-samsung/Makefile  |    1 +
 arch/arm/plat-samsung/dev-pwm.c |   52 +++++++++++++++++++++++++++++++++++++++
 arch/arm/plat-samsung/pwm.c     |   33 ------------------------
 6 files changed, 68 insertions(+), 42 deletions(-)
 create mode 100644 arch/arm/plat-samsung/dev-pwm.c

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 579d2f0..f3a953f 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -231,7 +231,7 @@ config MACH_HMT
 	select S3C_DEV_NAND
 	select S3C_DEV_USB_HOST
 	select S3C64XX_SETUP_FB_24BPP
-	select HAVE_PWM
+	select SAMSUNG_DEV_PWM
 	help
 	  Machine support for the Airgoo HMT
 
@@ -249,8 +249,8 @@ config MACH_SMARTQ
 	select S3C64XX_SETUP_SDHCI
 	select S3C64XX_SETUP_FB_24BPP
 	select SAMSUNG_DEV_ADC
+	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
-	select HAVE_PWM
 	help
 	    Shared machine support for SmartQ 5/7
 
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index eb105e6..d9c4096 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -56,13 +56,6 @@ config S3C24XX_DCLK
 	help
 	  Clock code for supporting DCLK/CLKOUT on S3C24XX architectures
 
-config S3C24XX_PWM
-	bool "PWM device support"
-	select HAVE_PWM
-	help
-	  Support for exporting the PWM timer blocks via the pwm device
-	  system.
-
 # gpio configurations
 
 config S3C24XX_GPIO_EXTRA
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 32be05c..184a85a 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -273,6 +273,19 @@ config SAMSUNG_DEV_KEYPAD
 	help
 	  Compile in platform device definitions for keypad
 
+config SAMSUNG_DEV_PWM
+	bool
+	default y if ARCH_S3C2410
+	help
+	  Compile in platform device definition for PWM Timer
+
+config S3C24XX_PWM
+	bool "PWM device support"
+	select HAVE_PWM
+	help
+	  Support for exporting the PWM timer blocks via the pwm device
+	  system.
+
 # DMA
 
 config S3C_DMA
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 29932f8..e9de58a 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_SAMSUNG_DEV_ADC)	+= dev-adc.o
 obj-$(CONFIG_SAMSUNG_DEV_IDE)	+= dev-ide.o
 obj-$(CONFIG_SAMSUNG_DEV_TS)	+= dev-ts.o
 obj-$(CONFIG_SAMSUNG_DEV_KEYPAD)	+= dev-keypad.o
+obj-$(CONFIG_SAMSUNG_DEV_PWM)	+= dev-pwm.o
 
 # DMA support
 
diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c
new file mode 100644
index 0000000..68c5986
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-pwm.c
@@ -0,0 +1,53 @@
+/* linux/arch/arm/plat-samsung/dev-pwm.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * Copyright (c) 2007 Ben Dooks
+ * Copyright (c) 2008 Simtec Electronics
+ *	Ben Dooks <ben@simtec.co.uk>, <ben-linux@fluff.org>
+ *
+ * S3C series device definition for the PWM timer
+ *
+ * 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/platform_device.h>
+
+#include <mach/irqs.h>
+
+#include <plat/devs.h>
+
+#define TIMER_RESOURCE_SIZE (1)
+
+#define TIMER_RESOURCE(_tmr, _irq)			\
+	(struct resource [TIMER_RESOURCE_SIZE]) {	\
+		[0] = {					\
+			.start	= _irq,			\
+			.end	= _irq,			\
+			.flags	= IORESOURCE_IRQ	\
+		}					\
+	}
+
+#define DEFINE_S3C_TIMER(_tmr_no, _irq)			\
+	.name		= "s3c24xx-pwm",		\
+	.id		= _tmr_no,			\
+	.num_resources	= TIMER_RESOURCE_SIZE,		\
+	.resource	= TIMER_RESOURCE(_tmr_no, _irq),	\
+
+/*
+ * since we already have an static mapping for the timer,
+ * we do not bother setting any IO resource for the base.
+ */
+
+struct platform_device s3c_device_timer[] = {
+	[0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
+	[1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
+	[2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
+	[3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
+	[4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
+};
+EXPORT_SYMBOL(s3c_device_timer);
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c
index 2eeb49f..f37457c 100644
--- a/arch/arm/plat-samsung/pwm.c
+++ b/arch/arm/plat-samsung/pwm.c
@@ -20,10 +20,8 @@
 #include <linux/io.h>
 #include <linux/pwm.h>
 
-#include <mach/irqs.h>
 #include <mach/map.h>
 
-#include <plat/devs.h>
 #include <plat/regs-timer.h>
 
 struct pwm_device {
@@ -47,37 +45,6 @@ struct pwm_device {
 
 static struct clk *clk_scaler[2];
 
-/* Standard setup for a timer block. */
-
-#define TIMER_RESOURCE_SIZE (1)
-
-#define TIMER_RESOURCE(_tmr, _irq)			\
-	(struct resource [TIMER_RESOURCE_SIZE]) {	\
-		[0] = {					\
-			.start	= _irq,			\
-			.end	= _irq,			\
-			.flags	= IORESOURCE_IRQ	\
-		}					\
-	}
-
-#define DEFINE_S3C_TIMER(_tmr_no, _irq)			\
-	.name		= "s3c24xx-pwm",		\
-	.id		= _tmr_no,			\
-	.num_resources	= TIMER_RESOURCE_SIZE,		\
-	.resource	= TIMER_RESOURCE(_tmr_no, _irq),	\
-
-/* since we already have an static mapping for the timer, we do not
- * bother setting any IO resource for the base.
- */
-
-struct platform_device s3c_device_timer[] = {
-	[0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
-	[1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
-	[2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
-	[3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
-	[4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
-};
-
 static inline int pwm_is_tdiv(struct pwm_device *pwm)
 {
 	return clk_get_parent(pwm->clk) == pwm->clk_div;
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
  2011-02-26  4:29 ` [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-26  4:29 ` [PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440 Banajit Goswami
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for LCD backlight using PWM timer for
Samsung SMDK6410 board.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s3c64xx/Kconfig         |    1 +
 arch/arm/mach-s3c64xx/mach-smdk6410.c |   46 ++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index f3a953f..e4177e2 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -143,6 +143,7 @@ config MACH_SMDK6410
 	select S3C_DEV_USB_HSOTG
 	select S3C_DEV_WDT
 	select SAMSUNG_DEV_KEYPAD
+	select SAMSUNG_DEV_PWM
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select S3C64XX_SETUP_SDHCI
 	select S3C64XX_SETUP_I2C1
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index e85192a..4a3fe0c 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/smsc911x.h>
 #include <linux/regulator/fixed.h>
+#include <linux/pwm_backlight.h>
 
 #ifdef CONFIG_SMDK6410_WM1190_EV1
 #include <linux/mfd/wm8350/core.h>
@@ -48,6 +49,7 @@
 #include <mach/hardware.h>
 #include <mach/regs-fb.h>
 #include <mach/map.h>
+#include <mach/gpio-bank-f.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
@@ -118,7 +120,6 @@ static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
 {
 	if (power) {
 		gpio_direction_output(S3C64XX_GPF(13), 1);
-		gpio_direction_output(S3C64XX_GPF(15), 1);
 
 		/* fire nRESET on power up */
 		gpio_direction_output(S3C64XX_GPN(5), 0);
@@ -126,7 +127,6 @@ static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
 		gpio_direction_output(S3C64XX_GPN(5), 1);
 		msleep(1);
 	} else {
-		gpio_direction_output(S3C64XX_GPF(15), 0);
 		gpio_direction_output(S3C64XX_GPF(13), 0);
 	}
 }
@@ -269,6 +269,45 @@ static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
 	.cols		= 8,
 };
 
+static int smdk6410_backlight_init(struct device *dev)
+{
+	int ret;
+
+	ret = gpio_request(S3C64XX_GPF(15), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */
+	s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C64XX_GPF15_PWM_TOUT1);
+
+	return 0;
+}
+
+static void smdk6410_backlight_exit(struct device *dev)
+{
+	s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT);
+	gpio_free(S3C64XX_GPF(15));
+}
+
+static struct platform_pwm_backlight_data smdk6410_backlight_data = {
+	.pwm_id		= 1,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,
+	.init		= smdk6410_backlight_init,
+	.exit		= smdk6410_backlight_exit,
+};
+
+static struct platform_device smdk6410_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[1].dev,
+		.platform_data	= &smdk6410_backlight_data,
+	},
+};
+
 static struct map_desc smdk6410_iodesc[] = {};
 
 static struct platform_device *smdk6410_devices[] __initdata = {
@@ -298,6 +337,9 @@ static struct platform_device *smdk6410_devices[] __initdata = {
 	&s3c_device_rtc,
 	&s3c_device_ts,
 	&s3c_device_wdt,
+	&s3c_device_timer[0],
+	&s3c_device_timer[1],
+	&smdk6410_backlight_device,
 };
 
 #ifdef CONFIG_REGULATOR
@@ -693,7 +735,6 @@ static void __init smdk6410_machine_init(void)
 
 	gpio_request(S3C64XX_GPN(5), "LCD power");
 	gpio_request(S3C64XX_GPF(13), "LCD power");
-	gpio_request(S3C64XX_GPF(15), "LCD power");
 
 	i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
 	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
  2011-02-26  4:29 ` [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung Banajit Goswami
  2011-02-26  4:29 ` [PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410 Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-26  4:29 ` [PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450 Banajit Goswami
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for LCD backlight control using PWM timer
for Samsung SMDK6440 board.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s5p64x0/Kconfig         |    1 +
 arch/arm/mach-s5p64x0/mach-smdk6440.c |   44 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index 164d278..be5888a 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -34,6 +34,7 @@ config MACH_SMDK6440
 	select S3C_DEV_WDT
 	select S3C64XX_DEV_SPI
 	select SAMSUNG_DEV_ADC
+	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
 	select S5P64X0_SETUP_I2C1
 	help
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index e5beb84..58941d7 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -32,6 +33,7 @@
 #include <mach/map.h>
 #include <mach/regs-clock.h>
 #include <mach/i2c.h>
+#include <mach/regs-gpio.h>
 
 #include <plat/regs-serial.h>
 #include <plat/gpio-cfg.h>
@@ -88,6 +90,45 @@ static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
 	},
 };
 
+static int smdk6440_backlight_init(struct device *dev)
+{
+	int ret;
+
+	ret = gpio_request(S5P6440_GPF(15), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with S5P6440_GPF15_PWM_TOUT1 */
+	s3c_gpio_cfgpin(S5P6440_GPF(15), (0x02 << 30));
+
+	return 0;
+}
+
+static void smdk6440_backlight_exit(struct device *dev)
+{
+	s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_OUTPUT);
+	gpio_free(S5P6440_GPF(15));
+}
+
+static struct platform_pwm_backlight_data smdk6440_backlight_data = {
+	.pwm_id		= 1,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,
+	.init		= smdk6440_backlight_init,
+	.exit		= smdk6440_backlight_exit,
+};
+
+static struct platform_device smdk6440_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[1].dev,
+		.platform_data	= &smdk6440_backlight_data,
+	},
+};
+
 static struct platform_device *smdk6440_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_rtc,
@@ -97,6 +138,9 @@ static struct platform_device *smdk6440_devices[] __initdata = {
 	&s3c_device_wdt,
 	&samsung_asoc_dma,
 	&s5p6440_device_iis,
+	&s3c_device_timer[0],
+	&s3c_device_timer[1],
+	&smdk6440_backlight_device,
 };
 
 static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
                   ` (2 preceding siblings ...)
  2011-02-26  4:29 ` [PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440 Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-26  4:29 ` [PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100 Banajit Goswami
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for LCD backlight control using PWM timer
for Samsung SMDK6450 board.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s5p64x0/Kconfig         |    1 +
 arch/arm/mach-s5p64x0/mach-smdk6450.c |   44 +++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index be5888a..08b0a5b 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -48,6 +48,7 @@ config MACH_SMDK6450
 	select S3C_DEV_WDT
 	select S3C64XX_DEV_SPI
 	select SAMSUNG_DEV_ADC
+	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
 	select S5P64X0_SETUP_I2C1
 	help
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 3a20de0..296cc0f 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -32,6 +33,7 @@
 #include <mach/map.h>
 #include <mach/regs-clock.h>
 #include <mach/i2c.h>
+#include <mach/regs-gpio.h>
 
 #include <plat/regs-serial.h>
 #include <plat/gpio-cfg.h>
@@ -106,6 +108,45 @@ static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
 #endif
 };
 
+static int smdk6450_backlight_init(struct device *dev)
+{
+	int ret;
+
+	ret = gpio_request(S5P6450_GPF(15), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with S5P6450_GPF15_PWM_TOUT1 */
+	s3c_gpio_cfgpin(S5P6450_GPF(15), (0x02 << 30));
+
+	return 0;
+}
+
+static void smdk6450_backlight_exit(struct device *dev)
+{
+	s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_OUTPUT);
+	gpio_free(S5P6450_GPF(15));
+}
+
+static struct platform_pwm_backlight_data smdk6450_backlight_data = {
+	.pwm_id		= 1,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,
+	.init		= smdk6450_backlight_init,
+	.exit		= smdk6450_backlight_exit,
+};
+
+static struct platform_device smdk6450_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[1].dev,
+		.platform_data	= &smdk6450_backlight_data,
+	},
+};
+
 static struct platform_device *smdk6450_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_rtc,
@@ -115,6 +156,9 @@ static struct platform_device *smdk6450_devices[] __initdata = {
 	&s3c_device_wdt,
 	&samsung_asoc_dma,
 	&s5p6450_device_iis0,
+	&s3c_device_timer[0],
+	&s3c_device_timer[1],
+	&smdk6450_backlight_device,
 	/* s5p6450_device_spi0 will be added */
 };
 
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
                   ` (3 preceding siblings ...)
  2011-02-26  4:29 ` [PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450 Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-26  4:29 ` [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210 Banajit Goswami
  2011-02-28 10:53 ` [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Kukjin Kim
  6 siblings, 0 replies; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for LCD backlight using PWM timer for
Samsung SMDKC100 board.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s5pc100/Kconfig         |    1 +
 arch/arm/mach-s5pc100/mach-smdkc100.c |   48 ++++++++++++++++++++++++++++++---
 2 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index b8fbf2f..608722f 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -58,6 +58,7 @@ config MACH_SMDKC100
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_IDE
 	select SAMSUNG_DEV_KEYPAD
+	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
 	select S5PC100_SETUP_FB_24BPP
 	select S5PC100_SETUP_I2C1
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index dd192a2..22d5348 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -23,12 +23,15 @@
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/input.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 #include <mach/map.h>
 #include <mach/regs-fb.h>
+#include <mach/regs-gpio.h>
+
 #include <video/platform_lcd.h>
 
 #include <asm/irq.h>
@@ -107,9 +110,6 @@ static struct i2c_board_info i2c_devs1[] __initdata = {
 static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
 				   unsigned int power)
 {
-	/* backlight */
-	gpio_direction_output(S5PC100_GPD(0), power);
-
 	if (power) {
 		/* module reset */
 		gpio_direction_output(S5PC100_GPH0(6), 1);
@@ -178,6 +178,44 @@ static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
 	.rows		= 2,
 	.cols		= 8,
 };
+
+static int smdkc100_backlight_init(struct device *dev)
+{
+	int ret;
+
+	ret = gpio_request(S5PC100_GPD(0), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPF for PWM-OUT0\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with S5PC100_GPD_TOUT_0 */
+	s3c_gpio_cfgpin(S5PC100_GPD(0), (0x2 << 0));
+
+	return 0;
+}
+
+static void smdkc100_backlight_exit(struct device *dev)
+{
+	s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_OUTPUT);
+	gpio_free(S5PC100_GPD(0));
+}
+
+static struct platform_pwm_backlight_data smdkc100_backlight_data = {
+	.pwm_id		= 0,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,
+	.init		= smdkc100_backlight_init,
+	.exit		= smdkc100_backlight_exit,
+};
+
+static struct platform_device smdkc100_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[0].dev,
+		.platform_data	= &smdkc100_backlight_data,
+	},
+};
 
 static struct platform_device *smdkc100_devices[] __initdata = {
 	&s3c_device_adc,
@@ -200,6 +238,9 @@ static struct platform_device *smdkc100_devices[] __initdata = {
 	&s5p_device_fimc1,
 	&s5p_device_fimc2,
 	&s5pc100_device_spdif,
+	&s3c_device_timer[0],
+	&s3c_device_timer[1],
+	&smdkc100_backlight_device,
 };
 
 static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
@@ -233,7 +274,6 @@ static void __init smdkc100_machine_init(void)
 	s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
 
 	/* LCD init */
-	gpio_request(S5PC100_GPD(0), "GPD");
 	gpio_request(S5PC100_GPH0(6), "GPH0");
 	smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
 	platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
                   ` (4 preceding siblings ...)
  2011-02-26  4:29 ` [PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100 Banajit Goswami
@ 2011-02-26  4:29 ` Banajit Goswami
  2011-02-28  4:14   ` Kyungmin Park
  2011-02-28 10:53 ` [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Kukjin Kim
  6 siblings, 1 reply; 9+ messages in thread
From: Banajit Goswami @ 2011-02-26  4:29 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for LCD backlight control using PWM timer
for Samsung's SMDKV210 board.

Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
---
 arch/arm/mach-s5pv210/Kconfig         |    1 +
 arch/arm/mach-s5pv210/mach-smdkv210.c |   46 +++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 53aabef..d7fd031 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -130,6 +130,7 @@ config MACH_SMDKV210
 	select SAMSUNG_DEV_ADC
 	select SAMSUNG_DEV_IDE
 	select SAMSUNG_DEV_KEYPAD
+	select SAMSUNG_DEV_PWM
 	select SAMSUNG_DEV_TS
 	select S5PV210_SETUP_FB_24BPP
 	select S5PV210_SETUP_I2C1
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index bc9fdb5..8833e7b 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -18,6 +18,7 @@
 #include <linux/fb.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -43,6 +44,7 @@
 #include <plat/keypad.h>
 #include <plat/pm.h>
 #include <plat/fb.h>
+#include <plat/gpio-cfg.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
 #define SMDKV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
@@ -208,6 +210,45 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
 	.setup_gpio	= s5pv210_fb_gpio_setup_24bpp,
 };
 
+static int smdkv210_backlight_init(struct device *dev)
+{
+	int ret;
+
+	ret = gpio_request(S5PV210_GPD0(3), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */
+	s3c_gpio_cfgpin(S5PV210_GPD0(3), (0x2 << 12));
+
+	return 0;
+}
+
+static void smdkv210_backlight_exit(struct device *dev)
+{
+	s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT);
+	gpio_free(S5PV210_GPD0(3));
+}
+
+static struct platform_pwm_backlight_data smdkv210_backlight_data = {
+	.pwm_id		= 3,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,
+	.init		= smdkv210_backlight_init,
+	.exit		= smdkv210_backlight_exit,
+};
+
+static struct platform_device smdkv210_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[3].dev,
+		.platform_data	= &smdkv210_backlight_data,
+	},
+};
+
 static struct platform_device *smdkv210_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_cfcon,
@@ -229,6 +270,11 @@ static struct platform_device *smdkv210_devices[] __initdata = {
 	&samsung_device_keypad,
 	&smdkv210_dm9000,
 	&smdkv210_lcd_lte480wv,
+	&s3c_device_timer[0],
+	&s3c_device_timer[1],
+	&s3c_device_timer[2],
+	&s3c_device_timer[3],
+	&smdkv210_backlight_device,
 };
 
 static void __init smdkv210_dm9000_init(void)
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210
  2011-02-26  4:29 ` [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210 Banajit Goswami
@ 2011-02-28  4:14   ` Kyungmin Park
  0 siblings, 0 replies; 9+ messages in thread
From: Kyungmin Park @ 2011-02-28  4:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Sat, Feb 26, 2011 at 1:29 PM, Banajit Goswami <banajit.g@samsung.com> wrote:
> This patch adds support for LCD backlight control using PWM timer
> for Samsung's SMDKV210 board.
>
> Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
> ---
> ?arch/arm/mach-s5pv210/Kconfig ? ? ? ? | ? ?1 +
> ?arch/arm/mach-s5pv210/mach-smdkv210.c | ? 46 +++++++++++++++++++++++++++++++++
> ?2 files changed, 47 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
> index 53aabef..d7fd031 100644
> --- a/arch/arm/mach-s5pv210/Kconfig
> +++ b/arch/arm/mach-s5pv210/Kconfig
> @@ -130,6 +130,7 @@ config MACH_SMDKV210
> ? ? ? ?select SAMSUNG_DEV_ADC
> ? ? ? ?select SAMSUNG_DEV_IDE
> ? ? ? ?select SAMSUNG_DEV_KEYPAD
> + ? ? ? select SAMSUNG_DEV_PWM
> ? ? ? ?select SAMSUNG_DEV_TS
> ? ? ? ?select S5PV210_SETUP_FB_24BPP
> ? ? ? ?select S5PV210_SETUP_I2C1
> diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
> index bc9fdb5..8833e7b 100644
> --- a/arch/arm/mach-s5pv210/mach-smdkv210.c
> +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
> @@ -18,6 +18,7 @@
> ?#include <linux/fb.h>
> ?#include <linux/gpio.h>
> ?#include <linux/delay.h>
> +#include <linux/pwm_backlight.h>
>
> ?#include <asm/mach/arch.h>
> ?#include <asm/mach/map.h>
> @@ -43,6 +44,7 @@
> ?#include <plat/keypad.h>
> ?#include <plat/pm.h>
> ?#include <plat/fb.h>
> +#include <plat/gpio-cfg.h>
>
> ?/* Following are default values for UCON, ULCON and UFCON UART registers */
> ?#define SMDKV210_UCON_DEFAULT ?(S3C2410_UCON_TXILEVEL | ? ? ? ?\
> @@ -208,6 +210,45 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
> ? ? ? ?.setup_gpio ? ? = s5pv210_fb_gpio_setup_24bpp,
> ?};
>
> +static int smdkv210_backlight_init(struct device *dev)
> +{
> + ? ? ? int ret;
> +
> + ? ? ? ret = gpio_request(S5PV210_GPD0(3), "Backlight");
> + ? ? ? if (ret) {
> + ? ? ? ? ? ? ? printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n");
> + ? ? ? ? ? ? ? return ret;
> + ? ? ? }
> +
> + ? ? ? /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */
> + ? ? ? s3c_gpio_cfgpin(S5PV210_GPD0(3), (0x2 << 12));

what's (0x2 << 12)? Do you mean S3C_GPIO_SFN(2)?
please use the macro and other patches are same usage.

> +
> + ? ? ? return 0;
> +}
> +
> +static void smdkv210_backlight_exit(struct device *dev)
> +{
> + ? ? ? s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT);
> + ? ? ? gpio_free(S5PV210_GPD0(3));
> +}
> +
> +static struct platform_pwm_backlight_data smdkv210_backlight_data = {
> + ? ? ? .pwm_id ? ? ? ? = 3,
> + ? ? ? .max_brightness = 255,
> + ? ? ? .dft_brightness = 255,
> + ? ? ? .pwm_period_ns ?= 78770,
> + ? ? ? .init ? ? ? ? ? = smdkv210_backlight_init,
> + ? ? ? .exit ? ? ? ? ? = smdkv210_backlight_exit,
> +};
> +
> +static struct platform_device smdkv210_backlight_device = {
> + ? ? ? .name ? ? ? ? ? = "pwm-backlight",
> + ? ? ? .dev ? ? ? ? ? ?= {
> + ? ? ? ? ? ? ? .parent ? ? ? ? = &s3c_device_timer[3].dev,
> + ? ? ? ? ? ? ? .platform_data ?= &smdkv210_backlight_data,
> + ? ? ? },
> +};
> +
> ?static struct platform_device *smdkv210_devices[] __initdata = {
> ? ? ? ?&s3c_device_adc,
> ? ? ? ?&s3c_device_cfcon,
> @@ -229,6 +270,11 @@ static struct platform_device *smdkv210_devices[] __initdata = {
> ? ? ? ?&samsung_device_keypad,
> ? ? ? ?&smdkv210_dm9000,
> ? ? ? ?&smdkv210_lcd_lte480wv,
> + ? ? ? &s3c_device_timer[0],
> + ? ? ? &s3c_device_timer[1],
> + ? ? ? &s3c_device_timer[2],
> + ? ? ? &s3c_device_timer[3],

Why do you register timer[0...2] at here? it's only use the timer[3]
at this patch.
Other patches are same usage.

Thank you,
Kyungmin Park

> + ? ? ? &smdkv210_backlight_device,
> ?};
>
> ?static void __init smdkv210_dm9000_init(void)
> --
> 1.6.5.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight
  2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
                   ` (5 preceding siblings ...)
  2011-02-26  4:29 ` [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210 Banajit Goswami
@ 2011-02-28 10:53 ` Kukjin Kim
  6 siblings, 0 replies; 9+ messages in thread
From: Kukjin Kim @ 2011-02-28 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

Banajit Goswami wrote:
> 
> This patch adds support PWM backlight for S5P SoCs.
> 
> 1. Move PWM timer code from plat-s3c24xx to plat-samsung for common
> useability
> 2. Add PWM backlight support for SMDK6410/6440/6450/C100 and SMDKV210
> 
> Note: The modification of GPIO F for S5P64X0 patch should be merged first
as
> there is a dependency for PWM on S5P64X0.
> 
> [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to
> plat-samsung
> [PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410
> [PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440
> [PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450
> [PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100
> [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210

Ok, looks ok to me except adding unrelated platform devices.
Could you please re-work?

And please make sure that it works fine on each board before re-submitting
:)

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-02-28 10:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26  4:29 [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Banajit Goswami
2011-02-26  4:29 ` [PATCH 1/6] ARM: SAMSUNG: Move PWM device definition from plat-s3c24xx to plat-samsung Banajit Goswami
2011-02-26  4:29 ` [PATCH 2/6] ARM: S3C64XX: Add PWM backlight support on SMDK6410 Banajit Goswami
2011-02-26  4:29 ` [PATCH 3/6] ARM: S5P64X0: Add PWM backlight support on SMDK6440 Banajit Goswami
2011-02-26  4:29 ` [PATCH 4/6] ARM: S5P64X0: Add PWM backlight support on SMDK6450 Banajit Goswami
2011-02-26  4:29 ` [PATCH 5/6] ARM: S5PC100: Add PWM backlight support on SMDKC100 Banajit Goswami
2011-02-26  4:29 ` [PATCH 6/6] ARM: S5PV210: Add PWM backlight support on SMDKV210 Banajit Goswami
2011-02-28  4:14   ` Kyungmin Park
2011-02-28 10:53 ` [PATCH 0/6] ARM: SAMSUNG: Add support PWM backlight Kukjin Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).