brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/dedeckeh.git] / target / linux / brcm2708 / patches-4.4 / 0321-pinctrl-bcm2835-Return-pins-to-inputs-when-freed.patch
1 From 2e4f06a9b7276db1e2dafe33564ad5115f63a210 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 6 May 2016 12:32:47 +0100
4 Subject: [PATCH 321/381] pinctrl-bcm2835: Return pins to inputs when freed
5
6 When dynamically unloading overlays, it is important that freed pins are
7 restored to being inputs to prevent functions from being enabled in
8 multiple places at once.
9
10 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
11 ---
12 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 ++++++++++
13 1 file changed, 10 insertions(+)
14
15 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
16 +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
17 @@ -831,6 +831,15 @@ static const struct pinctrl_ops bcm2835_
18 .dt_free_map = bcm2835_pctl_dt_free_map,
19 };
20
21 +static void bcm2835_pmx_free(struct pinctrl_dev *pctldev,
22 + unsigned offset)
23 +{
24 + struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
25 +
26 + /* disable by setting to GPIO_IN */
27 + bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN);
28 +}
29 +
30 static int bcm2835_pmx_get_functions_count(struct pinctrl_dev *pctldev)
31 {
32 return BCM2835_FSEL_COUNT;
33 @@ -890,6 +899,7 @@ static int bcm2835_pmx_gpio_set_directio
34 }
35
36 static const struct pinmux_ops bcm2835_pmx_ops = {
37 + .free = bcm2835_pmx_free,
38 .get_functions_count = bcm2835_pmx_get_functions_count,
39 .get_function_name = bcm2835_pmx_get_function_name,
40 .get_function_groups = bcm2835_pmx_get_function_groups,