linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg()
@ 2012-07-24 10:35 Axel Lin
  2012-07-24 13:38 ` Mathias Nyman
  2012-08-04 23:10 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-07-24 10:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mathias Nyman, Alan Cox, Grant Likely, Linus Walleij

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>
---
 drivers/gpio/gpio-msic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c
index 71a838f..b389862 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)
 	if (offset < 20)
 		return INTEL_MSIC_GPIO0HV0CTLO - offset + 16;
 
-	return INTEL_MSIC_GPIO1HV0CTLO + offset + 20;
+	return INTEL_MSIC_GPIO1HV0CTLO - offset + 20;
 }
 
 static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg()
  2012-07-24 10:35 [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg() Axel Lin
@ 2012-07-24 13:38 ` Mathias Nyman
  2012-08-04 23:10 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Mathias Nyman @ 2012-07-24 13:38 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Alan Cox, Grant Likely, Linus Walleij

On 07/24/2012 01:35 PM, Axel Lin wrote:
> 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>
> ---
>   drivers/gpio/gpio-msic.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c
> index 71a838f..b389862 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)
>   	if (offset<  20)
>   		return INTEL_MSIC_GPIO0HV0CTLO - offset + 16;
>
> -	return INTEL_MSIC_GPIO1HV0CTLO + offset + 20;
> +	return INTEL_MSIC_GPIO1HV0CTLO - offset + 20;
>   }
>
>   static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)

Nice, good catch.

The last 4 of the 24 gpios will work properly as outputs with this fix.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg()
  2012-07-24 10:35 [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg() Axel Lin
  2012-07-24 13:38 ` Mathias Nyman
@ 2012-08-04 23:10 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-08-04 23:10 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mathias Nyman, Alan Cox, Grant Likely

On Tue, Jul 24, 2012 at 12:35 PM, Axel Lin <axel.lin@gmail.com> wrote:

> 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>

Thanks, applied to my fixes branch with Mathias' ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-04 23:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 10:35 [PATCH] gpio: msic: Fix calculating register address in msic_gpio_to_oreg() Axel Lin
2012-07-24 13:38 ` Mathias Nyman
2012-08-04 23:10 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).