pinctrl: intel: Add default case to intel_config_set_pull()
Subsystems (3)
PATCH 1/4 pinctrl: intel: Add default case to intel_config_set_pull()
For the sake of symmetry with intel_config_get_pull(), add a default case to the outer switch.
--- drivers/pinctrl/intel/pinctrl-intel.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pinctrl/intel/pinctrl-intel.c +4 -0
@@ -758,6 +758,10 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin, }break ; + +default : + ret = -EINVAL ; +break ; }if (!ret)
Signature · 1 line
2.35.1
PATCH 2/4 pinctrl: intel: Deduplicate some code in intel_config_set_pull()
First part is to assign default argument for all cases, since bias disablement doesn't use it anyway.
Second part is to clear all bits in the bias setting and depending on the argument and parameter set them as asked.
While at it, add break statement to the default cases.
--- drivers/pinctrl/intel/pinctrl-intel.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +8 -18
@@ -691,21 +691,14 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,raw_spin_lock_irqsave (&pctrl->lock, flags); value =readl (padcfg1); + value &= ~(PADCFG1_TERM_MASK |PADCFG1_TERM_UP ); -switch (param) { -case PIN_CONFIG_BIAS_DISABLE : - value &= ~(PADCFG1_TERM_MASK |PADCFG1_TERM_UP ); -break ; +/* Set default strength value in case none is given */ +if (arg ==1 ) + arg =5000 ; +switch (param) {case PIN_CONFIG_BIAS_PULL_UP : - value &= ~PADCFG1_TERM_MASK ; - - value |=PADCFG1_TERM_UP ; - -/* Set default strength value in case none is given */ -if (arg ==1 ) - arg =5000 ; -switch (arg) {case 20000 : value |=PADCFG1_TERM_20K <<PADCFG1_TERM_SHIFT ;
@@ -721,17 +714,13 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,break ;default : ret = -EINVAL ; +break ; } + value |=PADCFG1_TERM_UP ;break ;case PIN_CONFIG_BIAS_PULL_DOWN : - value &= ~(PADCFG1_TERM_UP |PADCFG1_TERM_MASK ); - -/* Set default strength value in case none is given */ -if (arg ==1 ) - arg =5000 ; -switch (arg) {case 20000 : value |=PADCFG1_TERM_20K <<PADCFG1_TERM_SHIFT ;
@@ -755,6 +744,7 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,break ;default : ret = -EINVAL ; +break ; }break ;
Signature · 1 line
2.35.1
PATCH 3/4 pinctrl: intel: Add definitions to all possible biases
In reply to Andy ShevchenkoAdd definitions to all possible biases, i.e. add ~800 Ohms, ~952 Ohms, ~4 kOhms.
--- drivers/pinctrl/intel/pinctrl-intel.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/intel/pinctrl-intel.c +3 -0
@@ -81,8 +81,11 @@#define PADCFG1_TERM_MASK GENMASK(12, 10)#define PADCFG1_TERM_20K BIT(2)#define PADCFG1_TERM_5K BIT(1) +#define PADCFG1_TERM_4K (BIT(2) | BIT(1))#define PADCFG1_TERM_1K BIT(0) +#define PADCFG1_TERM_952 (BIT(2) | BIT(0))#define PADCFG1_TERM_833 (BIT(1) | BIT(0)) +#define PADCFG1_TERM_800 (BIT(2) | BIT(1) | BIT(0))#define PADCFG2 0x008#define PADCFG2_DEBEN BIT(0)
Signature · 1 line
2.35.1
PATCH 4/4 pinctrl: intel: Add ~4k bias support
In reply to Andy ShevchenkoAll versions that have 20k and 5k resistance, i.e. all that the driver supports, may support ~4k when the above mentioned are connected in parallel. Add such a support.
--- drivers/pinctrl/intel/pinctrl-intel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pinctrl/intel/pinctrl-intel.c +12 -0
@@ -577,6 +577,9 @@ static int intel_config_get_pull(struct intel_pinctrl *pctrl, unsigned int pin,case PADCFG1_TERM_1K : *arg =1000 ;break ; +case PADCFG1_TERM_4K : + *arg =4000 ; +break ;case PADCFG1_TERM_5K : *arg =5000 ;break ;
@@ -602,6 +605,9 @@ static int intel_config_get_pull(struct intel_pinctrl *pctrl, unsigned int pin,return -EINVAL ; *arg =1000 ;break ; +case PADCFG1_TERM_4K : + *arg =4000 ; +break ;case PADCFG1_TERM_5K : *arg =5000 ;break ;
@@ -709,6 +715,9 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,case 5000 : value |=PADCFG1_TERM_5K <<PADCFG1_TERM_SHIFT ;break ; +case 4000 : + value |=PADCFG1_TERM_4K <<PADCFG1_TERM_SHIFT ; +break ;case 1000 : value |=PADCFG1_TERM_1K <<PADCFG1_TERM_SHIFT ;break ;
@@ -731,6 +740,9 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin,case 5000 : value |=PADCFG1_TERM_5K <<PADCFG1_TERM_SHIFT ;break ; +case 4000 : + value |=PADCFG1_TERM_4K <<PADCFG1_TERM_SHIFT ; +break ;case 1000 :if (!(community->features &PINCTRL_FEATURE_1K_PD )) { ret = -EINVAL ;
Signature · 1 line
2.35.1
Quoted 2 lines · Andy Shevchenko
For the sake of symmetry with
intel_config_get_pull(), add a default case to the outer switch.
The stats for the entire series:
drivers/pinctrl/intel/pinctrl-intel.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
For the sake of symmetry with
intel_config_get_pull(), add a default case to the outer switch.The stats for the entire series:
drivers/pinctrl/intel/pinctrl-intel.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-)
Thanks!
For the series,
Quoted 7 lines · Mika Westerberg
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
For the sake of symmetry with
intel_config_get_pull(), add a default case to the outer switch.The stats for the entire series:
Quoted 8 lines
Quoted 2 lines
drivers/pinctrl/intel/pinctrl-intel.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-)Thanks!
For the series,
Acked-by Mika Westerberg <[email protected]>
Pushed to my review and testing queue, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko