@@ -1041,98 +1041,115 @@ static int abx500_pin_config_get(struct pinctrl_dev *pctldev,
10411041
10421042static int abx500_pin_config_set (struct pinctrl_dev * pctldev ,
10431043 unsigned pin ,
1044- unsigned long config )
1044+ unsigned long * configs ,
1045+ unsigned num_configs )
10451046{
10461047 struct abx500_pinctrl * pct = pinctrl_dev_get_drvdata (pctldev );
10471048 struct gpio_chip * chip = & pct -> chip ;
10481049 unsigned offset ;
10491050 int ret = - EINVAL ;
1050- enum pin_config_param param = pinconf_to_config_param (config );
1051- enum pin_config_param argument = pinconf_to_config_argument (config );
1052-
1053- dev_dbg (chip -> dev , "pin %d [%#lx]: %s %s\n" ,
1054- pin , config , (param == PIN_CONFIG_OUTPUT ) ? "output " : "input" ,
1055- (param == PIN_CONFIG_OUTPUT ) ? (argument ? "high" : "low" ) :
1056- (argument ? "pull up" : "pull down" ));
1057-
1058- /* on ABx500, there is no GPIO0, so adjust the offset */
1059- offset = pin - 1 ;
1060-
1061- switch (param ) {
1062- case PIN_CONFIG_BIAS_DISABLE :
1063- ret = abx500_gpio_direction_input (chip , offset );
1064- if (ret < 0 )
1065- goto out ;
1066- /*
1067- * Some chips only support pull down, while some actually
1068- * support both pull up and pull down. Such chips have
1069- * a "pullud" range specified for the pins that support
1070- * both features. If the pin is not within that range, we
1071- * fall back to the old bit set that only support pull down.
1072- */
1073- if (abx500_pullud_supported (chip , pin ))
1074- ret = abx500_set_pull_updown (pct ,
1075- pin ,
1076- ABX500_GPIO_PULL_NONE );
1077- else
1078- /* Chip only supports pull down */
1079- ret = abx500_gpio_set_bits (chip , AB8500_GPIO_PUD1_REG ,
1080- offset , ABX500_GPIO_PULL_NONE );
1081- break ;
1082-
1083- case PIN_CONFIG_BIAS_PULL_DOWN :
1084- ret = abx500_gpio_direction_input (chip , offset );
1085- if (ret < 0 )
1086- goto out ;
1087- /*
1088- * if argument = 1 set the pull down
1089- * else clear the pull down
1090- * Some chips only support pull down, while some actually
1091- * support both pull up and pull down. Such chips have
1092- * a "pullud" range specified for the pins that support
1093- * both features. If the pin is not within that range, we
1094- * fall back to the old bit set that only support pull down.
1095- */
1096- if (abx500_pullud_supported (chip , pin ))
1097- ret = abx500_set_pull_updown (pct ,
1098- pin ,
1099- argument ? ABX500_GPIO_PULL_DOWN : ABX500_GPIO_PULL_NONE );
1100- else
1101- /* Chip only supports pull down */
1102- ret = abx500_gpio_set_bits (chip , AB8500_GPIO_PUD1_REG ,
1103- offset ,
1104- argument ? ABX500_GPIO_PULL_DOWN : ABX500_GPIO_PULL_NONE );
1105- break ;
1106-
1107- case PIN_CONFIG_BIAS_PULL_UP :
1108- ret = abx500_gpio_direction_input (chip , offset );
1109- if (ret < 0 )
1110- goto out ;
1111- /*
1112- * if argument = 1 set the pull up
1113- * else clear the pull up
1114- */
1115- ret = abx500_gpio_direction_input (chip , offset );
1116- /*
1117- * Some chips only support pull down, while some actually
1118- * support both pull up and pull down. Such chips have
1119- * a "pullud" range specified for the pins that support
1120- * both features. If the pin is not within that range, do
1121- * nothing
1122- */
1123- if (abx500_pullud_supported (chip , pin ))
1124- ret = abx500_set_pull_updown (pct ,
1125- pin ,
1126- argument ? ABX500_GPIO_PULL_UP : ABX500_GPIO_PULL_NONE );
1127- break ;
1051+ int i ;
1052+ enum pin_config_param param ;
1053+ enum pin_config_param argument ;
1054+
1055+ for (i = 0 ; i < num_configs ; i ++ ) {
1056+ param = pinconf_to_config_param (configs [i ]);
1057+ argument = pinconf_to_config_argument (configs [i ]);
1058+
1059+ dev_dbg (chip -> dev , "pin %d [%#lx]: %s %s\n" ,
1060+ pin , configs [i ],
1061+ (param == PIN_CONFIG_OUTPUT ) ? "output " : "input" ,
1062+ (param == PIN_CONFIG_OUTPUT ) ?
1063+ (argument ? "high" : "low" ) :
1064+ (argument ? "pull up" : "pull down" ));
1065+
1066+ /* on ABx500, there is no GPIO0, so adjust the offset */
1067+ offset = pin - 1 ;
1068+
1069+ switch (param ) {
1070+ case PIN_CONFIG_BIAS_DISABLE :
1071+ ret = abx500_gpio_direction_input (chip , offset );
1072+ if (ret < 0 )
1073+ goto out ;
1074+ /*
1075+ * Some chips only support pull down, while some
1076+ * actually support both pull up and pull down. Such
1077+ * chips have a "pullud" range specified for the pins
1078+ * that support both features. If the pin is not
1079+ * within that range, we fall back to the old bit set
1080+ * that only support pull down.
1081+ */
1082+ if (abx500_pullud_supported (chip , pin ))
1083+ ret = abx500_set_pull_updown (pct ,
1084+ pin ,
1085+ ABX500_GPIO_PULL_NONE );
1086+ else
1087+ /* Chip only supports pull down */
1088+ ret = abx500_gpio_set_bits (chip ,
1089+ AB8500_GPIO_PUD1_REG , offset ,
1090+ ABX500_GPIO_PULL_NONE );
1091+ break ;
11281092
1129- case PIN_CONFIG_OUTPUT :
1130- ret = abx500_gpio_direction_output (chip , offset , argument );
1131- break ;
1093+ case PIN_CONFIG_BIAS_PULL_DOWN :
1094+ ret = abx500_gpio_direction_input (chip , offset );
1095+ if (ret < 0 )
1096+ goto out ;
1097+ /*
1098+ * if argument = 1 set the pull down
1099+ * else clear the pull down
1100+ * Some chips only support pull down, while some
1101+ * actually support both pull up and pull down. Such
1102+ * chips have a "pullud" range specified for the pins
1103+ * that support both features. If the pin is not
1104+ * within that range, we fall back to the old bit set
1105+ * that only support pull down.
1106+ */
1107+ if (abx500_pullud_supported (chip , pin ))
1108+ ret = abx500_set_pull_updown (pct ,
1109+ pin ,
1110+ argument ? ABX500_GPIO_PULL_DOWN :
1111+ ABX500_GPIO_PULL_NONE );
1112+ else
1113+ /* Chip only supports pull down */
1114+ ret = abx500_gpio_set_bits (chip ,
1115+ AB8500_GPIO_PUD1_REG ,
1116+ offset ,
1117+ argument ? ABX500_GPIO_PULL_DOWN :
1118+ ABX500_GPIO_PULL_NONE );
1119+ break ;
11321120
1133- default :
1134- dev_err (chip -> dev , "illegal configuration requested\n" );
1135- }
1121+ case PIN_CONFIG_BIAS_PULL_UP :
1122+ ret = abx500_gpio_direction_input (chip , offset );
1123+ if (ret < 0 )
1124+ goto out ;
1125+ /*
1126+ * if argument = 1 set the pull up
1127+ * else clear the pull up
1128+ */
1129+ ret = abx500_gpio_direction_input (chip , offset );
1130+ /*
1131+ * Some chips only support pull down, while some
1132+ * actually support both pull up and pull down. Such
1133+ * chips have a "pullud" range specified for the pins
1134+ * that support both features. If the pin is not
1135+ * within that range, do nothing
1136+ */
1137+ if (abx500_pullud_supported (chip , pin ))
1138+ ret = abx500_set_pull_updown (pct ,
1139+ pin ,
1140+ argument ? ABX500_GPIO_PULL_UP :
1141+ ABX500_GPIO_PULL_NONE );
1142+ break ;
1143+
1144+ case PIN_CONFIG_OUTPUT :
1145+ ret = abx500_gpio_direction_output (chip , offset ,
1146+ argument );
1147+ break ;
1148+
1149+ default :
1150+ dev_err (chip -> dev , "illegal configuration requested\n" );
1151+ }
1152+ } /* for each config */
11361153out :
11371154 if (ret < 0 )
11381155 dev_err (pct -> dev , "%s failed (%d)\n" , __func__ , ret );
0 commit comments