pinctrl: avoid duplicated calling enable_pinmux_setting for a pin
authorFan Wu <fwu@marvell.com>
Mon, 9 Jun 2014 01:37:56 +0000 (09:37 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 11 Jul 2014 12:08:26 +0000 (14:08 +0200)
What the patch does:
1. Call pinmux_disable_setting ahead of pinmux_enable_setting
  each time pinctrl_select_state is called
2. Remove the HW disable operation in pinmux_disable_setting function.
3. Remove the disable ops in struct pinmux_ops
4. Remove all the disable ops users in current code base.

Notes:
1. Great thanks for the suggestion from Linus, Tony Lindgren and
   Stephen Warren and Everyone that shared comments on this patch.
2. The patch also includes comment fixes from Stephen Warren.

The reason why we do this:
1. To avoid duplicated calling of the enable_setting operation
   without disabling operation inbetween which will let the pin
   descriptor desc->mux_usecount increase monotonously.
2. The HW pin disable operation is not useful for any of the
   existing platforms.
   And this can be used to avoid the HW glitch after using the
   item #1 modification.

In the following case, the issue can be reproduced:
1. There is a driver that need to switch pin state dynamically,
   e.g. between "sleep" and "default" state
2. The pin setting configuration in a DTS node may be like this:

  component a {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&a_grp_setting &c_grp_setting>;
pinctrl-1 = <&b_grp_setting &c_grp_setting>;
  }

  The "c_grp_setting" config node is totally identical, maybe like
  following one:

  c_grp_setting: c_grp_setting {
pinctrl-single,pins = <GPIO48 AF6>;
  }

3. When switching the pin state in the following official pinctrl
   sequence:
pin = pinctrl_get();
state = pinctrl_lookup_state(wanted_state);
pinctrl_select_state(state);
pinctrl_put();

Test Result:
1. The switch is completed as expected, that is: the device's
   pin configuration is changed according to the description in the
   "wanted_state" group setting
2. The "desc->mux_usecount" of the corresponding pins in "c_group"
   is increased without being decreased, because the "desc" is for
   each physical pin while the setting is for each setting node
   in the DTS.
   Thus, if the "c_grp_setting" in pinctrl-0 is not disabled ahead
   of enabling "c_grp_setting" in pinctrl-1, the desc->mux_usecount
   will keep increasing without any chance to be decreased.

According to the comments in the original code, only the setting,
in old state but not in new state, will be "disabled" (calling
pinmux_disable_setting), which is correct logic but not intact. We
still need consider case that the setting is in both old state
and new state. We can do this in the following two ways:

1. Avoid to "enable"(calling pinmux_enable_setting) the "same pin
   setting" repeatedly
2. "Disable"(calling pinmux_disable_setting) the "same pin setting",
   actually two setting instances, ahead of enabling them.

Analysis:
1. The solution #2 is better because it can avoid too much
   iteration.
2. If we disable all of the settings in the old state and one of
   the setting(s) exist in the new state, the pins mux function
   change may happen when some SoC vendors defined the
   "pinctrl-single,function-off"
   in their DTS file.
   old_setting => disabled_setting => new_setting.
3. In the pinmux framework, when a pin state is switched, the
   setting in the old state should be marked as "disabled".

Conclusion:
1. To Remove the HW disabling operation to above the glitch mentioned
   above.
2. Handle the issue mentioned above by disabling all of the settings
   in old state and then enable the all of the settings in new state.

Signed-off-by: Fan Wu <fwu@marvell.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
23 files changed:
drivers/pinctrl/core.c
drivers/pinctrl/pinctrl-abx500.c
drivers/pinctrl/pinctrl-adi2.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-bcm2835.c
drivers/pinctrl/pinctrl-exynos5440.c
drivers/pinctrl/pinctrl-msm.c
drivers/pinctrl/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-rockchip.c
drivers/pinctrl/pinctrl-samsung.c
drivers/pinctrl/pinctrl-single.c
drivers/pinctrl/pinctrl-st.c
drivers/pinctrl/pinctrl-tb10x.c
drivers/pinctrl/pinctrl-tegra.c
drivers/pinctrl/pinctrl-tz1090-pdc.c
drivers/pinctrl/pinctrl-tz1090.c
drivers/pinctrl/pinctrl-u300.c
drivers/pinctrl/pinmux.c
drivers/pinctrl/sh-pfc/pinctrl.c
drivers/pinctrl/sirf/pinctrl-sirf.c
drivers/pinctrl/spear/pinctrl-spear.c
drivers/pinctrl/vt8500/pinctrl-wmt.c
include/linux/pinctrl/pinmux.h

index e09474ecde2346bd900d8f9d05ba3c26c63f9aa9..e4f65510c87e8928666e195b6b76e52cae9252b5 100644 (file)
@@ -992,29 +992,15 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
 
        if (p->state) {
                /*
-                * The set of groups with a mux configuration in the old state
-                * may not be identical to the set of groups with a mux setting
-                * in the new state. While this might be unusual, it's entirely
-                * possible for the "user"-supplied mapping table to be written
-                * that way. For each group that was configured in the old state
-                * but not in the new state, this code puts that group into a
-                * safe/disabled state.
+                * For each pinmux setting in the old state, forget SW's record
+                * of mux owner for that pingroup. Any pingroups which are
+                * still owned by the new state will be re-acquired by the call
+                * to pinmux_enable_setting() in the loop below.
                 */
                list_for_each_entry(setting, &p->state->settings, node) {
-                       bool found = false;
                        if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
                                continue;
-                       list_for_each_entry(setting2, &state->settings, node) {
-                               if (setting2->type != PIN_MAP_TYPE_MUX_GROUP)
-                                       continue;
-                               if (setting2->data.mux.group ==
-                                               setting->data.mux.group) {
-                                       found = true;
-                                       break;
-                               }
-                       }
-                       if (!found)
-                               pinmux_disable_setting(setting);
+                       pinmux_disable_setting(setting);
                }
        }
 
index 163da9c3ea0e164c228bff771ed8b41347632fa7..f3f8b24efe5482b2e77bba5c79d1a6865878d265 100644 (file)
@@ -737,20 +737,6 @@ static int abx500_pmx_enable(struct pinctrl_dev *pctldev, unsigned function,
        return ret;
 }
 
-static void abx500_pmx_disable(struct pinctrl_dev *pctldev,
-                              unsigned function, unsigned group)
-{
-       struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
-       const struct abx500_pingroup *g;
-
-       g = &pct->soc->groups[group];
-       if (g->altsetting < 0)
-               return;
-
-       /* FIXME: poke out the mux, set the pin to some default state? */
-       dev_dbg(pct->dev, "disable group %s, %u pins\n", g->name, g->npins);
-}
-
 static int abx500_gpio_request_enable(struct pinctrl_dev *pctldev,
                               struct pinctrl_gpio_range *range,
                               unsigned offset)
@@ -799,7 +785,6 @@ static const struct pinmux_ops abx500_pinmux_ops = {
        .get_function_name = abx500_pmx_get_func_name,
        .get_function_groups = abx500_pmx_get_func_groups,
        .enable = abx500_pmx_enable,
-       .disable = abx500_pmx_disable,
        .gpio_request_enable = abx500_gpio_request_enable,
        .gpio_disable_free = abx500_gpio_disable_free,
 };
index 5c44feb54ebb4771566dcce454bd7f81a9bc34fe..b02ee4f882c0bc9b6e9205543ddf2908772cabe9 100644 (file)
@@ -652,35 +652,6 @@ static int adi_pinmux_enable(struct pinctrl_dev *pctldev, unsigned func_id,
        return 0;
 }
 
-static void adi_pinmux_disable(struct pinctrl_dev *pctldev, unsigned func_id,
-       unsigned group_id)
-{
-       struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
-       struct gpio_port *port;
-       struct pinctrl_gpio_range *range;
-       unsigned long flags;
-       unsigned short *mux, pin;
-
-       mux = (unsigned short *)pinctrl->soc->groups[group_id].mux;
-
-       while (*mux) {
-               pin = P_IDENT(*mux);
-
-               range = pinctrl_find_gpio_range_from_pin(pctldev, pin);
-               if (range == NULL) /* should not happen */
-                       return;
-
-               port = container_of(range->gc, struct gpio_port, chip);
-
-               spin_lock_irqsave(&port->lock, flags);
-
-               port_setup(port, pin_to_offset(range, pin), true);
-               mux++;
-
-               spin_unlock_irqrestore(&port->lock, flags);
-       }
-}
-
 static int adi_pinmux_get_funcs_count(struct pinctrl_dev *pctldev)
 {
        struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
@@ -728,7 +699,6 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev,
 
 static struct pinmux_ops adi_pinmux_ops = {
        .enable = adi_pinmux_enable,
-       .disable = adi_pinmux_disable,
        .get_functions_count = adi_pinmux_get_funcs_count,
        .get_function_name = adi_pinmux_get_func_name,
        .get_function_groups = adi_pinmux_get_groups,
index 421493cb490c52a9f434df0ffd041c91c31536b9..bd57ab514aa48dacd22077c36365a03c63958276 100644 (file)
@@ -611,26 +611,6 @@ static int at91_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
        return 0;
 }
 
-static void at91_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
-                          unsigned group)
-{
-       struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
-       const struct at91_pmx_pin *pins_conf = info->groups[group].pins_conf;
-       const struct at91_pmx_pin *pin;
-       uint32_t npins = info->groups[group].npins;
-       int i;
-       unsigned mask;
-       void __iomem *pio;
-
-       for (i = 0; i < npins; i++) {
-               pin = &pins_conf[i];
-               at91_pin_dbg(info->dev, pin);
-               pio = pin_to_controller(info, pin->bank);
-               mask = pin_to_mask(pin->pin);
-               at91_mux_gpio_enable(pio, mask, 1);
-       }
-}
-
 static int at91_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
 {
        struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
@@ -705,7 +685,6 @@ static const struct pinmux_ops at91_pmx_ops = {
        .get_function_name      = at91_pmx_get_func_name,
        .get_function_groups    = at91_pmx_get_groups,
        .enable                 = at91_pmx_enable,
-       .disable                = at91_pmx_disable,
        .gpio_request_enable    = at91_gpio_request_enable,
        .gpio_disable_free      = at91_gpio_disable_free,
 };
index 3d907de9bc91501cc7a83ccd7cfab487bbcab265..5bcfd7ace0cd207eeddfa310663df8c5494ff6a2 100644 (file)
@@ -841,16 +841,6 @@ static int bcm2835_pmx_enable(struct pinctrl_dev *pctldev,
        return 0;
 }
 
-static void bcm2835_pmx_disable(struct pinctrl_dev *pctldev,
-               unsigned func_selector,
-               unsigned group_selector)
-{
-       struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
-
-       /* disable by setting to GPIO_IN */
-       bcm2835_pinctrl_fsel_set(pc, group_selector, BCM2835_FSEL_GPIO_IN);
-}
-
 static void bcm2835_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
                struct pinctrl_gpio_range *range,
                unsigned offset)
@@ -880,7 +870,6 @@ static const struct pinmux_ops bcm2835_pmx_ops = {
        .get_function_name = bcm2835_pmx_get_function_name,
        .get_function_groups = bcm2835_pmx_get_function_groups,
        .enable = bcm2835_pmx_enable,
-       .disable = bcm2835_pmx_disable,
        .gpio_disable_free = bcm2835_pmx_gpio_disable_free,
        .gpio_set_direction = bcm2835_pmx_gpio_set_direction,
 };
index 8fe2ab0a769812ddf1af7737b126c68525de5057..4b145b5db7a6a9d68bfb20c15462ed7b89c1acdf 100644 (file)
@@ -371,13 +371,6 @@ static int exynos5440_pinmux_enable(struct pinctrl_dev *pctldev, unsigned select
        return 0;
 }
 
-/* disable a specified pinmux by writing to registers */
-static void exynos5440_pinmux_disable(struct pinctrl_dev *pctldev,
-                                       unsigned selector, unsigned group)
-{
-       exynos5440_pinmux_setup(pctldev, selector, group, false);
-}
-
 /*
  * The calls to gpio_direction_output() and gpio_direction_input()
  * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
@@ -395,7 +388,6 @@ static const struct pinmux_ops exynos5440_pinmux_ops = {
        .get_function_name      = exynos5440_pinmux_get_fname,
        .get_function_groups    = exynos5440_pinmux_get_groups,
        .enable                 = exynos5440_pinmux_enable,
-       .disable                = exynos5440_pinmux_disable,
        .gpio_set_direction     = exynos5440_pinmux_gpio_set_direction,
 };
 
index df6dda4ce803fa0fcb4655bfd5f1eefbf3320743..bdfaba4430f23d1f776247f1ffbb741bfc1e056d 100644 (file)
@@ -165,36 +165,11 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev,
        return 0;
 }
 
-static void msm_pinmux_disable(struct pinctrl_dev *pctldev,
-                              unsigned function,
-                              unsigned group)
-{
-       struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-       const struct msm_pingroup *g;
-       unsigned long flags;
-       u32 val;
-
-       g = &pctrl->soc->groups[group];
-
-       if (WARN_ON(g->mux_bit < 0))
-               return;
-
-       spin_lock_irqsave(&pctrl->lock, flags);
-
-       /* Clear the mux bits to select gpio mode */
-       val = readl(pctrl->regs + g->ctl_reg);
-       val &= ~(0x7 << g->mux_bit);
-       writel(val, pctrl->regs + g->ctl_reg);
-
-       spin_unlock_irqrestore(&pctrl->lock, flags);
-}
-
 static const struct pinmux_ops msm_pinmux_ops = {
        .get_functions_count    = msm_get_functions_count,
        .get_function_name      = msm_get_function_name,
        .get_function_groups    = msm_get_function_groups,
        .enable                 = msm_pinmux_enable,
-       .disable                = msm_pinmux_disable,
 };
 
 static int msm_config_reg(struct msm_pinctrl *pctrl,
index 8f6f16ef73f3e0da427283aaafe835180b91f9c8..a564251fe093ccbc8490698e433dcebcb26b7fa6 100644 (file)
@@ -1765,21 +1765,6 @@ out_glitch:
        return ret;
 }
 
