aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-04-09 04:52:26 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-04-14 08:03:25 -0400
commitd17322feecf80152303426dd724577025d1fbd7e (patch)
tree7aac6be363e63bdf0bba70332666d2b759953540
parentf30e49f1291bc309865f88126005d526421d7e3a (diff)
gpio: sx150x: move platform data into driver
The sx150x has some platform data definition in <linux/i2c/sx150x.h> but this file is only included from the driver in the whole kernel so move its contents into the driver. Cc: Wei Chen <Wei.Chen@csr.com> Cc: Peter Rosin <peda@axentia.se> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-sx150x.c60
-rw-r--r--include/linux/i2c/sx150x.h82
2 files changed, 59 insertions, 83 deletions
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index d57e8ad0bfd2..d4501d5f8b8e 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -25,7 +25,6 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/i2c/sx150x.h>
29#include <linux/of.h> 28#include <linux/of.h>
30#include <linux/of_address.h> 29#include <linux/of_address.h>
31#include <linux/of_irq.h> 30#include <linux/of_irq.h>
@@ -85,6 +84,65 @@ struct sx150x_device_data {
85 } pri; 84 } pri;
86}; 85};
87 86
87/**
88 * struct sx150x_platform_data - config data for SX150x driver
89 * @gpio_base: The index number of the first GPIO assigned to this
90 * GPIO expander. The expander will create a block of
91 * consecutively numbered gpios beginning at the given base,
92 * with the size of the block depending on the model of the
93 * expander chip.
94 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
95 * instead of as an oscillator, increasing the size of the
96 * GP(I)O pool created by this expander by one. The
97 * output-only GPO pin will be added at the end of the block.
98 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
99 * for each IO line in the expander. Setting the bit at
100 * position n will enable the pull-up for the IO at
101 * the corresponding offset. For chips with fewer than
102 * 16 IO pins, high-end bits are ignored.
103 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
104 * resistor for each IO line in the expander. Setting the
105 * bit at position n will enable the pull-down for the IO at
106 * the corresponding offset. For chips with fewer than
107 * 16 IO pins, high-end bits are ignored.
108 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
109 * operation for each IO line in the expander. Setting the
110 * bit at position n enables open-drain operation for
111 * the IO at the corresponding offset. Clearing the bit
112 * enables regular push-pull operation for that IO.
113 * For chips with fewer than 16 IO pins, high-end bits
114 * are ignored.
115 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
116 * in the expander. Setting the bit at position n inverts
117 * the polarity of that IO line, while clearing it results
118 * in normal polarity. For chips with fewer than 16 IO pins,
119 * high-end bits are ignored.
120 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
121 * is connected, via which it reports interrupt events
122 * across all GPIO lines. This must be a real,
123 * pre-existing IRQ line.
124 * Setting this value < 0 disables the irq_chip functionality
125 * of the driver.
126 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
127 * IRQ lines will appear. Similarly to gpio_base, the expander
128 * will create a block of irqs beginning at this number.
129 * This value is ignored if irq_summary is < 0.
130 * @reset_during_probe: If set to true, the driver will trigger a full
131 * reset of the chip at the beginning of the probe
132 * in order to place it in a known state.
133 */
134struct sx150x_platform_data {
135 unsigned gpio_base;
136 bool oscio_is_gpo;
137 u16 io_pullup_ena;
138 u16 io_pulldn_ena;
139 u16 io_open_drain_ena;
140 u16 io_polarity;
141 int irq_summary;
142 unsigned irq_base;
143 bool reset_during_probe;
144};
145
88struct sx150x_chip { 146struct sx150x_chip {
89 struct gpio_chip gpio_chip; 147 struct gpio_chip gpio_chip;
90 struct i2c_client *client; 148 struct i2c_client *client;
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h
deleted file mode 100644
index 52baa79d69a7..000000000000
--- a/include/linux/i2c/sx150x.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Driver for the Semtech SX150x I2C GPIO Expanders
3 *
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
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 version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20#ifndef __LINUX_I2C_SX150X_H
21#define __LINUX_I2C_SX150X_H
22
23/**
24 * struct sx150x_platform_data - config data for SX150x driver
25 * @gpio_base: The index number of the first GPIO assigned to this
26 * GPIO expander. The expander will create a block of
27 * consecutively numbered gpios beginning at the given base,
28 * with the size of the block depending on the model of the
29 * expander chip.
30 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
31 * instead of as an oscillator, increasing the size of the
32 * GP(I)O pool created by this expander by one. The
33 * output-only GPO pin will be added at the end of the block.
34 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
35 * for each IO line in the expander. Setting the bit at
36 * position n will enable the pull-up for the IO at
37 * the corresponding offset. For chips with fewer than
38 * 16 IO pins, high-end bits are ignored.
39 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
40 * resistor for each IO line in the expander. Setting the
41 * bit at position n will enable the pull-down for the IO at
42 * the corresponding offset. For chips with fewer than
43 * 16 IO pins, high-end bits are ignored.
44 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
45 * operation for each IO line in the expander. Setting the
46 * bit at position n enables open-drain operation for
47 * the IO at the corresponding offset. Clearing the bit
48 * enables regular push-pull operation for that IO.
49 * For chips with fewer than 16 IO pins, high-end bits
50 * are ignored.
51 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
52 * in the expander. Setting the bit at position n inverts
53 * the polarity of that IO line, while clearing it results
54 * in normal polarity. For chips with fewer than 16 IO pins,
55 * high-end bits are ignored.
56 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
57 * is connected, via which it reports interrupt events
58 * across all GPIO lines. This must be a real,
59 * pre-existing IRQ line.
60 * Setting this value < 0 disables the irq_chip functionality
61 * of the driver.
62 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
63 * IRQ lines will appear. Similarly to gpio_base, the expander
64 * will create a block of irqs beginning at this number.
65 * This value is ignored if irq_summary is < 0.
66 * @reset_during_probe: If set to true, the driver will trigger a full
67 * reset of the chip at the beginning of the probe
68 * in order to place it in a known state.
69 */
70struct sx150x_platform_data {
71 unsigned gpio_base;
72 bool oscio_is_gpo;
73 u16 io_pullup_ena;
74 u16 io_pulldn_ena;
75 u16 io_open_drain_ena;
76 u16 io_polarity;
77 int irq_summary;
78 unsigned irq_base;
79 bool reset_during_probe;
80};
81
82#endif /* __LINUX_I2C_SX150X_H */