1/* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 * 02110-1301, USA. 16 */ 17 18#include "msm_fb.h" 19#include "mddihost.h" 20#include "mddihosti.h" 21 22static int prism_lcd_on(struct platform_device *pdev); 23static int prism_lcd_off(struct platform_device *pdev); 24 25static int prism_lcd_on(struct platform_device *pdev) 26{ 27 /* Set the MDP pixel data attributes for Primary Display */ 28 mddi_host_write_pix_attr_reg(0x00C3); 29 30 return 0; 31} 32 33static int prism_lcd_off(struct platform_device *pdev) 34{ 35 return 0; 36} 37 38static int __init prism_probe(struct platform_device *pdev) 39{ 40 msm_fb_add_device(pdev); 41 42 return 0; 43} 44 45static struct platform_driver this_driver = { 46 .probe = prism_probe, 47 .driver = { 48 .name = "mddi_prism_wvga", 49 }, 50}; 51 52static struct msm_fb_panel_data prism_panel_data = { 53 .on = prism_lcd_on, 54 .off = prism_lcd_off, 55}; 56 57static struct platform_device this_device = { 58 .name = "mddi_prism_wvga", 59 .id = 0, 60 .dev = { 61 .platform_data = &prism_panel_data, 62 } 63}; 64 65static int __init prism_init(void) 66{ 67 int ret; 68 struct msm_panel_info *pinfo; 69 70#ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT 71 u32 id; 72 73 ret = msm_fb_detect_client("mddi_prism_wvga"); 74 if (ret == -ENODEV) 75 return 0; 76 77 if (ret) { 78 id = mddi_get_client_id(); 79 80 if (((id >> 16) != 0x4474) || ((id & 0xffff) == 0x8960)) 81 return 0; 82 } 83#endif 84 ret = platform_driver_register(&this_driver); 85 if (!ret) { 86 pinfo = &prism_panel_data.panel_info; 87 pinfo->xres = 800; 88 pinfo->yres = 480; 89 pinfo->type = MDDI_PANEL; 90 pinfo->pdest = DISPLAY_1; 91 pinfo->mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR; 92 pinfo->wait_cycle = 0; 93 pinfo->bpp = 18; 94 pinfo->fb_num = 2; 95 pinfo->clk_rate = 153600000; 96 pinfo->clk_min = 150000000; 97 pinfo->clk_max = 160000000; 98 pinfo->lcd.vsync_enable = TRUE; 99 pinfo->lcd.refx100 = 6050; 100 pinfo->lcd.v_back_porch = 23; 101 pinfo->lcd.v_front_porch = 20; 102 pinfo->lcd.v_pulse_width = 105; 103 pinfo->lcd.hw_vsync_mode = TRUE; 104 pinfo->lcd.vsync_notifier_period = 0; 105 106 ret = platform_device_register(&this_device); 107 if (ret) 108 platform_driver_unregister(&this_driver); 109 } 110 111 return ret; 112} 113 114module_init(prism_init); 115