-static void nmk_pmx_disable(struct pinctrl_dev *pctldev,
-                           unsigned function, unsigned group)
-{
-       struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
-       const struct nmk_pingroup *g;
-
-       g = &npct->soc->groups[group];
-
-       if (g->altsetting < 0)
-               return;
-
-       /* Poke out the mux, set the pin to some default state? */
-       dev_dbg(npct->dev, "disable group %s, %u pins\n", g->name, g->npins);
-}
-
 static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
                                   struct pinctrl_gpio_range *range,
                                   unsigned offset)
@@ -1826,7 +1811,6 @@ static const struct pinmux_ops nmk_pinmux_ops = {
        .get_function_name = nmk_pmx_get_func_name,
        .get_function_groups = nmk_pmx_get_func_groups,
        .enable = nmk_pmx_enable,
-       .disable = nmk_pmx_disable,
        .gpio_request_enable = nmk_gpio_request_enable,
        .gpio_disable_free = nmk_gpio_disable_free,
 };
index bb805d5e9ff066a37275fb3e758d7dbae8ab87c9..51f67a6eadcb7403cda1f355d22d27b506983c72 100644 (file)
@@ -657,23 +657,6 @@ static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
        return 0;
 }
 
-static void rockchip_pmx_disable(struct pinctrl_dev *pctldev,
-                                       unsigned selector, unsigned group)
-{
-       struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
-       const unsigned int *pins = info->groups[group].pins;
-       struct rockchip_pin_bank *bank;
-       int cnt;
-
-       dev_dbg(info->dev, "disable function %s group %s\n",
-               info->functions[selector].name, info->groups[group].name);
-
-       for (cnt = 0; cnt < info->groups[group].npins; cnt++) {
-               bank = pin_to_bank(info, pins[cnt]);
-               rockchip_set_mux(bank, pins[cnt] - bank->pin_base, 0);
-       }
-}
-
 /*
  * The calls to gpio_direction_output() and gpio_direction_input()
  * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
@@ -716,7 +699,6 @@ static const struct pinmux_ops rockchip_pmx_ops = {
        .get_function_name      = rockchip_pmx_get_func_name,
        .get_function_groups    = rockchip_pmx_get_groups,
        .enable                 = rockchip_pmx_enable,
-       .disable                = rockchip_pmx_disable,
        .gpio_set_direction     = rockchip_pmx_gpio_set_direction,
 };
 
index 3e61d0f8f146fb209ca83e15b0c8f7dd10b0281c..089abde35d44134cb3de2f8514881e1d6e8ef285 100644 (file)
@@ -333,13 +333,6 @@ static int samsung_pinmux_enable(struct pinctrl_dev *pctldev, unsigned selector,
        return 0;
 }
 
-/* disable a specified pinmux by writing to registers */
-static void samsung_pinmux_disable(struct pinctrl_dev *pctldev,
-                                       unsigned selector, unsigned group)
-{
-       samsung_pinmux_setup(pctldev, selector, group, false);
-}
-
 /*
  * The calls to gpio_direction_output() and gpio_direction_input()
  * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
@@ -390,7 +383,6 @@ static const struct pinmux_ops samsung_pinmux_ops = {
        .get_function_name      = samsung_pinmux_get_fname,
        .get_function_groups    = samsung_pinmux_get_groups,
        .enable                 = samsung_pinmux_enable,
-       .disable                = samsung_pinmux_disable,
        .gpio_set_direction     = samsung_pinmux_gpio_set_direction,
 };
 
index 2960557bfed95c6d79f316c020ec98c426f38f83..ff6a2bda52e570cba4904a747ffb9f9c9ea32dc1 100644 (file)
@@ -488,61 +488,6 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
        return 0;
 }
 
-static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
-                                       unsigned group)
-{
-       struct pcs_device *pcs;
-       struct pcs_function *func;
-       int i;
-
-       pcs = pinctrl_dev_get_drvdata(pctldev);
-       /* If function mask is null, needn't disable it. */
-       if (!pcs->fmask)
-               return;
-
-       func = radix_tree_lookup(&pcs->ftree, fselector);
-       if (!func) {
-               dev_err(pcs->dev, "%s could not find function%i\n",
-                       __func__, fselector);
-               return;
-       }
-
-       /*
-        * Ignore disable if function-off is not specified. Some hardware
-        * does not have clearly defined disable function. For pin specific
-        * off modes, you can use alternate named states as described in
-        * pinctrl-bindings.txt.
-        */
-       if (pcs->foff == PCS_OFF_DISABLED) {
-               dev_dbg(pcs->dev, "ignoring disable for %s function%i\n",
-                       func->name, fselector);
-               return;
-       }
-
-       dev_dbg(pcs->dev, "disabling function%i %s\n",
-               fselector, func->name);
-
-       for (i = 0; i < func->nvals; i++) {
-               struct pcs_func_vals *vals;
-               unsigned long flags;
-               unsigned val, mask;
-
-               vals = &func->vals[i];
-               raw_spin_lock_irqsave(&pcs->lock, flags);
-               val = pcs->read(vals->reg);
-
-               if (pcs->bits_per_mux)
-                       mask = vals->mask;
-               else
-                       mask = pcs->fmask;
-
-               val &= ~mask;
-               val |= pcs->foff << pcs->fshift;
-               pcs->write(val, vals->reg);
-               raw_spin_unlock_irqrestore(&pcs->lock, flags);
-       }
-}
-
 static int pcs_request_gpio(struct pinctrl_dev *pctldev,
                            struct pinctrl_gpio_range *range, unsigned pin)
 {
@@ -575,7 +520,6 @@ static const struct pinmux_ops pcs_pinmux_ops = {
        .get_function_name = pcs_get_function_name,
        .get_function_groups = pcs_get_function_groups,
        .enable = pcs_enable,
-       .disable = pcs_disable,
        .gpio_request_enable = pcs_request_gpio,
 };
 
index 1bd6363bc95ef2b0d0bd2b58d733159941c78fa0..e1919cd4311747ee7152147e0cb94e18db2153da 100644 (file)
@@ -930,11 +930,6 @@ static int st_pmx_enable(struct pinctrl_dev *pctldev, unsigned fselector,
        return 0;
 }
 
-static void st_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
-               unsigned group)
-{
-}
-
 static int st_pmx_set_gpio_direction(struct pinctrl_dev *pctldev,
                        struct pinctrl_gpio_range *range, unsigned gpio,
                        bool input)
