Skip to content

Commit be5bb8f

Browse files
committed
pinctrl: moorefield: Fix open-drain pin mode configuration
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. Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 29cf9f3 commit be5bb8f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/pinctrl/intel/pinctrl-moorefield.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,11 @@ static int mofld_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
661661

662662
break;
663663

664+
case PIN_CONFIG_DRIVE_PUSH_PULL:
665+
if (value & BUFCFG_OD_EN)
666+
return -EINVAL;
667+
break;
668+
664669
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
665670
if (!(value & BUFCFG_OD_EN))
666671
return -EINVAL;
@@ -734,10 +739,14 @@ static int mofld_config_set_pin(struct mofld_pinctrl *mp, unsigned int pin,
734739

735740
break;
736741

742+
case PIN_CONFIG_DRIVE_PUSH_PULL:
743+
mask |= BUFCFG_OD_EN;
744+
bits &= ~BUFCFG_OD_EN;
745+
break;
746+
737747
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
738748
mask |= BUFCFG_OD_EN;
739-
if (arg)
740-
bits |= BUFCFG_OD_EN;
749+
bits |= BUFCFG_OD_EN;
741750
break;
742751

743752
case PIN_CONFIG_SLEW_RATE:
@@ -769,6 +778,7 @@ static int mofld_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
769778
case PIN_CONFIG_BIAS_DISABLE:
770779
case PIN_CONFIG_BIAS_PULL_UP:
771780
case PIN_CONFIG_BIAS_PULL_DOWN:
781+
case PIN_CONFIG_DRIVE_PUSH_PULL:
772782
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
773783
case PIN_CONFIG_SLEW_RATE:
774784
ret = mofld_config_set_pin(mp, pin, configs[i]);

0 commit comments

Comments
 (0)