Skip to content

Commit 23484d8

Browse files
Emantorjmberg-intel
authored andcommitted
net: rfkill: gpio: set GPIO direction
Fix the undefined usage of the GPIO consumer API after retrieving the GPIO description with GPIO_ASIS. The API documentation mentions that GPIO_ASIS won't set a GPIO direction and requires the user to set a direction before using the GPIO. This can be confirmed on i.MX6 hardware, where rfkill-gpio is no longer able to enabled/disable a device, presumably because the GPIO controller was never configured for the output direction. Fixes: b2f750c ("net: rfkill: gpio: prevent value glitch during probe") Cc: [email protected] Signed-off-by: Rouven Czerwinski <[email protected]> Link: https://msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent c1393c1 commit 23484d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/rfkill/rfkill-gpio.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
126126
return -EINVAL;
127127
}
128128

129+
ret = gpiod_direction_output(rfkill->reset_gpio, true);
130+
if (ret)
131+
return ret;
132+
133+
ret = gpiod_direction_output(rfkill->shutdown_gpio, true);
134+
if (ret)
135+
return ret;
136+
129137
rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
130138
rfkill->type, &rfkill_gpio_ops,
131139
rfkill);

0 commit comments

Comments
 (0)