Skip to content

Commit

Permalink
leds: expresswire: Fix GPIO pin control with gpiod_direction_output()
Browse files Browse the repository at this point in the history
The flash LED GPIO pin is controlled by gpiod_direction_output() instead
of gpiod_set_value().

Signed-off-by: Raymond Hackley <[email protected]>
  • Loading branch information
wonderfulShrineMaidenOfParadise committed Nov 3, 2024
1 parent 1f7a09e commit bcfeee4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/leds/leds-expresswire.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,41 @@ EXPORT_SYMBOL_NS_GPL(expresswire_power_off, EXPRESSWIRE);

void expresswire_enable(struct expresswire_common_props *props)
{
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
udelay(props->timing.detect_delay_us);
gpiod_set_value(props->ctrl_gpio, 0);
gpiod_direction_output(props->ctrl_gpio, 0);
udelay(props->timing.detect_us);
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
}
EXPORT_SYMBOL_NS_GPL(expresswire_enable, EXPRESSWIRE);

void expresswire_start(struct expresswire_common_props *props)
{
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
udelay(props->timing.data_start_us);
}
EXPORT_SYMBOL_NS_GPL(expresswire_start, EXPRESSWIRE);

void expresswire_end(struct expresswire_common_props *props)
{
gpiod_set_value(props->ctrl_gpio, 0);
gpiod_direction_output(props->ctrl_gpio, 0);
udelay(props->timing.end_of_data_low_us);
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
udelay(props->timing.end_of_data_high_us);
}
EXPORT_SYMBOL_NS_GPL(expresswire_end, EXPRESSWIRE);

void expresswire_set_bit(struct expresswire_common_props *props, bool bit)
{
if (bit) {
gpiod_set_value(props->ctrl_gpio, 0);
gpiod_direction_output(props->ctrl_gpio, 0);
udelay(props->timing.short_bitset_us);
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
udelay(props->timing.long_bitset_us);
} else {
gpiod_set_value(props->ctrl_gpio, 0);
gpiod_direction_output(props->ctrl_gpio, 0);
udelay(props->timing.long_bitset_us);
gpiod_set_value(props->ctrl_gpio, 1);
gpiod_direction_output(props->ctrl_gpio, 1);
udelay(props->timing.short_bitset_us);
}
}
Expand Down

0 comments on commit bcfeee4

Please sign in to comment.