linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Igor Grinberg <grinberg@compulab.co.il>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Kevin Hilman <khilman@ti.com>,
	linux-input@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Zumeng Chen <zumeng.chen@windriver.com>
Subject: Re: [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting
Date: Wed, 21 Nov 2012 11:08:47 -0800	[thread overview]
Message-ID: <20121121190847.GE18567@atomide.com> (raw)
In-Reply-To: <1353341038-14381-3-git-send-email-grinberg@compulab.co.il>

* Igor Grinberg <grinberg@compulab.co.il> [121119 08:06]:
> Commit 97ee9f01 (ARM: OMAP: fix the ads7846 init code) have enabled the
> pendown GPIO debounce time setting by the below sequence:
> 
>   gpio_request_one()
>   gpio_set_debounce()
>   gpio_free()
> 
> It also revealed a bug in the OMAP GPIO handling code which prevented
> the GPIO debounce clock to be disabled and CORE transition to low power
> states.
> 
> Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on
> free/reset) fixes the OMAP GPIO handling code by making sure that the
> GPIO debounce clock gets disabled if no GPIO is requested from current
> bank.
> 
> While fixing the OMAP GPIO handling code (in the right way), the above
> commit makes the gpio_request->set_debounce->free sequence invalid as
> after freeing the GPIO, the debounce settings are lost.
> 
> Fix the debounce settings by moving the debounce initialization to the
> actual GPIO requesting code - the ads7846 driver.
> 
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Zumeng Chen <zumeng.chen@windriver.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/common-board-devices.c |   34 ++++++++++++++++-----------
>  1 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
> index ad85609..d246efd 100644
> --- a/arch/arm/mach-omap2/common-board-devices.c
> +++ b/arch/arm/mach-omap2/common-board-devices.c
> @@ -63,30 +63,36 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>  	struct spi_board_info *spi_bi = &ads7846_spi_board_info;
>  	int err;
>  
> -	err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
> -	if (err) {
> -		pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
> -		return;
> -	}
> +	/*
> +	 * If a board defines get_pendown_state() function, request the pendown
> +	 * GPIO and set the GPIO debounce time.
> +	 * If a board does not define the get_pendown_state() function, then
> +	 * the ads7846 driver will setup the pendown GPIO itself.
> +	 */
> +	if (board_pdata && board_pdata->get_pendown_state) {
> +		err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
> +		if (err) {
> +			pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
> +			return;
> +		}
> +
> +		if (gpio_debounce)
> +			gpio_set_debounce(gpio_pendown, gpio_debounce);
>  
> -	if (gpio_debounce)
> -		gpio_set_debounce(gpio_pendown, gpio_debounce);
> +		gpio_export(gpio_pendown, 0);
> +	}
>  
>  	spi_bi->bus_num	= bus_num;
>  	spi_bi->irq	= gpio_to_irq(gpio_pendown);
>  
> +	ads7846_config.gpio_pendown = gpio_pendown;
> +
>  	if (board_pdata) {
>  		board_pdata->gpio_pendown = gpio_pendown;
> +		board_pdata->gpio_pendown_debounce = gpio_debounce;
>  		spi_bi->platform_data = board_pdata;
> -		if (board_pdata->get_pendown_state)
> -			gpio_export(gpio_pendown, 0);
> -	} else {
> -		ads7846_config.gpio_pendown = gpio_pendown;
>  	}
>  
> -	if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
> -		gpio_free(gpio_pendown);
> -
>  	spi_register_board_info(&ads7846_spi_board_info, 1);
>  }
>  #else
> -- 
> 1.7.3.4
> 

  reply	other threads:[~2012-11-21 19:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 16:03 [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting Igor Grinberg
2012-11-19 16:03 ` [PATCH 1/2] ads7846: enable pendown GPIO debounce time setting Igor Grinberg
2012-11-19 17:01   ` [PATCH v2 " Igor Grinberg
2012-11-19 16:03 ` [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting Igor Grinberg
2012-11-21 19:08   ` Tony Lindgren [this message]
2012-11-20  8:21 ` [PATCH 0/2] " Dmitry Torokhov
2012-11-21 19:09   ` Tony Lindgren
2012-11-21 20:55     ` Dmitry Torokhov

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=20121121190847.GE18567@atomide.com \
    --to=tony@atomide.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grinberg@compulab.co.il \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=zumeng.chen@windriver.com \
    /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).