Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon/it87: Remove the SMBus interface support

This interface was useless as the LPC ISA-like interface is always
available, is faster, and is more reliable. This cuts the driver
size by some 20%.

This change is also required to later convert the it87 driver to a
platform driver, so that we can get rid of i2c-isa in a near future.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

authored by

Jean Delvare and committed by
Jean Delvare
8e9afcbb 0f23e50a

+64 -163
-9
Documentation/feature-removal-schedule.txt
··· 151 151 152 152 --------------------------- 153 153 154 - What: I2C interface of the it87 driver 155 - When: January 2007 156 - Why: The ISA interface is faster and should be always available. The I2C 157 - probing is also known to cause trouble in at least one case (see 158 - bug #5889.) 159 - Who: Jean Delvare <khali@linux-fr.org> 160 - 161 - --------------------------- 162 - 163 154 What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports 164 155 (temporary transition config option provided until then) 165 156 The transition config option will also be removed at the same time.
+13 -2
Documentation/hwmon/it87
··· 9 9 http://www.ite.com.tw/ 10 10 * IT8712F 11 11 Prefix: 'it8712' 12 - Addresses scanned: I2C 0x2d 13 - from Super I/O config space (8 I/O ports) 12 + Addresses scanned: from Super I/O config space (8 I/O ports) 14 13 Datasheet: Publicly available at the ITE website 15 14 http://www.ite.com.tw/ 16 15 * IT8716F ··· 51 52 Force PWM polarity to active high (DANGEROUS). Some chips are 52 53 misconfigured by BIOS - PWM values would be inverted. This option tries 53 54 to fix this. Please contact your BIOS manufacturer and ask him for fix. 55 + 56 + 57 + Hardware Interfaces 58 + ------------------- 59 + 60 + All the chips suported by this driver are LPC Super-I/O chips, accessed 61 + through the LPC bus (ISA-like I/O ports). The IT8712F additionally has an 62 + SMBus interface to the hardware monitoring functions. This driver no 63 + longer supports this interface though, as it is slower and less reliable 64 + than the ISA access, and was only available on a small number of 65 + motherboard models. 66 + 54 67 55 68 Description 56 69 -----------
+51 -151
drivers/hwmon/it87.c
··· 3 3 monitoring. 4 4 5 5 Supports: IT8705F Super I/O chip w/LPC interface 6 - IT8712F Super I/O chip w/LPC interface & SMBus 6 + IT8712F Super I/O chip w/LPC interface 7 7 IT8716F Super I/O chip w/LPC interface 8 8 IT8718F Super I/O chip w/LPC interface 9 9 Sis950 A clone of the IT8705F ··· 41 41 #include <asm/io.h> 42 42 43 43 44 - /* Addresses to scan */ 45 - static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; 46 44 static unsigned short isa_address; 47 - 48 - /* Insmod parameters */ 49 - I2C_CLIENT_INSMOD_4(it87, it8712, it8716, it8718); 45 + enum chips { it87, it8712, it8716, it8718 }; 50 46 51 47 #define REG 0x2e /* The register to read/write */ 52 48 #define DEV 0x07 /* Register: Logical device select */ ··· 158 162 #define IT87_REG_TEMP_HIGH(nr) (0x40 + (nr) * 2) 159 163 #define IT87_REG_TEMP_LOW(nr) (0x41 + (nr) * 2) 160 164 161 - #define IT87_REG_I2C_ADDR 0x48 162 - 163 165 #define IT87_REG_VIN_ENABLE 0x50 164 166 #define IT87_REG_TEMP_ENABLE 0x51 165 167 ··· 236 242 }; 237 243 238 244 239 - static int it87_attach_adapter(struct i2c_adapter *adapter); 240 - static int it87_isa_attach_adapter(struct i2c_adapter *adapter); 241 - static int it87_detect(struct i2c_adapter *adapter, int address, int kind); 245 + static int it87_detect(struct i2c_adapter *adapter); 242 246 static int it87_detach_client(struct i2c_client *client); 243 247 244 248 static int it87_read_value(struct i2c_client *client, u8 reg); 245 - static int it87_write_value(struct i2c_client *client, u8 reg, u8 value); 249 + static void it87_write_value(struct i2c_client *client, u8 reg, u8 value); 246 250 static struct it87_data *it87_update_device(struct device *dev); 247 251 static int it87_check_pwm(struct i2c_client *client); 248 252 static void it87_init_client(struct i2c_client *client, struct it87_data *data); 249 253 250 - 251 - static struct i2c_driver it87_driver = { 252 - .driver = { 253 - .name = "it87", 254 - }, 255 - .id = I2C_DRIVERID_IT87, 256 - .attach_adapter = it87_attach_adapter, 257 - .detach_client = it87_detach_client, 258 - }; 259 254 260 255 static struct i2c_driver it87_isa_driver = { 261 256 .driver = { 262 257 .owner = THIS_MODULE, 263 258 .name = "it87-isa", 264 259 }, 265 - .attach_adapter = it87_isa_attach_adapter, 260 + .attach_adapter = it87_detect, 266 261 .detach_client = it87_detach_client, 267 262 }; 268 263 ··· 833 850 .attrs = it87_attributes_opt, 834 851 }; 835 852 836 - /* This function is called when: 837 - * it87_driver is inserted (when this module is loaded), for each 838 - available adapter 839 - * when a new adapter is inserted (and it87_driver is still present) */ 840 - static int it87_attach_adapter(struct i2c_adapter *adapter) 841 - { 842 - if (!(adapter->class & I2C_CLASS_HWMON)) 843 - return 0; 844 - return i2c_probe(adapter, &addr_data, it87_detect); 845 - } 846 - 847 - static int it87_isa_attach_adapter(struct i2c_adapter *adapter) 848 - { 849 - return it87_detect(adapter, isa_address, -1); 850 - } 851 - 852 853 /* SuperIO detection - will change isa_address if a chip is found */ 853 854 static int __init it87_find(unsigned short *address) 854 855 { ··· 883 916 } 884 917 885 918 /* This function is called by i2c_probe */ 886 - static int it87_detect(struct i2c_adapter *adapter, int address, int kind) 919 + static int it87_detect(struct i2c_adapter *adapter) 887 920 { 888 - int i; 889 921 struct i2c_client *new_client; 890 922 struct it87_data *data; 891 923 int err = 0; 892 - const char *name = ""; 893 - int is_isa = i2c_is_isa_adapter(adapter); 924 + const char *name; 894 925 int enable_pwm_interface; 895 926 896 - if (!is_isa && 897 - !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 898 - goto ERROR0; 899 - 900 927 /* Reserve the ISA region */ 901 - if (is_isa) 902 - if (!request_region(address, IT87_EXTENT, 903 - it87_isa_driver.driver.name)) 904 - goto ERROR0; 905 - 906 - /* For now, we presume we have a valid client. We create the 907 - client structure, even though we cannot fill it completely yet. 908 - But it allows us to access it87_{read,write}_value. */ 928 + if (!request_region(isa_address, IT87_EXTENT, 929 + it87_isa_driver.driver.name)){ 930 + err = -EBUSY; 931 + goto ERROR0; 932 + } 909 933 910 934 if (!(data = kzalloc(sizeof(struct it87_data), GFP_KERNEL))) { 911 935 err = -ENOMEM; ··· 904 946 } 905 947 906 948 new_client = &data->client; 907 - if (is_isa) 908 - mutex_init(&data->lock); 949 + mutex_init(&data->lock); 909 950 i2c_set_clientdata(new_client, data); 910 - new_client->addr = address; 951 + new_client->addr = isa_address; 911 952 new_client->adapter = adapter; 912 - new_client->driver = is_isa ? &it87_isa_driver : &it87_driver; 913 - new_client->flags = 0; 953 + new_client->driver = &it87_isa_driver; 914 954 915 955 /* Now, we do the remaining detection. */ 916 - 917 - if (kind < 0) { 918 - if ((it87_read_value(new_client, IT87_REG_CONFIG) & 0x80) 919 - || (!is_isa 920 - && it87_read_value(new_client, IT87_REG_I2C_ADDR) != address)) { 921 - err = -ENODEV; 922 - goto ERROR2; 923 - } 956 + if ((it87_read_value(new_client, IT87_REG_CONFIG) & 0x80) 957 + || it87_read_value(new_client, IT87_REG_CHIPID) != 0x90) { 958 + err = -ENODEV; 959 + goto ERROR2; 924 960 } 925 961 926 962 /* Determine the chip type. */ 927 - if (kind <= 0) { 928 - i = it87_read_value(new_client, IT87_REG_CHIPID); 929 - if (i == 0x90) { 930 - kind = it87; 931 - if (is_isa) { 932 - switch (chip_type) { 933 - case IT8712F_DEVID: 934 - kind = it8712; 935 - break; 936 - case IT8716F_DEVID: 937 - kind = it8716; 938 - break; 939 - case IT8718F_DEVID: 940 - kind = it8718; 941 - break; 942 - } 943 - } 944 - } 945 - else { 946 - if (kind == 0) 947 - dev_info(&adapter->dev, 948 - "Ignoring 'force' parameter for unknown chip at " 949 - "adapter %d, address 0x%02x\n", 950 - i2c_adapter_id(adapter), address); 951 - err = -ENODEV; 952 - goto ERROR2; 953 - } 954 - } 955 - 956 - if (kind == it87) { 957 - name = "it87"; 958 - } else if (kind == it8712) { 963 + switch (chip_type) { 964 + case IT8712F_DEVID: 965 + data->type = it8712; 959 966 name = "it8712"; 960 - } else if (kind == it8716) { 967 + break; 968 + case IT8716F_DEVID: 969 + data->type = it8716; 961 970 name = "it8716"; 962 - } else if (kind == it8718) { 971 + break; 972 + case IT8718F_DEVID: 973 + data->type = it8718; 963 974 name = "it8718"; 975 + break; 976 + default: 977 + data->type = it87; 978 + name = "it87"; 964 979 } 965 980 966 981 /* Fill in the remaining client fields and put it into the global list */ 967 982 strlcpy(new_client->name, name, I2C_NAME_SIZE); 968 - data->type = kind; 969 - data->valid = 0; 970 983 mutex_init(&data->update_lock); 971 984 972 985 /* Tell the I2C layer a new client has arrived */ 973 986 if ((err = i2c_attach_client(new_client))) 974 987 goto ERROR2; 975 - 976 - if (!is_isa) 977 - dev_info(&new_client->dev, "The I2C interface to IT87xxF " 978 - "hardware monitoring chips is deprecated. Please " 979 - "report if you still rely on it.\n"); 980 988 981 989 /* Check PWM configuration */ 982 990 enable_pwm_interface = it87_check_pwm(new_client); ··· 1053 1129 ERROR2: 1054 1130 kfree(data); 1055 1131 ERROR1: 1056 - if (is_isa) 1057 - release_region(address, IT87_EXTENT); 1132 + release_region(isa_address, IT87_EXTENT); 1058 1133 ERROR0: 1059 1134 return err; 1060 1135 } ··· 1070 1147 if ((err = i2c_detach_client(client))) 1071 1148 return err; 1072 1149 1073 - if(i2c_is_isa_client(client)) 1074 - release_region(client->addr, IT87_EXTENT); 1150 + release_region(client->addr, IT87_EXTENT); 1075 1151 kfree(data); 1076 1152 1077 1153 return 0; 1078 1154 } 1079 1155 1080 - /* The SMBus locks itself, but ISA access must be locked explicitly! 1081 - We don't want to lock the whole ISA bus, so we lock each client 1082 - separately. 1156 + /* ISA access must be locked explicitly! 1083 1157 We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, 1084 1158 would slow down the IT87 access and should not be necessary. */ 1085 1159 static int it87_read_value(struct i2c_client *client, u8 reg) 1086 1160 { 1087 1161 struct it87_data *data = i2c_get_clientdata(client); 1088 - 1089 1162 int res; 1090 - if (i2c_is_isa_client(client)) { 1091 - mutex_lock(&data->lock); 1092 - outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); 1093 - res = inb_p(client->addr + IT87_DATA_REG_OFFSET); 1094 - mutex_unlock(&data->lock); 1095 - return res; 1096 - } else 1097 - return i2c_smbus_read_byte_data(client, reg); 1163 + 1164 + mutex_lock(&data->lock); 1165 + outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); 1166 + res = inb_p(client->addr + IT87_DATA_REG_OFFSET); 1167 + mutex_unlock(&data->lock); 1168 + 1169 + return res; 1098 1170 } 1099 1171 1100 - /* The SMBus locks itself, but ISA access muse be locked explicitly! 1101 - We don't want to lock the whole ISA bus, so we lock each client 1102 - separately. 1172 + /* ISA access must be locked explicitly! 1103 1173 We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, 1104 1174 would slow down the IT87 access and should not be necessary. */ 1105 - static int it87_write_value(struct i2c_client *client, u8 reg, u8 value) 1175 + static void it87_write_value(struct i2c_client *client, u8 reg, u8 value) 1106 1176 { 1107 1177 struct it87_data *data = i2c_get_clientdata(client); 1108 1178 1109 - if (i2c_is_isa_client(client)) { 1110 - mutex_lock(&data->lock); 1111 - outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); 1112 - outb_p(value, client->addr + IT87_DATA_REG_OFFSET); 1113 - mutex_unlock(&data->lock); 1114 - return 0; 1115 - } else 1116 - return i2c_smbus_write_byte_data(client, reg, value); 1179 + mutex_lock(&data->lock); 1180 + outb_p(reg, client->addr + IT87_ADDR_REG_OFFSET); 1181 + outb_p(value, client->addr + IT87_DATA_REG_OFFSET); 1182 + mutex_unlock(&data->lock); 1117 1183 } 1118 1184 1119 1185 /* Return 1 if and only if the PWM interface is safe to use */ ··· 1338 1426 { 1339 1427 int res; 1340 1428 1341 - res = i2c_add_driver(&it87_driver); 1342 - if (res) 1429 + if ((res = it87_find(&isa_address))) 1343 1430 return res; 1344 - 1345 - if (!it87_find(&isa_address)) { 1346 - res = i2c_isa_add_driver(&it87_isa_driver); 1347 - if (res) { 1348 - i2c_del_driver(&it87_driver); 1349 - return res; 1350 - } 1351 - } 1352 - 1353 - return 0; 1431 + return i2c_isa_add_driver(&it87_isa_driver); 1354 1432 } 1355 1433 1356 1434 static void __exit sm_it87_exit(void) 1357 1435 { 1358 - if (isa_address) 1359 - i2c_isa_del_driver(&it87_isa_driver); 1360 - i2c_del_driver(&it87_driver); 1436 + i2c_isa_del_driver(&it87_isa_driver); 1361 1437 } 1362 1438 1363 1439
-1
include/linux/i2c-id.h
··· 144 144 #define I2C_DRIVERID_MTP008 1023 145 145 #define I2C_DRIVERID_DS1621 1024 146 146 #define I2C_DRIVERID_ADM1024 1025 147 - #define I2C_DRIVERID_IT87 1026 148 147 #define I2C_DRIVERID_CH700X 1027 /* single driver for CH7003-7009 digital pc to tv encoders */ 149 148 #define I2C_DRIVERID_FSCPOS 1028 150 149 #define I2C_DRIVERID_FSCSCY 1029