Skip to content

Commit dcbe3cc

Browse files
William Breathitt Grayjic23
authored andcommitted
iio: stx104: Implement get_multiple callback
The Apex Embedded Systems STX104 series of devices provides 4 TTL compatible lines of inputs accessed via a single 4-bit port. Since four input lines are acquired on a single port input read, the STX104 GPIO driver may improve multiple input reads by utilizing a get_multiple callback. This patch implements the stx104_gpio_get_multiple function which serves as the respective get_multiple callback. Cc: Jonathan Cameron <[email protected]> Cc: Hartmut Knaack <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Peter Meerwald-Stadler <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent c26dd81 commit dcbe3cc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/iio/adc/stx104.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ static int stx104_gpio_get(struct gpio_chip *chip, unsigned int offset)
233233
return !!(inb(stx104gpio->base) & BIT(offset));
234234
}
235235

236+
static int stx104_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
237+
unsigned long *bits)
238+
{
239+
struct stx104_gpio *const stx104gpio = gpiochip_get_data(chip);
240+
241+
*bits = inb(stx104gpio->base);
242+
243+
return 0;
244+
}
245+
236246
static void stx104_gpio_set(struct gpio_chip *chip, unsigned int offset,
237247
int value)
238248
{
@@ -342,6 +352,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
342352
stx104gpio->chip.direction_input = stx104_gpio_direction_input;
343353
stx104gpio->chip.direction_output = stx104_gpio_direction_output;
344354
stx104gpio->chip.get = stx104_gpio_get;
355+
stx104gpio->chip.get_multiple = stx104_gpio_get_multiple;
345356
stx104gpio->chip.set = stx104_gpio_set;
346357
stx104gpio->chip.set_multiple = stx104_gpio_set_multiple;
347358
stx104gpio->base = base[id] + 3;

0 commit comments

Comments
 (0)