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

Move the pcf8591 driver to hwmon

Directory drivers/i2c/chips is going away, so drivers there must find
new homes. For the pcf8591 driver, the best choice seems to be the
hwmon subsystem. While the Philips PCF8591 device isn't a typical
hardware monitoring chip, its DAC interface is compatible with the
hwmon one, so it fits somewhat.

If a better subsystem is ever created for ADC/DAC chips, the driver
could be moved there.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>

+27 -26
Documentation/i2c/chips/pcf8591 Documentation/hwmon/pcf8591
+14
drivers/hwmon/Kconfig
··· 635 635 This driver can also be built as a module. If so, the module 636 636 will be called pc87427. 637 637 638 + config SENSORS_PCF8591 639 + tristate "Philips PCF8591 ADC/DAC" 640 + depends on I2C 641 + default n 642 + help 643 + If you say yes here you get support for Philips PCF8591 4-channel 644 + ADC, 1-channel DAC chips. 645 + 646 + This driver can also be built as a module. If so, the module 647 + will be called pcf8591. 648 + 649 + These devices are hard to detect and rarely found on mainstream 650 + hardware. If unsure, say N. 651 + 638 652 config SENSORS_SIS5595 639 653 tristate "Silicon Integrated Systems Corp. SiS5595" 640 654 depends on PCI
+1
drivers/hwmon/Makefile
··· 70 70 obj-$(CONFIG_SENSORS_MAX6650) += max6650.o 71 71 obj-$(CONFIG_SENSORS_PC87360) += pc87360.o 72 72 obj-$(CONFIG_SENSORS_PC87427) += pc87427.o 73 + obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 73 74 obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o 74 75 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o 75 76 obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
-13
drivers/i2c/chips/Kconfig
··· 64 64 This driver is deprecated and will be dropped soon. Use 65 65 drivers/gpio/pca953x.c instead. 66 66 67 - config SENSORS_PCF8591 68 - tristate "Philips PCF8591" 69 - depends on EXPERIMENTAL 70 - default n 71 - help 72 - If you say yes here you get support for Philips PCF8591 chips. 73 - 74 - This driver can also be built as a module. If so, the module 75 - will be called pcf8591. 76 - 77 - These devices are hard to detect and rarely found on mainstream 78 - hardware. If unsure, say N. 79 - 80 67 config SENSORS_MAX6875 81 68 tristate "Maxim MAX6875 Power supply supervisor" 82 69 depends on EXPERIMENTAL
-1
drivers/i2c/chips/Makefile
··· 15 15 obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o 16 16 obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o 17 17 obj-$(CONFIG_PCF8575) += pcf8575.o 18 - obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 19 18 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 20 19 21 20 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
+12 -12
drivers/i2c/chips/pcf8591.c drivers/hwmon/pcf8591.c
··· 1 1 /* 2 2 Copyright (C) 2001-2004 Aurelien Jarno <aurelien@aurel32.net> 3 - Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with 3 + Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with 4 4 the help of Jean Delvare <khali@linux-fr.org> 5 5 6 6 This program is free software; you can redistribute it and/or modify ··· 41 41 " 3 = two differential inputs\n"); 42 42 43 43 /* The PCF8591 control byte 44 - 7 6 5 4 3 2 1 0 44 + 7 6 5 4 3 2 1 0 45 45 | 0 |AOEF| AIP | 0 |AINC| AICH | */ 46 46 47 47 /* Analog Output Enable Flag (analog output active if 1) */ 48 48 #define PCF8591_CONTROL_AOEF 0x40 49 - 50 - /* Analog Input Programming 49 + 50 + /* Analog Input Programming 51 51 0x00 = four single ended inputs 52 52 0x10 = three differential inputs 53 53 0x20 = single ended and differential mixed ··· 58 58 #define PCF8591_CONTROL_AINC 0x04 59 59 60 60 /* Channel selection 61 - 0x00 = channel 0 61 + 0x00 = channel 0 62 62 0x01 = channel 1 63 63 0x02 = channel 2 64 64 0x03 = channel 3 */ ··· 114 114 return -EINVAL; 115 115 } 116 116 117 - static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 117 + static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 118 118 show_out0_ouput, set_out0_output); 119 119 120 120 static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf) ··· 139 139 return count; 140 140 } 141 141 142 - static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, 142 + static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, 143 143 show_out0_enable, set_out0_enable); 144 144 145 145 static struct attribute *pcf8591_attributes[] = { ··· 196 196 err = -ENOMEM; 197 197 goto exit; 198 198 } 199 - 199 + 200 200 i2c_set_clientdata(client, data); 201 201 mutex_init(&data->update_lock); 202 202 ··· 249 249 data->aout = PCF8591_INIT_AOUT; 250 250 251 251 i2c_smbus_write_byte_data(client, data->control, data->aout); 252 - 253 - /* The first byte transmitted contains the conversion code of the 252 + 253 + /* The first byte transmitted contains the conversion code of the 254 254 previous read cycle. FLUSH IT! */ 255 255 i2c_smbus_read_byte(client); 256 256 } ··· 267 267 data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK) 268 268 | channel; 269 269 i2c_smbus_write_byte(client, data->control); 270 - 271 - /* The first byte transmitted contains the conversion code of 270 + 271 + /* The first byte transmitted contains the conversion code of 272 272 the previous read cycle. FLUSH IT! */ 273 273 i2c_smbus_read_byte(client); 274 274 }