Skip to content

Commit dd26209

Browse files
committed
pinctrl: intel: Fix 2 kOhm bias which is 833 Ohm
2 kOhm bias was never an option in Intel GPIO hardware, the available matrix is: 000 none 001 1 kOhm (if available) 010 5 kOhm 100 20 kOhm As easy to get the 3 resistors are gated separately and according to parallel circuits calculations we may get combinations of the above where the result is always strictly less than minimal resistance. Hence, additional values can be: 011 ~833.3 Ohm 101 ~952.4 Ohm 110 ~4 kOhm 111 ~800 Ohm That said, convert TERM definitions to be the bit masks to reflect the above. While at it, enable the same setting for pull down case. Fixes: 7981c00 ("pinctrl: intel: Add Intel Sunrisepoint pin controller and GPIO support") Cc: Jamie McClymont <jamie@kwiius.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 3650b22 commit dd26209

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262
#define PADCFG1_TERM_UP BIT(13)
6363
#define PADCFG1_TERM_SHIFT 10
6464
#define PADCFG1_TERM_MASK GENMASK(12, 10)
65-
#define PADCFG1_TERM_20K 4
66-
#define PADCFG1_TERM_2K 3
67-
#define PADCFG1_TERM_5K 2
68-
#define PADCFG1_TERM_1K 1
65+
#define PADCFG1_TERM_20K BIT(2)
66+
#define PADCFG1_TERM_5K BIT(1)
67+
#define PADCFG1_TERM_1K BIT(0)
68+
#define PADCFG1_TERM_833 (BIT(1) | BIT(0))
6969

7070
#define PADCFG2 0x008
7171
#define PADCFG2_DEBEN BIT(0)
@@ -549,12 +549,12 @@ static int intel_config_get_pull(struct intel_pinctrl *pctrl, unsigned int pin,
549549
return -EINVAL;
550550

551551
switch (term) {
552+
case PADCFG1_TERM_833:
553+
*arg = 833;
554+
break;
552555
case PADCFG1_TERM_1K:
553556
*arg = 1000;
554557
break;
555-
case PADCFG1_TERM_2K:
556-
*arg = 2000;
557-
break;
558558
case PADCFG1_TERM_5K:
559559
*arg = 5000;
560560
break;
@@ -570,6 +570,11 @@ static int intel_config_get_pull(struct intel_pinctrl *pctrl, unsigned int pin,
570570
return -EINVAL;
571571

572572
switch (term) {
573+
case PADCFG1_TERM_833:
574+
if (!(community->features & PINCTRL_FEATURE_1K_PD))
575+
return -EINVAL;
576+
*arg = 833;
577+
break;
573578
case PADCFG1_TERM_1K:
574579
if (!(community->features & PINCTRL_FEATURE_1K_PD))
575580
return -EINVAL;
@@ -685,12 +690,12 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,
685690
case 5000:
686691
value |= PADCFG1_TERM_5K << PADCFG1_TERM_SHIFT;
687692
break;
688-
case 2000:
689-
value |= PADCFG1_TERM_2K << PADCFG1_TERM_SHIFT;
690-
break;
691693
case 1000:
692694
value |= PADCFG1_TERM_1K << PADCFG1_TERM_SHIFT;
693695
break;
696+
case 833:
697+
value |= PADCFG1_TERM_833 << PADCFG1_TERM_SHIFT;
698+
break;
694699
default:
695700
ret = -EINVAL;
696701
}
@@ -714,6 +719,13 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,
714719
}
715720
value |= PADCFG1_TERM_1K << PADCFG1_TERM_SHIFT;
716721
break;
722+
case 833:
723+
if (!(community->features & PINCTRL_FEATURE_1K_PD)) {
724+
ret = -EINVAL;
725+
break;
726+
}
727+
value |= PADCFG1_TERM_833 << PADCFG1_TERM_SHIFT;
728+
break;
717729
default:
718730
ret = -EINVAL;
719731
}

0 commit comments

Comments
 (0)