devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/2] mfd: cpcap: implement irq sense helper
Date: Thu, 2 Mar 2017 08:09:12 -0800	[thread overview]
Message-ID: <20170302160912.GO20572@atomide.com> (raw)
In-Reply-To: <20170302002242.21819-1-sre@kernel.org>

* Sebastian Reichel <sre@kernel.org> [170301 16:24]:
> CPCAP can sense if IRQ is currently set or not. This
> functionality is required for a few subdevices, such
> as the power button and usb phy modules.
> 
> Signed-off-by: Sebastian Reichel <sre@kernel.org>
> ---
> Changes since PATCHv1:
>  - Newly introduced patch
> ---
>  drivers/mfd/motorola-cpcap.c       | 25 +++++++++++++++++++++++++
>  include/linux/mfd/motorola-cpcap.h |  2 ++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c
> index 6aeada7d7ce5..b2a53750d579 100644
> --- a/drivers/mfd/motorola-cpcap.c
> +++ b/drivers/mfd/motorola-cpcap.c
> @@ -32,6 +32,31 @@ struct cpcap_ddata {
>  	struct regmap *regmap;
>  };
>  
> +static int cpcap_sense_irq(struct regmap *regmap, int irq)
> +{
> +	int reg = CPCAP_REG_INTS1 + (irq / 16) * 4;
> +	int mask = 1 << (irq % 16);
> +	int err, val;
> +
> +	if (irq < 0 || irq > 64)
> +		return -EINVAL;
> +
> +	err = regmap_read(regmap, reg, &val);
> +	if (err)
> +		return err;
> +
> +	return !!(val & mask);
> +}
> +
> +int cpcap_sense_virq(struct regmap *regmap, int virq)
> +{
> +	struct regmap_irq_chip_data *d = irq_get_chip_data(virq);
> +	int base = regmap_irq_chip_get_base(d);
> +
> +	return cpcap_sense_irq(regmap, virq - base);
> +}
> +EXPORT_SYMBOL_GPL(cpcap_sense_irq);

You have a typo here, should be cpcap_sense_virq for the exported one :)

Other than that my ack is still valid.

Regards,

Tony

      parent reply	other threads:[~2017-03-02 16:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24  8:59 [PATCH] input: cpcap-pwrbutton: new driver Sebastian Reichel
2017-02-25 18:58 ` Dmitry Torokhov
2017-02-25 19:21   ` Tony Lindgren
     [not found]     ` <20170225192100.GK21809-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-02-28  2:32       ` Tony Lindgren
2017-02-28  0:18 ` Rob Herring
2017-03-02  0:22 ` [PATCHv2 1/2] mfd: cpcap: implement irq sense helper Sebastian Reichel
     [not found]   ` <20170302002242.21819-1-sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-02  0:22     ` [PATCHv2 2/2] input: cpcap-pwrbutton: new driver Sebastian Reichel
2017-03-02  1:20       ` Dmitry Torokhov
2017-03-02 18:01         ` Tony Lindgren
     [not found]       ` <20170302002242.21819-2-sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-04 16:22         ` kbuild test robot
2017-03-02 15:17   ` [PATCHv2 1/2] mfd: cpcap: implement irq sense helper Tony Lindgren
2017-03-02 16:09   ` Tony Lindgren [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=20170302160912.GO20572@atomide.com \
    --to=tony@atomide.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.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).