aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2009-09-18 16:45:48 -0400
committerJean Delvare <khali@linux-fr.org>2009-09-18 16:45:48 -0400
commit732d481127abaa0add41ee918191ea08e9ede17e (patch)
tree8d2c939552826eb604882a8dd027bc67832d96e6
parent8f67eeb0b44cde19216955975ffef8513a87c0c0 (diff)
i2c/chips: Remove deprecated pca9539 driver
The pca9539 driver in drivers/i2c/chips which just exports its registers to sysfs is superseded by drivers/gpio/pca953x.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> Acked-by: Ben Gardner <gardner.ben@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--Documentation/i2c/chips/pca953958
-rw-r--r--drivers/i2c/chips/Kconfig13
-rw-r--r--drivers/i2c/chips/Makefile1
-rw-r--r--drivers/i2c/chips/pca9539.c152
4 files changed, 0 insertions, 224 deletions
diff --git a/Documentation/i2c/chips/pca9539 b/Documentation/i2c/chips/pca9539
deleted file mode 100644
index 6aff890088b..00000000000
--- a/Documentation/i2c/chips/pca9539
+++ /dev/null
@@ -1,58 +0,0 @@
1Kernel driver pca9539
2=====================
3
4NOTE: this driver is deprecated and will be dropped soon, use
5drivers/gpio/pca9539.c instead.
6
7Supported chips:
8 * Philips PCA9539
9 Prefix: 'pca9539'
10 Addresses scanned: none
11 Datasheet:
12 http://www.semiconductors.philips.com/acrobat/datasheets/PCA9539_2.pdf
13
14Author: Ben Gardner <bgardner@wabtec.com>
15
16
17Description
18-----------
19
20The Philips PCA9539 is a 16 bit low power I/O device.
21All 16 lines can be individually configured as an input or output.
22The input sense can also be inverted.
23The 16 lines are split between two bytes.
24
25
26Detection
27---------
28
29The PCA9539 is difficult to detect and not commonly found in PC machines,
30so you have to pass the I2C bus and address of the installed PCA9539
31devices explicitly to the driver at load time via the force=... parameter.
32
33
34Sysfs entries
35-------------
36
37Each is a byte that maps to the 8 I/O bits.
38A '0' suffix is for bits 0-7, while '1' is for bits 8-15.
39
40input[01] - read the current value
41output[01] - sets the output value
42direction[01] - direction of each bit: 1=input, 0=output
43invert[01] - toggle the input bit sense
44
45input reads the actual state of the line and is always available.
46The direction defaults to input for all channels.
47
48
49General Remarks
50---------------
51
52Note that each output, direction, and invert entry controls 8 lines.
53You should use the read, modify, write sequence.
54For example. to set output bit 0 of 1.
55 val=$(cat output0)
56 val=$(( $val | 1 ))
57 echo $val > output0
58
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 1b5455ec290..8cd1a7f3dcb 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -33,19 +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
36config SENSORS_PCA9539
37 tristate "Philips PCA9539 16-bit I/O port (DEPRECATED)"
38 depends on EXPERIMENTAL && GPIO_PCA953X = "n"
39 help
40 If you say yes here you get support for the Philips PCA9539
41 16-bit I/O port.
42
43 This driver can also be built as a module. If so, the module
44 will be called pca9539.
45
46 This driver is deprecated and will be dropped soon. Use
47 drivers/gpio/pca953x.c instead.
48
49config SENSORS_TSL2550 36config SENSORS_TSL2550
50 tristate "Taos TSL2550 ambient light sensor" 37 tristate "Taos TSL2550 ambient light sensor"
51 depends on EXPERIMENTAL 38 depends on EXPERIMENTAL
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index fceb377f528..8cd778dd64e 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -11,7 +11,6 @@
11# 11#
12 12
13obj-$(CONFIG_DS1682) += ds1682.o 13obj-$(CONFIG_DS1682) += ds1682.o
14obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o
15obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o 14obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
16obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 15obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
17 16
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c
deleted file mode 100644
index 270de4e56a8..00000000000
--- a/drivers/i2c/chips/pca9539.c
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 pca9539.c - 16-bit I/O port with interrupt and reset
3
4 Copyright (C) 2005 Ben Gardner <bgardner@wabtec.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9*/
10
11#include <linux/module.h>
12#include <linux/init.h>
13#include <linux/slab.h>
14#include <linux/i2c.h>
15#include <linux/hwmon-sysfs.h>
16
17/* Addresses to scan: none, device is not autodetected */
18static const unsigned short normal_i2c[] = { I2C_CLIENT_END };
19
20/* Insmod parameters */
21I2C_CLIENT_INSMOD_1(pca9539);
22
23enum pca9539_cmd
24{
25 PCA9539_INPUT_0 = 0,
26 PCA9539_INPUT_1 = 1,
27 PCA9539_OUTPUT_0 = 2,
28 PCA9539_OUTPUT_1 = 3,
29 PCA9539_INVERT_0 = 4,
30 PCA9539_INVERT_1 = 5,
31 PCA9539_DIRECTION_0 = 6,
32 PCA9539_DIRECTION_1 = 7,
33};
34
35/* following are the sysfs callback functions */
36static ssize_t pca9539_show(struct device *dev, struct device_attribute *attr,
37 char *buf)
38{
39 struct sensor_device_attribute *psa = to_sensor_dev_attr(attr);
40 struct i2c_client *client = to_i2c_client(dev);
41 return sprintf(buf, "%d\n", i2c_smbus_read_byte_data(client,
42 psa->index));
43}
44
45static ssize_t pca9539_store(struct device *dev, struct device_attribute *attr,
46 const char *buf, size_t count)
47{
48 struct sensor_device_attribute *psa = to_sensor_dev_attr(attr);
49 struct i2c_client *client = to_i2c_client(dev);
50 unsigned long val = simple_strtoul(buf, NULL, 0);
51 if (val > 0xff)
52 return -EINVAL;
53 i2c_smbus_write_byte_data(client, psa->index, val);
54 return count;
55}
56
57/* Define the device attributes */
58
59#define PCA9539_ENTRY_RO(name, cmd_idx) \
60 static SENSOR_DEVICE_ATTR(name, S_IRUGO, pca9539_show, NULL, cmd_idx)
61
62#define PCA9539_ENTRY_RW(name, cmd_idx) \
63 static SENSOR_DEVICE_ATTR(name, S_IRUGO | S_IWUSR, pca9539_show, \
64 pca9539_store, cmd_idx)
65
66PCA9539_ENTRY_RO(input0, PCA9539_INPUT_0);
67PCA9539_ENTRY_RO(input1, PCA9539_INPUT_1);
68PCA9539_ENTRY_RW(output0, PCA9539_OUTPUT_0);
69PCA9539_ENTRY_RW(output1, PCA9539_OUTPUT_1);
70PCA9539_ENTRY_RW(invert0, PCA9539_INVERT_0);
71PCA9539_ENTRY_RW(invert1, PCA9539_INVERT_1);
72PCA9539_ENTRY_RW(direction0, PCA9539_DIRECTION_0);
73PCA9539_ENTRY_RW(direction1, PCA9539_DIRECTION_1);
74
75static struct attribute *pca9539_attributes[] = {
76 &sensor_dev_attr_input0.dev_attr.attr,
77 &sensor_dev_attr_input1.dev_attr.attr,
78 &sensor_dev_attr_output0.dev_attr.attr,
79 &sensor_dev_attr_output1.dev_attr.attr,
80 &sensor_dev_attr_invert0.dev_attr.attr,
81 &sensor_dev_attr_invert1.dev_attr.attr,
82 &sensor_dev_attr_direction0.dev_attr.attr,
83 &sensor_dev_attr_direction1.dev_attr.attr,
84 NULL
85};
86
87static struct attribute_group pca9539_defattr_group = {
88 .attrs = pca9539_attributes,
89};
90
91/* Return 0 if detection is successful, -ENODEV otherwise */
92static int pca9539_detect(struct i2c_client *client, int kind,
93 struct i2c_board_info *info)
94{
95 struct i2c_adapter *adapter = client->adapter;
96
97 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
98 return -ENODEV;
99
100 strlcpy(info->type, "pca9539", I2C_NAME_SIZE);
101
102 return 0;
103}
104
105static int pca9539_probe(struct i2c_client *client,
106 const struct i2c_device_id *id)
107{
108 /* Register sysfs hooks */
109 return sysfs_create_group(&client->dev.kobj,
110 &pca9539_defattr_group);
111}
112
113static int pca9539_remove(struct i2c_client *client)
114{
115 sysfs_remove_group(&client->dev.kobj, &pca9539_defattr_group);
116 return 0;
117}
118
119static const struct i2c_device_id pca9539_id[] = {
120 { "pca9539", 0 },
121 { }
122};
123
124static struct i2c_driver pca9539_driver = {
125 .driver = {
126 .name = "pca9539",
127 },
128 .probe = pca9539_probe,
129 .remove = pca9539_remove,
130 .id_table = pca9539_id,
131
132 .detect = pca9539_detect,
133 .address_data = &addr_data,
134};
135
136static int __init pca9539_init(void)
137{
138 return i2c_add_driver(&pca9539_driver);
139}
140
141static void __exit pca9539_exit(void)
142{
143 i2c_del_driver(&pca9539_driver);
144}
145
146MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>");
147MODULE_DESCRIPTION("PCA9539 driver");
148MODULE_LICENSE("GPL");
149
150module_init(pca9539_init);
151module_exit(pca9539_exit);
152