Skip to content

Commit 9891422

Browse files
committed
pinctrl: merrifield: 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 5835196 commit 9891422

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/pinctrl/intel/pinctrl-merrifield.c

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

711711
break;
712712

713+
case PIN_CONFIG_DRIVE_PUSH_PULL:
714+
if (value & BUFCFG_OD_EN)
715+
return -EINVAL;
716+
break;
717+
713718
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
714719
if (!(value & BUFCFG_OD_EN))
715720
return -EINVAL;
@@ -791,10 +796,14 @@ static int mrfld_config_set_pin(struct mrfld_pinctrl *mp, unsigned int pin,
791796

792797
break;
793798

799+
case PIN_CONFIG_DRIVE_PUSH_PULL:
800+
mask |= BUFCFG_OD_EN;
801+
bits &= ~BUFCFG_OD_EN;
802+
break;
803+
794804
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
795805
mask |= BUFCFG_OD_EN;
796-
if (arg)
797-
bits |= BUFCFG_OD_EN;
806+
bits |= BUFCFG_OD_EN;
798807
break;
799808

800809
case PIN_CONFIG_SLEW_RATE:
@@ -826,6 +835,7 @@ static int mrfld_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
826835
case PIN_CONFIG_BIAS_DISABLE:
827836
case PIN_CONFIG_BIAS_PULL_UP:
828837
case PIN_CONFIG_BIAS_PULL_DOWN:
838+
case PIN_CONFIG_DRIVE_PUSH_PULL:
829839
case PIN_CONFIG_DRIVE_OPEN_DRAIN:
830840
case PIN_CONFIG_SLEW_RATE:
831841
ret = mrfld_config_set_pin(mp, pin, configs[i]);

0 commit comments

Comments
 (0)