Skip to content

Commit

Permalink
Move the pcf8591 driver to hwmon
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare committed Mar 30, 2009
1 parent a157d06 commit fb4504f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
File renamed without changes.
14 changes: 14 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions drivers/i2c/chips/pcf8591.c → drivers/hwmon/pcf8591.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand Down Expand Up @@ -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)
Expand All @@ -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[] = {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
13 changes: 0 additions & 13 deletions drivers/i2c/chips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion drivers/i2c/chips/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb4504f

Please sign in to comment.