diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-09-18 16:45:48 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-09-18 16:45:48 -0400 |
commit | 8f67eeb0b44cde19216955975ffef8513a87c0c0 (patch) | |
tree | c848851a7494b72038f24beca93362755567e8cc | |
parent | 4ba2ccb83e03077bb94f8848ee573f1e27cea969 (diff) |
i2c/chips: Remove deprecated pcf8575 driver
The pcf8575 driver in drivers/i2c/chips which just exports its register to
sysfs is superseded by drivers/gpio/pcf857x.c which properly uses the gpiolib.
As this driver has been deprecated for more than a year, finally remove it.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Bart Van Assche <bart.vanassche@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | Documentation/i2c/chips/pcf8575 | 69 | ||||
-rw-r--r-- | drivers/i2c/chips/Kconfig | 18 | ||||
-rw-r--r-- | drivers/i2c/chips/Makefile | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf8575.c | 198 |
4 files changed, 0 insertions, 286 deletions
diff --git a/Documentation/i2c/chips/pcf8575 b/Documentation/i2c/chips/pcf8575 deleted file mode 100644 index 40b268eb276..00000000000 --- a/Documentation/i2c/chips/pcf8575 +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | About the PCF8575 chip and the pcf8575 kernel driver | ||
2 | ==================================================== | ||
3 | |||
4 | The PCF8575 chip is produced by the following manufacturers: | ||
5 | |||
6 | * Philips NXP | ||
7 | http://www.nxp.com/#/pip/cb=[type=product,path=50807/41735/41850,final=PCF8575_3]|pip=[pip=PCF8575_3][0] | ||
8 | |||
9 | * Texas Instruments | ||
10 | http://focus.ti.com/docs/prod/folders/print/pcf8575.html | ||
11 | |||
12 | |||
13 | Some vendors sell small PCB's with the PCF8575 mounted on it. You can connect | ||
14 | such a board to a Linux host via e.g. an USB to I2C interface. Examples of | ||
15 | PCB boards with a PCF8575: | ||
16 | |||
17 | * SFE Breakout Board for PCF8575 I2C Expander by RobotShop | ||
18 | http://www.robotshop.ca/home/products/robot-parts/electronics/adapters-converters/sfe-pcf8575-i2c-expander-board.html | ||
19 | |||
20 | * Breakout Board for PCF8575 I2C Expander by Spark Fun Electronics | ||
21 | http://www.sparkfun.com/commerce/product_info.php?products_id=8130 | ||
22 | |||
23 | |||
24 | Description | ||
25 | ----------- | ||
26 | The PCF8575 chip is a 16-bit I/O expander for the I2C bus. Up to eight of | ||
27 | these chips can be connected to the same I2C bus. You can find this | ||
28 | chip on some custom designed hardware, but you won't find it on PC | ||
29 | motherboards. | ||
30 | |||
31 | The PCF8575 chip consists of a 16-bit quasi-bidirectional port and an I2C-bus | ||
32 | interface. Each of the sixteen I/O's can be independently used as an input or | ||
33 | an output. To set up an I/O pin as an input, you have to write a 1 to the | ||
34 | corresponding output. | ||
35 | |||
36 | For more information please see the datasheet. | ||
37 | |||
38 | |||
39 | Detection | ||
40 | --------- | ||
41 | |||
42 | There is no method known to detect whether a chip on a given I2C address is | ||
43 | a PCF8575 or whether it is any other I2C device, so you have to pass the I2C | ||
44 | bus and address of the installed PCF8575 devices explicitly to the driver at | ||
45 | load time via the force=... parameter. | ||
46 | |||
47 | /sys interface | ||
48 | -------------- | ||
49 | |||
50 | For each address on which a PCF8575 chip was found or forced the following | ||
51 | files will be created under /sys: | ||
52 | * /sys/bus/i2c/devices/<bus>-<address>/read | ||
53 | * /sys/bus/i2c/devices/<bus>-<address>/write | ||
54 | where bus is the I2C bus number (0, 1, ...) and address is the four-digit | ||
55 | hexadecimal representation of the 7-bit I2C address of the PCF8575 | ||
56 | (0020 .. 0027). | ||
57 | |||
58 | The read file is read-only. Reading it will trigger an I2C read and will hence | ||
59 | report the current input state for the pins configured as inputs, and the | ||
60 | current output value for the pins configured as outputs. | ||
61 | |||
62 | The write file is read-write. Writing a value to it will configure all pins | ||
63 | as output for which the corresponding bit is zero. Reading the write file will | ||
64 | return the value last written, or -EAGAIN if no value has yet been written to | ||
65 | the write file. | ||
66 | |||
67 | On module initialization the configuration of the chip is not changed -- the | ||
68 | chip is left in the state it was already configured in through either power-up | ||
69 | or through previous I2C write actions. | ||
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 02d746c9c47..1b5455ec290 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -33,24 +33,6 @@ config SENSORS_PCF8574 | |||
33 | These devices are hard to detect and rarely found on mainstream | 33 | These devices are hard to detect and rarely found on mainstream |
34 | hardware. If unsure, say N. | 34 | hardware. If unsure, say N. |
35 | 35 | ||
36 | config PCF8575 | ||
37 | tristate "Philips PCF8575 (DEPRECATED)" | ||
38 | default n | ||
39 | depends on GPIO_PCF857X = "n" | ||
40 | help | ||
41 | If you say yes here you get support for Philips PCF8575 chip. | ||
42 | This chip is a 16-bit I/O expander for the I2C bus. Several other | ||
43 | chip manufacturers sell equivalent chips, e.g. Texas Instruments. | ||
44 | |||
45 | This driver can also be built as a module. If so, the module | ||
46 | will be called pcf8575. | ||
47 | |||
48 | This driver is deprecated and will be dropped soon. Use | ||
49 | drivers/gpio/pcf857x.c instead. | ||
50 | |||
51 | This device is hard to detect and is rarely found on mainstream | ||
52 | hardware. If unsure, say N. | ||
53 | |||
54 | config SENSORS_PCA9539 | 36 | config SENSORS_PCA9539 |
55 | tristate "Philips PCA9539 16-bit I/O port (DEPRECATED)" | 37 | tristate "Philips PCA9539 16-bit I/O port (DEPRECATED)" |
56 | depends on EXPERIMENTAL && GPIO_PCA953X = "n" | 38 | depends on EXPERIMENTAL && GPIO_PCA953X = "n" |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index f4680d16ee3..fceb377f528 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -13,7 +13,6 @@ | |||
13 | obj-$(CONFIG_DS1682) += ds1682.o | 13 | obj-$(CONFIG_DS1682) += ds1682.o |
14 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o | 14 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o |
15 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o | 15 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o |
16 | obj-$(CONFIG_PCF8575) += pcf8575.o | ||
17 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o | 16 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o |
18 | 17 | ||
19 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) | 18 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) |
diff --git a/drivers/i2c/chips/pcf8575.c b/drivers/i2c/chips/pcf8575.c deleted file mode 100644 index 07fd7cb3c57..00000000000 --- a/drivers/i2c/chips/pcf8575.c +++ /dev/null | |||
@@ -1,198 +0,0 @@ | |||
1 | /* | ||
2 | pcf8575.c | ||
3 | |||
4 | About the PCF8575 chip: the PCF8575 is a 16-bit I/O expander for the I2C bus | ||
5 | produced by a.o. Philips Semiconductors. | ||
6 | |||
7 | Copyright (C) 2006 Michael Hennerich, Analog Devices Inc. | ||
8 | <hennerich@blackfin.uclinux.org> | ||
9 | Based on pcf8574.c. | ||
10 | |||
11 | Copyright (c) 2007 Bart Van Assche <bart.vanassche@gmail.com>. | ||
12 | Ported this driver from ucLinux to the mainstream Linux kernel. | ||
13 | |||
14 | This program is free software; you can redistribute it and/or modify | ||
15 | it under the terms of the GNU General Public License as published by | ||
16 | the Free Software Foundation; either version 2 of the License, or | ||
17 | (at your option) any later version. | ||
18 | |||
19 | This program is distributed in the hope that it will be useful, | ||
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | GNU General Public License for more details. | ||
23 | |||
24 | You should have received a copy of the GNU General Public License | ||
25 | along with this program; if not, write to the Free Software | ||
26 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | */ | ||
28 | |||
29 | #include <linux/module.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/i2c.h> | ||
32 | #include <linux/slab.h> /* kzalloc() */ | ||
33 | #include <linux/sysfs.h> /* sysfs_create_group() */ | ||
34 | |||
35 | /* Addresses to scan: none, device can't be detected */ | ||
36 | static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
37 | |||
38 | /* Insmod parameters */ | ||
39 | I2C_CLIENT_INSMOD; | ||
40 | |||
41 | |||
42 | /* Each client has this additional data */ | ||
43 | struct pcf8575_data { | ||
44 | int write; /* last written value, or error code */ | ||
45 | }; | ||
46 | |||
47 | /* following are the sysfs callback functions */ | ||
48 | static ssize_t show_read(struct device *dev, struct device_attribute *attr, | ||
49 | char *buf) | ||
50 | { | ||
51 | struct i2c_client *client = to_i2c_client(dev); | ||
52 | u16 val; | ||
53 | u8 iopin_state[2]; | ||
54 | |||
55 | i2c_master_recv(client, iopin_state, 2); | ||
56 | |||
57 | val = iopin_state[0]; | ||
58 | val |= iopin_state[1] << 8; | ||
59 | |||
60 | return sprintf(buf, "%u\n", val); | ||
61 | } | ||
62 | |||
63 | static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); | ||
64 | |||
65 | static ssize_t show_write(struct device *dev, struct device_attribute *attr, | ||
66 | char *buf) | ||
67 | { | ||
68 | struct pcf8575_data *data = dev_get_drvdata(dev); | ||
69 | if (data->write < 0) | ||
70 | return data->write; | ||
71 | return sprintf(buf, "%d\n", data->write); | ||
72 | } | ||
73 | |||
74 | static ssize_t set_write(struct device *dev, struct device_attribute *attr, | ||
75 | const char *buf, size_t count) | ||
76 | { | ||
77 | struct i2c_client *client = to_i2c_client(dev); | ||
78 | struct pcf8575_data *data = i2c_get_clientdata(client); | ||
79 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
80 | u8 iopin_state[2]; | ||
81 | |||
82 | if (val > 0xffff) | ||
83 | return -EINVAL; | ||
84 | |||
85 | data->write = val; | ||
86 | |||
87 | iopin_state[0] = val & 0xFF; | ||
88 | iopin_state[1] = val >> 8; | ||
89 | |||
90 | i2c_master_send(client, iopin_state, 2); | ||
91 | |||
92 | return count; | ||
93 | } | ||
94 | |||
95 | static DEVICE_ATTR(write, S_IWUSR | S_IRUGO, show_write, set_write); | ||
96 | |||
97 | static struct attribute *pcf8575_attributes[] = { | ||
98 | &dev_attr_read.attr, | ||
99 | &dev_attr_write.attr, | ||
100 | NULL | ||
101 | }; | ||
102 | |||
103 | static const struct attribute_group pcf8575_attr_group = { | ||
104 | .attrs = pcf8575_attributes, | ||
105 | }; | ||
106 | |||
107 | /* | ||
108 | * Real code | ||
109 | */ | ||
110 | |||
111 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
112 | static int pcf8575_detect(struct i2c_client *client, int kind, | ||
113 | struct i2c_board_info *info) | ||
114 | { | ||
115 | struct i2c_adapter *adapter = client->adapter; | ||
116 | |||
117 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) | ||
118 | return -ENODEV; | ||
119 | |||
120 | /* This is the place to detect whether the chip at the specified | ||
121 | address really is a PCF8575 chip. However, there is no method known | ||
122 | to detect whether an I2C chip is a PCF8575 or any other I2C chip. */ | ||
123 | |||
124 | strlcpy(info->type, "pcf8575", I2C_NAME_SIZE); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int pcf8575_probe(struct i2c_client *client, | ||
130 | const struct i2c_device_id *id) | ||
131 | { | ||
132 | struct pcf8575_data *data; | ||
133 | int err; | ||
134 | |||
135 | data = kzalloc(sizeof(struct pcf8575_data), GFP_KERNEL); | ||
136 | if (!data) { | ||
137 | err = -ENOMEM; | ||
138 | goto exit; | ||
139 | } | ||
140 | |||
141 | i2c_set_clientdata(client, data); | ||
142 | data->write = -EAGAIN; | ||
143 | |||
144 | /* Register sysfs hooks */ | ||
145 | err = sysfs_create_group(&client->dev.kobj, &pcf8575_attr_group); | ||
146 | if (err) | ||
147 | goto exit_free; | ||
148 | |||
149 | return 0; | ||
150 | |||
151 | exit_free: | ||
152 | kfree(data); | ||
153 | exit: | ||
154 | return err; | ||
155 | } | ||
156 | |||
157 | static int pcf8575_remove(struct i2c_client *client) | ||
158 | { | ||
159 | sysfs_remove_group(&client->dev.kobj, &pcf8575_attr_group); | ||
160 | kfree(i2c_get_clientdata(client)); | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static const struct i2c_device_id pcf8575_id[] = { | ||
165 | { "pcf8575", 0 }, | ||
166 | { } | ||
167 | }; | ||
168 | |||
169 | static struct i2c_driver pcf8575_driver = { | ||
170 | .driver = { | ||
171 | .owner = THIS_MODULE, | ||
172 | .name = "pcf8575", | ||
173 | }, | ||
174 | .probe = pcf8575_probe, | ||
175 | .remove = pcf8575_remove, | ||
176 | .id_table = pcf8575_id, | ||
177 | |||
178 | .detect = pcf8575_detect, | ||
179 | .address_data = &addr_data, | ||
180 | }; | ||
181 | |||
182 | static int __init pcf8575_init(void) | ||
183 | { | ||
184 | return i2c_add_driver(&pcf8575_driver); | ||
185 | } | ||
186 | |||
187 | static void __exit pcf8575_exit(void) | ||
188 | { | ||
189 | i2c_del_driver(&pcf8575_driver); | ||
190 | } | ||
191 | |||
192 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>, " | ||
193 | "Bart Van Assche <bart.vanassche@gmail.com>"); | ||
194 | MODULE_DESCRIPTION("pcf8575 driver"); | ||
195 | MODULE_LICENSE("GPL"); | ||
196 | |||
197 | module_init(pcf8575_init); | ||
198 | module_exit(pcf8575_exit); | ||