From patchwork Wed Jun 22 06:41:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Banajit Goswami X-Patchwork-Id: 903652 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 p5M6fgpl011205 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Jun 2011 06:42:04 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QZH80-0002ZR-9V; Wed, 22 Jun 2011 06:41:32 +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 1QZH7z-00019X-UD; Wed, 22 Jun 2011 06:41:31 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QZH7w-00019E-A0 for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2011 06:41:29 +0000 Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LN600K8LIKIRH50@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2011 15:41:21 +0900 (KST) X-AuditID: cbfee61b-b7b2dae000007af9-ab-4e018e912f5b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id C7.DC.31481.19E810E4; Wed, 22 Jun 2011 15:41:21 +0900 (KST) Received: from banajit.sisodomain.com ([107.108.83.226]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LN600A9IIKPF1@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2011 15:41:21 +0900 (KST) Date: Wed, 22 Jun 2011 12:11:15 +0530 From: Banajit Goswami Subject: [PATCH] ARM: EXYNOS4: Add PWM backlight support on Samsung SMDKV310 To: linux-samsung-soc@vger.kernel.org Message-id: <1308724875-32724-1-git-send-email-banajit.g@samsung.com> X-Mailer: git-send-email 1.7.2.3 X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110622_024128_639229_A9E5F0F7 X-CRM114-Status: GOOD ( 19.09 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [203.254.224.34 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain Cc: kgene.kim@samsung.com, Banajit Goswami , linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org 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 06:42:04 +0000 (UTC) This patch adds support for LCD backlight using PWM timer for Samsung SMDKV310 board. Signed-off-by: Banajit Goswami --- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/mach-smdkv310.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..9ab53bc 100644 --- a/arch/arm/mach-exynos4/Kconfig +++ b/arch/arm/mach-exynos4/Kconfig @@ -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 diff --git a/arch/arm/mach-exynos4/mach-smdkv310.c b/arch/arm/mach-exynos4/mach-smdkv310.c index 7e3ee6c..b097ef6 100644 --- a/arch/arm/mach-exynos4/mach-smdkv310.c +++ b/arch/arm/mach-exynos4/mach-smdkv310.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include @@ -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) +{ + 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, + .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, &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)