Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1502032 > unrolled thread

[PATCH 00/13] Revamp Semtech SX150x driver

Started byAndrey Smirnov <andrew.smirnov@gmail.com>
First post2016-10-17 16:30 +0200
Last post2016-10-17 16:40 +0200
Articles 10 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/13] Revamp Semtech SX150x driver Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:30 +0200
    [PATCH 10/13] gpio-sx150x: Replace 'oscio_is_gpio' with DT binding Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:30 +0200
    [PATCH 08/13] gpio-sx150x: Replace 'reset_during_probe" with DT binding Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:30 +0200
    [PATCH 02/13] gpio-sx150x: Remove 'irq_summary' parameter Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:30 +0200
    [PATCH 11/13] bindings: gpio-sx150x: Document "semtech,oscio-is-gpo" binding Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:30 +0200
    [PATCH 06/13] gpio-sx150x: Replace "io_pull*_ena" with DT bindings Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:40 +0200
    [PATCH 04/13] gpio-sx150x: Replace 'io_polarity' with DT binding Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:40 +0200
    [PATCH 05/13] bindings: gpio-sx150x: Document "semtech,io-polarity" binding Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:40 +0200
      Re: [PATCH 05/13] bindings: gpio-sx150x: Document  "semtech,io-polarity" binding Rob Herring <robh@kernel.org> - 2016-10-18 18:30 +0200
    [PATCH 03/13] gpio-sx150x: Remove 'irq_base' parameter Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-10-17 16:40 +0200

#1502032 — [PATCH 00/13] Revamp Semtech SX150x driver

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:30 +0200
Subject[PATCH 00/13] Revamp Semtech SX150x driver
Message-ID<sth5n-4CT-7@gated-at.bofh.it>
Hello,

I am working with a hardware design utilizing SX1506 GPIO expander
(actually it uses 1503, but they seem to be the same from SW's point
of view) and following are the pathches I had to make in order to be
able to succesfully use part's driver from upstream kernel.

I am pretty certain I did not do any of the DT bindings in a proper
way, so I am more than happy to change all of that, or, due to the
fact I don't use any of those bindings in my usecase, drop them
alltogether.

Thank you,
Andrey Smirnov

Andrey Smirnov (13):
  gpio-sx150x: Remove 'gpio_base' from pdata
  gpio-sx150x: Remove 'irq_summary' parameter
  gpio-sx150x: Remove 'irq_base' parameter
  gpio-sx150x: Replace 'io_polarity' with DT binding
  bindings: gpio-sx150x: Document "semtech,io-polarity" binding
  gpio-sx150x: Replace "io_pull*_ena" with DT bindings
  bindings: gpio-sx150x: Document "semtech,io-pull*" bindings
  gpio-sx150x: Replace 'reset_during_probe" with DT binding
  bindings: gpio-sx150x: Document "semtech,reset-during-probe" bindings
  gpio-sx150x: Replace 'oscio_is_gpio' with DT binding
  bindings: gpio-sx150x: Document "semtech,oscio-is-gpo" binding
  gpio-sx150x: Remove struct sx150x_platform_data
  gpio-sx150x: Pass device type in DT match table

 .../devicetree/bindings/gpio/gpio-sx150x.txt       |  29 ++++
 drivers/gpio/gpio-sx150x.c                         | 184 +++++++++------------
 2 files changed, 105 insertions(+), 108 deletions(-)

-- 
2.5.5

[toc] | [next] | [standalone]


#1502033 — [PATCH 10/13] gpio-sx150x: Replace 'oscio_is_gpio' with DT binding

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:30 +0200
Subject[PATCH 10/13] gpio-sx150x: Replace 'oscio_is_gpio' with DT binding
Message-ID<sth5o-4CT-35@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index a63f6ea..044ff3d 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -92,7 +92,6 @@ struct sx150x_device_data {
  *                output-only GPO pin will be added at the end of the block.
  */
 struct sx150x_platform_data {
-	bool     oscio_is_gpo;
 };
 
 struct sx150x_chip {
@@ -553,8 +552,6 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
 	chip->gpio_chip.of_node          = client->dev.of_node;
 	chip->gpio_chip.of_gpio_n_cells  = 2;
 #endif
-	if (pdata->oscio_is_gpo)
-		++chip->gpio_chip.ngpio;
 
 	chip->irq_chip.name                = client->name;
 	chip->irq_chip.irq_mask            = sx150x_irq_mask;
@@ -670,10 +667,6 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 			return err;
 	}
 
-
-	if (pdata->oscio_is_gpo)
-		sx150x_set_oscio(chip, 0);
-
 	return err;
 }
 
