Skip to content

Commit 29f1d5c

Browse files
Bartosz GolaszewskiUwe Kleine-König
authored andcommitted
pwm: pca9685: Use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 96d20cf commit 29f1d5c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/pwm/pwm-pca9685.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,14 @@ static int pca9685_pwm_gpio_get(struct gpio_chip *gpio, unsigned int offset)
263263
return pca9685_pwm_get_duty(chip, offset) != 0;
264264
}
265265

266-
static void pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,
267-
int value)
266+
static int pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,
267+
int value)
268268
{
269269
struct pwm_chip *chip = gpiochip_get_data(gpio);
270270

271271
pca9685_pwm_set_duty(chip, offset, value ? PCA9685_COUNTER_RANGE : 0);
272+
273+
return 0;
272274
}
273275

274276
static void pca9685_pwm_gpio_free(struct gpio_chip *gpio, unsigned int offset)
@@ -321,7 +323,7 @@ static int pca9685_pwm_gpio_probe(struct pwm_chip *chip)
321323
pca->gpio.direction_input = pca9685_pwm_gpio_direction_input;
322324
pca->gpio.direction_output = pca9685_pwm_gpio_direction_output;
323325
pca->gpio.get = pca9685_pwm_gpio_get;
324-
pca->gpio.set = pca9685_pwm_gpio_set;
326+
pca->gpio.set_rv = pca9685_pwm_gpio_set;
325327
pca->gpio.base = -1;
326328
pca->gpio.ngpio = PCA9685_MAXCHAN;
327329
pca->gpio.can_sleep = true;

0 commit comments

Comments
 (0)