@@ -957,7 +952,6 @@ static struct pinmux_ops st_pmxops = {
        .get_function_name      = st_pmx_get_fname,
        .get_function_groups    = st_pmx_get_groups,
        .enable                 = st_pmx_enable,
-       .disable                = st_pmx_disable,
        .gpio_set_direction     = st_pmx_set_gpio_direction,
 };
 
index 26ca6855f478d3018f79ab8aab87550e1eb52610..71c5d4f0c538ebbb192f963e3c6085b8bd4129cb 100644 (file)
@@ -738,22 +738,6 @@ static int tb10x_pctl_enable(struct pinctrl_dev *pctl,
        return 0;
 }
 
-static void tb10x_pctl_disable(struct pinctrl_dev *pctl,
-                       unsigned func_selector, unsigned group_selector)
-{
-       struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl);
-       const struct tb10x_pinfuncgrp *grp = &state->pingroups[group_selector];
-
-       if (grp->port < 0)
-               return;
-
-       mutex_lock(&state->mutex);
-
-       state->ports[grp->port].count--;
-
-       mutex_unlock(&state->mutex);
-}
-
 static struct pinmux_ops tb10x_pinmux_ops = {
        .get_functions_count = tb10x_get_functions_count,
        .get_function_name = tb10x_get_function_name,
@@ -761,7 +745,6 @@ static struct pinmux_ops tb10x_pinmux_ops = {
        .gpio_request_enable = tb10x_gpio_request_enable,
        .gpio_disable_free = tb10x_gpio_disable_free,
        .enable = tb10x_pctl_enable,
-       .disable = tb10x_pctl_disable,
 };
 
 static struct pinctrl_desc tb10x_pindesc = {
index 2d43bff74f59bd98d33cb61f4d456849b6718f1c..150af5503c093015dd4d425ca81d64780fc3358a 100644 (file)
@@ -290,24 +290,11 @@ static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function,
        return 0;
 }
 
-static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
-                                 unsigned function, unsigned group)
-{
-       struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
-       const struct tegra_pingroup *g;
-
-       g = &pmx->soc->groups[group];
-
-       if (WARN_ON(g->mux_reg < 0))
-               return;
-}
-
 static const struct pinmux_ops tegra_pinmux_ops = {
        .get_functions_count = tegra_pinctrl_get_funcs_count,
        .get_function_name = tegra_pinctrl_get_func_name,
        .get_function_groups = tegra_pinctrl_get_func_groups,
        .enable = tegra_pinctrl_enable,
-       .disable = tegra_pinctrl_disable,
 };
 
 static int tegra_pinconf_reg(struct tegra_pmx *pmx,
index 5bf01c28925ea4e8d0725a43c06a480e0ed0e946..41e81a35cabb07b43a8372210f0bfe6f29be2aa5 100644 (file)
@@ -574,33 +574,6 @@ static int tz1090_pdc_pinctrl_enable(struct pinctrl_dev *pctldev,
        return 0;
 }
 
-static void tz1090_pdc_pinctrl_disable(struct pinctrl_dev *pctldev,
-                                      unsigned int function,
-                                      unsigned int group)
-{
-       struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
-       const struct tz1090_pdc_pingroup *grp = &tz1090_pdc_groups[group];
-
-       dev_dbg(pctldev->dev, "%s(func=%u (%s), group=%u (%s))\n",
-               __func__,
-               function, tz1090_pdc_functions[function].name,
-               group, tz1090_pdc_groups[group].name);
-
-       /* is it even a mux? */
-       if (grp->drv)
-               return;
-
-       /* does this group even control the function? */
-       if (function != grp->func)
-               return;
-
-       /* record the pin being unmuxed and update mux bit */
-       spin_lock(&pmx->lock);
-       pmx->mux_en &= ~BIT(grp->pins[0]);
-       tz1090_pdc_pinctrl_mux(pmx, grp);
-       spin_unlock(&pmx->lock);
-}
-
 static const struct tz1090_pdc_pingroup *find_mux_group(
                                                struct tz1090_pdc_pmx *pmx,
                                                unsigned int pin)
@@ -662,7 +635,6 @@ static struct pinmux_ops tz1090_pdc_pinmux_ops = {
        .get_function_name      = tz1090_pdc_pinctrl_get_func_name,
        .get_function_groups    = tz1090_pdc_pinctrl_get_func_groups,
        .enable                 = tz1090_pdc_pinctrl_enable,
-       .disable                = tz1090_pdc_pinctrl_disable,
        .gpio_request_enable    = tz1090_pdc_pinctrl_gpio_request_enable,
        .gpio_disable_free      = tz1090_pdc_pinctrl_gpio_disable_free,
 };
index bc9cd7a7602ea30d930d099519b8dfbb3590742a..24082216842e5e69379dd575a7e0350ecbeab9d0 100644 (file)
@@ -1478,63 +1478,6 @@ mux_pins:
        return 0;
 }
 
