mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-05-02 10:04:31 -04:00
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 <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20250408-gpiochip-set-rv-pwm-v1-1-61e5c3358a74@linaro.org Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
committed by
Uwe Kleine-König
parent
96d20cfd16
commit
29f1d5cac2
@@ -263,12 +263,14 @@ static int pca9685_pwm_gpio_get(struct gpio_chip *gpio, unsigned int offset)
|
||||
return pca9685_pwm_get_duty(chip, offset) != 0;
|
||||
}
|
||||
|
||||
static void pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,
|
||||
int value)
|
||||
static int pca9685_pwm_gpio_set(struct gpio_chip *gpio, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct pwm_chip *chip = gpiochip_get_data(gpio);
|
||||
|
||||
pca9685_pwm_set_duty(chip, offset, value ? PCA9685_COUNTER_RANGE : 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
pca->gpio.direction_input = pca9685_pwm_gpio_direction_input;
|
||||
pca->gpio.direction_output = pca9685_pwm_gpio_direction_output;
|
||||
pca->gpio.get = pca9685_pwm_gpio_get;
|
||||
pca->gpio.set = pca9685_pwm_gpio_set;
|
||||
pca->gpio.set_rv = pca9685_pwm_gpio_set;
|
||||
pca->gpio.base = -1;
|
||||
pca->gpio.ngpio = PCA9685_MAXCHAN;
|
||||
pca->gpio.can_sleep = true;
|
||||
|
||||
Reference in New Issue
Block a user