@@ -706,6 +699,7 @@ static int sx150x_probe(struct i2c_client *client,
 	struct sx150x_platform_data *pdata;
 	struct sx150x_chip *chip;
 	int rc;
+	bool oscio_is_gpo;
 
 	pdata = dev_get_platdata(&client->dev);
 	if (!pdata)
@@ -719,11 +713,21 @@ static int sx150x_probe(struct i2c_client *client,
 	if (!chip)
 		return -ENOMEM;
 
+	oscio_is_gpo = of_property_read_bool(client->dev.of_node,
+					     "semtech,oscio-is-gpo");
+
 	sx150x_init_chip(chip, client, id->driver_data, pdata);
+
+	if (oscio_is_gpo)
+		chip->gpio_chip.ngpio++;
+
 	rc = sx150x_init_hw(chip, pdata);
 	if (rc < 0)
 		return rc;
 
+	if (oscio_is_gpo)
+		sx150x_set_oscio(chip, 0);
+
 	rc = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
 	if (rc)
 		return rc;
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502034 — [PATCH 08/13] gpio-sx150x: Replace 'reset_during_probe" with DT binding

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:30 +0200
Subject[PATCH 08/13] gpio-sx150x: Replace 'reset_during_probe" with DT binding
Message-ID<sth5o-4CT-39@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index b751ff9..a63f6ea 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -90,13 +90,9 @@ struct sx150x_device_data {
  *                instead of as an oscillator, increasing the size of the
  *                GP(I)O pool created by this expander by one.  The
  *                output-only GPO pin will be added at the end of the block.
- * @reset_during_probe: If set to true, the driver will trigger a full
- *                      reset of the chip at the beginning of the probe
- *                      in order to place it in a known state.
  */
 struct sx150x_platform_data {
 	bool     oscio_is_gpo;
-	bool     reset_during_probe;
 };
 
 struct sx150x_chip {
@@ -606,7 +602,8 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 	u32 io_pullup   = 0;
 	int err = 0;
 
-	if (pdata->reset_during_probe) {
+	if (of_property_read_bool(chip->client->dev.of_node,
+				  "semtech,reset-during-probe")) {
 		err = sx150x_reset(chip);
 		if (err < 0)
 			return err;
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502035 — [PATCH 02/13] gpio-sx150x: Remove 'irq_summary' parameter

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:30 +0200
Subject[PATCH 02/13] gpio-sx150x: Remove 'irq_summary' parameter
Message-ID<sth5o-4CT-29@gated-at.bofh.it>
In reply to#1502032
Information conveyed by 'irq_summary' paramter can be obtained from
struct i2c_client's irq field. Remove any uses of the former and replace
it with the latter.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index f9d6bec..e80c115 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -105,12 +105,6 @@ struct sx150x_device_data {
  *               the polarity of that IO line, while clearing it results
  *               in normal polarity. For chips with fewer than 16 IO pins,
  *               high-end bits are ignored.
- * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
- *               is connected, via which it reports interrupt events
- *               across all GPIO lines.  This must be a real,
- *               pre-existing IRQ line.
- *               Setting this value < 0 disables the irq_chip functionality
- *               of the driver.
  * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
  *            IRQ lines will appear.  Similarly to gpio_base, the expander
  *            will create a block of irqs beginning at this number.
@@ -124,7 +118,6 @@ struct sx150x_platform_data {
 	u16      io_pullup_ena;
 	u16      io_pulldn_ena;
 	u16      io_polarity;
-	int      irq_summary;
 	unsigned irq_base;
 	bool     reset_during_probe;
 };
@@ -133,7 +126,6 @@ struct sx150x_chip {
 	struct gpio_chip                 gpio_chip;
 	struct i2c_client               *client;
 	const struct sx150x_device_data *dev_cfg;
-	int                              irq_summary;
 	int                              irq_base;
 	int				 irq_update;
 	u32                              irq_sense;
@@ -598,7 +590,6 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
 	chip->irq_chip.irq_set_type        = sx150x_irq_set_type;
 	chip->irq_chip.irq_bus_lock        = sx150x_irq_bus_lock;
 	chip->irq_chip.irq_bus_sync_unlock = sx150x_irq_bus_sync_unlock;
-	chip->irq_summary                  = -1;
 	chip->irq_base                     = -1;
 	chip->irq_masked                   = ~0;
 	chip->irq_sense                    = 0;
@@ -699,12 +690,10 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 }
 
 static int sx150x_install_irq_chip(struct sx150x_chip *chip,
-				int irq_summary,
-				int irq_base)
+				   int irq_base)
 {
 	int err;
 
-	chip->irq_summary = irq_summary;
 	chip->irq_base    = irq_base;
 
 	/* Add gpio chip to irq subsystem */
@@ -718,11 +707,10 @@ static int sx150x_install_irq_chip(struct sx150x_chip *chip,
 	}
 
 	err = devm_request_threaded_irq(&chip->client->dev,
-			irq_summary, NULL, sx150x_irq_thread_fn,
+			chip->client->irq, NULL, sx150x_irq_thread_fn,
 			IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_FALLING,
 			chip->irq_chip.name, chip);
 	if (err < 0) {
-		chip->irq_summary = -1;
 		chip->irq_base    = -1;
 	}
 
@@ -759,9 +747,8 @@ static int sx150x_probe(struct i2c_client *client,
 	if (rc)
 		return rc;
 
-	if (pdata->irq_summary >= 0) {
+	if (client->irq) {
 		rc = sx150x_install_irq_chip(chip,
-					pdata->irq_summary,
 					pdata->irq_base);
 		if (rc < 0)
 			return rc;
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502036 — [PATCH 11/13] bindings: gpio-sx150x: Document "semtech,oscio-is-gpo" binding

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:30 +0200
Subject[PATCH 11/13] bindings: gpio-sx150x: Document "semtech,oscio-is-gpo" binding
Message-ID<sth5o-4CT-31@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 Documentation/devicetree/bindings/gpio/gpio-sx150x.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
index 4b7c48a..e96b554 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
@@ -48,6 +48,13 @@ Optional properties:
   			      beginning of the probe in order to place
   			      it in a known state.
 
+- semtech,oscio-is-gpo: Boolean, if set to true, the driver will
+  			configure OSCIO as a GPO instead of as an
+  			oscillator, increasing the size of the GP(I)O
+  			pool created by this expander by one.  The
+  			output-only GPO pin will be added at the end
+  			of the block.
+
 Example:
 
 	i2c_gpio_expander@20{
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502039 — [PATCH 06/13] gpio-sx150x: Replace "io_pull*_ena" with DT bindings

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:40 +0200
Subject[PATCH 06/13] gpio-sx150x: Replace "io_pull*_ena" with DT bindings
Message-ID<sthf3-4Gc-5@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 9b62133..b751ff9 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -90,24 +90,12 @@ struct sx150x_device_data {
  *                instead of as an oscillator, increasing the size of the
  *                GP(I)O pool created by this expander by one.  The
  *                output-only GPO pin will be added at the end of the block.
- * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
- *                 for each IO line in the expander.  Setting the bit at
- *                 position n will enable the pull-up for the IO at
- *                 the corresponding offset.  For chips with fewer than
- *                 16 IO pins, high-end bits are ignored.
- * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
- *                 resistor for each IO line in the expander. Setting the
- *                 bit at position n will enable the pull-down for the IO at
- *                 the corresponding offset.  For chips with fewer than
- *                 16 IO pins, high-end bits are ignored.
  * @reset_during_probe: If set to true, the driver will trigger a full
  *                      reset of the chip at the beginning of the probe
  *                      in order to place it in a known state.
  */
 struct sx150x_platform_data {
 	bool     oscio_is_gpo;
-	u16      io_pullup_ena;
-	u16      io_pulldn_ena;
 	bool     reset_during_probe;
 };
 
@@ -614,6 +602,8 @@ static int sx150x_reset(struct sx150x_chip *chip)
 static int sx150x_init_hw(struct sx150x_chip *chip,
 			struct sx150x_platform_data *pdata)
 {
+	u32 io_pulldown = 0;
+	u32 io_pullup   = 0;
 	int err = 0;
 
 	if (pdata->reset_during_probe) {
@@ -622,6 +612,14 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 			return err;
 	}
 
+	of_property_read_u32(chip->client->dev.of_node,
+			     "semtech,io-pullup",
+			     &io_pullup);
+
+	of_property_read_u32(chip->client->dev.of_node,
+			     "semtech,io-pulldown",
+			     &io_pulldown);
+
 	if (chip->dev_cfg->model == SX150X_789)
 		err = sx150x_i2c_write(chip->client,
 				chip->dev_cfg->pri.x789.reg_misc,
@@ -638,12 +636,12 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 		return err;
 
 	err = sx150x_init_io(chip, chip->dev_cfg->reg_pullup,
-			pdata->io_pullup_ena);
+			     io_pullup);
 	if (err < 0)
 		return err;
 
 	err = sx150x_init_io(chip, chip->dev_cfg->reg_pulldn,
-			pdata->io_pulldn_ena);
+			     io_pulldown);
 	if (err < 0)
 		return err;
 
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502041 — [PATCH 04/13] gpio-sx150x: Replace 'io_polarity' with DT binding

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:40 +0200
Subject[PATCH 04/13] gpio-sx150x: Replace 'io_polarity' with DT binding
Message-ID<sthf3-4Gc-11@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index e01afd8..9b62133 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -100,11 +100,6 @@ struct sx150x_device_data {
  *                 bit at position n will enable the pull-down for the IO at
  *                 the corresponding offset.  For chips with fewer than
  *                 16 IO pins, high-end bits are ignored.
- * @io_polarity: A bit-mask which enables polarity inversion for each IO line
- *               in the expander.  Setting the bit at position n inverts
- *               the polarity of that IO line, while clearing it results
- *               in normal polarity. For chips with fewer than 16 IO pins,
- *               high-end bits are ignored.
  * @reset_during_probe: If set to true, the driver will trigger a full
  *                      reset of the chip at the beginning of the probe
  *                      in order to place it in a known state.
@@ -113,7 +108,6 @@ struct sx150x_platform_data {
 	bool     oscio_is_gpo;
 	u16      io_pullup_ena;
 	u16      io_pulldn_ena;
-	u16      io_polarity;
 	bool     reset_during_probe;
 };
 
@@ -654,9 +648,15 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 		return err;
 
 	if (chip->dev_cfg->model == SX150X_789) {
+		u32 io_polarity = 0;
+
+		of_property_read_u32(chip->client->dev.of_node,
+				     "semtech,io-polarity",
+				     &io_polarity);
+
 		err = sx150x_init_io(chip,
-				chip->dev_cfg->pri.x789.reg_polarity,
-				pdata->io_polarity);
+				     chip->dev_cfg->pri.x789.reg_polarity,
+				     (u16)io_polarity);
 		if (err < 0)
 			return err;
 	} else if (chip->dev_cfg->model == SX150X_456) {
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1502047 — [PATCH 05/13] bindings: gpio-sx150x: Document "semtech,io-polarity" binding

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:40 +0200
Subject[PATCH 05/13] bindings: gpio-sx150x: Document "semtech,io-polarity" binding
Message-ID<sthf4-4Gc-17@gated-at.bofh.it>
In reply to#1502032
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 Documentation/devicetree/bindings/gpio/gpio-sx150x.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
index c809acb..02b92ae 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
@@ -26,6 +26,15 @@ The GPIO expander can optionally be used as an interrupt controller, in
 which case it uses the default two cell specifier as described in
 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt.
 
+Optional properties:
+
+- semtech,io-polarity: A bit-mask which enables polarity inversion for
+  		       each IO line in the expander. Setting the bit
+  		       at position n inverts the polarity of that IO
+  		       line, while clearing it results in normal
+  		       polarity. For chips with fewer than 16 IO pins,
+  		       high-end bits are ignored.
+
 Example:
 
 	i2c_gpio_expander@20{
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1503199 — Re: [PATCH 05/13] bindings: gpio-sx150x: Document "semtech,io-polarity" binding

FromRob Herring <robh@kernel.org>
Date2016-10-18 18:30 +0200
SubjectRe: [PATCH 05/13] bindings: gpio-sx150x: Document "semtech,io-polarity" binding
Message-ID<stFr3-4cE-5@gated-at.bofh.it>
In reply to#1502047
On Mon, Oct 17, 2016 at 07:27:00AM -0700, Andrey Smirnov wrote:
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  Documentation/devicetree/bindings/gpio/gpio-sx150x.txt | 9 +++++++++
>  1 file changed, 9 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1502049 — [PATCH 03/13] gpio-sx150x: Remove 'irq_base' parameter

FromAndrey Smirnov <andrew.smirnov@gmail.com>
Date2016-10-17 16:40 +0200
Subject[PATCH 03/13] gpio-sx150x: Remove 'irq_base' parameter
Message-ID<sthf4-4Gc-33@gated-at.bofh.it>
In reply to#1502032
Remove 'irq_base' parameter and call 'gpiochip_irqchip_add' with '0' as
irq base to automatically assign it.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/gpio/gpio-sx150x.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index e80c115..e01afd8 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -105,10 +105,6 @@ struct sx150x_device_data {
  *               the polarity of that IO line, while clearing it results
  *               in normal polarity. For chips with fewer than 16 IO pins,
  *               high-end bits are ignored.
- * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
- *            IRQ lines will appear.  Similarly to gpio_base, the expander
- *            will create a block of irqs beginning at this number.
- *            This value is ignored if irq_summary is < 0.
  * @reset_during_probe: If set to true, the driver will trigger a full
  *                      reset of the chip at the beginning of the probe
  *                      in order to place it in a known state.
@@ -118,7 +114,6 @@ struct sx150x_platform_data {
 	u16      io_pullup_ena;
 	u16      io_pulldn_ena;
 	u16      io_polarity;
-	unsigned irq_base;
 	bool     reset_during_probe;
 };
 
@@ -126,7 +121,6 @@ struct sx150x_chip {
 	struct gpio_chip                 gpio_chip;
 	struct i2c_client               *client;
 	const struct sx150x_device_data *dev_cfg;
-	int                              irq_base;
 	int				 irq_update;
 	u32                              irq_sense;
 	u32				 irq_masked;
@@ -590,7 +584,6 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
 	chip->irq_chip.irq_set_type        = sx150x_irq_set_type;
 	chip->irq_chip.irq_bus_lock        = sx150x_irq_bus_lock;
 	chip->irq_chip.irq_bus_sync_unlock = sx150x_irq_bus_sync_unlock;
-	chip->irq_base                     = -1;
 	chip->irq_masked                   = ~0;
 	chip->irq_sense                    = 0;
 	chip->dev_masked                   = ~0;
@@ -689,16 +682,13 @@ static int sx150x_init_hw(struct sx150x_chip *chip,
 	return err;
 }
 
-static int sx150x_install_irq_chip(struct sx150x_chip *chip,
-				   int irq_base)
+static int sx150x_install_irq_chip(struct sx150x_chip *chip)
 {
 	int err;
 
-	chip->irq_base    = irq_base;
-
 	/* Add gpio chip to irq subsystem */
 	err = gpiochip_irqchip_add(&chip->gpio_chip,
-		&chip->irq_chip, chip->irq_base,
+		&chip->irq_chip, 0,
 		handle_edge_irq, IRQ_TYPE_EDGE_BOTH);
 	if (err) {
 		dev_err(&chip->client->dev,
@@ -710,10 +700,6 @@ static int sx150x_install_irq_chip(struct sx150x_chip *chip,
 			chip->client->irq, NULL, sx150x_irq_thread_fn,
 			IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_FALLING,
 			chip->irq_chip.name, chip);
-	if (err < 0) {
-		chip->irq_base    = -1;
-	}
-
 	return err;
 }
 
@@ -748,8 +734,7 @@ static int sx150x_probe(struct i2c_client *client,
 		return rc;
 
 	if (client->irq) {
-		rc = sx150x_install_irq_chip(chip,
-					pdata->irq_base);
+		rc = sx150x_install_irq_chip(chip);
 		if (rc < 0)
 			return rc;
 	}
-- 
2.5.5

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web