diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-07-24 06:35:16 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-08-04 19:09:50 -0400 |
commit | f7da0bdbf585c0404fc89901ee4bdb806e70530f (patch) | |
tree | f87578041e5de9e4b4e79f36c171f3b693ba85f6 /drivers/gpio | |
parent | 8abdd2d2d873ece35a201c2e05af7b6998cf0dca (diff) |
gpio: msic: Fix calculating register address in msic_gpio_to_oreg()
In the case offset is 20 ... 23, the equation to get the register should be:
INTEL_MSIC_GPIO1HV0CTLO - offset + 20
With above equation, we can get below mapping between offset and the register:
offset is 20: INTEL_MSIC_GPIO1HV0CTLO
offset is 21: INTEL_MSIC_GPIO1HV1CTLO
offset is 22: INTEL_MSIC_GPIO1HV2CTLO
offset is 23: INTEL_MSIC_GPIO1HV3CTLO
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-msic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c index 71a838f44501..b38986285868 100644 --- a/drivers/gpio/gpio-msic.c +++ b/drivers/gpio/gpio-msic.c | |||
@@ -99,7 +99,7 @@ static int msic_gpio_to_oreg(unsigned offset) | |||
99 | if (offset < 20) | 99 | if (offset < 20) |
100 | return INTEL_MSIC_GPIO0HV0CTLO - offset + 16; | 100 | return INTEL_MSIC_GPIO0HV0CTLO - offset + 16; |
101 | 101 | ||
102 | return INTEL_MSIC_GPIO1HV0CTLO + offset + 20; | 102 | return INTEL_MSIC_GPIO1HV0CTLO - offset + 20; |
103 | } | 103 | } |
104 | 104 | ||
105 | static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 105 | static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |