From patchwork Fri Feb 1 09:20:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Zhu X-Patchwork-Id: 2077931 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BCE09DFE75 for ; Fri, 1 Feb 2013 09:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755892Ab3BAJV2 (ORCPT ); Fri, 1 Feb 2013 04:21:28 -0500 Received: from na3sys009aog113.obsmtp.com ([74.125.149.209]:50366 "EHLO na3sys009aog113.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755941Ab3BAJV1 (ORCPT ); Fri, 1 Feb 2013 04:21:27 -0500 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob113.postini.com ([74.125.148.12]) with SMTP ID DSNKUQuJEw+XJviuGiwUhraY7Rz3sJQC9bqf@postini.com; Fri, 01 Feb 2013 01:21:27 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 1 Feb 2013 01:21:09 -0800 Received: from localhost (unknown [10.38.36.52]) by maili.marvell.com (Postfix) with ESMTP id C24BB4E513; Fri, 1 Feb 2013 01:21:08 -0800 (PST) From: Zhou Zhu To: , , Andrew Morton , FlorianSchandinat@gmx.de Cc: , Greg Kroah-Hartman , Lisa Du , Guoqing Li , Zhou Zhu Subject: [PATCH v6 7/8] ARM: mmp: enable display in ttc_dkb Date: Fri, 1 Feb 2013 17:20:59 +0800 Message-Id: <1359710459-10142-1-git-send-email-zzhu3@marvell.com> X-Mailer: git-send-email 1.7.9.5 X-OriginalArrivalTime: 01 Feb 2013 09:21:09.0105 (UTC) FILETIME=[7853F610:01CE005D] Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org enable display in ttc_dkb Signed-off-by: Zhou Zhu Acked-by: Haojian Zhuang --- arch/arm/mach-mmp/ttc_dkb.c | 92 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index ce55fd8..49b3cf9 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -184,6 +186,92 @@ static struct pxa3xx_nand_platform_data dkb_nand_info = { }; #endif +#ifdef CONFIG_MMP_DISP +/* path config */ +#define CFG_IOPADMODE(iopad) (iopad) /* 0x0 ~ 0xd */ +#define SCLK_SOURCE_SELECT(x) (x << 30) /* 0x0 ~ 0x3 */ +/* link config */ +#define CFG_DUMBMODE(mode) (mode << 28) /* 0x0 ~ 0x6*/ +#define CFG_GRA_SWAPRB(x) (x << 0) /* 1: rbswap enabled */ +static struct mmp_mach_path_config dkb_disp_config[] = { + [0] = { + .name = "mmp-parallel", + .overlay_num = 2, + .output_type = PATH_OUT_PARALLEL, + .path_config = CFG_IOPADMODE(0x1) + | SCLK_SOURCE_SELECT(0x1), + .link_config = CFG_DUMBMODE(0x2) + | CFG_GRA_SWAPRB(0x1), + }, +}; + +static struct mmp_mach_plat_info dkb_disp_info = { + .name = "mmp-disp", + .clk_name = "disp0", + .path_num = 1, + .paths = dkb_disp_config, +}; + +static struct mmp_buffer_driver_mach_info dkb_fb_info = { + .name = "mmp-fb", + .path_name = "mmp-parallel", + .overlay_id = 0, + .dmafetch_id = 1, + .default_pixfmt = PIXFMT_RGB565, +}; + +static void dkb_tpo_panel_power(int on) +{ + int err; + u32 spi_reset = mfp_to_gpio(MFP_PIN_GPIO106); + + if (on) { + err = gpio_request(spi_reset, "TPO_LCD_SPI_RESET"); + if (err) { + pr_err("failed to request GPIO for TPO LCD RESET\n"); + return; + } + gpio_direction_output(spi_reset, 0); + udelay(100); + gpio_set_value(spi_reset, 1); + gpio_free(spi_reset); + } else { + err = gpio_request(spi_reset, "TPO_LCD_SPI_RESET"); + if (err) { + pr_err("failed to request LCD RESET gpio\n"); + return; + } + gpio_set_value(spi_reset, 0); + gpio_free(spi_reset); + } +} + +static struct mmp_mach_panel_info dkb_tpo_panel_info = { + .name = "tpo-hvga", + .plat_path_name = "mmp-parallel", + .plat_set_onoff = dkb_tpo_panel_power, +}; + +static struct spi_board_info spi_board_info[] __initdata = { + { + .modalias = "tpo-hvga", + .platform_data = &dkb_tpo_panel_info, + .bus_num = 5, + } +}; + +static void __init add_disp(void) +{ + pxa_register_device(&pxa910_device_disp, + &dkb_disp_info, sizeof(dkb_disp_info)); + spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); + pxa_register_device(&pxa910_device_fb, + &dkb_fb_info, sizeof(dkb_fb_info)); + pxa_register_device(&pxa910_device_panel, + &dkb_tpo_panel_info, sizeof(dkb_tpo_panel_info)); +} +#endif + static void __init ttc_dkb_init(void) { mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); @@ -212,6 +300,10 @@ static void __init ttc_dkb_init(void) pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata; platform_device_register(&pxa168_device_u2ootg); #endif + +#ifdef CONFIG_MMP_DISP + add_disp(); +#endif } MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")