diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c50229bd9f85..18124398b464 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -201,6 +201,7 @@ struct bus_type i2c_bus_type = { | |||
201 | .suspend = i2c_device_suspend, | 201 | .suspend = i2c_device_suspend, |
202 | .resume = i2c_device_resume, | 202 | .resume = i2c_device_resume, |
203 | }; | 203 | }; |
204 | EXPORT_SYMBOL_GPL(i2c_bus_type); | ||
204 | 205 | ||
205 | /** | 206 | /** |
206 | * i2c_new_device - instantiate an i2c device for use with a new style driver | 207 | * i2c_new_device - instantiate an i2c device for use with a new style driver |
@@ -285,6 +286,7 @@ void i2c_adapter_dev_release(struct device *dev) | |||
285 | struct i2c_adapter *adap = to_i2c_adapter(dev); | 286 | struct i2c_adapter *adap = to_i2c_adapter(dev); |
286 | complete(&adap->dev_released); | 287 | complete(&adap->dev_released); |
287 | } | 288 | } |
289 | EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); /* exported to i2c-isa */ | ||
288 | 290 | ||
289 | static ssize_t | 291 | static ssize_t |
290 | show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) | 292 | show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -303,6 +305,7 @@ struct class i2c_adapter_class = { | |||
303 | .name = "i2c-adapter", | 305 | .name = "i2c-adapter", |
304 | .dev_attrs = i2c_adapter_attrs, | 306 | .dev_attrs = i2c_adapter_attrs, |
305 | }; | 307 | }; |
308 | EXPORT_SYMBOL_GPL(i2c_adapter_class); /* exported to i2c-isa */ | ||
306 | 309 | ||
307 | static void i2c_scan_static_board_info(struct i2c_adapter *adapter) | 310 | static void i2c_scan_static_board_info(struct i2c_adapter *adapter) |
308 | { | 311 | { |
@@ -533,6 +536,7 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
533 | mutex_unlock(&core_lists); | 536 | mutex_unlock(&core_lists); |
534 | return res; | 537 | return res; |
535 | } | 538 | } |
539 | EXPORT_SYMBOL(i2c_del_adapter); | ||
536 | 540 | ||
537 | 541 | ||
538 | /* ------------------------------------------------------------------------- */ | 542 | /* ------------------------------------------------------------------------- */ |
@@ -650,6 +654,7 @@ int i2c_del_driver(struct i2c_driver *driver) | |||
650 | mutex_unlock(&core_lists); | 654 | mutex_unlock(&core_lists); |
651 | return 0; | 655 | return 0; |
652 | } | 656 | } |
657 | EXPORT_SYMBOL(i2c_del_driver); | ||
653 | 658 | ||
654 | /* ------------------------------------------------------------------------- */ | 659 | /* ------------------------------------------------------------------------- */ |
655 | 660 | ||
@@ -676,6 +681,7 @@ int i2c_check_addr(struct i2c_adapter *adapter, int addr) | |||
676 | 681 | ||
677 | return rval; | 682 | return rval; |
678 | } | 683 | } |
684 | EXPORT_SYMBOL(i2c_check_addr); | ||
679 | 685 | ||
680 | int i2c_attach_client(struct i2c_client *client) | 686 | int i2c_attach_client(struct i2c_client *client) |
681 | { | 687 | { |
@@ -729,7 +735,7 @@ out_unlock: | |||
729 | mutex_unlock(&adapter->clist_lock); | 735 | mutex_unlock(&adapter->clist_lock); |
730 | return res; | 736 | return res; |
731 | } | 737 | } |
732 | 738 | EXPORT_SYMBOL(i2c_attach_client); | |
733 | 739 | ||
734 | int i2c_detach_client(struct i2c_client *client) | 740 | int i2c_detach_client(struct i2c_client *client) |
735 | { | 741 | { |
@@ -762,6 +768,7 @@ int i2c_detach_client(struct i2c_client *client) | |||
762 | out: | 768 | out: |
763 | return res; | 769 | return res; |
764 | } | 770 | } |
771 | EXPORT_SYMBOL(i2c_detach_client); | ||
765 | 772 | ||
766 | static int i2c_inc_use_client(struct i2c_client *client) | 773 | static int i2c_inc_use_client(struct i2c_client *client) |
767 | { | 774 | { |
@@ -794,6 +801,7 @@ int i2c_use_client(struct i2c_client *client) | |||
794 | 801 | ||
795 | return 0; | 802 | return 0; |
796 | } | 803 | } |
804 | EXPORT_SYMBOL(i2c_use_client); | ||
797 | 805 | ||
798 | int i2c_release_client(struct i2c_client *client) | 806 | int i2c_release_client(struct i2c_client *client) |
799 | { | 807 | { |
@@ -808,6 +816,7 @@ int i2c_release_client(struct i2c_client *client) | |||
808 | 816 | ||
809 | return 0; | 817 | return 0; |
810 | } | 818 | } |
819 | EXPORT_SYMBOL(i2c_release_client); | ||
811 | 820 | ||
812 | void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) | 821 | void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) |
813 | { | 822 | { |
@@ -828,6 +837,7 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) | |||
828 | } | 837 | } |
829 | mutex_unlock(&adap->clist_lock); | 838 | mutex_unlock(&adap->clist_lock); |
830 | } | 839 | } |
840 | EXPORT_SYMBOL(i2c_clients_command); | ||
831 | 841 | ||
832 | static int __init i2c_init(void) | 842 | static int __init i2c_init(void) |
833 | { | 843 | { |
@@ -877,6 +887,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) | |||
877 | return -ENOSYS; | 887 | return -ENOSYS; |
878 | } | 888 | } |
879 | } | 889 | } |
890 | EXPORT_SYMBOL(i2c_transfer); | ||
880 | 891 | ||
881 | int i2c_master_send(struct i2c_client *client,const char *buf ,int count) | 892 | int i2c_master_send(struct i2c_client *client,const char *buf ,int count) |
882 | { | 893 | { |
@@ -895,6 +906,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count) | |||
895 | transmitted, else error code. */ | 906 | transmitted, else error code. */ |
896 | return (ret == 1) ? count : ret; | 907 | return (ret == 1) ? count : ret; |
897 | } | 908 | } |
909 | EXPORT_SYMBOL(i2c_master_send); | ||
898 | 910 | ||
899 | int i2c_master_recv(struct i2c_client *client, char *buf ,int count) | 911 | int i2c_master_recv(struct i2c_client *client, char *buf ,int count) |
900 | { | 912 | { |
@@ -914,7 +926,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count) | |||
914 | transmitted, else error code. */ | 926 | transmitted, else error code. */ |
915 | return (ret == 1) ? count : ret; | 927 | return (ret == 1) ? count : ret; |
916 | } | 928 | } |
917 | 929 | EXPORT_SYMBOL(i2c_master_recv); | |
918 | 930 | ||
919 | int i2c_control(struct i2c_client *client, | 931 | int i2c_control(struct i2c_client *client, |
920 | unsigned int cmd, unsigned long arg) | 932 | unsigned int cmd, unsigned long arg) |
@@ -936,6 +948,7 @@ int i2c_control(struct i2c_client *client, | |||
936 | } | 948 | } |
937 | return ret; | 949 | return ret; |
938 | } | 950 | } |
951 | EXPORT_SYMBOL(i2c_control); | ||
939 | 952 | ||
940 | /* ---------------------------------------------------- | 953 | /* ---------------------------------------------------- |
941 | * the i2c address scanning function | 954 | * the i2c address scanning function |
@@ -1077,6 +1090,7 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
1077 | 1090 | ||
1078 | return 0; | 1091 | return 0; |
1079 | } | 1092 | } |
1093 | EXPORT_SYMBOL(i2c_probe); | ||
1080 | 1094 | ||
1081 | struct i2c_adapter* i2c_get_adapter(int id) | 1095 | struct i2c_adapter* i2c_get_adapter(int id) |
1082 | { | 1096 | { |
@@ -1090,11 +1104,13 @@ struct i2c_adapter* i2c_get_adapter(int id) | |||
1090 | mutex_unlock(&core_lists); | 1104 | mutex_unlock(&core_lists); |
1091 | return adapter; | 1105 | return adapter; |
1092 | } | 1106 | } |
1107 | EXPORT_SYMBOL(i2c_get_adapter); | ||
1093 | 1108 | ||
1094 | void i2c_put_adapter(struct i2c_adapter *adap) | 1109 | void i2c_put_adapter(struct i2c_adapter *adap) |
1095 | { | 1110 | { |
1096 | module_put(adap->owner); | 1111 | module_put(adap->owner); |
1097 | } | 1112 | } |
1113 | EXPORT_SYMBOL(i2c_put_adapter); | ||
1098 | 1114 | ||
1099 | /* The SMBus parts */ | 1115 | /* The SMBus parts */ |
1100 | 1116 | ||
@@ -1163,6 +1179,7 @@ s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) | |||
1163 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1179 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, |
1164 | value,0,I2C_SMBUS_QUICK,NULL); | 1180 | value,0,I2C_SMBUS_QUICK,NULL); |
1165 | } | 1181 | } |
1182 | EXPORT_SYMBOL(i2c_smbus_write_quick); | ||
1166 | 1183 | ||
1167 | s32 i2c_smbus_read_byte(struct i2c_client *client) | 1184 | s32 i2c_smbus_read_byte(struct i2c_client *client) |
1168 | { | 1185 | { |
@@ -1173,12 +1190,14 @@ s32 i2c_smbus_read_byte(struct i2c_client *client) | |||
1173 | else | 1190 | else |
1174 | return data.byte; | 1191 | return data.byte; |
1175 | } | 1192 | } |
1193 | EXPORT_SYMBOL(i2c_smbus_read_byte); | ||
1176 | 1194 | ||
1177 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) | 1195 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) |
1178 | { | 1196 | { |
1179 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, | 1197 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, |
1180 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); | 1198 | I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); |
1181 | } | 1199 | } |
1200 | EXPORT_SYMBOL(i2c_smbus_write_byte); | ||
1182 | 1201 | ||
1183 | s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) | 1202 | s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) |
1184 | { | 1203 | { |
@@ -1189,6 +1208,7 @@ s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) | |||
1189 | else | 1208 | else |
1190 | return data.byte; | 1209 | return data.byte; |
1191 | } | 1210 | } |
1211 | EXPORT_SYMBOL(i2c_smbus_read_byte_data); | ||
1192 | 1212 | ||
1193 | s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) | 1213 | s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) |
1194 | { | 1214 | { |
@@ -1198,6 +1218,7 @@ s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) | |||
1198 | I2C_SMBUS_WRITE,command, | 1218 | I2C_SMBUS_WRITE,command, |
1199 | I2C_SMBUS_BYTE_DATA,&data); | 1219 | I2C_SMBUS_BYTE_DATA,&data); |
1200 | } | 1220 | } |
1221 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); | ||
1201 | 1222 | ||
1202 | s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) | 1223 | s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) |
1203 | { | 1224 | { |
@@ -1208,6 +1229,7 @@ s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) | |||
1208 | else | 1229 | else |
1209 | return data.word; | 1230 | return data.word; |
1210 | } | 1231 | } |
1232 | EXPORT_SYMBOL(i2c_smbus_read_word_data); | ||
1211 | 1233 | ||
1212 | s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | 1234 | s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) |
1213 | { | 1235 | { |
@@ -1217,6 +1239,7 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | |||
1217 | I2C_SMBUS_WRITE,command, | 1239 | I2C_SMBUS_WRITE,command, |
1218 | I2C_SMBUS_WORD_DATA,&data); | 1240 | I2C_SMBUS_WORD_DATA,&data); |
1219 | } | 1241 | } |
1242 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | ||
1220 | 1243 | ||
1221 | s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, | 1244 | s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, |
1222 | u8 length, const u8 *values) | 1245 | u8 length, const u8 *values) |
@@ -1231,6 +1254,7 @@ s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, | |||
1231 | I2C_SMBUS_WRITE,command, | 1254 | I2C_SMBUS_WRITE,command, |
1232 | I2C_SMBUS_BLOCK_DATA,&data); | 1255 | I2C_SMBUS_BLOCK_DATA,&data); |
1233 | } | 1256 | } |
1257 | EXPORT_SYMBOL(i2c_smbus_write_block_data); | ||
1234 | 1258 | ||
1235 | /* Returns the number of read bytes */ | 1259 | /* Returns the number of read bytes */ |
1236 | s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) | 1260 | s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) |
@@ -1245,6 +1269,7 @@ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *val | |||
1245 | memcpy(values, &data.block[1], data.block[0]); | 1269 | memcpy(values, &data.block[1], data.block[0]); |
1246 | return data.block[0]; | 1270 | return data.block[0]; |
1247 | } | 1271 | } |
1272 | EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); | ||
1248 | 1273 | ||
1249 | s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, | 1274 | s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, |
1250 | u8 length, const u8 *values) | 1275 | u8 length, const u8 *values) |
@@ -1259,6 +1284,7 @@ s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, | |||
1259 | I2C_SMBUS_WRITE, command, | 1284 | I2C_SMBUS_WRITE, command, |
1260 | I2C_SMBUS_I2C_BLOCK_DATA, &data); | 1285 | I2C_SMBUS_I2C_BLOCK_DATA, &data); |
1261 | } | 1286 | } |
1287 | EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data); | ||
1262 | 1288 | ||
1263 | /* Simulate a SMBus command using the i2c protocol | 1289 | /* Simulate a SMBus command using the i2c protocol |
1264 | No checking of parameters is done! */ | 1290 | No checking of parameters is done! */ |
@@ -1445,41 +1471,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, | |||
1445 | 1471 | ||
1446 | return res; | 1472 | return res; |
1447 | } | 1473 | } |
1448 | |||
1449 | |||
1450 | /* Next three are needed by i2c-isa */ | ||
1451 | EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); | ||
1452 | EXPORT_SYMBOL_GPL(i2c_adapter_class); | ||
1453 | EXPORT_SYMBOL_GPL(i2c_bus_type); | ||
1454 | |||
1455 | EXPORT_SYMBOL(i2c_del_adapter); | ||
1456 | EXPORT_SYMBOL(i2c_del_driver); | ||
1457 | EXPORT_SYMBOL(i2c_attach_client); | ||
1458 | EXPORT_SYMBOL(i2c_detach_client); | ||
1459 | EXPORT_SYMBOL(i2c_use_client); | ||
1460 | EXPORT_SYMBOL(i2c_release_client); | ||
1461 | EXPORT_SYMBOL(i2c_clients_command); | ||
1462 | EXPORT_SYMBOL(i2c_check_addr); | ||
1463 | |||
1464 | EXPORT_SYMBOL(i2c_master_send); | ||
1465 | EXPORT_SYMBOL(i2c_master_recv); | ||
1466 | EXPORT_SYMBOL(i2c_control); | ||
1467 | EXPORT_SYMBOL(i2c_transfer); | ||
1468 | EXPORT_SYMBOL(i2c_get_adapter); | ||
1469 | EXPORT_SYMBOL(i2c_put_adapter); | ||
1470 | EXPORT_SYMBOL(i2c_probe); | ||
1471 | |||
1472 | EXPORT_SYMBOL(i2c_smbus_xfer); | 1474 | EXPORT_SYMBOL(i2c_smbus_xfer); |
1473 | EXPORT_SYMBOL(i2c_smbus_write_quick); | ||
1474 | EXPORT_SYMBOL(i2c_smbus_read_byte); | ||
1475 | EXPORT_SYMBOL(i2c_smbus_write_byte); | ||
1476 | EXPORT_SYMBOL(i2c_smbus_read_byte_data); | ||
1477 | EXPORT_SYMBOL(i2c_smbus_write_byte_data); | ||
1478 | EXPORT_SYMBOL(i2c_smbus_read_word_data); | ||
1479 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | ||
1480 | EXPORT_SYMBOL(i2c_smbus_write_block_data); | ||
1481 | EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); | ||
1482 | EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data); | ||
1483 | 1475 | ||
1484 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); | 1476 | MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); |
1485 | MODULE_DESCRIPTION("I2C-Bus main module"); | 1477 | MODULE_DESCRIPTION("I2C-Bus main module"); |