linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: Axel Lin <axel.lin@ingics.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-gpio@vger.kernel.org, linux-xtensa@linux-xtensa.org
Subject: Re: [RFT][PATCH] gpio: xtensa: Implement .direction_input and .direction_output callbacks
Date: Sat, 26 Apr 2014 22:38:00 +0300	[thread overview]
Message-ID: <20140426193800.GA4806@tarshish> (raw)
In-Reply-To: <1398429188.1754.1.camel@phoenix>

Hi Axel,

On Fri, Apr 25, 2014 at 08:33:08PM +0800, Axel Lin wrote:
> The implementation of _gpiod_direction_output_raw() checks both .set and
> .direction_output callbacks. To make gpio_direction_output() works, both .set
> and .direction_output callbacks needs to be implemented in the driver.
> 
> Similarly, gpiod_direction_input() checks both .get and .direction_input
> callbacks. To make gpio_direction_input() works, both .get and .direction_input
> needs to be implemented in the driver.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi Baruch,
> I don't have this h/w to test, so this patch needs test.
> I think both gpio_direction_output() and gpio_direction_input() do not work
> without this patch. Which means gpio_request_one() also does not work.

I don't have access to this hardware anymore either. Adding the Xtensa list to 
Cc.

> BTW, I also hit below build error.
>   CC      drivers/gpio/gpio-xtensa.o
> drivers/gpio/gpio-xtensa.c: Assembler messages:
> drivers/gpio/gpio-xtensa.c:87: Error: unknown opcode or format name 'read_impwire'
> drivers/gpio/gpio-xtensa.c:116: Error: unknown opcode or format name 'rur.expstate'
> drivers/gpio/gpio-xtensa.c:130: Error: unknown opcode or format name 'wrmsk_expstate'
> make[2]: *** [drivers/gpio/gpio-xtensa.o] Error 1
> make[1]: *** [drivers/gpio] Error 2
> make: *** [drivers] Error 2
> (I found the same build error is already reported by Geert Uytterhoeven.)

This should be fixed by commit 8e9356c6146d0 (xtensa: fsf: drop nonexistent 
GPIO32 support) for the fsf variant. This commit is included in v3.14. If you 
build a different variant you must use a matching toolchain.

baruch

>  drivers/gpio/gpio-xtensa.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-xtensa.c b/drivers/gpio/gpio-xtensa.c
> index 7081304..ed6d874 100644
> --- a/drivers/gpio/gpio-xtensa.c
> +++ b/drivers/gpio/gpio-xtensa.c
> @@ -96,6 +96,12 @@ static void xtensa_impwire_set_value(struct gpio_chip *gc, unsigned offset,
>  	BUG(); /* output only; should never be called */
>  }
>  
> +static int xtensa_impwire_direction_input(struct gpio_chip *gc,
> +					  unsigned offset)
> +{
> +	return 0;
> +}
> +
>  static int xtensa_expstate_get_direction(struct gpio_chip *gc, unsigned offset)
>  {
>  	return 0; /* output only */
> @@ -126,6 +132,13 @@ static void xtensa_expstate_set_value(struct gpio_chip *gc, unsigned offset,
>  	disable_cp(flags, saved_cpenable);
>  }
>  
> +static int xtensa_expstate_direction_output(struct gpio_chip *gc,
> +					    unsigned offset, int value)
> +{
> +	xtensa_expstate_set_value(gc, offset, value);
> +	return 0;
> +}
> +
>  static struct gpio_chip impwire_chip = {
>  	.label		= "impwire",
>  	.base		= -1,
> @@ -133,6 +146,7 @@ static struct gpio_chip impwire_chip = {
>  	.get_direction	= xtensa_impwire_get_direction,
>  	.get		= xtensa_impwire_get_value,
>  	.set		= xtensa_impwire_set_value,
> +	.direction_input = xtensa_impwire_direction_input,
>  };
>  
>  static struct gpio_chip expstate_chip = {
> @@ -142,6 +156,7 @@ static struct gpio_chip expstate_chip = {
>  	.get_direction	= xtensa_expstate_get_direction,
>  	.get		= xtensa_expstate_get_value,
>  	.set		= xtensa_expstate_set_value,
> +	.direction_output = xtensa_expstate_direction_output,
>  };
>  
>  static int xtensa_gpio_probe(struct platform_device *pdev)
> -- 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

      reply	other threads:[~2014-04-26 19:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25 12:33 [RFT][PATCH] gpio: xtensa: Implement .direction_input and .direction_output callbacks Axel Lin
2014-04-26 19:38 ` Baruch Siach [this message]

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=20140426193800.GA4806@tarshish \
    --to=baruch@tkos.co.il \
    --cc=axel.lin@ingics.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.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 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).