From patchwork Wed Oct 24 06:59:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Zhu X-Patchwork-Id: 1636071 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 168333FC36 for ; Wed, 24 Oct 2012 06:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757840Ab2JXG5A (ORCPT ); Wed, 24 Oct 2012 02:57:00 -0400 Received: from na3sys009aog121.obsmtp.com ([74.125.149.145]:35490 "EHLO na3sys009aog121.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757834Ab2JXG5A (ORCPT ); Wed, 24 Oct 2012 02:57:00 -0400 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob121.postini.com ([74.125.148.12]) with SMTP ID DSNKUIeROYs6mbvyvzYj1zMrTBheixLUDSMm@postini.com; Tue, 23 Oct 2012 23:57:00 PDT Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 23 Oct 2012 23:54:49 -0700 Received: from localhost (unknown [10.38.36.52]) by maili.marvell.com (Postfix) with ESMTP id C55934E510; Tue, 23 Oct 2012 23:54:48 -0700 (PDT) From: Zhou Zhu To: , , Cc: , Zhou Zhu Subject: [PATCHv4 8/9] ARM: mmp: enable display in ttc_dkb Date: Wed, 24 Oct 2012 14:59:13 +0800 Message-Id: <1351061953-6804-1-git-send-email-zzhu3@marvell.com> X-Mailer: git-send-email 1.7.0.4 X-OriginalArrivalTime: 24 Oct 2012 06:54:49.0123 (UTC) FILETIME=[75BE0730:01CDB1B4] 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 files changed, 92 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 7a7de2b..1ec31d0 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 @@ -177,6 +179,92 @@ static struct mv_usb_platform_data ttc_usb_pdata = { #endif #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 = "LCDCLK", + .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)); @@ -202,6 +290,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")