Lines Matching refs:fwd

250 #define fwd_tmp_values(fwd)	&(fwd)->tmp[0]  argument
251 #define fwd_tmp_descs(fwd) (void *)&(fwd)->tmp[BITS_TO_LONGS((fwd)->chip.ngpio)] argument
257 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get_direction() local
259 return gpiod_get_direction(fwd->descs[offset]); in gpio_fwd_get_direction()
264 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_direction_input() local
266 return gpiod_direction_input(fwd->descs[offset]); in gpio_fwd_direction_input()
272 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_direction_output() local
274 return gpiod_direction_output(fwd->descs[offset], value); in gpio_fwd_direction_output()
279 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get() local
281 return chip->can_sleep ? gpiod_get_value_cansleep(fwd->descs[offset]) in gpio_fwd_get()
282 : gpiod_get_value(fwd->descs[offset]); in gpio_fwd_get()
285 static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, in gpio_fwd_get_multiple() argument
288 struct gpio_desc **descs = fwd_tmp_descs(fwd); in gpio_fwd_get_multiple()
289 unsigned long *values = fwd_tmp_values(fwd); in gpio_fwd_get_multiple()
293 bitmap_clear(values, 0, fwd->chip.ngpio); in gpio_fwd_get_multiple()
294 for_each_set_bit(i, mask, fwd->chip.ngpio) in gpio_fwd_get_multiple()
295 descs[j++] = fwd->descs[i]; in gpio_fwd_get_multiple()
297 if (fwd->chip.can_sleep) in gpio_fwd_get_multiple()
305 for_each_set_bit(i, mask, fwd->chip.ngpio) in gpio_fwd_get_multiple()
314 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get_multiple_locked() local
319 mutex_lock(&fwd->mlock); in gpio_fwd_get_multiple_locked()
320 error = gpio_fwd_get_multiple(fwd, mask, bits); in gpio_fwd_get_multiple_locked()
321 mutex_unlock(&fwd->mlock); in gpio_fwd_get_multiple_locked()
323 spin_lock_irqsave(&fwd->slock, flags); in gpio_fwd_get_multiple_locked()
324 error = gpio_fwd_get_multiple(fwd, mask, bits); in gpio_fwd_get_multiple_locked()
325 spin_unlock_irqrestore(&fwd->slock, flags); in gpio_fwd_get_multiple_locked()
333 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set() local
336 gpiod_set_value_cansleep(fwd->descs[offset], value); in gpio_fwd_set()
338 gpiod_set_value(fwd->descs[offset], value); in gpio_fwd_set()
341 static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, in gpio_fwd_set_multiple() argument
344 struct gpio_desc **descs = fwd_tmp_descs(fwd); in gpio_fwd_set_multiple()
345 unsigned long *values = fwd_tmp_values(fwd); in gpio_fwd_set_multiple()
348 for_each_set_bit(i, mask, fwd->chip.ngpio) { in gpio_fwd_set_multiple()
350 descs[j++] = fwd->descs[i]; in gpio_fwd_set_multiple()
353 if (fwd->chip.can_sleep) in gpio_fwd_set_multiple()
362 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set_multiple_locked() local
366 mutex_lock(&fwd->mlock); in gpio_fwd_set_multiple_locked()
367 gpio_fwd_set_multiple(fwd, mask, bits); in gpio_fwd_set_multiple_locked()
368 mutex_unlock(&fwd->mlock); in gpio_fwd_set_multiple_locked()
370 spin_lock_irqsave(&fwd->slock, flags); in gpio_fwd_set_multiple_locked()
371 gpio_fwd_set_multiple(fwd, mask, bits); in gpio_fwd_set_multiple_locked()
372 spin_unlock_irqrestore(&fwd->slock, flags); in gpio_fwd_set_multiple_locked()
379 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set_config() local
381 return gpiod_set_config(fwd->descs[offset], config); in gpio_fwd_set_config()
386 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_to_irq() local
388 return gpiod_to_irq(fwd->descs[offset]); in gpio_fwd_to_irq()
410 struct gpiochip_fwd *fwd; in gpiochip_fwd_create() local
415 fwd = devm_kzalloc(dev, struct_size(fwd, tmp, fwd_tmp_size(ngpios)), in gpiochip_fwd_create()
417 if (!fwd) in gpiochip_fwd_create()
420 chip = &fwd->chip; in gpiochip_fwd_create()
453 fwd->descs = descs; in gpiochip_fwd_create()
456 mutex_init(&fwd->mlock); in gpiochip_fwd_create()
458 spin_lock_init(&fwd->slock); in gpiochip_fwd_create()
460 error = devm_gpiochip_add_data(dev, chip, fwd); in gpiochip_fwd_create()
464 return fwd; in gpiochip_fwd_create()
476 struct gpiochip_fwd *fwd; in gpio_aggregator_probe() local
493 fwd = gpiochip_fwd_create(dev, n, descs); in gpio_aggregator_probe()
494 if (IS_ERR(fwd)) in gpio_aggregator_probe()
495 return PTR_ERR(fwd); in gpio_aggregator_probe()
497 platform_set_drvdata(pdev, fwd); in gpio_aggregator_probe()