From patchwork Mon Jul 25 20:00:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 1004682 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 p6PEB9WI019411 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Jul 2011 14:11:30 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QlLrl-0003F0-7s; Mon, 25 Jul 2011 14:10:42 +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 1QlLrj-0007o7-Td; Mon, 25 Jul 2011 14:10:39 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QlLqD-0007O4-T3 for linux-arm-kernel@lists.infradead.org; Mon, 25 Jul 2011 14:09:07 +0000 Received: from epcpsbgm1.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LOW00A2D7ATSQK0@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 25 Jul 2011 23:08:59 +0900 (KST) X-AuditID: cbfee61a-b7cf0ae000006bc6-84-4e2d78fbca76 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id 5A.21.27590.BF87D2E4; Mon, 25 Jul 2011 23:08:59 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LOW00ITF7ANNI@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 25 Jul 2011 23:08:59 +0900 (KST) Date: Mon, 25 Jul 2011 16:00:23 -0400 From: Ajay Kumar Subject: [PATCH V2 5/7] ARM: S5P64X0: Add file to hold common Framebuffer and LCD code In-reply-to: <1311624025-2643-1-git-send-email-ajaykumar.rs@samsung.com> To: kgene.kim@samsung.com, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jg1.han@samsung.com, m.szyprowski@samsung.com Message-id: <1311624025-2643-6-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.0.4 References: <1311624025-2643-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110725_100906_279566_CACABDAD X-CRM114-Status: GOOD ( 24.82 ) X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [203.254.224.33 listed in list.dnswl.org] -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date 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]); Mon, 25 Jul 2011 14:11:30 +0000 (UTC) This patch creates a file which holds the framebuffer and LCD code which is common for SMDK6440 and SMDK6450. It mainly includes: -- Basic FB window definition. -- platform data for FB and LCD. -- platform_device support for LCD. Signed-off-by: Ajay Kumar --- arch/arm/mach-s5p64x0/Kconfig | 5 ++ arch/arm/mach-s5p64x0/Makefile | 3 + arch/arm/mach-s5p64x0/common-fb.c | 92 ++++++++++++++++++++++++ arch/arm/mach-s5p64x0/include/mach/common-fb.h | 26 +++++++ 4 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-s5p64x0/common-fb.c create mode 100644 arch/arm/mach-s5p64x0/include/mach/common-fb.h diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index 4fee745..ed87151 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig @@ -32,6 +32,11 @@ config S5P64X0_SETUP_I2C1 help Common setup code for i2c bus 1. +config COMMON_FB + bool + help + Common framebuffer and LCD code which can be shared across SMDKs. + # machine support config MACH_SMDK6440 diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile index 487d179..e5e90f9 100644 --- a/arch/arm/mach-s5p64x0/Makefile +++ b/arch/arm/mach-s5p64x0/Makefile @@ -22,6 +22,9 @@ obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o +#common code +obj-$(CONFIG_COMMON_FB) += common-fb.o + # device support obj-y += dev-audio.o diff --git a/arch/arm/mach-s5p64x0/common-fb.c b/arch/arm/mach-s5p64x0/common-fb.c new file mode 100644 index 0000000..a5531ef --- /dev/null +++ b/arch/arm/mach-s5p64x0/common-fb.c @@ -0,0 +1,92 @@ +/* linux/arch/arm/mach-s5p64x0/common-fb.c + * + * Copyright (c) 2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * Includes definitions for variables and functions + * needed in order to support framebuffer. + * Note that this code is common across SMDK6440 and SMDK6450. + * + * 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 + +#include +#include + +#include +#include + +/* Frame Buffer */ +struct s3c_fb_pd_win smdk64x0_fb_win0 = { + .win_mode = { + .left_margin = 8, + .right_margin = 13, + .upper_margin = 7, + .lower_margin = 5, + .hsync_len = 3, + .vsync_len = 1, + .xres = 800, + .yres = 480, + .refresh = 60, + }, + .max_bpp = 32, + .default_bpp = 24, +}; + +struct s3c_fb_platdata smdk64x0_lcd_pdata __initdata = { + .win[0] = &smdk64x0_fb_win0, + .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, + .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, + .setup_gpio = s5p64x0_fb_gpio_setup_24bpp, +}; + +/* LCD power controller */ +void smdk64x0_lte480_reset_power(struct plat_lcd_data *pd, + unsigned int power) +{ + unsigned int cfg; + int err; + + if (power) { + cfg = readl(S5P64X0_SYS_ID) & 0xf0000; + if (cfg == 0x40000) { + err = gpio_request(S5P6440_GPN(5), "GPN"); + if (err) { + printk(KERN_ERR "failed to request GPN for lcd reset\n"); + return; + } + + gpio_direction_output(S5P6440_GPN(5), 1); + gpio_set_value(S5P6440_GPN(5), 0); + gpio_set_value(S5P6440_GPN(5), 1); + gpio_free(S5P6440_GPN(5)); + } else if (cfg == 0x50000) { + err = gpio_request(S5P6450_GPN(5), "GPN"); + if (err) { + printk(KERN_ERR "failed to request GPN for lcd reset\n"); + return; + } + + gpio_direction_output(S5P6450_GPN(5), 1); + gpio_set_value(S5P6450_GPN(5), 0); + gpio_set_value(S5P6450_GPN(5), 1); + gpio_free(S5P6450_GPN(5)); + } + } +} + +struct plat_lcd_data smdk64x0_lcd_power_data = { + .set_power = smdk64x0_lte480_reset_power, +}; + +struct platform_device smdk64x0_lcd_lte480wv = { + .name = "platform-lcd", + .dev = { + .parent = &s3c_device_fb.dev, + .platform_data = &smdk64x0_lcd_power_data, + } +}; diff --git a/arch/arm/mach-s5p64x0/include/mach/common-fb.h b/arch/arm/mach-s5p64x0/include/mach/common-fb.h new file mode 100644 index 0000000..c239623 --- /dev/null +++ b/arch/arm/mach-s5p64x0/include/mach/common-fb.h @@ -0,0 +1,26 @@ +/* linux/arch/arm/mach-s5p64x0/include/mach/common-fb.h + * + * Copyright (c) 2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * Includes declarations for variables and functions + * needed in order to support framebuffer. + * + * 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 +#include + +#include