Skip to contentSkip to conversation

ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310

PATCH New JinGoo Han 3 participants 4 messages Jun 22, 2011 – Jun 23, 2011 1 message not in the archive Arm Samsung Exynos

lore
Share & tools
lore

JinGoo Han

author
#0 lore raw

Hi, Banajit.

Quoted 75 lines

-----Original Message-----
From: [email protected] [mailto:linux-samsung-soc- [email protected]] On Behalf Of Banajit Goswami
Sent: Wednesday, June 22, 2011 3:41 PM
To: [email protected]
Cc: [email protected]; [email protected]; linux-arm- [email protected]; Banajit Goswami
Subject: [PATCH] ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310

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

---
 arch/arm/mach-exynos4/Kconfig         |    1 +
 arch/arm/mach-exynos4/mach-smdkv310.c |   43
+++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
arch/arm/mach-exynos4/Kconfig +1 -0
index 1435fc3..9ab53bc 100644
@@ -128,6 +128,7 @@ config MACH_SMDKV310
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
 	select SAMSUNG_DEV_KEYPAD
+	select SAMSUNG_DEV_PWM
 	select EXYNOS4_DEV_PD
 	select EXYNOS4_DEV_SYSMMU
 	select EXYNOS4_SETUP_I2C1
arch/arm/mach- renamed from arch/arm/mach-exynos4/mach-smdkv310.c +0 -0

exynos4/mach-smdkv310.c
index 7e3ee6c..b097ef6 100644

arch/arm/mach-exynos4/mach-smdkv310.c +19 -0
@@ -16,6 +16,7 @@
 #include <linux/io.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
@@ -29,6 +30,7 @@
 #include <plat/sdhci.h>
 #include <plat/iic.h>
 #include <plat/pd.h>
+#include <plat/gpio-cfg.h>
 
 #include <mach/map.h>
 
@@ -172,6 +174,45 @@ static struct i2c_board_info i2c_devs1[] __initdata =
 {
 	{I2C_BOARD_INFO("wm8994", 0x1a),},
 };
 
+static int smdkv310_backlight_init(struct device *dev)
+{
+	int ret = 0;
+
+	ret = gpio_request(EXYNOS4_GPD0(1), "Backlight");
+	if (ret) {
+		printk(KERN_ERR "failed to request GPD for PWM-OUT0\n");
+		return ret;
+	}
+
+	/* Configure GPIO pin with EXYNOS4_GPD_0_1_TOUT_0 */
+	s3c_gpio_cfgpin(EXYNOS4_GPD0(1), S3C_GPIO_SFN(2));
+
+	return 0;
+}
+
+static void smdkv310_backlight_exit(struct device *dev)

arch/arm/mach-exynos4/mach-smdkv310.c static struct i2c_board_info i2c_devs1[] __initdata = · line 204

Quoted 10 lines
arch/arm/mach-exynos4/mach-smdkv310.c +10 -0
+{
+	s3c_gpio_cfgpin(EXYNOS4_GPD0(1), S3C_GPIO_OUTPUT);
+	gpio_free(EXYNOS4_GPD0(1));
+}
+
+static struct platform_pwm_backlight_data smdkv310_backlight_data = {
+	.pwm_id		= 1,
+	.max_brightness	= 255,
+	.dft_brightness	= 255,
+	.pwm_period_ns	= 78770,

Please use 1000 as pwm_period_ns instead of 78770 as follows:
- .pwm_period_ns = 78770,
+ .pwm_period_ns = 1000,

The value '78770' makes noise related to resonance at LCD board.

I will explain how I get the value of PWM period.

The SMDK boards use LT3591 as backlight LED driver of LTE480WV LCD According to the LT3591 datasheet, the switching frequency should be 1MHz. So, PWM period is calculated by following formula:

        PWM period = 1/switching frequency
                       = 1/1MHz
                       = 1000 ns

You can find LT3591 datasheet easily on the Internet. Please refer to it for more information.
Good luck.

Quoted 33 lines
arch/arm/mach-exynos4/mach-smdkv310.c +12 -0
+	.init		= smdkv310_backlight_init,
+	.exit		= smdkv310_backlight_exit,
+};
+
+static struct platform_device smdkv310_backlight_device = {
+	.name		= "pwm-backlight",
+	.dev		= {
+		.parent		= &s3c_device_timer[1].dev,
+		.platform_data	= &smdkv310_backlight_data,
+	},
+};
+
 static struct platform_device *smdkv310_devices[] __initdata = {
 	&s3c_device_hsmmc0,
arch/arm/mach-exynos4/mach-smdkv310.c +2 -0
 	&s3c_device_hsmmc1,
@@ -195,6 +236,8 @@ static struct platform_device *smdkv310_devices[]
 __initdata = {
 	&samsung_asoc_dma,
 	&smdkv310_smsc911x,
 	&smdkv310_pcm_device,
+	&s3c_device_timer[1],
+	&smdkv310_backlight_device,
 };
 

static void __init smdkv310_smsc911x_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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/1 ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310

In reply to a message not in the archive
Quoted 3 lines

From: JinGoo Han <[email protected]>

Hi, Banajit.

Hi Jingoo,

Quoted 3 lines
Quoted 3 lines

---

...
<snip>
...

Quoted 5 lines
Quoted 1 line

+ ? ? .pwm_period_ns ?= 78770,

Please use 1000 as pwm_period_ns instead of 78770 as follows:
- ? ? ? .pwm_period_ns ?= 78770,
+ ? ? ? .pwm_period_ns ?= 1000,

Yes, I will modify the period value and send updated patch

Quoted 11 lines

The value '78770' makes noise related to resonance at LCD board.

I will explain how I get the value of PWM period.

The SMDK boards use LT3591 as backlight LED driver of LTE480WV LCD According to the LT3591 datasheet, the switching frequency should be 1MHz. So, PWM period is calculated by following formula:
? ? ? ?PWM period = 1/switching frequency
? ? ? ? ? ? ? ? ? ? ? = 1/1MHz
? ? ? ? ? ? ? ? ? ? ? = 1000 ns

Thanks for the explanation.

Quoted 3 lines

You can find LT3591 datasheet easily on the Internet. Please refer to it for more information.
Good luck.

Thanks you.

Quoted 1 line
Quoted 1 line

+ ? ? .init ? ? ? ? ? = smdkv310_backlight_init,

...
<snip>
...

Quoted 1 line

Regards,
Banajit

#3 lore raw

PATCH 1/1 ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310

Quoted 6 lines · Banajit Goswami
Quoted 4 lines

From: JinGoo Han <[email protected]>

Hi, Banajit.

Hi Jingoo,

Hi all,

Hmm...
If the same code is required into each boards, please don't add them on both.

I think, we can avoid duplication...

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#4 lore raw

PATCH 1/1 ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310

Quoted 8 lines · Kukjin Kim
Quoted 6 lines · Banajit Goswami
Quoted 4 lines

From: JinGoo Han <[email protected]>

Hi, Banajit.

Hi Jingoo,

Hi all,

Hello,

Quoted 4 lines

Hmm...
If the same code is required into each boards, please don't add them on both.

I think, we can avoid duplication...

Yes, I have already started working on it.
I can send it by tomorrow.

Quoted 4 lines

Thanks.

Best regards,
Kgene.

Thanks,
Banajit