public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Kumar Gala <galak@codeaurora.org>,
	Andy Gross <agross@codeaurora.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	marc.zyngier@arm.com, linux-arm-msm@vger.kernel.org,
	linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/8] mfd: pm8921: Implement irq_get_irqchip_state
Date: Thu, 23 Jul 2015 15:47:21 +0100	[thread overview]
Message-ID: <20150723144721.GG3436@x1> (raw)
In-Reply-To: <1436942435-25611-2-git-send-email-bjorn.andersson@sonymobile.com>

On Tue, 14 Jul 2015, Bjorn Andersson wrote:

> Implement irq_chip->irq_get_irqchip_state to make it possible for PMIC
> block drivers to access the IRQ real time status bits. The status bits
> are used for various kinds of input signals, e.g. GPIO.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
> 
> Changes since v1:
> - Drop extra check for !chip
> - Simplify return value
> 
>  drivers/mfd/pm8921-core.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
> index 5a92646a2ccb..00856a67d34b 100644
> --- a/drivers/mfd/pm8921-core.c
> +++ b/drivers/mfd/pm8921-core.c
> @@ -236,11 +236,49 @@ static int pm8xxx_irq_set_type(struct irq_data *d, unsigned int flow_type)
>  	return pm8xxx_config_irq(chip, block, config);
>  }
>  
> +static int pm8xxx_irq_get_irqchip_state(struct irq_data *d,
> +					enum irqchip_irq_state which,
> +					bool *state)
> +{
> +	struct pm_irq_chip *chip = irq_data_get_irq_chip_data(d);
> +	unsigned int pmirq = irqd_to_hwirq(d);
> +	unsigned int bits;
> +	int irq_bit;
> +	u8 block;
> +	int rc;
> +
> +	if (which != IRQCHIP_STATE_LINE_LEVEL)
> +		return -EINVAL;
> +
> +	block = pmirq / 8;
> +	irq_bit = pmirq % 8;
> +
> +	spin_lock(&chip->pm_irq_lock);
> +	rc = regmap_write(chip->regmap, SSBI_REG_ADDR_IRQ_BLK_SEL, block);
> +	if (rc) {
> +		pr_err("Failed Selecting Block %d rc=%d\n", block, rc);
> +		goto bail;
> +	}
> +
> +	rc = regmap_read(chip->regmap, SSBI_REG_ADDR_IRQ_RT_STATUS, &bits);
> +	if (rc) {
> +		pr_err("Failed Reading Status rc=%d\n", rc);
> +		goto bail;
> +	}
> +
> +	*state = !!(bits & BIT(irq_bit));
> +bail:
> +	spin_unlock(&chip->pm_irq_lock);
> +
> +	return rc;
> +}
> +
>  static struct irq_chip pm8xxx_irq_chip = {
>  	.name		= "pm8xxx",
>  	.irq_mask_ack	= pm8xxx_irq_mask_ack,
>  	.irq_unmask	= pm8xxx_irq_unmask,
>  	.irq_set_type	= pm8xxx_irq_set_type,
> +	.irq_get_irqchip_state = pm8xxx_irq_get_irqchip_state,
>  	.flags		= IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE,
>  };
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  parent reply	other threads:[~2015-07-23 14:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18  6:47 [PATCH 0/8] Qualcomm PMIC pinctrl additions Bjorn Andersson
2015-06-18  6:47 ` [PATCH 1/8] pinctrl: qcom: spmi-mpp: Transition to generic dt binding parser Bjorn Andersson
2015-07-14 10:56   ` Linus Walleij
2015-06-18  6:47 ` [PATCH 2/8] pinctrl: qcom: spmi-mpp: Fixes related to enable handling Bjorn Andersson
2015-07-14 10:57   ` Linus Walleij
2015-06-18  6:47 ` [PATCH 3/8] pinctrl: qcom: spmi-mpp: Introduce defines for MODE_CTL Bjorn Andersson
2015-07-14 10:58   ` Linus Walleij
2015-06-18  6:47 ` [PATCH 4/8] pinctrl: qcom: spmi-mpp: Implement support for sink mode Bjorn Andersson
2015-07-14 11:01   ` Linus Walleij
2015-06-18  6:47 ` [PATCH 5/8] pinctrl: qcom: spmi-mpp: Add support for setting analog output level Bjorn Andersson
2015-06-24  8:17   ` Ivan T. Ivanov
2015-07-14 11:04   ` Linus Walleij
2015-07-15  6:40   ` [PATCH v2 " Bjorn Andersson
2015-07-17 12:30     ` Linus Walleij
2015-06-18  6:47 ` [PATCH 6/8] pinctrl: qcom: spmi-mpp: Transpose pinmux function Bjorn Andersson
2015-07-17 12:31   ` Linus Walleij
2015-06-18  6:47 ` [PATCH 7/8] mfd: pm8921: Implement irq_get_irqchip_state Bjorn Andersson
2015-06-18  7:32   ` Marc Zyngier
2015-06-18 16:37     ` Bjorn Andersson
2015-07-15  6:40   ` [PATCH v2 " Bjorn Andersson
2015-07-17 12:33     ` Linus Walleij
2015-07-17 19:54       ` Linus Walleij
2015-07-17 12:44     ` Marc Zyngier
2015-07-23 14:47     ` Lee Jones [this message]
2015-06-18  6:47 ` [PATCH 8/8] pinctrl: qcom: ssbi: Family A gpio & mpp drivers Bjorn Andersson
2015-06-24  8:17   ` Ivan T. Ivanov
2015-06-24 19:54   ` Srinivas Kandagatla
2015-07-15  6:40   ` [PATCH v2 " Bjorn Andersson
2015-07-17 12:35     ` Linus Walleij
2015-06-24  8:29 ` [PATCH 0/8] Qualcomm PMIC pinctrl additions Ivan T. Ivanov

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=20150723144721.GG3436@x1 \
    --to=lee.jones@linaro.org \
    --cc=agross@codeaurora.org \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=galak@codeaurora.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=sameo@linux.intel.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