Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

randomblame

By: a guest on Feb 10th, 2010  |  syntax: None  |  size: 16.30 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. /* linux/arch/arm/mach-msm/board-htcdiamond-panel.c
  2. ** Based on board-trout-panel.c by: Brian Swetland <swetland@google.com>
  3. */
  4.  
  5. #include <linux/kernel.h>
  6. #include <linux/init.h>
  7. #include <linux/platform_device.h>
  8. #include <linux/delay.h>
  9. #include <linux/leds.h>
  10. #include <linux/clk.h>
  11. #include <linux/err.h>
  12.  
  13. #include <asm/io.h>
  14. #include <asm/gpio.h>
  15. #include <asm/mach-types.h>
  16.  
  17. #include <mach/msm_fb.h>
  18. #include <mach/vreg.h>
  19.  
  20. #include "board-htcdiamond.h"
  21. #include "proc_comm_wince.h"
  22. #include "devices.h"
  23.  
  24. //static struct clk *gp_clk;
  25.  
  26. #define MDDI_CLIENT_CORE_BASE  0x108000
  27. #define LCD_CONTROL_BLOCK_BASE 0x110000
  28. #define SPI_BLOCK_BASE         0x120000
  29. #define I2C_BLOCK_BASE         0x130000
  30. #define PWM_BLOCK_BASE         0x140000
  31. #define GPIO_BLOCK_BASE        0x150000
  32. #define SYSTEM_BLOCK1_BASE     0x160000
  33. #define SYSTEM_BLOCK2_BASE     0x170000
  34.  
  35.  
  36. #define DPSUS       (MDDI_CLIENT_CORE_BASE|0x24)
  37. #define SYSCLKENA   (MDDI_CLIENT_CORE_BASE|0x2C)
  38. #define PWM0OFF       (PWM_BLOCK_BASE|0x1C)
  39.  
  40. #define V_VDDE2E_VDD2_GPIO 0
  41. #define MDDI_RST_N 82
  42.  
  43. #define MDDICAP0    (MDDI_CLIENT_CORE_BASE|0x00)
  44. #define MDDICAP1    (MDDI_CLIENT_CORE_BASE|0x04)
  45. #define MDDICAP2    (MDDI_CLIENT_CORE_BASE|0x08)
  46. #define MDDICAP3    (MDDI_CLIENT_CORE_BASE|0x0C)
  47. #define MDCAPCHG    (MDDI_CLIENT_CORE_BASE|0x10)
  48. #define MDCRCERC    (MDDI_CLIENT_CORE_BASE|0x14)
  49. #define TTBUSSEL    (MDDI_CLIENT_CORE_BASE|0x18)
  50. #define DPSET0      (MDDI_CLIENT_CORE_BASE|0x1C)
  51. #define DPSET1      (MDDI_CLIENT_CORE_BASE|0x20)
  52. #define DPSUS       (MDDI_CLIENT_CORE_BASE|0x24)
  53. #define DPRUN       (MDDI_CLIENT_CORE_BASE|0x28)
  54. #define SYSCKENA    (MDDI_CLIENT_CORE_BASE|0x2C)
  55. #define TESTMODE    (MDDI_CLIENT_CORE_BASE|0x30)
  56. #define FIFOMONI    (MDDI_CLIENT_CORE_BASE|0x34)
  57. #define INTMONI     (MDDI_CLIENT_CORE_BASE|0x38)
  58. #define MDIOBIST    (MDDI_CLIENT_CORE_BASE|0x3C)
  59. #define MDIOPSET    (MDDI_CLIENT_CORE_BASE|0x40)
  60. #define BITMAP0     (MDDI_CLIENT_CORE_BASE|0x44)
  61. #define BITMAP1     (MDDI_CLIENT_CORE_BASE|0x48)
  62. #define BITMAP2     (MDDI_CLIENT_CORE_BASE|0x4C)
  63. #define BITMAP3     (MDDI_CLIENT_CORE_BASE|0x50)
  64. #define BITMAP4     (MDDI_CLIENT_CORE_BASE|0x54)
  65.  
  66. #define SRST        (LCD_CONTROL_BLOCK_BASE|0x00)
  67. #define PORT_ENB    (LCD_CONTROL_BLOCK_BASE|0x04)
  68. #define START       (LCD_CONTROL_BLOCK_BASE|0x08)
  69. #define PORT        (LCD_CONTROL_BLOCK_BASE|0x0C)
  70. #define CMN         (LCD_CONTROL_BLOCK_BASE|0x10)
  71. #define GAMMA       (LCD_CONTROL_BLOCK_BASE|0x14)
  72. #define INTFLG      (LCD_CONTROL_BLOCK_BASE|0x18)
  73. #define INTMSK      (LCD_CONTROL_BLOCK_BASE|0x1C)
  74. #define MPLFBUF     (LCD_CONTROL_BLOCK_BASE|0x20)
  75. #define HDE_LEFT    (LCD_CONTROL_BLOCK_BASE|0x24)
  76. #define VDE_TOP     (LCD_CONTROL_BLOCK_BASE|0x28)
  77. #define PXL         (LCD_CONTROL_BLOCK_BASE|0x30)
  78. #define HCYCLE      (LCD_CONTROL_BLOCK_BASE|0x34)
  79. #define HSW         (LCD_CONTROL_BLOCK_BASE|0x38)
  80. #define HDE_START   (LCD_CONTROL_BLOCK_BASE|0x3C)
  81. #define HDE_SIZE    (LCD_CONTROL_BLOCK_BASE|0x40)
  82. #define VCYCLE      (LCD_CONTROL_BLOCK_BASE|0x44)
  83. #define VSW         (LCD_CONTROL_BLOCK_BASE|0x48)
  84. #define VDE_START   (LCD_CONTROL_BLOCK_BASE|0x4C)
  85. #define VDE_SIZE    (LCD_CONTROL_BLOCK_BASE|0x50)
  86. #define WAKEUP      (LCD_CONTROL_BLOCK_BASE|0x54)
  87. #define WSYN_DLY    (LCD_CONTROL_BLOCK_BASE|0x58)
  88. #define REGENB      (LCD_CONTROL_BLOCK_BASE|0x5C)
  89. #define VSYNIF      (LCD_CONTROL_BLOCK_BASE|0x60)
  90. #define WRSTB       (LCD_CONTROL_BLOCK_BASE|0x64)
  91. #define RDSTB       (LCD_CONTROL_BLOCK_BASE|0x68)
  92. #define ASY_DATA    (LCD_CONTROL_BLOCK_BASE|0x6C)
  93. #define ASY_DATB    (LCD_CONTROL_BLOCK_BASE|0x70)
  94. #define ASY_DATC    (LCD_CONTROL_BLOCK_BASE|0x74)
  95. #define ASY_DATD    (LCD_CONTROL_BLOCK_BASE|0x78)
  96. #define ASY_DATE    (LCD_CONTROL_BLOCK_BASE|0x7C)
  97. #define ASY_DATF    (LCD_CONTROL_BLOCK_BASE|0x80)
  98. #define ASY_DATG    (LCD_CONTROL_BLOCK_BASE|0x84)
  99. #define ASY_DATH    (LCD_CONTROL_BLOCK_BASE|0x88)
  100. #define ASY_CMDSET  (LCD_CONTROL_BLOCK_BASE|0x8C)
  101.  
  102. #define SSICTL      (SPI_BLOCK_BASE|0x00)
  103. #define SSITIME     (SPI_BLOCK_BASE|0x04)
  104. #define SSITX       (SPI_BLOCK_BASE|0x08)
  105. #define SSIRX       (SPI_BLOCK_BASE|0x0C)
  106. #define SSIINTC     (SPI_BLOCK_BASE|0x10)
  107. #define SSIINTS     (SPI_BLOCK_BASE|0x14)
  108. #define SSIDBG1     (SPI_BLOCK_BASE|0x18)
  109. #define SSIDBG2     (SPI_BLOCK_BASE|0x1C)
  110. #define SSIID       (SPI_BLOCK_BASE|0x20)
  111.  
  112. #define WKREQ       (SYSTEM_BLOCK1_BASE|0x00)
  113. #define CLKENB      (SYSTEM_BLOCK1_BASE|0x04)
  114. #define DRAMPWR     (SYSTEM_BLOCK1_BASE|0x08)
  115. #define INTMASK     (SYSTEM_BLOCK1_BASE|0x0C)
  116. #define GPIOSEL     (SYSTEM_BLOCK2_BASE|0x00)
  117.  
  118. #define GPIODATA    (GPIO_BLOCK_BASE|0x00)
  119. #define GPIODIR     (GPIO_BLOCK_BASE|0x04)
  120. #define GPIOIS      (GPIO_BLOCK_BASE|0x08)
  121. #define GPIOIBE     (GPIO_BLOCK_BASE|0x0C)
  122. #define GPIOIEV     (GPIO_BLOCK_BASE|0x10)
  123. #define GPIOIE      (GPIO_BLOCK_BASE|0x14)
  124. #define GPIORIS     (GPIO_BLOCK_BASE|0x18)
  125. #define GPIOMIS     (GPIO_BLOCK_BASE|0x1C)
  126. #define GPIOIC      (GPIO_BLOCK_BASE|0x20)
  127. #define GPIOOMS     (GPIO_BLOCK_BASE|0x24)
  128. #define GPIOPC      (GPIO_BLOCK_BASE|0x28)
  129. #define GPIOID      (GPIO_BLOCK_BASE|0x30)
  130.  
  131. #define GPIOSEL_VWAKEINT (1U << 0)
  132. #define INTMASK_VWAKEOUT (1U << 0)
  133.  
  134. #define SPI_WRITE(reg, val) \
  135.         { SSITX,        0x00010000 | (((reg) & 0xff) << 8) | ((val) & 0xff) }, \
  136.         { 0, 5 },
  137.  
  138. #define SPI_WRITE1(reg) \
  139.         { SSITX,        (reg) & 0xff }, \
  140.         { 0, 5 },
  141.  
  142. #define SPI_WRITE_S(reg,val) \
  143.         {0x120000,0x130},\
  144.         {0x120004,0x100},\
  145.         {0x120008,0x80000 | (reg)},\
  146.         {0x120008,(val)},\
  147.         {0x120000,0x132}
  148.  
  149. // panel type, 0=unknown, 1=hitachi
  150. static int type=0;
  151. module_param(type, int, S_IRUGO | S_IWUSR | S_IWGRP);
  152.  
  153. struct mddi_table {
  154.         uint32_t reg;
  155.         uint32_t value;
  156. };
  157.  
  158. static struct mddi_table mddi_toshiba_common_init_table[] = {  
  159.         {0x0010801c,0x4bec0066},
  160.         {0x00108020,0x00000113},
  161.         {0x00108024,0x00000000},
  162.         {0x00108028,0x00000001},{1,14},//300},
  163.         {0x0010802c,0x00000001},
  164.         {0x00160004,0x0000a1ef},
  165.         {0x00170000,0x00000000},
  166.         {0x00160000,0x00000000},
  167.         {0x00150000,0x03cf0000},
  168.         {0x00150004,0x000003cf},
  169.         {0x00150028,0x00000000},
  170.         {0x00160008,0x00000001},
  171.         {0x00140008,0x00000060},
  172.         {0x00140000,0x00001388},
  173.         {0x0014001c,0x00000001},
  174.         {0x00140028,0x00000060},
  175.         {0x00140020,0x00001388},
  176.         {0x0014003c,0x00000001},
  177.         {0x00140008,0x000000e0},
  178.         {0x00140028,0x000000e0},
  179.         {0x00140068,0x00000003},{1,1},
  180.  
  181. };
  182.  
  183. static struct mddi_table mddi_sharp_table[] = {
  184.         {0x110008,0},
  185.         {0x110030,0x101},
  186.         {0x11005c,0x1},
  187.         {0x150004,0x3cf},
  188.         {0x150000,0x40004},{1,2},
  189.         {1,0x32},
  190.         {0x120000,0x170},
  191.         {0x120004,0x100},
  192.         {0x120000,0x172},
  193.         SPI_WRITE_S(0x12,1),
  194.         {1,0x12c},
  195.         SPI_WRITE_S(0x13,3),
  196.         {1,0x30},
  197.         {0x110030,1},
  198.         {0x11005c,0x1},
  199.         {0x110008,1},
  200. };
  201.  
  202.  
  203. static struct mddi_table mddi_toshiba_prim_start_table[] = {
  204.         {0x00108044,0x028001e0},
  205.         {0x00108048,0x01e000f0},
  206.         {0x0010804c,0x01e000f0},
  207.         {0x00108050,0x01e000f0},
  208.         {0x00108054,0x00dc00b0},
  209.         {0x00160004,0x0000a1eb},
  210.         {0x00110004,0x00000001},
  211.         {0x0011000c,0x00000008},
  212.         {0x00110030,0x00000001},
  213.         {0x00110020,0x00000000},
  214.         {0x00110034,0x000000f9},
  215.         {0x00110038,0x00000002},
  216.         {0x0011003c,0x00000007},
  217.         {0x00110040,0x000000ef},
  218.         {0x00110044,0x000002ff},
  219.         {0x00110048,0x00000005},
  220.         {0x0011004c,0x00000009},
  221.         {0x00110050,0x0000027f},
  222.         {0x00110008,0x00000001},
  223. };
  224.  
  225. struct spi_table {
  226.         uint16_t reg;
  227.         uint16_t value;
  228.         uint16_t delay;
  229. };
  230. static struct spi_table hitachi_spi_table[] = {
  231.         {2,0},
  232.         {3,0},
  233.         {4,0},
  234.         {0x10,0x250},
  235.         {0x20,2},
  236.         {0x21,0x1a27},
  237.         {0x22,0x3e},
  238.         {0x23,0x7400},
  239.         {0x24,0x7400},
  240.         {0x25,0x6a06},
  241.         {0x26,0x7400},
  242.         {0x27,0x1906},
  243.         {0x28,0x1925},
  244.         {0x29,0x1944},
  245.         {0x2a,0x666},
  246.         {0x100,0x33},
  247.         {0x101,3},
  248.         {0x102,0x3700},
  249.         {0x300,0x6657},
  250.         {0x301,0x515},
  251.         {0x302,0xc113},
  252.         {0x303,0x273},
  253.         {0x304,0x6131},
  254.         {0x305,0xc416},
  255.         {0x501,0xffff},
  256.         {0x502,0xffff},
  257.         {0x503,0xffff},
  258.  
  259.         {0x504,0xff},
  260.         {0x518,0},
  261.         {2,0x200,0xa},
  262.         {1,1,2},
  263.         {2,0x8210,0x14},
  264.         {2,0x8310,0x14},
  265.         {2,0x710,0x14},
  266.         {2,0x1730,0x14},
  267.         {1,0x12,0},
  268.         {1,0x32,0},
  269.         {0x23,0,0x14},
  270.         {1,0x33,0},
  271.         {0x23,0x7400,0},
  272.  
  273.  
  274. };
  275.  
  276. static int client_state=1; // we are booting with the panel on.
  277.  
  278. static void htcdiamond_process_mddi_table(struct msm_mddi_client_data *client_data,
  279.                                      struct mddi_table *table, size_t count)
  280. {
  281.         int i;
  282.         for(i = 0; i < count; i++) {
  283.                 uint32_t reg = table[i].reg;
  284.                 uint32_t value = table[i].value;
  285.                 if (reg == 0)
  286.                         udelay(value);
  287.                 else if (reg == 1)
  288.                         msleep(value);
  289.                 else {
  290.                         client_data->remote_write(client_data, value, reg);
  291.                 }
  292.         }
  293. }
  294.  
  295. static void htcdiamond_process_spi_table(struct msm_mddi_client_data *client_data,
  296.                                           struct spi_table *table, size_t count)
  297. {
  298.         int i;
  299.         mdelay(0x32);
  300.         client_data->remote_write(client_data, 0x170, SSICTL);
  301.         client_data->remote_write(client_data, 0x100, SSITIME);
  302.         client_data->remote_write(client_data, 0x172, SSICTL);
  303.         for(i = 0; i < count; i++) {
  304.                
  305.                 uint16_t reg = table[i].reg;
  306.                 uint16_t value = table[i].value;
  307.                 uint16_t delay = table[i].delay;
  308.                
  309.                 client_data->remote_write(client_data, 0x170, SSICTL);
  310.                 client_data->remote_write(client_data, 0x80010, SSITX);
  311.                 client_data->remote_write(client_data, 0x10000 | reg, SSITX);
  312.                 client_data->remote_write(client_data, 0x172, SSICTL);
  313.                 client_data->remote_write(client_data, 0x170, SSICTL);
  314.                 client_data->remote_write(client_data, 0x80012, SSITX);
  315.                 client_data->remote_write(client_data, 0x10000 | value, SSITX);
  316.                 client_data->remote_write(client_data, 0x172, SSICTL);
  317.  
  318.                 if(delay)
  319.                         msleep(delay);
  320.         }
  321. }
  322.  
  323. extern void  micropklt_lcd_ctrl(int);
  324.  
  325. static void htcdiamond_mddi_power_client(struct msm_mddi_client_data *client_data,
  326.                                     int on)
  327. {
  328.         struct msm_dex_command dex;
  329.         int i;
  330.        
  331.         printk("htcdiamond_mddi_power_client(%d)\n", on);
  332.        
  333.         if(type==0) // don't power up/down if we don't know the panel type
  334.                 return;
  335.         if(on) {
  336.                 msm_gpio_set_function(DEX_GPIO_CFG(RAPH100_LCD_PWR1,0,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  337.                 micropklt_lcd_ctrl(1);
  338.                 dex.cmd=PCOM_PMIC_REG_ON;
  339.                 dex.has_data=1;
  340.                 dex.data=0x800;
  341.                 msm_proc_comm_wince(&dex,0);
  342.                 mdelay(40);
  343.  
  344.                 msm_gpio_set_function(DEX_GPIO_CFG(0x3c,0,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  345.                 msm_gpio_set_function(DEX_GPIO_CFG(0x3d,0,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  346.                 gpio_set_value(0x3d,0);
  347.                 udelay(10);
  348.                 gpio_set_value(0x3d,1);
  349.                 udelay(10);
  350.                 msm_gpio_set_function(DEX_GPIO_CFG(0x3d,0,GPIO_INPUT,GPIO_NO_PULL,GPIO_2MA,0));
  351.                 for(i=0;i<10;i++) {
  352.                         gpio_set_value(0x3c,0);
  353.                         udelay(10);
  354.                         gpio_set_value(0x3c,1);
  355.                         udelay(10);
  356.                 }
  357.                 msm_gpio_set_function(DEX_GPIO_CFG(0x3c,1,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  358.                 msm_gpio_set_function(DEX_GPIO_CFG(0x3d,1,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  359.                 msm_gpio_set_function(DEX_GPIO_CFG(0x1b,1,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,0));
  360.  
  361.                 micropklt_lcd_ctrl(2);
  362.                 dex.data=0x2000;
  363.                 msm_proc_comm_wince(&dex,0);
  364.                 mdelay(50);
  365.                 msm_gpio_set_function(DEX_GPIO_CFG(RAPH100_LCD_PWR2,0,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,1));
  366.                 mdelay(200);
  367.         } else {
  368.                 gpio_set_value(RAPH100_LCD_PWR2, 0);
  369.                 mdelay(1);
  370.                 dex.cmd=PCOM_PMIC_REG_OFF;
  371.                 dex.has_data=1;
  372.                 dex.data=0x2000;
  373.                 msm_proc_comm_wince(&dex,0);
  374.                 mdelay(7);
  375.                 msm_gpio_set_function(DEX_GPIO_CFG(0x1b,0,GPIO_OUTPUT,GPIO_NO_PULL,GPIO_2MA,0));
  376.                 dex.data=0x800;
  377.                 micropklt_lcd_ctrl(5);
  378.                 msm_proc_comm_wince(&dex,0);
  379.                 mdelay(3);
  380.                 gpio_set_value(RAPH100_LCD_PWR1, 0);
  381.                 mdelay(10);
  382.         }
  383.  
  384.        
  385. }
  386. static int htcdiamond_mddi_hitachi_panel_init(
  387.                                              struct msm_mddi_bridge_platform_data *bridge_data,
  388.           struct msm_mddi_client_data *client_data)
  389. {
  390.  
  391.         client_data->auto_hibernate(client_data, 0);
  392.         client_data->remote_write(client_data, 0x40004, GPIODATA);
  393.         mdelay(2);
  394.         htcdiamond_process_spi_table(client_data, hitachi_spi_table,
  395.                                       ARRAY_SIZE(hitachi_spi_table));
  396.         client_data->auto_hibernate(client_data, 1);
  397.  
  398.         return 0;
  399. }
  400.  
  401. //static int htcdiamond_mddi_sharp_panel_init(
  402.         //                                     struct msm_mddi_bridge_platform_data *bridge_data,
  403.        //   struct msm_mddi_client_data *client_data)
  404. //{
  405.  
  406.   //      client_data->auto_hibernate(client_data, 0);
  407.     //    htcdiamond_process_mddi_table(client_data, mddi_sharp_table,
  408.       //                                ARRAY_SIZE( mddi_sharp_table));
  409.         //client_data->auto_hibernate(client_data, 1);
  410.  
  411.         //return 0;
  412. //}
  413.  
  414.  
  415.  
  416. //static int htcdiamond_mddi_toshiba_client_init(
  417. //      struct msm_mddi_bridge_platform_data *bridge_data,
  418. //      struct msm_mddi_client_data *client_data)
  419. //{
  420. //      int panel_id, gpio_val;
  421.  
  422. //      if(client_state)
  423. //              return;
  424. //      printk("htcdiamond_mddi_toshiba_client_init\n");
  425. //      client_data->auto_hibernate(client_data, 0);
  426.  
  427. //      gpio_val = client_data->remote_read(client_data, GPIODATA);
  428. //      panel_id=0;
  429.  
  430. //      if ( (gpio_val & 0x10) != 0 ) panel_id++;
  431. //      if ( (gpio_val & 4) != 0 ) panel_id+=2;
  432.        
  433. //      printk("toshiba GPIODATA=0x%08x panel_id=%d at toshiba_mddi_enable\n", gpio_val, panel_id);
  434. //      if(panel_id==1 && type==0)
  435. //              type=2;
  436. //
  437. //      if(type) {
  438. //              htcdiamond_process_mddi_table(client_data, mddi_toshiba_common_init_table,
  439. //                      ARRAY_SIZE(mddi_toshiba_common_init_table));
  440. //              mdelay(50);
  441. //              htcdiamond_process_mddi_table(client_data, mddi_toshiba_prim_start_table,
  442. //                                              ARRAY_SIZE(mddi_toshiba_prim_start_table));
  443. /*
  444.                 switch(type) {
  445.                         case 0:
  446.                                 printk("unknown panel\n");
  447.                                 break;
  448.                         case 1:
  449.                                 printk("init hitachi panel on toshiba client\n");
  450.                                 htcdiamond_mddi_hitachi_panel_init(bridge_data,client_data);
  451.                                 break;
  452.                         case 2:
  453.                                 printk("init sharp panel on toshiba client\n");
  454.                                 htcdiamond_mddi_sharp_panel_init(bridge_data,client_data);
  455.                                 break;
  456.                         default:
  457.                                 printk("unknown panel_id: %d\n", type);
  458.                 };
  459. */
  460.         //}
  461.         //client_state=1;
  462.  
  463.  
  464.         //client_data->auto_hibernate(client_data, 1);
  465.         //return 0;
  466. //}
  467.  
  468. static int htcdiamond_mddi_toshiba_client_uninit(
  469.         struct msm_mddi_bridge_platform_data *bridge_data,
  470.         struct msm_mddi_client_data *client_data)
  471. {
  472.         client_state=0;
  473.         return 0;
  474. }
  475.  
  476. static int htcdiamond_mddi_panel_unblank(
  477.         struct msm_mddi_bridge_platform_data *bridge_data,
  478.         struct msm_mddi_client_data *client_data)
  479. {
  480.         client_data->auto_hibernate(client_data, 0);
  481. //      if(type)
  482. //              htcdiamond_process_mddi_table(client_data, mddi_toshiba_prim_start_table,
  483. //                                      ARRAY_SIZE(mddi_toshiba_prim_start_table));
  484. //      switch(type) {
  485. //              case 0:
  486. //                      printk("unknown panel\n");
  487. //                      break;
  488. //              case 1:
  489. //                      printk("init hitachi panel on toshiba client\n");
  490. //                      htcdiamond_mddi_hitachi_panel_init(bridge_data,client_data);
  491. //                      break;
  492. //              case 2:
  493. //                      printk("init sharp panel on toshiba client\n");
  494. //                      htcdiamond_mddi_sharp_panel_init(bridge_data,client_data);
  495. //                      break;
  496. //              default:
  497. //                      printk("unknown panel_id: %d\n", type);
  498. //      };
  499.         client_data->auto_hibernate(client_data, 1);
  500. //        client_data->remote_write(client_data, GPIOSEL_VWAKEINT, GPIOSEL);
  501. //      client_data->remote_write(client_data, INTMASK_VWAKEOUT, INTMASK);
  502.  
  503.         return 0;
  504.  
  505. }
  506.  
  507. static int htcdiamond_mddi_panel_blank(
  508.         struct msm_mddi_bridge_platform_data *bridge_data,
  509.         struct msm_mddi_client_data *client_data)
  510. {
  511.         // not used
  512.         return 0;
  513. }
  514.  
  515. extern struct resource resources_msm_fb[];
  516.  
  517. static struct msm_mddi_bridge_platform_data toshiba_client_data = {
  518.         //.init = htcdiamond_mddi_toshiba_client_init,
  519.         .uninit = htcdiamond_mddi_toshiba_client_uninit,
  520.         .blank = htcdiamond_mddi_panel_blank,
  521.         .unblank = htcdiamond_mddi_panel_unblank,
  522.         .fb_data = {
  523.                 .xres = 240,
  524.                 .yres = 400,
  525.                 .output_format = 0,
  526.         },
  527. };
  528.  
  529.  
  530. static struct msm_mddi_platform_data mddi_pdata = {
  531.         .clk_rate = 122880000,
  532.         .power_client = htcdiamond_mddi_power_client,
  533.         .fb_resource = resources_msm_fb,
  534.         .num_clients = 1,
  535.         .client_platform_data = {
  536.                 {
  537.                         .product_id = (0xd263 << 16 | 0),
  538.                         .name = "TC358720XBG",
  539.                         .id = 0,
  540.                         .client_data = &toshiba_client_data,
  541.                         .clk_rate = 0,
  542.                 },
  543.         },
  544. };
  545.  
  546. int __init htcdiamond_init_panel(void)
  547. {
  548.         int rc;
  549.        
  550.         if(!machine_is_htcdiamond()) {
  551.                 printk("Disabling Diamond Panel\n");
  552.                 return 0;
  553.         }
  554.         printk(KERN_INFO "%s: Initializing panel\n", __func__);
  555.  
  556.         if (!machine_is_htcdiamond() && !machine_is_htcdiamond_cdma() && !machine_is_htcdiamond() && !machine_is_htcdiamond_cdma()) {
  557.                 printk(KERN_INFO "%s: panel does not apply to this device, aborted\n", __func__);
  558.                 return 0;
  559.         }
  560.  
  561.         rc = platform_device_register(&msm_device_mdp);
  562.         if (rc)
  563.                 return rc;
  564.         msm_device_mddi0.dev.platform_data = &mddi_pdata;
  565.         return platform_device_register(&msm_device_mddi0);
  566. }
  567.  
  568. device_initcall(htcdiamond_init_panel);