34 #include <linux/module.h>
35 #include <linux/kernel.h>
36 #include <linux/slab.h>
38 #include <linux/i2c.h>
50 unsigned short flags,
char read_write,
57 if ((addr & 0xfc) == 0x50 || (addr & 0xfc) == 0x30
62 error = nforce2_smbus->
algo->smbus_xfer(adap, addr, flags, read_write,
73 static u8 last_channels;
76 unsigned short flags,
char read_write,
84 if ((addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30)
88 if (last_channels != channels) {
92 error = nforce2_smbus->
algo->smbus_xfer(adap, 0x18, 0,
100 error = nforce2_smbus->
algo->smbus_xfer(adap, addr, flags, read_write,
101 command, size, data);
109 unsigned short flags,
char read_write,
110 u8 command,
int size,
114 return nforce2_access_channel(adap, addr, flags, read_write, command,
119 unsigned short flags,
char read_write,
120 u8 command,
int size,
124 return nforce2_access_channel(adap, addr, flags, read_write, command,
129 unsigned short flags,
char read_write,
130 u8 command,
int size,
134 return nforce2_access_channel(adap, addr, flags, read_write, command,
139 unsigned short flags,
char read_write,
140 u8 command,
int size,
144 return nforce2_access_channel(adap, addr, flags, read_write, command,
148 static int __init nforce2_s4985_init(
void)
157 ioconfig.byte = 0x00;
161 dev_err(&nforce2_smbus->
dev,
"PCA9556 configuration failed\n");
169 dev_err(&nforce2_smbus->
dev,
"Physical bus removal failed\n");
176 if (!s4985_adapter) {
187 s4985_algo[0] = *(nforce2_smbus->
algo);
188 s4985_algo[0].
smbus_xfer = nforce2_access_virt0;
189 s4985_adapter[0] = *nforce2_smbus;
190 s4985_adapter[0].
algo = s4985_algo;
191 s4985_adapter[0].
dev.parent = nforce2_smbus->
dev.parent;
192 for (i = 1; i < 5; i++) {
193 s4985_algo[
i] = *(nforce2_smbus->
algo);
194 s4985_adapter[
i] = *nforce2_smbus;
195 snprintf(s4985_adapter[i].
name,
sizeof(s4985_adapter[i].name),
196 "SMBus nForce2 adapter (CPU%d)", i - 1);
197 s4985_adapter[
i].
algo = s4985_algo +
i;
198 s4985_adapter[
i].
dev.parent = nforce2_smbus->
dev.parent;
200 s4985_algo[1].
smbus_xfer = nforce2_access_virt1;
201 s4985_algo[2].
smbus_xfer = nforce2_access_virt2;
202 s4985_algo[3].
smbus_xfer = nforce2_access_virt3;
203 s4985_algo[4].
smbus_xfer = nforce2_access_virt4;
206 for (i = 0; i < 5; i++) {
210 "Virtual adapter %d registration "
211 "failed, module not inserted\n", i);
212 for (i--; i >= 0; i--)
224 kfree(s4985_adapter);
225 s4985_adapter =
NULL;
233 static void __exit nforce2_s4985_exit(
void)
238 for (i = 0; i < 5; i++)
240 kfree(s4985_adapter);
241 s4985_adapter =
NULL;
249 "Physical bus restoration failed\n");