Message ID | 20230605154523.11799-1-andriy.shevchenko@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [v1,1/2] pinctrl: moorefield: Fix open-drain pin mode configuration | expand |
On Mon, Jun 05, 2023 at 06:45:23PM +0300, Andy Shevchenko wrote: > Use explicit comparison to BUFCFG_PINMODE_GPIO instead of implying it. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tue, Jun 06, 2023 at 08:15:47AM +0300, Mika Westerberg kirjoitti: > On Mon, Jun 05, 2023 at 06:45:22PM +0300, Andy Shevchenko wrote: > > Currently the pin may not be configured as open-drain in some > > cases because the argument may be 0 for the boolean types of > > the pin configurations. Fix this by ignoring the argument. > > > > With that, allow to actually restore pin to the push-pull mode. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Thank you! > BTW, looking at the two drivers they seem to have a lot of > commonalities. Perhaps it makes sense to consolidate? Yes, that's the plan, perhaps for the next cycle.
On Tue, Jun 06, 2023 at 08:15:47AM +0300, Mika Westerberg wrote: > On Mon, Jun 05, 2023 at 06:45:22PM +0300, Andy Shevchenko wrote: > > Currently the pin may not be configured as open-drain in some > > cases because the argument may be 0 for the boolean types of > > the pin configurations. Fix this by ignoring the argument. > > > > With that, allow to actually restore pin to the push-pull mode. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Both pushed to my review and testing queue, thanks!
diff --git a/drivers/pinctrl/intel/pinctrl-moorefield.c b/drivers/pinctrl/intel/pinctrl-moorefield.c index 3c9a8484b442..7656a5e20919 100644 --- a/drivers/pinctrl/intel/pinctrl-moorefield.c +++ b/drivers/pinctrl/intel/pinctrl-moorefield.c @@ -661,6 +661,11 @@ static int mofld_config_get(struct pinctrl_dev *pctldev, unsigned int pin, break; + case PIN_CONFIG_DRIVE_PUSH_PULL: + if (value & BUFCFG_OD_EN) + return -EINVAL; + break; + case PIN_CONFIG_DRIVE_OPEN_DRAIN: if (!(value & BUFCFG_OD_EN)) return -EINVAL; @@ -734,10 +739,14 @@ static int mofld_config_set_pin(struct mofld_pinctrl *mp, unsigned int pin, break; + case PIN_CONFIG_DRIVE_PUSH_PULL: + mask |= BUFCFG_OD_EN; + bits &= ~BUFCFG_OD_EN; + break; + case PIN_CONFIG_DRIVE_OPEN_DRAIN: mask |= BUFCFG_OD_EN; - if (arg) - bits |= BUFCFG_OD_EN; + bits |= BUFCFG_OD_EN; break; case PIN_CONFIG_SLEW_RATE: @@ -769,6 +778,7 @@ static int mofld_config_set(struct pinctrl_dev *pctldev, unsigned int pin, case PIN_CONFIG_BIAS_DISABLE: case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_DOWN: + case PIN_CONFIG_DRIVE_PUSH_PULL: case PIN_CONFIG_DRIVE_OPEN_DRAIN: case PIN_CONFIG_SLEW_RATE: ret = mofld_config_set_pin(mp, pin, configs[i]);
Currently the pin may not be configured as open-drain in some cases because the argument may be 0 for the boolean types of the pin configurations. Fix this by ignoring the argument. With that, allow to actually restore pin to the push-pull mode. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pinctrl/intel/pinctrl-moorefield.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)