Lines Matching refs:fwd
252 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get_direction() local
254 return gpiod_get_direction(fwd->descs[offset]); in gpio_fwd_get_direction()
259 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_direction_input() local
261 return gpiod_direction_input(fwd->descs[offset]); in gpio_fwd_direction_input()
267 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_direction_output() local
269 return gpiod_direction_output(fwd->descs[offset], value); in gpio_fwd_direction_output()
274 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get() local
276 return chip->can_sleep ? gpiod_get_value_cansleep(fwd->descs[offset]) in gpio_fwd_get()
277 : gpiod_get_value(fwd->descs[offset]); in gpio_fwd_get()
280 static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, in gpio_fwd_get_multiple() argument
289 values = &fwd->tmp[0]; in gpio_fwd_get_multiple()
290 descs = (void *)&fwd->tmp[BITS_TO_LONGS(fwd->chip.ngpio)]; in gpio_fwd_get_multiple()
292 bitmap_clear(values, 0, fwd->chip.ngpio); in gpio_fwd_get_multiple()
293 for_each_set_bit(i, mask, fwd->chip.ngpio) in gpio_fwd_get_multiple()
294 descs[j++] = fwd->descs[i]; in gpio_fwd_get_multiple()
296 if (fwd->chip.can_sleep) in gpio_fwd_get_multiple()
304 for_each_set_bit(i, mask, fwd->chip.ngpio) in gpio_fwd_get_multiple()
313 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_get_multiple_locked() local
318 mutex_lock(&fwd->mlock); in gpio_fwd_get_multiple_locked()
319 error = gpio_fwd_get_multiple(fwd, mask, bits); in gpio_fwd_get_multiple_locked()
320 mutex_unlock(&fwd->mlock); in gpio_fwd_get_multiple_locked()
322 spin_lock_irqsave(&fwd->slock, flags); in gpio_fwd_get_multiple_locked()
323 error = gpio_fwd_get_multiple(fwd, mask, bits); in gpio_fwd_get_multiple_locked()
324 spin_unlock_irqrestore(&fwd->slock, flags); in gpio_fwd_get_multiple_locked()
332 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set() local
335 gpiod_set_value_cansleep(fwd->descs[offset], value); in gpio_fwd_set()
337 gpiod_set_value(fwd->descs[offset], value); in gpio_fwd_set()
340 static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long *mask, in gpio_fwd_set_multiple() argument
348 values = &fwd->tmp[0]; in gpio_fwd_set_multiple()
349 descs = (void *)&fwd->tmp[BITS_TO_LONGS(fwd->chip.ngpio)]; in gpio_fwd_set_multiple()
351 for_each_set_bit(i, mask, fwd->chip.ngpio) { in gpio_fwd_set_multiple()
353 descs[j++] = fwd->descs[i]; in gpio_fwd_set_multiple()
356 if (fwd->chip.can_sleep) in gpio_fwd_set_multiple()
365 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set_multiple_locked() local
369 mutex_lock(&fwd->mlock); in gpio_fwd_set_multiple_locked()
370 gpio_fwd_set_multiple(fwd, mask, bits); in gpio_fwd_set_multiple_locked()
371 mutex_unlock(&fwd->mlock); in gpio_fwd_set_multiple_locked()
373 spin_lock_irqsave(&fwd->slock, flags); in gpio_fwd_set_multiple_locked()
374 gpio_fwd_set_multiple(fwd, mask, bits); in gpio_fwd_set_multiple_locked()
375 spin_unlock_irqrestore(&fwd->slock, flags); in gpio_fwd_set_multiple_locked()
382 struct gpiochip_fwd *fwd = gpiochip_get_data(chip); in gpio_fwd_set_config() local
384 return gpiod_set_config(fwd->descs[offset], config); in gpio_fwd_set_config()
406 struct gpiochip_fwd *fwd; in gpiochip_fwd_create() local
411 fwd = devm_kzalloc(dev, struct_size(fwd, tmp, in gpiochip_fwd_create()
413 if (!fwd) in gpiochip_fwd_create()
416 chip = &fwd->chip; in gpiochip_fwd_create()
447 fwd->descs = descs; in gpiochip_fwd_create()
450 mutex_init(&fwd->mlock); in gpiochip_fwd_create()
452 spin_lock_init(&fwd->slock); in gpiochip_fwd_create()
454 error = devm_gpiochip_add_data(dev, chip, fwd); in gpiochip_fwd_create()
458 return fwd; in gpiochip_fwd_create()
470 struct gpiochip_fwd *fwd; in gpio_aggregator_probe() local
487 fwd = gpiochip_fwd_create(dev, n, descs); in gpio_aggregator_probe()
488 if (IS_ERR(fwd)) in gpio_aggregator_probe()
489 return PTR_ERR(fwd); in gpio_aggregator_probe()
491 platform_set_drvdata(pdev, fwd); in gpio_aggregator_probe()