All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-kernel@vger.kernel.org, Viresh Kumar <viresh.kumar@st.com>,
	Michel Jaouen <michel.jaouen@stericsson.com>,
	Chris Blair <chris.blair@stericsson.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] mfd/stmpe: Add support for no-interrupt config
Date: Mon, 20 Feb 2012 18:06:20 +0100	[thread overview]
Message-ID: <20120220170620.GG5387@sortiz-mobl> (raw)
In-Reply-To: <1327400314-18030-1-git-send-email-linus.walleij@stericsson.com>

Hi Linus,

On Tue, Jan 24, 2012 at 11:18:34AM +0100, Linus Walleij wrote:
> From: Chris Blair <chris.blair@stericsson.com>
> 
> Adds support for boards which have an STMPE device without the
> interrupt pin connected.
Applied, thanks.

Cheers,
Samuel.


> Cc: Viresh Kumar <viresh.kumar@st.com>
> Signed-off-by: Chris Blair <chris.blair@stericsson.com>
> Tested-by: Michel Jaouen <michel.jaouen@stericsson.com>
> Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/stmpe.c       |   72 +++++++++++++++++++++++++--------------------
>  include/linux/mfd/stmpe.h |    2 +
>  2 files changed, 42 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index e07947e..7c98e61 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -864,7 +864,7 @@ static int __devinit stmpe_chip_init(struct stmpe *stmpe)
>  	unsigned int irq_trigger = stmpe->pdata->irq_trigger;
>  	int autosleep_timeout = stmpe->pdata->autosleep_timeout;
>  	struct stmpe_variant_info *variant = stmpe->variant;
> -	u8 icr;
> +	u8 icr = 0;
>  	unsigned int id;
>  	u8 data[2];
>  	int ret;
> @@ -887,31 +887,33 @@ static int __devinit stmpe_chip_init(struct stmpe *stmpe)
>  	if (ret)
>  		return ret;
>  
> -	if (id == STMPE801_ID)
> -		icr = STMPE801_REG_SYS_CTRL_INT_EN;
> -	else
> -		icr = STMPE_ICR_LSB_GIM;
> -
> -	/* STMPE801 doesn't support Edge interrupts */
> -	if (id != STMPE801_ID) {
> -		if (irq_trigger == IRQF_TRIGGER_FALLING ||
> -				irq_trigger == IRQF_TRIGGER_RISING)
> -			icr |= STMPE_ICR_LSB_EDGE;
> -	}
> -
> -	if (irq_trigger == IRQF_TRIGGER_RISING ||
> -			irq_trigger == IRQF_TRIGGER_HIGH) {
> +	if (!stmpe->pdata->no_irq) {
>  		if (id == STMPE801_ID)
> -			icr |= STMPE801_REG_SYS_CTRL_INT_HI;
> +			icr = STMPE801_REG_SYS_CTRL_INT_EN;
>  		else
> -			icr |= STMPE_ICR_LSB_HIGH;
> -	}
> +			icr = STMPE_ICR_LSB_GIM;
>  
> -	if (stmpe->pdata->irq_invert_polarity) {
> -		if (id == STMPE801_ID)
> -			icr ^= STMPE801_REG_SYS_CTRL_INT_HI;
> -		else
> -			icr ^= STMPE_ICR_LSB_HIGH;
> +		/* STMPE801 doesn't support Edge interrupts */
> +		if (id != STMPE801_ID) {
> +			if (irq_trigger == IRQF_TRIGGER_FALLING ||
> +					irq_trigger == IRQF_TRIGGER_RISING)
> +				icr |= STMPE_ICR_LSB_EDGE;
> +		}
> +
> +		if (irq_trigger == IRQF_TRIGGER_RISING ||
> +				irq_trigger == IRQF_TRIGGER_HIGH) {
> +			if (id == STMPE801_ID)
> +				icr |= STMPE801_REG_SYS_CTRL_INT_HI;
> +			else
> +				icr |= STMPE_ICR_LSB_HIGH;
> +		}
> +
> +		if (stmpe->pdata->irq_invert_polarity) {
> +			if (id == STMPE801_ID)
> +				icr ^= STMPE801_REG_SYS_CTRL_INT_HI;
> +			else
> +				icr ^= STMPE_ICR_LSB_HIGH;
> +		}
>  	}
>  
>  	if (stmpe->pdata->autosleep) {
> @@ -988,7 +990,7 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
>  	if (ci->init)
>  		ci->init(stmpe);
>  
> -	if (pdata->irq_over_gpio) {
> +	if (!pdata->no_irq && pdata->irq_over_gpio) {
>  		ret = gpio_request_one(pdata->irq_gpio, GPIOF_DIR_IN, "stmpe");
>  		if (ret) {
>  			dev_err(stmpe->dev, "failed to request IRQ GPIO: %d\n",
> @@ -1005,15 +1007,21 @@ int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum)
>  	if (ret)
>  		goto free_gpio;
>  
> -	ret = stmpe_irq_init(stmpe);
> -	if (ret)
> -		goto free_gpio;
> +	if (pdata->no_irq) {
> +		dev_info(stmpe->dev,
> +			"board config says IRQs are not supported\n");
> +	} else {
> +		ret = stmpe_irq_init(stmpe);
> +		if (ret)
> +			goto free_gpio;
>  
> -	ret = request_threaded_irq(stmpe->irq, NULL, stmpe_irq,
> -			pdata->irq_trigger | IRQF_ONESHOT, "stmpe", stmpe);
> -	if (ret) {
> -		dev_err(stmpe->dev, "failed to request IRQ: %d\n", ret);
> -		goto out_removeirq;
> +		ret = request_threaded_irq(stmpe->irq, NULL, stmpe_irq,
> +				pdata->irq_trigger | IRQF_ONESHOT,
> +				"stmpe", stmpe);
> +		if (ret) {
> +			dev_err(stmpe->dev, "failed to request IRQ: %d\n", ret);
> +			goto out_removeirq;
> +		}
>  	}
>  
>  	ret = stmpe_devices_init(stmpe);
> diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
> index ca1d7a3..c4b45fd 100644
> --- a/include/linux/mfd/stmpe.h
> +++ b/include/linux/mfd/stmpe.h
> @@ -188,6 +188,7 @@ struct stmpe_ts_platform_data {
>   * @irq_invert_polarity: IRQ line is connected with reversed polarity
>   * @autosleep: bool to enable/disable stmpe autosleep
>   * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
> + * @no_irq: IRQs are not supported on this board
>   * @irq_base: base IRQ number.  %STMPE_NR_IRQS irqs will be used, or
>   *	      %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
>   * @irq_over_gpio: true if gpio is used to get irq
> @@ -200,6 +201,7 @@ struct stmpe_ts_platform_data {
>  struct stmpe_platform_data {
>  	int id;
>  	unsigned int blocks;
> +	bool no_irq;
>  	int irq_base;
>  	unsigned int irq_trigger;
>  	bool irq_invert_polarity;
> -- 
> 1.7.8
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

  parent reply	other threads:[~2012-02-20 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 10:18 [PATCH] mfd/stmpe: Add support for no-interrupt config Linus Walleij
2012-01-24 11:34 ` Viresh Kumar
2012-02-20 17:06 ` Samuel Ortiz [this message]
2012-02-20 17:11   ` Samuel Ortiz

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=20120220170620.GG5387@sortiz-mobl \
    --to=sameo@linux.intel.com \
    --cc=chris.blair@stericsson.com \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michel.jaouen@stericsson.com \
    --cc=viresh.kumar@st.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 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.