diff options
Diffstat (limited to 'drivers/video/savage/savagefb-i2c.c')
-rw-r--r-- | drivers/video/savage/savagefb-i2c.c | 43 |
1 files changed, 16 insertions, 27 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 | ||
50 | static void savage4_gpio_setscl(void *data, int val) | 50 | static 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 | ||
64 | static void savage4_gpio_setsda(void *data, int val) | 64 | static 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 | ||
78 | static int savage4_gpio_getscl(void *data) | 78 | static 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 | ||
85 | static int savage4_gpio_getsda(void *data) | 85 | static 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 | ||
92 | static void prosavage_gpio_setscl(void* data, int val) | 92 | static 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 | ||
108 | static void prosavage_gpio_setsda(void* data, int val) | 108 | static 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 | ||
124 | static int prosavage_gpio_getscl(void* data) | 124 | static 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 | ||
132 | static int prosavage_gpio_getsda(void* data) | 132 | static 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) | |||
140 | static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | 140 | static 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 | ||
180 | void savagefb_create_i2c_busses(struct fb_info *info) | 177 | void 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 | ||
211 | void savagefb_delete_i2c_busses(struct fb_info *info) | 208 | void 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) | |||
225 | static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) | 218 | static 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; |