gpio: pcal6408: fix set output

Fix the set output function so that it will configure the
gpio to the specified state.

Change-Id: I265e53a83b64c6663eb52013087e1960de29f0d3
Signed-off-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-on: https://gerrit.mot.com/1834058
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
This commit is contained in:
Ryan Lattrel 2020-12-21 16:44:33 -06:00
parent bc34f8e620
commit ad8684e595

View file

@ -273,6 +273,16 @@ static int pcal6048_direction_in(struct gpio_chip *gc, unsigned offset)
return ret;
}
static void pcal6048_set_gpio(struct gpio_chip *gc, unsigned offset, int value)
{
struct pcal6048_dev *chip = gpiochip_get_data(gc);
if (value)
pcal6048_set_reg(chip, offset, chip->conf->output);
else
pcal6048_clear_reg(chip, offset, chip->conf->output);
}
static int pcal6048_direction_out(struct gpio_chip *gc, unsigned offset, int value)
{
struct pcal6048_dev *chip = gpiochip_get_data(gc);
@ -287,6 +297,8 @@ static int pcal6048_direction_out(struct gpio_chip *gc, unsigned offset, int val
else
ret = pcal6048_clear_reg(chip, offset, chip->conf->direction);
pcal6048_set_gpio(gc, offset, value);
return ret;
}
@ -310,16 +322,6 @@ static int pcal6048_get_gpio(struct gpio_chip *gc, unsigned offset)
return pcal6048_read_reg(chip, offset, chip->conf->input);
}
static void pcal6048_set_gpio(struct gpio_chip *gc, unsigned offset, int value)
{
struct pcal6048_dev *chip = gpiochip_get_data(gc);
if (value)
pcal6048_set_reg(chip, offset, chip->conf->output);
else
pcal6048_clear_reg(chip, offset, chip->conf->output);
}
static int pcal6048_set_config(struct gpio_chip *gc, unsigned int offset, unsigned long config)
{
struct pcal6048_dev *chip = gpiochip_get_data(gc);