aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/savage
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/savage')
-rw-r--r--drivers/video/savage/savagefb-i2c.c43
-rw-r--r--drivers/video/savage/savagefb_accel.c8
-rw-r--r--drivers/video/savage/savagefb_driver.c33
3 files changed, 35 insertions, 49 deletions
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index aeec437104eb..00719a91479f 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -49,7 +49,7 @@
49 49
50static void savage4_gpio_setscl(void *data, int val) 50static void savage4_gpio_setscl(void *data, int val)
51{ 51{
52 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 52 struct savagefb_i2c_chan *chan = data;
53 unsigned int r; 53 unsigned int r;
54 54
55 r = readl(chan->ioaddr + chan->reg); 55 r = readl(chan->ioaddr + chan->reg);
@@ -63,7 +63,7 @@ static void savage4_gpio_setscl(void *data, int val)
63 63
64static void savage4_gpio_setsda(void *data, int val) 64static void savage4_gpio_setsda(void *data, int val)
65{ 65{
66 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 66 struct savagefb_i2c_chan *chan = data;
67 67
68 unsigned int r; 68 unsigned int r;
69 r = readl(chan->ioaddr + chan->reg); 69 r = readl(chan->ioaddr + chan->reg);
@@ -77,21 +77,21 @@ static void savage4_gpio_setsda(void *data, int val)
77 77
78static int savage4_gpio_getscl(void *data) 78static int savage4_gpio_getscl(void *data)
79{ 79{
80 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 80 struct savagefb_i2c_chan *chan = data;
81 81
82 return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); 82 return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN));
83} 83}
84 84
85static int savage4_gpio_getsda(void *data) 85static int savage4_gpio_getsda(void *data)
86{ 86{
87 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 87 struct savagefb_i2c_chan *chan = data;
88 88
89 return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); 89 return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN));
90} 90}
91 91
92static void prosavage_gpio_setscl(void* data, int val) 92static void prosavage_gpio_setscl(void* data, int val)
93{ 93{
94 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 94 struct savagefb_i2c_chan *chan = data;
95 u32 r; 95 u32 r;
96 96
97 SET_CR_IX(chan->ioaddr, chan->reg); 97 SET_CR_IX(chan->ioaddr, chan->reg);
@@ -107,7 +107,7 @@ static void prosavage_gpio_setscl(void* data, int val)
107 107
108static void prosavage_gpio_setsda(void* data, int val) 108static void prosavage_gpio_setsda(void* data, int val)
109{ 109{
110 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 110 struct savagefb_i2c_chan *chan = data;
111 unsigned int r; 111 unsigned int r;
112 112
113 SET_CR_IX(chan->ioaddr, chan->reg); 113 SET_CR_IX(chan->ioaddr, chan->reg);
@@ -123,7 +123,7 @@ static void prosavage_gpio_setsda(void* data, int val)
123 123
124static int prosavage_gpio_getscl(void* data) 124static int prosavage_gpio_getscl(void* data)
125{ 125{
126 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 126 struct savagefb_i2c_chan *chan = data;
127 127
128 SET_CR_IX(chan->ioaddr, chan->reg); 128 SET_CR_IX(chan->ioaddr, chan->reg);
129 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); 129 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN));
@@ -131,7 +131,7 @@ static int prosavage_gpio_getscl(void* data)
131 131
132static int prosavage_gpio_getsda(void* data) 132static int prosavage_gpio_getsda(void* data)
133{ 133{
134 struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; 134 struct savagefb_i2c_chan *chan = data;
135 135
136 SET_CR_IX(chan->ioaddr, chan->reg); 136 SET_CR_IX(chan->ioaddr, chan->reg);
137 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); 137 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN));
@@ -140,10 +140,9 @@ static int prosavage_gpio_getsda(void* data)
140static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, 140static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
141 const char *name) 141 const char *name)
142{ 142{
143 int (*add_bus)(struct i2c_adapter *) = symbol_get(i2c_bit_add_bus);
144 int rc = 0; 143 int rc = 0;
145 144
146 if (add_bus && chan->par) { 145 if (chan->par) {
147 strcpy(chan->adapter.name, name); 146 strcpy(chan->adapter.name, name);
148 chan->adapter.owner = THIS_MODULE; 147 chan->adapter.owner = THIS_MODULE;
149 chan->adapter.id = I2C_HW_B_SAVAGE; 148 chan->adapter.id = I2C_HW_B_SAVAGE;
@@ -161,7 +160,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
161 chan->algo.setscl(chan, 1); 160 chan->algo.setscl(chan, 1);
162 udelay(20); 161 udelay(20);
163 162
164 rc = add_bus(&chan->adapter); 163 rc = i2c_bit_add_bus(&chan->adapter);
165 164
166 if (rc == 0) 165 if (rc == 0)
167 dev_dbg(&chan->par->pcidev->dev, 166 dev_dbg(&chan->par->pcidev->dev,
@@ -169,8 +168,6 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
169 else 168 else
170 dev_warn(&chan->par->pcidev->dev, 169 dev_warn(&chan->par->pcidev->dev,
171 "Failed to register I2C bus %s.\n", name); 170 "Failed to register I2C bus %s.\n", name);
172
173 symbol_put(i2c_bit_add_bus);
174 } else 171 } else
175 chan->par = NULL; 172 chan->par = NULL;
176 173
@@ -179,7 +176,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
179 176
180void savagefb_create_i2c_busses(struct fb_info *info) 177void savagefb_create_i2c_busses(struct fb_info *info)
181{ 178{
182 struct savagefb_par *par = (struct savagefb_par *)info->par; 179 struct savagefb_par *par = info->par;
183 par->chan.par = par; 180 par->chan.par = par;
184 181
185 switch(info->fix.accel) { 182 switch(info->fix.accel) {
@@ -210,14 +207,10 @@ void savagefb_create_i2c_busses(struct fb_info *info)
210 207
211void savagefb_delete_i2c_busses(struct fb_info *info) 208void savagefb_delete_i2c_busses(struct fb_info *info)
212{ 209{
213 struct savagefb_par *par = (struct savagefb_par *)info->par; 210 struct savagefb_par *par = info->par;
214 int (*del_bus)(struct i2c_adapter *) =
215 symbol_get(i2c_bit_del_bus);
216 211
217 if (del_bus && par->chan.par) { 212 if (par->chan.par)
218 del_bus(&par->chan.adapter); 213 i2c_bit_del_bus(&par->chan.adapter);
219 symbol_put(i2c_bit_del_bus);
220 }
221 214
222 par->chan.par = NULL; 215 par->chan.par = NULL;
223} 216}
@@ -225,8 +218,6 @@ void savagefb_delete_i2c_busses(struct fb_info *info)
225static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) 218static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
226{ 219{
227 u8 start = 0x0; 220 u8 start = 0x0;
228 int (*transfer)(struct i2c_adapter *, struct i2c_msg *, int) =
229 symbol_get(i2c_transfer);
230 struct i2c_msg msgs[] = { 221 struct i2c_msg msgs[] = {
231 { 222 {
232 .addr = SAVAGE_DDC, 223 .addr = SAVAGE_DDC,
@@ -240,21 +231,19 @@ static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
240 }; 231 };
241 u8 *buf = NULL; 232 u8 *buf = NULL;
242 233
243 if (transfer && chan->par) { 234 if (chan->par) {
244 buf = kmalloc(EDID_LENGTH, GFP_KERNEL); 235 buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
245 236
246 if (buf) { 237 if (buf) {
247 msgs[1].buf = buf; 238 msgs[1].buf = buf;
248 239
249 if (transfer(&chan->adapter, msgs, 2) != 2) { 240 if (i2c_transfer(&chan->adapter, msgs, 2) != 2) {
250 dev_dbg(&chan->par->pcidev->dev, 241 dev_dbg(&chan->par->pcidev->dev,
251 "Unable to read EDID block.\n"); 242 "Unable to read EDID block.\n");
252 kfree(buf); 243 kfree(buf);
253 buf = NULL; 244 buf = NULL;
254 } 245 }
255 } 246 }
256
257 symbol_put(i2c_transfer);
258 } 247 }
259 248
260 return buf; 249 return buf;
diff --git a/drivers/video/savage/savagefb_accel.c b/drivers/video/savage/savagefb_accel.c
index bac8ea3a0108..bbcc055d3bb7 100644
--- a/drivers/video/savage/savagefb_accel.c
+++ b/drivers/video/savage/savagefb_accel.c
@@ -21,7 +21,7 @@ static u32 savagefb_rop[] = {
21 21
22int savagefb_sync(struct fb_info *info) 22int savagefb_sync(struct fb_info *info)
23{ 23{
24 struct savagefb_par *par = (struct savagefb_par *)info->par; 24 struct savagefb_par *par = info->par;
25 25
26 par->SavageWaitIdle(par); 26 par->SavageWaitIdle(par);
27 return 0; 27 return 0;
@@ -29,7 +29,7 @@ int savagefb_sync(struct fb_info *info)
29 29
30void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) 30void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
31{ 31{
32 struct savagefb_par *par = (struct savagefb_par *)info->par; 32 struct savagefb_par *par = info->par;
33 int sx = region->sx, dx = region->dx; 33 int sx = region->sx, dx = region->dx;
34 int sy = region->sy, dy = region->dy; 34 int sy = region->sy, dy = region->dy;
35 int cmd; 35 int cmd;
@@ -63,7 +63,7 @@ void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
63 63
64void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 64void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
65{ 65{
66 struct savagefb_par *par = (struct savagefb_par *)info->par; 66 struct savagefb_par *par = info->par;
67 int cmd, color; 67 int cmd, color;
68 68
69 if (!rect->width || !rect->height) 69 if (!rect->width || !rect->height)
@@ -90,7 +90,7 @@ void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
90 90
91void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) 91void savagefb_imageblit(struct fb_info *info, const struct fb_image *image)
92{ 92{
93 struct savagefb_par *par = (struct savagefb_par *)info->par; 93 struct savagefb_par *par = info->par;
94 int fg, bg, size, i, width; 94 int fg, bg, size, i, width;
95 int cmd; 95 int cmd;
96 u32 *src = (u32 *) image->data; 96 u32 *src = (u32 *) image->data;
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 09e2f2841901..baddd2b320bd 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -686,7 +686,7 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode
686static int savagefb_check_var (struct fb_var_screeninfo *var, 686static int savagefb_check_var (struct fb_var_screeninfo *var,
687 struct fb_info *info) 687 struct fb_info *info)
688{ 688{
689 struct savagefb_par *par = (struct savagefb_par *)info->par; 689 struct savagefb_par *par = info->par;
690 int memlen, vramlen, mode_valid = 0; 690 int memlen, vramlen, mode_valid = 0;
691 691
692 DBG("savagefb_check_var"); 692 DBG("savagefb_check_var");
@@ -1025,7 +1025,7 @@ static int savagefb_setcolreg(unsigned regno,
1025 unsigned transp, 1025 unsigned transp,
1026 struct fb_info *info) 1026 struct fb_info *info)
1027{ 1027{
1028 struct savagefb_par *par = (struct savagefb_par *)info->par; 1028 struct savagefb_par *par = info->par;
1029 1029
1030 if (regno >= NR_PALETTE) 1030 if (regno >= NR_PALETTE)
1031 return -EINVAL; 1031 return -EINVAL;
@@ -1328,7 +1328,7 @@ static void savagefb_set_fix(struct fb_info *info)
1328#if defined(CONFIG_FB_SAVAGE_ACCEL) 1328#if defined(CONFIG_FB_SAVAGE_ACCEL)
1329static void savagefb_set_clip(struct fb_info *info) 1329static void savagefb_set_clip(struct fb_info *info)
1330{ 1330{
1331 struct savagefb_par *par = (struct savagefb_par *)info->par; 1331 struct savagefb_par *par = info->par;
1332 int cmd; 1332 int cmd;
1333 1333
1334 cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; 1334 cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
@@ -1342,7 +1342,7 @@ static void savagefb_set_clip(struct fb_info *info)
1342 1342
1343static int savagefb_set_par (struct fb_info *info) 1343static int savagefb_set_par (struct fb_info *info)
1344{ 1344{
1345 struct savagefb_par *par = (struct savagefb_par *)info->par; 1345 struct savagefb_par *par = info->par;
1346 struct fb_var_screeninfo *var = &info->var; 1346 struct fb_var_screeninfo *var = &info->var;
1347 int err; 1347 int err;
1348 1348
@@ -1381,7 +1381,7 @@ static int savagefb_set_par (struct fb_info *info)
1381static int savagefb_pan_display (struct fb_var_screeninfo *var, 1381static int savagefb_pan_display (struct fb_var_screeninfo *var,
1382 struct fb_info *info) 1382 struct fb_info *info)
1383{ 1383{
1384 struct savagefb_par *par = (struct savagefb_par *)info->par; 1384 struct savagefb_par *par = info->par;
1385 u_int y_bottom; 1385 u_int y_bottom;
1386 1386
1387 y_bottom = var->yoffset; 1387 y_bottom = var->yoffset;
@@ -1534,7 +1534,7 @@ static void savage_disable_mmio (struct savagefb_par *par)
1534 1534
1535static int __devinit savage_map_mmio (struct fb_info *info) 1535static int __devinit savage_map_mmio (struct fb_info *info)
1536{ 1536{
1537 struct savagefb_par *par = (struct savagefb_par *)info->par; 1537 struct savagefb_par *par = info->par;
1538 DBG ("savage_map_mmio"); 1538 DBG ("savage_map_mmio");
1539 1539
1540 if (S3_SAVAGE3D_SERIES (par->chip)) 1540 if (S3_SAVAGE3D_SERIES (par->chip))
@@ -1567,7 +1567,7 @@ static int __devinit savage_map_mmio (struct fb_info *info)
1567 1567
1568static void __devinit savage_unmap_mmio (struct fb_info *info) 1568static void __devinit savage_unmap_mmio (struct fb_info *info)
1569{ 1569{
1570 struct savagefb_par *par = (struct savagefb_par *)info->par; 1570 struct savagefb_par *par = info->par;
1571 DBG ("savage_unmap_mmio"); 1571 DBG ("savage_unmap_mmio");
1572 1572
1573 savage_disable_mmio(par); 1573 savage_disable_mmio(par);
@@ -1581,7 +1581,7 @@ static void __devinit savage_unmap_mmio (struct fb_info *info)
1581static int __devinit savage_map_video (struct fb_info *info, 1581static int __devinit savage_map_video (struct fb_info *info,
1582 int video_len) 1582 int video_len)
1583{ 1583{
1584 struct savagefb_par *par = (struct savagefb_par *)info->par; 1584 struct savagefb_par *par = info->par;
1585 int resource; 1585 int resource;
1586 1586
1587 DBG("savage_map_video"); 1587 DBG("savage_map_video");
@@ -1619,7 +1619,7 @@ static int __devinit savage_map_video (struct fb_info *info,
1619 1619
1620static void __devinit savage_unmap_video (struct fb_info *info) 1620static void __devinit savage_unmap_video (struct fb_info *info)
1621{ 1621{
1622 struct savagefb_par *par = (struct savagefb_par *)info->par; 1622 struct savagefb_par *par = info->par;
1623 1623
1624 DBG("savage_unmap_video"); 1624 DBG("savage_unmap_video");
1625 1625
@@ -1869,7 +1869,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
1869 struct pci_dev *dev, 1869 struct pci_dev *dev,
1870 const struct pci_device_id *id) 1870 const struct pci_device_id *id)
1871{ 1871{
1872 struct savagefb_par *par = (struct savagefb_par *)info->par; 1872 struct savagefb_par *par = info->par;
1873 int err = 0; 1873 int err = 0;
1874 1874
1875 par->pcidev = dev; 1875 par->pcidev = dev;
@@ -2139,8 +2139,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
2139 2139
2140static void __devexit savagefb_remove (struct pci_dev *dev) 2140static void __devexit savagefb_remove (struct pci_dev *dev)
2141{ 2141{
2142 struct fb_info *info = 2142 struct fb_info *info = pci_get_drvdata(dev);
2143 (struct fb_info *)pci_get_drvdata(dev);
2144 2143
2145 DBG("savagefb_remove"); 2144 DBG("savagefb_remove");
2146 2145
@@ -2174,9 +2173,8 @@ static void __devexit savagefb_remove (struct pci_dev *dev)
2174 2173
2175static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) 2174static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
2176{ 2175{
2177 struct fb_info *info = 2176 struct fb_info *info = pci_get_drvdata(dev);
2178 (struct fb_info *)pci_get_drvdata(dev); 2177 struct savagefb_par *par = info->par;
2179 struct savagefb_par *par = (struct savagefb_par *)info->par;
2180 2178
2181 DBG("savagefb_suspend"); 2179 DBG("savagefb_suspend");
2182 2180
@@ -2210,9 +2208,8 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
2210 2208
2211static int savagefb_resume (struct pci_dev* dev) 2209static int savagefb_resume (struct pci_dev* dev)
2212{ 2210{
2213 struct fb_info *info = 2211 struct fb_info *info = pci_get_drvdata(dev);
2214 (struct fb_info *)pci_get_drvdata(dev); 2212 struct savagefb_par *par = info->par;
2215 struct savagefb_par *par = (struct savagefb_par *)info->par;
2216 int cur_state = par->pm_state; 2213 int cur_state = par->pm_state;
2217 2214
2218 DBG("savage_resume"); 2215 DBG("savage_resume");