aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/via/dvi.c6
-rw-r--r--drivers/video/via/lcd.c6
-rw-r--r--drivers/video/via/via_i2c.c64
-rw-r--r--drivers/video/via/viafbdev.c35
-rw-r--r--drivers/video/via/viafbdev.h19
-rw-r--r--drivers/video/via/vt1636.c4
6 files changed, 69 insertions, 65 deletions
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index d6965447ca69..c5c32b6b6e6c 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -160,7 +160,7 @@ int viafb_tmds_trasmitter_identify(void)
160 160
161static void tmds_register_write(int index, u8 data) 161static void tmds_register_write(int index, u8 data)
162{ 162{
163 viaparinfo->i2c_stuff.i2c_port = 163 viaparinfo->shared->i2c_stuff.i2c_port =
164 viaparinfo->chip_info->tmds_chip_info.i2c_port; 164 viaparinfo->chip_info->tmds_chip_info.i2c_port;
165 165
166 viafb_i2c_writebyte(viaparinfo->chip_info->tmds_chip_info. 166 viafb_i2c_writebyte(viaparinfo->chip_info->tmds_chip_info.
@@ -172,7 +172,7 @@ static int tmds_register_read(int index)
172{ 172{
173 u8 data; 173 u8 data;
174 174
175 viaparinfo->i2c_stuff.i2c_port = 175 viaparinfo->shared->i2c_stuff.i2c_port =
176 viaparinfo->chip_info->tmds_chip_info.i2c_port; 176 viaparinfo->chip_info->tmds_chip_info.i2c_port;
177 viafb_i2c_readbyte((u8) viaparinfo->chip_info-> 177 viafb_i2c_readbyte((u8) viaparinfo->chip_info->
178 tmds_chip_info.tmds_chip_slave_addr, 178 tmds_chip_info.tmds_chip_slave_addr,
@@ -182,7 +182,7 @@ static int tmds_register_read(int index)
182 182
183static int tmds_register_read_bytes(int index, u8 *buff, int buff_len) 183static int tmds_register_read_bytes(int index, u8 *buff, int buff_len)
184{ 184{
185 viaparinfo->i2c_stuff.i2c_port = 185 viaparinfo->shared->i2c_stuff.i2c_port =
186 viaparinfo->chip_info->tmds_chip_info.i2c_port; 186 viaparinfo->chip_info->tmds_chip_info.i2c_port;
187 viafb_i2c_readbytes((u8) viaparinfo->chip_info->tmds_chip_info. 187 viafb_i2c_readbytes((u8) viaparinfo->chip_info->tmds_chip_info.
188 tmds_chip_slave_addr, (u8) index, buff, buff_len); 188 tmds_chip_slave_addr, (u8) index, buff, buff_len);
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 78c6b3387947..144d34bdf0ac 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -207,13 +207,13 @@ static bool lvds_identify_integratedlvds(void)
207 207
208int viafb_lvds_trasmitter_identify(void) 208int viafb_lvds_trasmitter_identify(void)
209{ 209{
210 viaparinfo->i2c_stuff.i2c_port = I2CPORTINDEX; 210 viaparinfo->shared->i2c_stuff.i2c_port = I2CPORTINDEX;
211 if (viafb_lvds_identify_vt1636()) { 211 if (viafb_lvds_identify_vt1636()) {
212 viaparinfo->chip_info->lvds_chip_info.i2c_port = I2CPORTINDEX; 212 viaparinfo->chip_info->lvds_chip_info.i2c_port = I2CPORTINDEX;
213 DEBUG_MSG(KERN_INFO 213 DEBUG_MSG(KERN_INFO
214 "Found VIA VT1636 LVDS on port i2c 0x31 \n"); 214 "Found VIA VT1636 LVDS on port i2c 0x31 \n");
215 } else { 215 } else {
216 viaparinfo->i2c_stuff.i2c_port = GPIOPORTINDEX; 216 viaparinfo->shared->i2c_stuff.i2c_port = GPIOPORTINDEX;
217 if (viafb_lvds_identify_vt1636()) { 217 if (viafb_lvds_identify_vt1636()) {
218 viaparinfo->chip_info->lvds_chip_info.i2c_port = 218 viaparinfo->chip_info->lvds_chip_info.i2c_port =
219 GPIOPORTINDEX; 219 GPIOPORTINDEX;
@@ -470,7 +470,7 @@ static int lvds_register_read(int index)
470{ 470{
471 u8 data; 471 u8 data;
472 472
473 viaparinfo->i2c_stuff.i2c_port = GPIOPORTINDEX; 473 viaparinfo->shared->i2c_stuff.i2c_port = GPIOPORTINDEX;
474 viafb_i2c_readbyte((u8) viaparinfo->chip_info-> 474 viafb_i2c_readbyte((u8) viaparinfo->chip_info->
475 lvds_chip_info.lvds_chip_slave_addr, 475 lvds_chip_info.lvds_chip_slave_addr,
476 (u8) index, &data); 476 (u8) index, &data);
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c
index 0f3ed4eb236d..15543e968248 100644
--- a/drivers/video/via/via_i2c.c
+++ b/drivers/video/via/via_i2c.c
@@ -97,7 +97,7 @@ int viafb_i2c_readbyte(u8 slave_addr, u8 index, u8 *pdata)
97 mm1[0] = index; 97 mm1[0] = index;
98 msgs[0].len = 1; msgs[1].len = 1; 98 msgs[0].len = 1; msgs[1].len = 1;
99 msgs[0].buf = mm1; msgs[1].buf = pdata; 99 msgs[0].buf = mm1; msgs[1].buf = pdata;
100 i2c_transfer(&viaparinfo->i2c_stuff.adapter, msgs, 2); 100 i2c_transfer(&viaparinfo->shared->i2c_stuff.adapter, msgs, 2);
101 101
102 return 0; 102 return 0;
103} 103}
@@ -111,7 +111,7 @@ int viafb_i2c_writebyte(u8 slave_addr, u8 index, u8 data)
111 msgs.addr = slave_addr / 2; 111 msgs.addr = slave_addr / 2;
112 msgs.len = 2; 112 msgs.len = 2;
113 msgs.buf = msg; 113 msgs.buf = msg;
114 return i2c_transfer(&viaparinfo->i2c_stuff.adapter, &msgs, 1); 114 return i2c_transfer(&viaparinfo->shared->i2c_stuff.adapter, &msgs, 1);
115} 115}
116 116
117int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len) 117int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len)
@@ -125,53 +125,53 @@ int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len)
125 mm1[0] = index; 125 mm1[0] = index;
126 msgs[0].len = 1; msgs[1].len = buff_len; 126 msgs[0].len = 1; msgs[1].len = buff_len;
127 msgs[0].buf = mm1; msgs[1].buf = buff; 127 msgs[0].buf = mm1; msgs[1].buf = buff;
128 i2c_transfer(&viaparinfo->i2c_stuff.adapter, msgs, 2); 128 i2c_transfer(&viaparinfo->shared->i2c_stuff.adapter, msgs, 2);
129 return 0; 129 return 0;
130} 130}
131 131
132int viafb_create_i2c_bus(void *viapar) 132int viafb_create_i2c_bus(void *viapar)
133{ 133{
134 int ret; 134 int ret;
135 struct viafb_par *par = (struct viafb_par *)viapar; 135 struct via_i2c_stuff *i2c_stuff =
136 136 &((struct viafb_par *)viapar)->shared->i2c_stuff;
137 strcpy(par->i2c_stuff.adapter.name, "via_i2c"); 137
138 par->i2c_stuff.i2c_port = 0x0; 138 strcpy(i2c_stuff->adapter.name, "via_i2c");
139 par->i2c_stuff.adapter.owner = THIS_MODULE; 139 i2c_stuff->i2c_port = 0x0;
140 par->i2c_stuff.adapter.id = 0x01FFFF; 140 i2c_stuff->adapter.owner = THIS_MODULE;
141 par->i2c_stuff.adapter.class = 0; 141 i2c_stuff->adapter.id = 0x01FFFF;
142 par->i2c_stuff.adapter.algo_data = &par->i2c_stuff.algo; 142 i2c_stuff->adapter.class = 0;
143 par->i2c_stuff.adapter.dev.parent = NULL; 143 i2c_stuff->adapter.algo_data = &i2c_stuff->algo;
144 par->i2c_stuff.algo.setsda = via_i2c_setsda; 144 i2c_stuff->adapter.dev.parent = NULL;
145 par->i2c_stuff.algo.setscl = via_i2c_setscl; 145 i2c_stuff->algo.setsda = via_i2c_setsda;
146 par->i2c_stuff.algo.getsda = via_i2c_getsda; 146 i2c_stuff->algo.setscl = via_i2c_setscl;
147 par->i2c_stuff.algo.getscl = via_i2c_getscl; 147 i2c_stuff->algo.getsda = via_i2c_getsda;
148 par->i2c_stuff.algo.udelay = 40; 148 i2c_stuff->algo.getscl = via_i2c_getscl;
149 par->i2c_stuff.algo.timeout = 20; 149 i2c_stuff->algo.udelay = 40;
150 par->i2c_stuff.algo.data = &par->i2c_stuff; 150 i2c_stuff->algo.timeout = 20;
151 151 i2c_stuff->algo.data = i2c_stuff;
152 i2c_set_adapdata(&par->i2c_stuff.adapter, &par->i2c_stuff); 152
153 i2c_set_adapdata(&i2c_stuff->adapter, i2c_stuff);
153 154
154 /* Raise SCL and SDA */ 155 /* Raise SCL and SDA */
155 par->i2c_stuff.i2c_port = I2CPORTINDEX; 156 i2c_stuff->i2c_port = I2CPORTINDEX;
156 via_i2c_setsda(&par->i2c_stuff, 1); 157 via_i2c_setsda(i2c_stuff, 1);
157 via_i2c_setscl(&par->i2c_stuff, 1); 158 via_i2c_setscl(i2c_stuff, 1);
158 159
159 par->i2c_stuff.i2c_port = GPIOPORTINDEX; 160 i2c_stuff->i2c_port = GPIOPORTINDEX;
160 via_i2c_setsda(&par->i2c_stuff, 1); 161 via_i2c_setsda(i2c_stuff, 1);
161 via_i2c_setscl(&par->i2c_stuff, 1); 162 via_i2c_setscl(i2c_stuff, 1);
162 udelay(20); 163 udelay(20);
163 164
164 ret = i2c_bit_add_bus(&par->i2c_stuff.adapter); 165 ret = i2c_bit_add_bus(&i2c_stuff->adapter);
165 if (ret == 0) 166 if (ret == 0)
166 DEBUG_MSG("I2C bus %s registered.\n", 167 DEBUG_MSG("I2C bus %s registered.\n", i2c_stuff->adapter.name);
167 par->i2c_stuff.adapter.name);
168 else 168 else
169 DEBUG_MSG("Failed to register I2C bus %s.\n", 169 DEBUG_MSG("Failed to register I2C bus %s.\n",
170 par->i2c_stuff.adapter.name); 170 i2c_stuff->adapter.name);
171 return ret; 171 return ret;
172} 172}
173 173
174void viafb_delete_i2c_buss(void *par) 174void viafb_delete_i2c_buss(void *par)
175{ 175{
176 i2c_del_adapter(&((struct viafb_par *)par)->i2c_stuff.adapter); 176 i2c_del_adapter(&((struct viafb_par *)par)->shared->i2c_stuff.adapter);
177} 177}
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index a17e138c92b3..4a8853a07602 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1943,40 +1943,30 @@ static int __devinit via_pci_probe(void)
1943 char *tmpc, *tmpm; 1943 char *tmpc, *tmpm;
1944 char *tmpc_sec, *tmpm_sec; 1944 char *tmpc_sec, *tmpm_sec;
1945 int vmode_index; 1945 int vmode_index;
1946 u32 tmds_length, lvds_length, crt_length, chip_length, viafb_par_length; 1946 u32 viafb_par_length;
1947 1947
1948 DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n"); 1948 DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n");
1949 1949
1950 viafb_par_length = ALIGN(sizeof(struct viafb_par), BITS_PER_LONG/8); 1950 viafb_par_length = ALIGN(sizeof(struct viafb_par), BITS_PER_LONG/8);
1951 tmds_length = ALIGN(sizeof(struct tmds_setting_information),
1952 BITS_PER_LONG/8);
1953 lvds_length = ALIGN(sizeof(struct lvds_setting_information),
1954 BITS_PER_LONG/8);
1955 crt_length = ALIGN(sizeof(struct lvds_setting_information),
1956 BITS_PER_LONG/8);
1957 chip_length = ALIGN(sizeof(struct chip_information), BITS_PER_LONG/8);
1958 1951
1959 /* Allocate fb_info and ***_par here, also including some other needed 1952 /* Allocate fb_info and ***_par here, also including some other needed
1960 * variables 1953 * variables
1961 */ 1954 */
1962 viafbinfo = framebuffer_alloc(viafb_par_length + 2 * lvds_length + 1955 viafbinfo = framebuffer_alloc(viafb_par_length +
1963 tmds_length + crt_length + chip_length, NULL); 1956 ALIGN(sizeof(struct viafb_shared), BITS_PER_LONG/8), NULL);
1964 if (!viafbinfo) { 1957 if (!viafbinfo) {
1965 printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); 1958 printk(KERN_ERR"Could not allocate memory for viafb_info.\n");
1966 return -ENODEV; 1959 return -ENODEV;
1967 } 1960 }
1968 1961
1969 viaparinfo = (struct viafb_par *)viafbinfo->par; 1962 viaparinfo = (struct viafb_par *)viafbinfo->par;
1970 viaparinfo->tmds_setting_info = (struct tmds_setting_information *) 1963 viaparinfo->shared = viafbinfo->par + viafb_par_length;
1971 ((unsigned long)viaparinfo + viafb_par_length); 1964 viaparinfo->tmds_setting_info = &viaparinfo->shared->tmds_setting_info;
1972 viaparinfo->lvds_setting_info = (struct lvds_setting_information *) 1965 viaparinfo->lvds_setting_info = &viaparinfo->shared->lvds_setting_info;
1973 ((unsigned long)viaparinfo->tmds_setting_info + tmds_length); 1966 viaparinfo->lvds_setting_info2 =
1974 viaparinfo->lvds_setting_info2 = (struct lvds_setting_information *) 1967 &viaparinfo->shared->lvds_setting_info2;
1975 ((unsigned long)viaparinfo->lvds_setting_info + lvds_length); 1968 viaparinfo->crt_setting_info = &viaparinfo->shared->crt_setting_info;
1976 viaparinfo->crt_setting_info = (struct crt_setting_information *) 1969 viaparinfo->chip_info = &viaparinfo->shared->chip_info;
1977 ((unsigned long)viaparinfo->lvds_setting_info2 + lvds_length);
1978 viaparinfo->chip_info = (struct chip_information *)
1979 ((unsigned long)viaparinfo->crt_setting_info + crt_length);
1980 1970
1981 if (viafb_dual_fb) 1971 if (viafb_dual_fb)
1982 viafb_SAMM_ON = 1; 1972 viafb_SAMM_ON = 1;
@@ -2142,6 +2132,7 @@ static int __devinit via_pci_probe(void)
2142 viaparinfo->iga_path = IGA1; 2132 viaparinfo->iga_path = IGA1;
2143 viaparinfo1->iga_path = IGA2; 2133 viaparinfo1->iga_path = IGA2;
2144 memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info)); 2134 memcpy(viafbinfo1, viafbinfo, sizeof(struct fb_info));
2135 viafbinfo1->par = viaparinfo1;
2145 viafbinfo1->screen_base = viafbinfo->screen_base + 2136 viafbinfo1->screen_base = viafbinfo->screen_base +
2146 viafb_second_offset; 2137 viafb_second_offset;
2147 2138
@@ -2193,7 +2184,7 @@ static int __devinit via_pci_probe(void)
2193 viafbinfo->node, viafbinfo->fix.id, default_var.xres, 2184 viafbinfo->node, viafbinfo->fix.id, default_var.xres,
2194 default_var.yres, default_var.bits_per_pixel); 2185 default_var.yres, default_var.bits_per_pixel);
2195 2186
2196 viafb_init_proc(&viaparinfo->proc_entry); 2187 viafb_init_proc(&viaparinfo->shared->proc_entry);
2197 viafb_init_dac(IGA2); 2188 viafb_init_dac(IGA2);
2198 return 0; 2189 return 0;
2199} 2190}
@@ -2214,7 +2205,7 @@ static void __devexit via_pci_remove(void)
2214 if (viafb_dual_fb) 2205 if (viafb_dual_fb)
2215 framebuffer_release(viafbinfo1); 2206 framebuffer_release(viafbinfo1);
2216 2207
2217 viafb_remove_proc(viaparinfo->proc_entry); 2208 viafb_remove_proc(viaparinfo->shared->proc_entry);
2218} 2209}
2219 2210
2220#ifndef MODULE 2211#ifndef MODULE
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index 2763922bbe4f..1d1fe35feaa7 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -37,6 +37,20 @@
37#define VERSION_OS 0 /* 0: for 32 bits OS, 1: for 64 bits OS */ 37#define VERSION_OS 0 /* 0: for 32 bits OS, 1: for 64 bits OS */
38#define VERSION_MINOR 4 38#define VERSION_MINOR 4
39 39
40struct viafb_shared {
41 struct proc_dir_entry *proc_entry; /*viafb proc entry */
42
43 /* I2C stuff */
44 struct via_i2c_stuff i2c_stuff;
45
46 /* All the information will be needed to set engine */
47 struct tmds_setting_information tmds_setting_info;
48 struct crt_setting_information crt_setting_info;
49 struct lvds_setting_information lvds_setting_info;
50 struct lvds_setting_information lvds_setting_info2;
51 struct chip_information chip_info;
52};
53
40struct viafb_par { 54struct viafb_par {
41 void __iomem *io_virt; /*iospace virtual memory address */ 55 void __iomem *io_virt; /*iospace virtual memory address */
42 unsigned int fbmem; /*framebuffer physical memory address */ 56 unsigned int fbmem; /*framebuffer physical memory address */
@@ -47,12 +61,11 @@ struct viafb_par {
47 u32 VQ_start; /* Virtual Queue Start Address */ 61 u32 VQ_start; /* Virtual Queue Start Address */
48 u32 VQ_end; /* Virtual Queue End Address */ 62 u32 VQ_end; /* Virtual Queue End Address */
49 u32 iga_path; 63 u32 iga_path;
50 struct proc_dir_entry *proc_entry; /*viafb proc entry */
51 64
52 /* I2C stuff */ 65 struct viafb_shared *shared;
53 struct via_i2c_stuff i2c_stuff;
54 66
55 /* All the information will be needed to set engine */ 67 /* All the information will be needed to set engine */
68 /* depreciated, use the ones in shared directly */
56 struct tmds_setting_information *tmds_setting_info; 69 struct tmds_setting_information *tmds_setting_info;
57 struct crt_setting_information *crt_setting_info; 70 struct crt_setting_information *crt_setting_info;
58 struct lvds_setting_information *lvds_setting_info; 71 struct lvds_setting_information *lvds_setting_info;
diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c
index 322a9f993550..a6b37494e79a 100644
--- a/drivers/video/via/vt1636.c
+++ b/drivers/video/via/vt1636.c
@@ -27,7 +27,7 @@ u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information
27{ 27{
28 u8 data; 28 u8 data;
29 29
30 viaparinfo->i2c_stuff.i2c_port = plvds_chip_info->i2c_port; 30 viaparinfo->shared->i2c_stuff.i2c_port = plvds_chip_info->i2c_port;
31 viafb_i2c_readbyte(plvds_chip_info->lvds_chip_slave_addr, index, &data); 31 viafb_i2c_readbyte(plvds_chip_info->lvds_chip_slave_addr, index, &data);
32 32
33 return data; 33 return data;
@@ -39,7 +39,7 @@ void viafb_gpio_i2c_write_mask_lvds(struct lvds_setting_information
39{ 39{
40 int index, data; 40 int index, data;
41 41
42 viaparinfo->i2c_stuff.i2c_port = plvds_chip_info->i2c_port; 42 viaparinfo->shared->i2c_stuff.i2c_port = plvds_chip_info->i2c_port;
43 43
44 index = io_data.Index; 44 index = io_data.Index;
45 data = viafb_gpio_i2c_read_lvds(plvds_setting_info, plvds_chip_info, 45 data = viafb_gpio_i2c_read_lvds(plvds_setting_info, plvds_chip_info,