aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/vt1636.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/via/vt1636.c')
-rw-r--r--drivers/video/via/vt1636.c121
1 files changed, 41 insertions, 80 deletions
diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c
index d65bf1aee87c..60e4192c2b34 100644
--- a/drivers/video/via/vt1636.c
+++ b/drivers/video/via/vt1636.c
@@ -23,6 +23,34 @@
23#include <linux/via_i2c.h> 23#include <linux/via_i2c.h>
24#include "global.h" 24#include "global.h"
25 25
26static const struct IODATA common_init_data[] = {
27/* Index, Mask, Value */
28 /* Set panel power sequence timing */
29 {0x10, 0xC0, 0x00},
30 /* T1: VDD on - Data on. Each increment is 1 ms. (50ms = 031h) */
31 {0x0B, 0xFF, 0x40},
32 /* T2: Data on - Backlight on. Each increment is 2 ms. (210ms = 068h) */
33 {0x0C, 0xFF, 0x31},
34 /* T3: Backlight off -Data off. Each increment is 2 ms. (210ms = 068h)*/
35 {0x0D, 0xFF, 0x31},
36 /* T4: Data off - VDD off. Each increment is 1 ms. (50ms = 031h) */
37 {0x0E, 0xFF, 0x68},
38 /* T5: VDD off - VDD on. Each increment is 100 ms. (500ms = 04h) */
39 {0x0F, 0xFF, 0x68},
40 /* LVDS output power up */
41 {0x09, 0xA0, 0xA0},
42 /* turn on back light */
43 {0x10, 0x33, 0x13}
44};
45
46/* Index, Mask, Value */
47static const struct IODATA dual_channel_enable_data = {0x08, 0xF0, 0xE0};
48static const struct IODATA single_channel_enable_data = {0x08, 0xF0, 0x00};
49static const struct IODATA dithering_enable_data = {0x0A, 0x70, 0x50};
50static const struct IODATA dithering_disable_data = {0x0A, 0x70, 0x00};
51static const struct IODATA vdd_on_data = {0x10, 0x20, 0x20};
52static const struct IODATA vdd_off_data = {0x10, 0x20, 0x00};
53
26u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information 54u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information
27 *plvds_setting_info, struct lvds_chip_information *plvds_chip_info, 55 *plvds_setting_info, struct lvds_chip_information *plvds_chip_info,
28 u8 index) 56 u8 index)
@@ -55,108 +83,41 @@ void viafb_init_lvds_vt1636(struct lvds_setting_information
55 int reg_num, i; 83 int reg_num, i;
56 84
57 /* Common settings: */ 85 /* Common settings: */
58 reg_num = ARRAY_SIZE(COMMON_INIT_TBL_VT1636); 86 reg_num = ARRAY_SIZE(common_init_data);
59 87 for (i = 0; i < reg_num; i++)
60 for (i = 0; i < reg_num; i++) {
61 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, 88 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info,
62 plvds_chip_info, 89 plvds_chip_info, common_init_data[i]);
63 COMMON_INIT_TBL_VT1636[i]);
64 }
65 90
66 /* Input Data Mode Select */ 91 /* Input Data Mode Select */
67 if (plvds_setting_info->device_lcd_dualedge) { 92 if (plvds_setting_info->device_lcd_dualedge)
68 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, 93 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info,
69 plvds_chip_info, 94 plvds_chip_info, dual_channel_enable_data);
70 DUAL_CHANNEL_ENABLE_TBL_VT1636[0]); 95 else
71 } else {
72 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, 96 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info,
73 plvds_chip_info, 97 plvds_chip_info, single_channel_enable_data);
74 SINGLE_CHANNEL_ENABLE_TBL_VT1636[0]);
75 }
76 98
77 if (plvds_setting_info->LCDDithering) { 99 if (plvds_setting_info->LCDDithering)
78 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, 100 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info,
79 plvds_chip_info, 101 plvds_chip_info, dithering_enable_data);
80 DITHERING_ENABLE_TBL_VT1636[0]); 102 else
81 } else {
82 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, 103 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info,
83 plvds_chip_info, 104 plvds_chip_info, dithering_disable_data);
84 DITHERING_DISABLE_TBL_VT1636[0]);
85 }
86} 105}
87 106
88void viafb_enable_lvds_vt1636(struct lvds_setting_information 107void viafb_enable_lvds_vt1636(struct lvds_setting_information
89 *plvds_setting_info, 108 *plvds_setting_info,
90 struct lvds_chip_information *plvds_chip_info) 109 struct lvds_chip_information *plvds_chip_info)
91{ 110{
92
93 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, plvds_chip_info, 111 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, plvds_chip_info,
94 VDD_ON_TBL_VT1636[0]); 112 vdd_on_data);
95
96 /* Pad on: */
97 switch (plvds_chip_info->output_interface) {
98 case INTERFACE_DVP0:
99 {
100 viafb_write_reg_mask(SR1E, VIASR, 0xC0, 0xC0);
101 break;
102 }
103
104 case INTERFACE_DVP1:
105 {
106 viafb_write_reg_mask(SR1E, VIASR, 0x30, 0x30);
107 break;
108 }
109
110 case INTERFACE_DFP_LOW:
111 {
112 viafb_write_reg_mask(SR2A, VIASR, 0x03, 0x03);
113 break;
114 }
115
116 case INTERFACE_DFP_HIGH:
117 {
118 viafb_write_reg_mask(SR2A, VIASR, 0x03, 0x0C);
119 break;
120 }
121
122 }
123} 113}
124 114
125void viafb_disable_lvds_vt1636(struct lvds_setting_information 115void viafb_disable_lvds_vt1636(struct lvds_setting_information
126 *plvds_setting_info, 116 *plvds_setting_info,
127 struct lvds_chip_information *plvds_chip_info) 117 struct lvds_chip_information *plvds_chip_info)
128{ 118{
129
130 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, plvds_chip_info, 119 viafb_gpio_i2c_write_mask_lvds(plvds_setting_info, plvds_chip_info,
131 VDD_OFF_TBL_VT1636[0]); 120 vdd_off_data);
132
133 /* Pad off: */
134 switch (plvds_chip_info->output_interface) {
135 case INTERFACE_DVP0:
136 {
137 viafb_write_reg_mask(SR1E, VIASR, 0x00, 0xC0);
138 break;
139 }
140
141 case INTERFACE_DVP1:
142 {
143 viafb_write_reg_mask(SR1E, VIASR, 0x00, 0x30);
144 break;
145 }
146
147 case INTERFACE_DFP_LOW:
148 {
149 viafb_write_reg_mask(SR2A, VIASR, 0x00, 0x03);
150 break;
151 }
152
153 case INTERFACE_DFP_HIGH:
154 {
155 viafb_write_reg_mask(SR2A, VIASR, 0x00, 0x0C);
156 break;
157 }
158
159 }
160} 121}
161 122
162bool viafb_lvds_identify_vt1636(u8 i2c_adapter) 123bool viafb_lvds_identify_vt1636(u8 i2c_adapter)