| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2008-2010, 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 | */ |
| 13 | |
| 14 | #include "msm_fb.h" |
| 15 | #include "mddihost.h" |
| 16 | #include "mddihosti.h" |
| 17 | |
| 18 | static int prism_lcd_on(struct platform_device *pdev); |
| 19 | static int prism_lcd_off(struct platform_device *pdev); |
| 20 | |
| 21 | static int prism_lcd_on(struct platform_device *pdev) |
| 22 | { |
| 23 | /* Set the MDP pixel data attributes for Primary Display */ |
| 24 | mddi_host_write_pix_attr_reg(0x00C3); |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static int prism_lcd_off(struct platform_device *pdev) |
| 30 | { |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | static int __devinit prism_probe(struct platform_device *pdev) |
| 35 | { |
| 36 | msm_fb_add_device(pdev); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | static struct platform_driver this_driver = { |
| 42 | .probe = prism_probe, |
| 43 | .driver = { |
| 44 | .name = "mddi_prism_wvga", |
| 45 | }, |
| 46 | }; |
| 47 | |
| 48 | static struct msm_fb_panel_data prism_panel_data = { |
| 49 | .on = prism_lcd_on, |
| 50 | .off = prism_lcd_off, |
| 51 | }; |
| 52 | |
| 53 | static struct platform_device this_device = { |
| 54 | .name = "mddi_prism_wvga", |
| 55 | .id = 0, |
| 56 | .dev = { |
| 57 | .platform_data = &prism_panel_data, |
| 58 | } |
| 59 | }; |
| 60 | |
| 61 | static int __init prism_init(void) |
| 62 | { |
| 63 | int ret; |
| 64 | struct msm_panel_info *pinfo; |
| 65 | |
| 66 | #ifdef CONFIG_FB_MSM_MDDI_AUTO_DETECT |
| 67 | u32 id; |
| 68 | |
| 69 | ret = msm_fb_detect_client("mddi_prism_wvga"); |
| 70 | if (ret == -ENODEV) |
| 71 | return 0; |
| 72 | |
| 73 | if (ret) { |
| 74 | id = mddi_get_client_id(); |
| 75 | |
| 76 | if (((id >> 16) != 0x4474) || ((id & 0xffff) == 0x8960)) |
| 77 | return 0; |
| 78 | } |
| 79 | #endif |
| 80 | ret = platform_driver_register(&this_driver); |
| 81 | if (!ret) { |
| 82 | pinfo = &prism_panel_data.panel_info; |
| 83 | pinfo->xres = 800; |
| 84 | pinfo->yres = 480; |
| 85 | MSM_FB_SINGLE_MODE_PANEL(pinfo); |
| 86 | pinfo->type = MDDI_PANEL; |
| 87 | pinfo->pdest = DISPLAY_1; |
| 88 | pinfo->mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR; |
| 89 | pinfo->wait_cycle = 0; |
| 90 | pinfo->bpp = 18; |
| 91 | pinfo->fb_num = 2; |
| 92 | pinfo->clk_rate = 153600000; |
| 93 | pinfo->clk_min = 140000000; |
| 94 | pinfo->clk_max = 160000000; |
| 95 | pinfo->lcd.vsync_enable = TRUE; |
| 96 | pinfo->lcd.refx100 = 6050; |
| 97 | pinfo->lcd.v_back_porch = 23; |
| 98 | pinfo->lcd.v_front_porch = 20; |
| 99 | pinfo->lcd.v_pulse_width = 105; |
| 100 | pinfo->lcd.hw_vsync_mode = TRUE; |
| 101 | pinfo->lcd.vsync_notifier_period = 0; |
| 102 | |
| 103 | ret = platform_device_register(&this_device); |
| 104 | if (ret) |
| 105 | platform_driver_unregister(&this_driver); |
| 106 | } |
| 107 | |
| 108 | return ret; |
| 109 | } |
| 110 | |
| 111 | module_init(prism_init); |