All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Turischev <denis@compulab.co.il>
To: LKML <linux-kernel@vger.kernel.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: it8761e_gpio: Fixed bug in gpio numbering
Date: Wed, 28 Apr 2010 11:24:57 +0300	[thread overview]
Message-ID: <4BD7F0D9.4040105@compulab.co.il> (raw)
In-Reply-To: <4BA0AA45.3070004@compulab.co.il>

SIO chip contains 16 possible gpio lines, not 14. Schematic just was not
read carefully.

Signed-off-by: Denis Turischev <denis@compulab.co.il>
---
 drivers/gpio/it8761e_gpio.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/it8761e_gpio.c b/drivers/gpio/it8761e_gpio.c
index 753219c..41a9388 100644
--- a/drivers/gpio/it8761e_gpio.c
+++ b/drivers/gpio/it8761e_gpio.c
@@ -80,8 +80,8 @@ static int it8761e_gpio_get(struct gpio_chip *gc, unsigned gpio_num)
 	u16 reg;
 	u8 bit;

-	bit = gpio_num % 7;
-	reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba;
+	bit = gpio_num % 8;
+	reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;

 	return !!(inb(reg) & (1 << bit));
 }
@@ -91,8 +91,8 @@ static int it8761e_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num)
 	u8 curr_dirs;
 	u8 io_reg, bit;

-	bit = gpio_num % 7;
-	io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO;
+	bit = gpio_num % 8;
+	io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;

 	spin_lock(&sio_lock);

@@ -116,8 +116,8 @@ static void it8761e_gpio_set(struct gpio_chip *gc,
 	u8 curr_vals, bit;
 	u16 reg;

-	bit = gpio_num % 7;
-	reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba;
+	bit = gpio_num % 8;
+	reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;

 	spin_lock(&sio_lock);

@@ -135,8 +135,8 @@ static int it8761e_gpio_direction_out(struct gpio_chip *gc,
 {
 	u8 curr_dirs, io_reg, bit;

-	bit = gpio_num % 7;
-	io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO;
+	bit = gpio_num % 8;
+	io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;

 	it8761e_gpio_set(gc, gpio_num, val);

@@ -200,7 +200,7 @@ static int __init it8761e_gpio_init(void)
 		return -EBUSY;

 	it8761e_gpio_chip.base = -1;
-	it8761e_gpio_chip.ngpio = 14;
+	it8761e_gpio_chip.ngpio = 16;

 	err = gpiochip_add(&it8761e_gpio_chip);
 	if (err < 0)
-- 1.6.3.3

  reply	other threads:[~2010-04-28  8:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28  8:54 [RESEND] gpio: introduce it8761e_gpio driver for IT8761E Super I/O chip Denis Turischev
2010-03-02 22:40 ` Andrew Morton
2010-03-17 10:09   ` it8761e_gpio: Fixed bug in gpio numbering Denis Turischev
2010-04-28  8:24     ` Denis Turischev [this message]
2010-06-30 15:23 ` [PATCH 1/2] gpio: SIO IT8761, Poulsbo SCH are I/O mapped Denis Turischev
2010-06-30 16:17   ` [PATCH 2/2] gpio: introduce f71808e_gpio driver for F71808E Super I/O chip Denis Turischev
2010-06-30 16:37     ` David Brownell
2010-07-01 10:06       ` Denis Turischev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD7F0D9.4040105@compulab.co.il \
    --to=denis@compulab.co.il \
    --cc=akpm@linux-foundation.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.