-/**
- * tz1090_pinctrl_disable() - Disable a function on a pin group.
- * @pctldev:           Pin control data
- * @function:          Function index to disable
- * @group:             Group index to disable
- *
- * Disable a particular function on a group of pins. The per GPIO pin pseudo pin
- * groups can be used (in which case the pin will be taken out of peripheral
- * mode. Some convenience pin groups can also be used in which case the effect
- * is the same as enabling the function on each individual pin in the group.
- */
-static void tz1090_pinctrl_disable(struct pinctrl_dev *pctldev,
-                                  unsigned int function, unsigned int group)
-{
-       struct tz1090_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
-       struct tz1090_pingroup *grp;
-       unsigned int pin_num, mux_group, i, npins;
-       const unsigned int *pins;
-
-       /* group of pins? */
-       if (group < ARRAY_SIZE(tz1090_groups)) {
-               grp = &tz1090_groups[group];
-               npins = grp->npins;
-               pins = grp->pins;
-               /*
-                * All pins in the group must belong to the same mux group,
-                * which allows us to just use the mux group of the first pin.
-                * By explicitly listing permitted pingroups for each function
-                * the pinmux core should ensure this is always the case.
-                */
-       } else {
-               pin_num = group - ARRAY_SIZE(tz1090_groups);
-               npins = 1;
-               pins = &pin_num;
-       }
-       mux_group = tz1090_mux_pins[*pins];
-
-       /* no mux group, but can still be individually muxed to peripheral */
-       if (mux_group >= TZ1090_MUX_GROUP_MAX) {
-               if (function == TZ1090_MUX_PERIP)
-                       goto unmux_pins;
-               return;
-       }
-
-       /* mux group already set to a different function? */
-       grp = &tz1090_mux_groups[mux_group];
-       dev_dbg(pctldev->dev, "%s: unmuxing %u pin(s) in '%s' from '%s'\n",
-               __func__, npins, grp->name, tz1090_functions[function].name);
-
-       /* subtract pins from ref count and unmux individually */
-       WARN_ON(grp->func_count < npins);
-       grp->func_count -= npins;
-unmux_pins:
-       for (i = 0; i < npins; ++i)
-               tz1090_pinctrl_perip_select(pmx, pins[i], false);
-}
-
 /**
  * tz1090_pinctrl_gpio_request_enable() - Put pin in GPIO mode.
  * @pctldev:           Pin control data
@@ -1575,7 +1518,6 @@ static struct pinmux_ops tz1090_pinmux_ops = {
        .get_function_name      = tz1090_pinctrl_get_func_name,
        .get_function_groups    = tz1090_pinctrl_get_func_groups,
        .enable                 = tz1090_pinctrl_enable,
-       .disable                = tz1090_pinctrl_disable,
        .gpio_request_enable    = tz1090_pinctrl_gpio_request_enable,
        .gpio_disable_free      = tz1090_pinctrl_gpio_disable_free,
 };
index 209a01b8bd3b84d9cbe2071a8007ef1caf7b3f0f..0959bb36450f79c09b7446e474aeedfac8014536 100644 (file)
@@ -970,19 +970,6 @@ static int u300_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
        return 0;
 }
 
-static void u300_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
-                            unsigned group)
-{
-       struct u300_pmx *upmx;
-
-       /* There is nothing to do with the power pins */
-       if (selector == 0)
-               return;
-
-       upmx = pinctrl_dev_get_drvdata(pctldev);
-       u300_pmx_endisable(upmx, selector, false);
-}
-
 static int u300_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
 {
        return ARRAY_SIZE(u300_pmx_functions);
@@ -1008,7 +995,6 @@ static const struct pinmux_ops u300_pmx_ops = {
        .get_function_name = u300_pmx_get_func_name,
        .get_function_groups = u300_pmx_get_groups,
        .enable = u300_pmx_enable,
-       .disable = u300_pmx_disable,
 };
 
 static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin,
index 051e8592990e9c9824563f8af789af05b1a5fdbf..c055daf9a80f0507e3e1004d648aa0e5131da8d4 100644 (file)
@@ -471,7 +471,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting)
 {
        struct pinctrl_dev *pctldev = setting->pctldev;
        const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
-       const struct pinmux_ops *ops = pctldev->desc->pmxops;
        int ret = 0;
        const unsigned *pins = NULL;
        unsigned num_pins = 0;
@@ -518,9 +517,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting)
                                 pins[i], desc->name, gname);
                }
        }
-
-       if (ops->disable)
-               ops->disable(pctldev, setting->data.mux.func, setting->data.mux.group);
 }
 
 #ifdef CONFIG_DEBUG_FS
index e758af95c209324f91d547877bc2b6a9bc2aab1f..11db3ee39d40eaf824c351b0a354d88c8b21b6c6 100644 (file)
@@ -345,27 +345,6 @@ done:
        return ret;
 }
 
-static void sh_pfc_func_disable(struct pinctrl_dev *pctldev, unsigned selector,
-                               unsigned group)
-{
-       struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
-       struct sh_pfc *pfc = pmx->pfc;
-       const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
-       unsigned long flags;
-       unsigned int i;
-
-       spin_lock_irqsave(&pfc->lock, flags);
-
-       for (i = 0; i < grp->nr_pins; ++i) {
-               int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
-               struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
-
-               cfg->type = PINMUX_TYPE_NONE;
-       }
-
-       spin_unlock_irqrestore(&pfc->lock, flags);
-}
-
 static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
                                      struct pinctrl_gpio_range *range,
                                      unsigned offset)
@@ -464,7 +443,6 @@ static const struct pinmux_ops sh_pfc_pinmux_ops = {
        .get_function_name      = sh_pfc_get_function_name,
        .get_function_groups    = sh_pfc_get_function_groups,
        .enable                 = sh_pfc_func_enable,
-       .disable                = sh_pfc_func_disable,
        .gpio_request_enable    = sh_pfc_gpio_request_enable,
        .gpio_disable_free      = sh_pfc_gpio_disable_free,
        .gpio_set_direction     = sh_pfc_gpio_set_direction,
index 014f5b1fee551f9ba586fe68908049236c97e0c6..4c1d7c68666d0fca2f2691757a2479eeefc50ab1 100644 (file)
@@ -186,15 +186,6 @@ static int sirfsoc_pinmux_enable(struct pinctrl_dev *pmxdev, unsigned selector,
        return 0;
 }
 
-static void sirfsoc_pinmux_disable(struct pinctrl_dev *pmxdev, unsigned selector,
-       unsigned group)
-{
-       struct sirfsoc_pmx *spmx;
-
-       spmx = pinctrl_dev_get_drvdata(pmxdev);
-       sirfsoc_pinmux_endisable(spmx, selector, false);
-}
-
 static int sirfsoc_pinmux_get_funcs_count(struct pinctrl_dev *pmxdev)
 {
        return sirfsoc_pmxfunc_cnt;
@@ -240,7 +231,6 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
 
 static struct pinmux_ops sirfsoc_pinmux_ops = {
        .enable = sirfsoc_pinmux_enable,
-       .disable = sirfsoc_pinmux_disable,
        .get_functions_count = sirfsoc_pinmux_get_funcs_count,
        .get_function_name = sirfsoc_pinmux_get_func_name,
        .get_function_groups = sirfsoc_pinmux_get_groups,
index 58bf6867aa17b69992aa0038111898526c81d11a..f72cc4e192bd34bb5c6c95defe6f1aff88258530 100644 (file)
@@ -274,12 +274,6 @@ static int spear_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function,
        return spear_pinctrl_endisable(pctldev, function, group, true);
 }
 
-static void spear_pinctrl_disable(struct pinctrl_dev *pctldev,
-               unsigned function, unsigned group)
-{
-       spear_pinctrl_endisable(pctldev, function, group, false);
-}
-
 /* gpio with pinmux */
 static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
                unsigned pin)
@@ -345,7 +339,6 @@ static const struct pinmux_ops spear_pinmux_ops = {
        .get_function_name = spear_pinctrl_get_func_name,
        .get_function_groups = spear_pinctrl_get_func_groups,
        .enable = spear_pinctrl_enable,
-       .disable = spear_pinctrl_disable,
        .gpio_request_enable = gpio_request_enable,
        .gpio_disable_free = gpio_disable_free,
 };
index 2c61281bebd7666f6b12e87a7618c47a3a3aae18..8c976c21eeeeccfb0a228d982b0ed25e4c2e5d45 100644 (file)
@@ -141,17 +141,6 @@ static int wmt_pmx_enable(struct pinctrl_dev *pctldev,
        return wmt_set_pinmux(data, func_selector, pinnum);
 }
 
-static void wmt_pmx_disable(struct pinctrl_dev *pctldev,
-                           unsigned func_selector,
-                           unsigned group_selector)
-{
-       struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
-       u32 pinnum = data->pins[group_selector].number;
-
-       /* disable by setting GPIO_IN */
-       wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, pinnum);
-}
-
 static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
                                      struct pinctrl_gpio_range *range,
                                      unsigned offset)
@@ -180,7 +169,6 @@ static struct pinmux_ops wmt_pinmux_ops = {
        .get_function_name = wmt_pmx_get_function_name,
        .get_function_groups = wmt_pmx_get_function_groups,
        .enable = wmt_pmx_enable,
-       .disable = wmt_pmx_disable,
        .gpio_disable_free = wmt_pmx_gpio_disable_free,
        .gpio_set_direction = wmt_pmx_gpio_set_direction,
 };
index c15395031cb30008d03f514ae5128ff550ce09fa..3097aafbeb24599ba3d9ee64946e60601b23ef13 100644 (file)
@@ -70,8 +70,6 @@ struct pinmux_ops {
                                  unsigned * const num_groups);
        int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector,
                       unsigned group_selector);
-       void (*disable) (struct pinctrl_dev *pctldev, unsigned func_selector,
-                        unsigned group_selector);
        int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
                                    struct pinctrl_gpio_range *range,
                                    unsigned offset);