mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: William Breathitt Gray <vilhelm.gray@gmail.com>,
	linus.walleij@linaro.org, gnurou@gmail.com
Cc: linux-gpio@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH 5/5] iio: stx104: Add GPIO set_multiple callback function support
Date: Sun, 22 Jan 2017 13:23:07 +0000	[thread overview]
Message-ID: <1690f497-7b6a-f82d-b0d9-c395c42e9694@kernel.org> (raw)
In-Reply-To: <53039e49d1421a6f070c691988eb22ef0987eba4.1484838095.git.vilhelm.gray@gmail.com>

On 19/01/17 15:06, William Breathitt Gray wrote:
> The Apex Embedded Systems STX104 series provides a digital output
> register where 4 lines may be set at a time. This patch add support for
> the set_multiple callback function, thus allowing multiple digital
> output lines to be set more efficiently in groups.
> 
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
>  drivers/iio/adc/stx104.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/iio/adc/stx104.c b/drivers/iio/adc/stx104.c
> index 7e3645749eaf..6971293909f7 100644
> --- a/drivers/iio/adc/stx104.c
> +++ b/drivers/iio/adc/stx104.c
> @@ -266,6 +266,28 @@ static void stx104_gpio_set(struct gpio_chip *chip, unsigned int offset,
>  	spin_unlock_irqrestore(&stx104gpio->lock, flags);
>  }
>  
> +static void stx104_gpio_set_multiple(struct gpio_chip *chip,
> +	unsigned long *mask, unsigned long *bits)
> +{
> +	struct stx104_gpio *const stx104gpio = gpiochip_get_data(chip);
> +	unsigned long flags;
> +
> +	/* verify masked GPIO are output */
> +	if (!(*mask & 0xF0))
> +		return;
> +
> +	*mask >>= 4;
> +	*bits >>= 4;
> +
> +	spin_lock_irqsave(&stx104gpio->lock, flags);
> +
> +	stx104gpio->out_state &= ~*mask;
> +	stx104gpio->out_state |= *mask & *bits;
> +	outb(stx104gpio->out_state, stx104gpio->base);
> +
> +	spin_unlock_irqrestore(&stx104gpio->lock, flags);
> +}
> +
>  static int stx104_probe(struct device *dev, unsigned int id)
>  {
>  	struct iio_dev *indio_dev;
> @@ -330,6 +352,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
>  	stx104gpio->chip.direction_output = stx104_gpio_direction_output;
>  	stx104gpio->chip.get = stx104_gpio_get;
>  	stx104gpio->chip.set = stx104_gpio_set;
> +	stx104gpio->chip.set_multiple = stx104_gpio_set_multiple;
>  	stx104gpio->base = base[id] + 3;
>  	stx104gpio->out_state = 0x0;
>  
> 

  reply	other threads:[~2017-01-22 13:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 15:05 [PATCH 0/5] Add GPIO set_multiple callback support for ISA_BUS_API drivers William Breathitt Gray
2017-01-19 15:05 ` [PATCH 1/5] gpio: 104-dio-48e: Add set_multiple callback function support William Breathitt Gray
2017-01-26  9:55   ` Linus Walleij
2017-01-19 15:05 ` [PATCH 2/5] gpio: 104-idio-16: " William Breathitt Gray
2017-01-26  9:56   ` Linus Walleij
2017-01-19 15:05 ` [PATCH 3/5] gpio: gpio-mm: " William Breathitt Gray
2017-01-26  9:57   ` Linus Walleij
2017-01-19 15:05 ` [PATCH 4/5] gpio: ws16c48: " William Breathitt Gray
2017-01-26  9:58   ` Linus Walleij
2017-01-19 15:06 ` [PATCH 5/5] iio: stx104: Add GPIO " William Breathitt Gray
2017-01-22 13:23   ` Jonathan Cameron [this message]
2017-01-31 20:03     ` William Breathitt Gray
2017-02-01 18:50       ` Jonathan Cameron
2017-01-22 13:26   ` Linus Walleij

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=1690f497-7b6a-f82d-b0d9-c395c42e9694@kernel.org \
    --to=jic23@kernel.org \
    --cc=gnurou@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=vilhelm.gray@gmail.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

all inboxes | Powered by JetHome®