pinctrl: single: fix pcs_disable with bits_per_mux
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 9 Jan 2014 12:50:28 +0000 (14:50 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 15 Jan 2014 07:30:08 +0000 (08:30 +0100)
pcs_enable() uses vals->mask instead of pcs->fmask when bits_per_mux is
enabled. However, pcs_disable() always uses pcs->fmask.

Fix pcs_disable() to use vals->mask with bits_per_mux.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-single.c

index 829b98c5c66fc99da137857847c7048c4e4d1d47..174f4c50cd77b7d63f59672906fa660e20972355 100644 (file)
@@ -525,12 +525,18 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
        for (i = 0; i < func->nvals; i++) {
                struct pcs_func_vals *vals;
                unsigned long flags;
-               unsigned val;
+               unsigned val, mask;
 
                vals = &func->vals[i];
                raw_spin_lock_irqsave(&pcs->lock, flags);
                val = pcs->read(vals->reg);
-               val &= ~pcs->fmask;
+
+               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);