superio-locks in rest
Subsystems (5)
RFC PATCH 4/4 superio-locks in rest
04 - use superio-locks in rest of drivers/hwmon/*.c
This patch(s) is compile-tested only, please review before installing and testing.
Signed-off-by Jim Cromie <[email protected]>
---
[jimc@harpo mylocks]$ diffstat diff.locks-superio-usein-hwmon
Kconfig | 8 ++++ f71805f.c | 71 ++++++++++++++++++++++++-------------- it87.c | 75 +++++++++++++++++++++++++++------------- smsc47b397.c | 65 ++++++++++++++++++++++++----------- smsc47m1.c | 58 ++++++++++++++++++++++--------- vt1211.c | 63 +++++++++++++++++++++++----------- w83627ehf.c | 96 ++++++++++++++++++++++++--------------------------- w83627hf.c | 109 ++++++++++++++++++++++++++++++++++++----------------------- 8 files changed, 348 insertions(+), 197 deletions(-)
drivers/hwmon/f71805f.c +46 -25
@@ -36,6 +36,7 @@#include <linux/mutex.h> #include <linux/sysfs.h> #include <linux/ioport.h> +#include <linux/superio-locks.h> #include <asm/io.h> static struct platform_device *pdev;
@@ -61,6 +62,21 @@ enum kinds { f71805f, f71872f };#define SIO_F71805F_ID 0x0406#define SIO_F71872F_ID 0x0341 +static struct superio * gate; + +static u16 cmd_addrs[] = {0x2e ,0x4e ,0 }; +static u16 devid_vals[] = {SIO_F71805F_ID ,SIO_F71872F_ID ,0 }; + +static struct superio_search where = { + .cmdreg_addrs = cmd_addrs, + .device_ids = devid_vals, + .devid_addr =SIO_REG_DEVID , + .devid_mask =0 , + .devid_word =1 , +}; + +#if 0 +static inline int superio_inb (int base,int reg) {
@@ -80,13 +96,6 @@ superio_inw(int base, int reg) }static inline void -superio_select (int base,int ld) -{ -outb (SIO_REG_LDSEL , base); -outb (ld, base +1 ); -} - -static inline void superio_enter (int base) {outb (0x87 , base);
@@ -99,6 +108,14 @@ superio_exit(int base) outb(0xaa, base); } +#endif + +static inline void +superio_select (struct superio *const gate,int ld) +{ +superio_outb (gate,SIO_REG_LDSEL , ld); +} +/* * ISA constants */
@@ -1315,31 +1332,36 @@ exit:return err; } -static int __init f71805f_find (int sioaddr,unsigned short *address, -struct f71805f_sio_data *sio_data) +static int __init f71805f_find (struct f71805f_sio_data *sio_data) {int err = -ENODEV ; -u16 devid; - +u16 devid, address; +static const char *names[] = {"F71805F/FG" ,"F71872F/FG" , }; -superio_enter (sioaddr); + gate =superio_find (&where); +if (!gate) { +printk (KERN_WARNING "pc87360: superio port not detected, " +"module not intalled.\n" ); +return -ENODEV ; + } +superio_enter (gate); - devid =superio_inw (sioaddr,SIO_REG_MANID ); + devid =superio_inw (gate,SIO_REG_MANID );if (devid !=SIO_FINTEK_ID ) goto exit; - devid =superio_inw (sioaddr,SIO_REG_DEVID ); + devid =superio_inw (gate,SIO_REG_DEVID );switch (devid) {case SIO_F71805F_ID : sio_data->kind = f71805f;break ;case SIO_F71872F_ID : sio_data->kind = f71872f; - sio_data->fnsel1 =superio_inb (sioaddr,SIO_REG_FNSEL1 ); + sio_data->fnsel1 =superio_inb (gate,SIO_REG_FNSEL1 );break ;default : printk(KERN_INFO DRVNAME ": Unsupported Fintek device, "
@@ -1347,28 +1369,28 @@ static int __init f71805f_find(int sioad goto exit; } -superio_select (sioaddr,F71805F_LD_HWM ); -if (!(superio_inb (sioaddr,SIO_REG_ENABLE ) &0x01 )) { +superio_select (gate,F71805F_LD_HWM ); +if (!(superio_inb (gate,SIO_REG_ENABLE ) &0x01 )) { printk(KERN_WARNING DRVNAME ": Device not activated, " "skipping\n"); goto exit; } - *address =superio_inw (sioaddr,SIO_REG_ADDR ); -if (*address ==0 ) { + address =superio_inw (gate,SIO_REG_ADDR ); +if (address ==0 ) { printk(KERN_WARNING DRVNAME ": Base address not set, " "skipping\n"); goto exit; } - *address &= ~(REGION_LENGTH -1 );/* Ignore 3 LSB */ + address &= ~(REGION_LENGTH -1 );/* Ignore 3 LSB */ err =0 ; printk(KERN_INFO DRVNAME ": Found %s chip at %#x, revision %u\n", - names[sio_data->kind], *address, - superio_inb(sioaddr, SIO_REG_DEVREV)); + names[sio_data->kind], address, + superio_inb(gate, SIO_REG_DEVREV)); exit: -superio_exit (sioaddr); +superio_exit (gate);return err; }
@@ -1378,8 +1400,7 @@ static int __init f71805f_init(void)unsigned short address;struct f71805f_sio_data sio_data; -if (f71805f_find (0x2e , &address, &sio_data) - &&f71805f_find (0x4e , &address, &sio_data)) +if (f71805f_find (&sio_data))return -ENODEV ; err =platform_driver_register (&f71805f_driver);
drivers/hwmon/it87.c +51 -24
134 lines not on this page · raw message
drivers/hwmon/Kconfig +8 -0
@@ -191,6 +191,7 @@ config SENSORS_DS1621 config SENSORS_F71805F tristate "Fintek F71805F/FG and F71872F/FG" depends on EXPERIMENTAL + select SUPERIO_LOCKS help If you say yes here you get support for hardware monitoring features of the Fintek F71805F/FG and F71872F/FG Super-I/O
@@ -253,6 +254,7 @@ config SENSORS_IT87 depends on I2C select I2C_ISA select HWMON_VID + select SUPERIO_LOCKS help If you say yes here you get support for ITE IT8705F, IT8712F, IT8716F and IT8718F sensor chips, and the SiS960 clone.
@@ -422,6 +424,7 @@ config SENSORS_PC87360 config SENSORS_PC87427 tristate "National Semiconductor PC87427" depends on EXPERIMENTAL + select SUPERIO_LOCKS help If you say yes here you get access to the hardware monitoring functions of the National Semiconductor PC87427 Super-I/O chip.
@@ -445,6 +448,7 @@ config SENSORS_SIS5595 config SENSORS_SMSC47M1 tristate "SMSC LPC47M10x and compatibles" + select SUPERIO_LOCKS help If you say yes here you get support for the integrated fan monitoring and control capabilities of the SMSC LPC47B27x,
@@ -479,6 +483,7 @@ config SENSORS_SMSC47M192 config SENSORS_SMSC47B397 tristate "SMSC LPC47B397-NC" depends on EXPERIMENTAL + select SUPERIO_LOCKS help If you say yes here you get support for the SMSC LPC47B397-NC sensor chip.
@@ -501,6 +506,7 @@ config SENSORS_VT1211 tristate "VIA VT1211" depends on EXPERIMENTAL select HWMON_VID + select SUPERIO_LOCKS help If you say yes here then you get support for hardware monitoring features of the VIA VT1211 Super-I/O chip.
@@ -576,6 +582,7 @@ config SENSORS_W83L785TS config SENSORS_W83627HF tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF" select HWMON_VID + select SUPERIO_LOCKS help If you say yes here you get support for the Winbond W836X7 series of sensor chips: the W83627HF, W83627THF, W83637HF, W83687THF and
@@ -588,6 +595,7 @@ config SENSORS_W83627EHF tristate "Winbond W83627EHF" depends on I2C && EXPERIMENTAL select I2C_ISA + select SUPERIO_LOCKS help If you say yes here you get preliminary support for the hardware monitoring functionality of the Winbond W83627EHF Super-I/O chip.
drivers/hwmon/smsc47b397.c +45 -20
107 lines not on this page · raw message
drivers/hwmon/smsc47m1.c +42 -16
104 lines not on this page · raw message
drivers/hwmon/vt1211.c +43 -20
121 lines not on this page · raw message
drivers/hwmon/w83627ehf.c +45 -51
148 lines not on this page · raw message
drivers/hwmon/w83627hf.c +68 -41
219 lines not on this page · raw message
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors