From patchwork Wed Jun 22 07:10:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 903712 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5M7M4iZ028313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Jun 2011 07:22:31 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QZHl5-00071k-4y; Wed, 22 Jun 2011 07:21:55 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QZHl4-0001jp-P9; Wed, 22 Jun 2011 07:21:54 +0000 Received: from ganesha.gnumonks.org ([2001:780:45:1d:2e0:81ff:fe28:898a]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QZHl0-0001jV-U6 for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2011 07:21:52 +0000 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1QZHkv-00057r-Rs; Wed, 22 Jun 2011 09:21:45 +0200 Received: from [12.23.102.184] (helo=starstone.dsn.sec.samsung.com) by jackpot.kr.gnumonks.org with esmtp (Exim 4.69) (envelope-from ) id 1QZGx6-0002SQ-95; Wed, 22 Jun 2011 15:30:16 +0900 From: Jingoo Han To: Kukjin Kim , linux-samsung-soc@vger.kernel.org Subject: [PATCH RESEND] ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKC210 Date: Wed, 22 Jun 2011 16:10:26 +0900 Message-Id: <1308726626-19635-1-git-send-email-jg1.han@samsung.com> X-Mailer: git-send-email 1.7.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110622_032151_346005_9D571CE2 X-CRM114-Status: GOOD ( 16.69 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain Cc: Jingoo Han , Banajit Goswami , linux-arm-kernel@lists.infradead.org, Ben Dooks X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 22 Jun 2011 07:22:31 +0000 (UTC) This patch adds support for LCD backlight control using PWM timer for Samsung's SMDKC210 board. Signed-off-by: Jingoo Han --- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/mach-smdkc210.c | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig index 1435fc3..a66896c 100644 --- a/arch/arm/mach-exynos4/Kconfig +++ b/arch/arm/mach-exynos4/Kconfig @@ -110,6 +110,7 @@ config MACH_SMDKC210 select S3C_DEV_HSMMC1 select S3C_DEV_HSMMC2 select S3C_DEV_HSMMC3 + select SAMSUNG_DEV_PWM select EXYNOS4_DEV_PD select EXYNOS4_DEV_SYSMMU select EXYNOS4_SETUP_I2C1 diff --git a/arch/arm/mach-exynos4/mach-smdkc210.c b/arch/arm/mach-exynos4/mach-smdkc210.c index e645f7a..bcd368c 100644 --- a/arch/arm/mach-exynos4/mach-smdkc210.c +++ b/arch/arm/mach-exynos4/mach-smdkc210.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include @@ -146,6 +148,45 @@ static struct i2c_board_info i2c_devs1[] __initdata = { {I2C_BOARD_INFO("wm8994", 0x1a),}, }; +static int smdkc210_backlight_init(struct device *dev) +{ + int ret; + + ret = gpio_request(EXYNOS4_GPD0(1), "Backlight"); + if (ret) { + printk(KERN_ERR "failed to request GPD for PWM-OUT 1\n"); + return ret; + } + + /* Configure GPIO pin with EXYNOS4_GPD_0_1_TOUT_1 */ + s3c_gpio_cfgpin(EXYNOS4_GPD0(1), S3C_GPIO_SFN(2)); + + return 0; +} + +static void smdkc210_backlight_exit(struct device *dev) +{ + s3c_gpio_cfgpin(EXYNOS4_GPD0(1), S3C_GPIO_OUTPUT); + gpio_free(EXYNOS4_GPD0(1)); +} + +static struct platform_pwm_backlight_data smdkc210_backlight_data = { + .pwm_id = 1, + .max_brightness = 255, + .dft_brightness = 255, + .pwm_period_ns = 1000, + .init = smdkc210_backlight_init, + .exit = smdkc210_backlight_exit, +}; + +static struct platform_device smdkc210_backlight_device = { + .name = "pwm-backlight", + .dev = { + .parent = &s3c_device_timer[1].dev, + .platform_data = &smdkc210_backlight_data, + }, +}; + static struct platform_device *smdkc210_devices[] __initdata = { &s3c_device_hsmmc0, &s3c_device_hsmmc1, @@ -166,6 +207,8 @@ static struct platform_device *smdkc210_devices[] __initdata = { &exynos4_device_sysmmu, &samsung_asoc_dma, &smdkc210_smsc911x, + &s3c_device_timer[1], + &smdkc210_backlight_device, }; static void __init smdkc210_smsc911x_init(void)