Move the pcf8591 driver to hwmon
authorJean Delvare <khali@linux-fr.org>
Mon, 30 Mar 2009 19:46:43 +0000 (21:46 +0200)
committerJean Delvare <khali@linux-fr.org>
Mon, 30 Mar 2009 19:46:43 +0000 (21:46 +0200)
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>
Documentation/hwmon/pcf8591 [moved from Documentation/i2c/chips/pcf8591 with 100% similarity]
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/pcf8591.c [moved from drivers/i2c/chips/pcf8591.c with 96% similarity]
drivers/i2c/chips/Kconfig
drivers/i2c/chips/Makefile

index 0eb4170..9a22816 100644 (file)
@@ -635,6 +635,20 @@ config SENSORS_PC87427
          This driver can also be built as a module.  If so, the module
          will be called pc87427.
 
+config SENSORS_PCF8591
+       tristate "Philips PCF8591 ADC/DAC"
+       depends on I2C
+       default n
+       help
+         If you say yes here you get support for Philips PCF8591 4-channel
+         ADC, 1-channel DAC chips.
+
+         This driver can also be built as a module.  If so, the module
+         will be called pcf8591.
+
+         These devices are hard to detect and rarely found on mainstream
+         hardware.  If unsure, say N.
+
 config SENSORS_SIS5595
        tristate "Silicon Integrated Systems Corp. SiS5595"
        depends on PCI
index 2e80f37..e332d62 100644 (file)
@@ -70,6 +70,7 @@ obj-$(CONFIG_SENSORS_MAX1619) += max1619.o
 obj-$(CONFIG_SENSORS_MAX6650)  += max6650.o
 obj-$(CONFIG_SENSORS_PC87360)  += pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)  += pc87427.o
+obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
 obj-$(CONFIG_SENSORS_SIS5595)  += sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
similarity index 96%
rename from drivers/i2c/chips/pcf8591.c
rename to drivers/hwmon/pcf8591.c
index 16ce3e1..1d7ffeb 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2001-2004 Aurelien Jarno <aurelien@aurel32.net>
-    Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with 
+    Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
     the help of Jean Delvare <khali@linux-fr.org>
 
     This program is free software; you can redistribute it and/or modify
@@ -41,13 +41,13 @@ MODULE_PARM_DESC(input_mode,
        " 3 = two differential inputs\n");
 
 /* The PCF8591 control byte
-      7    6    5    4    3    2    1    0  
+      7    6    5    4    3    2    1    0
    |  0 |AOEF|   AIP   |  0 |AINC|  AICH   | */
 
 /* Analog Output Enable Flag (analog output active if 1) */
 #define PCF8591_CONTROL_AOEF           0x40
-                                       
-/* Analog Input Programming 
+
+/* Analog Input Programming
    0x00 = four single ended inputs
    0x10 = three differential inputs
    0x20 = single ended and differential mixed
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(input_mode,
 #define PCF8591_CONTROL_AINC           0x04
 
 /* Channel selection
-   0x00 = channel 0 
+   0x00 = channel 0
    0x01 = channel 1
    0x02 = channel 2
    0x03 = channel 3 */
@@ -114,7 +114,7 @@ static ssize_t set_out0_output(struct device *dev, struct device_attribute *attr
        return -EINVAL;
 }
 
-static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 
+static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO,
                   show_out0_ouput, set_out0_output);
 
 static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf)
@@ -139,7 +139,7 @@ static ssize_t set_out0_enable(struct device *dev, struct device_attribute *attr
        return count;
 }
 
-static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, 
+static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO,
                   show_out0_enable, set_out0_enable);
 
 static struct attribute *pcf8591_attributes[] = {
@@ -196,7 +196,7 @@ static int pcf8591_probe(struct i2c_client *client,
                err = -ENOMEM;
                goto exit;
        }
-       
+
        i2c_set_clientdata(client, data);
        mutex_init(&data->update_lock);
 
@@ -249,8 +249,8 @@ static void pcf8591_init_client(struct i2c_client *client)
        data->aout = PCF8591_INIT_AOUT;
 
        i2c_smbus_write_byte_data(client, data->control, data->aout);
-       
-       /* The first byte transmitted contains the conversion code of the 
+
+       /* The first byte transmitted contains the conversion code of the
           previous read cycle. FLUSH IT! */
        i2c_smbus_read_byte(client);
 }
@@ -267,8 +267,8 @@ static int pcf8591_read_channel(struct device *dev, int channel)
                data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK)
                              | channel;
                i2c_smbus_write_byte(client, data->control);
-       
-               /* The first byte transmitted contains the conversion code of 
+
+               /* The first byte transmitted contains the conversion code of
                   the previous read cycle. FLUSH IT! */
                i2c_smbus_read_byte(client);
        }
index c80312c..8f8c81e 100644 (file)
@@ -64,19 +64,6 @@ config SENSORS_PCA9539
          This driver is deprecated and will be dropped soon. Use
          drivers/gpio/pca953x.c instead.
 
-config SENSORS_PCF8591
-       tristate "Philips PCF8591"
-       depends on EXPERIMENTAL
-       default n
-       help
-         If you say yes here you get support for Philips PCF8591 chips.
-
-         This driver can also be built as a module.  If so, the module
-         will be called pcf8591.
-
-         These devices are hard to detect and rarely found on mainstream
-         hardware.  If unsure, say N.
-
 config SENSORS_MAX6875
        tristate "Maxim MAX6875 Power supply supervisor"
        depends on EXPERIMENTAL
index d142f23..55a3760 100644 (file)
@@ -15,7 +15,6 @@ obj-$(CONFIG_SENSORS_MAX6875) += max6875.o
 obj-$(CONFIG_SENSORS_PCA9539)  += pca9539.o
 obj-$(CONFIG_SENSORS_PCF8574)  += pcf8574.o
 obj-$(CONFIG_PCF8575)          += pcf8575.o
-obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
 obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
 
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)