From patchwork Thu Jan 17 08:24:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Zhu X-Patchwork-Id: 1995481 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 86C17DF2E1 for ; Thu, 17 Jan 2013 08:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759235Ab3AQIcc (ORCPT ); Thu, 17 Jan 2013 03:32:32 -0500 Received: from na3sys009aog123.obsmtp.com ([74.125.149.149]:44410 "EHLO na3sys009aog123.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759328Ab3AQIcb (ORCPT ); Thu, 17 Jan 2013 03:32:31 -0500 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob123.postini.com ([74.125.148.12]) with SMTP ID DSNKUPe3GhDUk+K+y9MEVTKi7jGgb3C8Wi68@postini.com; Thu, 17 Jan 2013 00:32:31 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 17 Jan 2013 00:24:40 -0800 Received: from localhost (unknown [10.38.36.52]) by maili.marvell.com (Postfix) with ESMTP id 694F14E513; Thu, 17 Jan 2013 00:24:40 -0800 (PST) From: Zhou Zhu To: , , Andrew Morton , Cc: , Greg Kroah-Hartman , Zhou Zhu Subject: [PATCH v5 7/8] ARM: mmp: enable display in ttc_dkb Date: Thu, 17 Jan 2013 16:24:38 +0800 Message-Id: <1358411078-2811-1-git-send-email-zzhu3@marvell.com> X-Mailer: git-send-email 1.7.9.5 X-OriginalArrivalTime: 17 Jan 2013 08:24:40.0216 (UTC) FILETIME=[18324980:01CDF48C] 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 --- 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..7c3c3c9 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", + .ovly_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", + .ovly_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")