diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-01-11 18:45:55 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-14 08:21:38 -0500 |
commit | f684e4ac9f4bae4e6ecff92eef9645a44764fc04 (patch) | |
tree | 77455f29e17d3aa03e65aecdb505a850b4f10ce4 | |
parent | 7382b6231591a76d061d04a420937bbc5e1c1106 (diff) |
pinctrl: pinconf-generic: loose DT dependence
New pin controllers such as ACPI-based may also have custom properties
to parse, and should be able to use generic pin config. Let's make the
code compile on !OF systems and rename members a bit to underscore it
is custom parameters and not necessarily DT parameters.
This fixes a build regression for x86_64 on the zeroday kernel builds.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reviewed-and-tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinconf-generic.c | 39 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-zynq.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 8 | ||||
-rw-r--r-- | include/linux/pinctrl/pinconf-generic.h | 2 | ||||
-rw-r--r-- | include/linux/pinctrl/pinctrl.h | 17 |
5 files changed, 41 insertions, 33 deletions
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index e0886665b70a..4db92f64b4de 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c | |||
@@ -113,10 +113,11 @@ void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev, struct seq_file *s, | |||
113 | pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, | 113 | pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, |
114 | ARRAY_SIZE(conf_items)); | 114 | ARRAY_SIZE(conf_items)); |
115 | /* driver-specific parameters */ | 115 | /* driver-specific parameters */ |
116 | if (pctldev->desc->num_dt_params && pctldev->desc->conf_items) | 116 | if (pctldev->desc->num_custom_params && |
117 | pctldev->desc->custom_conf_items) | ||
117 | pinconf_generic_dump_one(pctldev, s, gname, pin, | 118 | pinconf_generic_dump_one(pctldev, s, gname, pin, |
118 | pctldev->desc->conf_items, | 119 | pctldev->desc->custom_conf_items, |
119 | pctldev->desc->num_dt_params); | 120 | pctldev->desc->num_custom_params); |
120 | } | 121 | } |
121 | 122 | ||
122 | void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, | 123 | void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, |
@@ -131,21 +132,24 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, | |||
131 | pinconf_to_config_argument(config)); | 132 | pinconf_to_config_argument(config)); |
132 | } | 133 | } |
133 | 134 | ||
134 | if (!pctldev->desc->num_dt_params || !pctldev->desc->conf_items) | 135 | if (!pctldev->desc->num_custom_params || |
136 | !pctldev->desc->custom_conf_items) | ||
135 | return; | 137 | return; |
136 | 138 | ||
137 | for (i = 0; i < pctldev->desc->num_dt_params; i++) { | 139 | for (i = 0; i < pctldev->desc->num_custom_params; i++) { |
138 | if (pinconf_to_config_param(config) != pctldev->desc->conf_items[i].param) | 140 | if (pinconf_to_config_param(config) != |
141 | pctldev->desc->custom_conf_items[i].param) | ||
139 | continue; | 142 | continue; |
140 | seq_printf(s, "%s: 0x%x", pctldev->desc->conf_items[i].display, | 143 | seq_printf(s, "%s: 0x%x", |
141 | pinconf_to_config_argument(config)); | 144 | pctldev->desc->custom_conf_items[i].display, |
145 | pinconf_to_config_argument(config)); | ||
142 | } | 146 | } |
143 | } | 147 | } |
144 | EXPORT_SYMBOL_GPL(pinconf_generic_dump_config); | 148 | EXPORT_SYMBOL_GPL(pinconf_generic_dump_config); |
145 | #endif | 149 | #endif |
146 | 150 | ||
147 | #ifdef CONFIG_OF | 151 | #ifdef CONFIG_OF |
148 | static const struct pinconf_generic_dt_params dt_params[] = { | 152 | static const struct pinconf_generic_params dt_params[] = { |
149 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, | 153 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, |
150 | { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 }, | 154 | { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 }, |
151 | { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 }, | 155 | { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 }, |
@@ -170,9 +174,9 @@ static const struct pinconf_generic_dt_params dt_params[] = { | |||
170 | }; | 174 | }; |
171 | 175 | ||
172 | /** | 176 | /** |
173 | * parse_dt_cfg - Parse DT pinconf parameters | 177 | * parse_dt_cfg() - Parse DT pinconf parameters |
174 | * @np: DT node | 178 | * @np: DT node |
175 | * @params: Array of describing DT parameters | 179 | * @params: Array of describing generic parameters |
176 | * @count: Number of entries in @params | 180 | * @count: Number of entries in @params |
177 | * @cfg: Array of parsed config options | 181 | * @cfg: Array of parsed config options |
178 | * @ncfg: Number of entries in @cfg | 182 | * @ncfg: Number of entries in @cfg |
@@ -183,7 +187,7 @@ static const struct pinconf_generic_dt_params dt_params[] = { | |||
183 | * needs to have enough memory allocated to hold all possible entries. | 187 | * needs to have enough memory allocated to hold all possible entries. |
184 | */ | 188 | */ |
185 | static void parse_dt_cfg(struct device_node *np, | 189 | static void parse_dt_cfg(struct device_node *np, |
186 | const struct pinconf_generic_dt_params *params, | 190 | const struct pinconf_generic_params *params, |
187 | unsigned int count, unsigned long *cfg, | 191 | unsigned int count, unsigned long *cfg, |
188 | unsigned int *ncfg) | 192 | unsigned int *ncfg) |
189 | { | 193 | { |
@@ -192,7 +196,7 @@ static void parse_dt_cfg(struct device_node *np, | |||
192 | for (i = 0; i < count; i++) { | 196 | for (i = 0; i < count; i++) { |
193 | u32 val; | 197 | u32 val; |
194 | int ret; | 198 | int ret; |
195 | const struct pinconf_generic_dt_params *par = ¶ms[i]; | 199 | const struct pinconf_generic_params *par = ¶ms[i]; |
196 | 200 | ||
197 | ret = of_property_read_u32(np, par->property, &val); | 201 | ret = of_property_read_u32(np, par->property, &val); |
198 | 202 | ||
@@ -232,15 +236,16 @@ int pinconf_generic_parse_dt_config(struct device_node *np, | |||
232 | /* allocate a temporary array big enough to hold one of each option */ | 236 | /* allocate a temporary array big enough to hold one of each option */ |
233 | max_cfg = ARRAY_SIZE(dt_params); | 237 | max_cfg = ARRAY_SIZE(dt_params); |
234 | if (pctldev) | 238 | if (pctldev) |
235 | max_cfg += pctldev->desc->num_dt_params; | 239 | max_cfg += pctldev->desc->num_custom_params; |
236 | cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); | 240 | cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); |
237 | if (!cfg) | 241 | if (!cfg) |
238 | return -ENOMEM; | 242 | return -ENOMEM; |
239 | 243 | ||
240 | parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); | 244 | parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); |
241 | if (pctldev && pctldev->desc->num_dt_params && pctldev->desc->params) | 245 | if (pctldev && pctldev->desc->num_custom_params && |
242 | parse_dt_cfg(np, pctldev->desc->params, | 246 | pctldev->desc->custom_params) |
243 | pctldev->desc->num_dt_params, cfg, &ncfg); | 247 | parse_dt_cfg(np, pctldev->desc->custom_params, |
248 | pctldev->desc->num_custom_params, cfg, &ncfg); | ||
244 | 249 | ||
245 | ret = 0; | 250 | ret = 0; |
246 | 251 | ||
diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c index 62534234da78..8aa05e2eb705 100644 --- a/drivers/pinctrl/pinctrl-zynq.c +++ b/drivers/pinctrl/pinctrl-zynq.c | |||
@@ -920,7 +920,7 @@ enum zynq_pin_config_param { | |||
920 | PIN_CONFIG_IOSTANDARD = PIN_CONFIG_END + 1, | 920 | PIN_CONFIG_IOSTANDARD = PIN_CONFIG_END + 1, |
921 | }; | 921 | }; |
922 | 922 | ||
923 | static const struct pinconf_generic_dt_params zynq_dt_params[] = { | 923 | static const struct pinconf_generic_params zynq_dt_params[] = { |
924 | {"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18}, | 924 | {"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18}, |
925 | }; | 925 | }; |
926 | 926 | ||
@@ -1099,9 +1099,9 @@ static struct pinctrl_desc zynq_desc = { | |||
1099 | .pctlops = &zynq_pctrl_ops, | 1099 | .pctlops = &zynq_pctrl_ops, |
1100 | .pmxops = &zynq_pinmux_ops, | 1100 | .pmxops = &zynq_pinmux_ops, |
1101 | .confops = &zynq_pinconf_ops, | 1101 | .confops = &zynq_pinconf_ops, |
1102 | .num_dt_params = ARRAY_SIZE(zynq_dt_params), | 1102 | .num_custom_params = ARRAY_SIZE(zynq_dt_params), |
1103 | .params = zynq_dt_params, | 1103 | .custom_params = zynq_dt_params, |
1104 | .conf_items = zynq_conf_items, | 1104 | .custom_conf_items = zynq_conf_items, |
1105 | .owner = THIS_MODULE, | 1105 | .owner = THIS_MODULE, |
1106 | }; | 1106 | }; |
1107 | 1107 | ||
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 17f811c9c2c0..bbf99a715b63 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | |||
@@ -131,7 +131,7 @@ struct pmic_gpio_state { | |||
131 | struct gpio_chip chip; | 131 | struct gpio_chip chip; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static const struct pinconf_generic_dt_params pmic_gpio_bindings[] = { | 134 | static const struct pinconf_generic_params pmic_gpio_bindings[] = { |
135 | {"qcom,pull-up-strength", PMIC_GPIO_CONF_PULL_UP, 0}, | 135 | {"qcom,pull-up-strength", PMIC_GPIO_CONF_PULL_UP, 0}, |
136 | {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0}, | 136 | {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0}, |
137 | }; | 137 | }; |
@@ -742,9 +742,9 @@ static int pmic_gpio_probe(struct platform_device *pdev) | |||
742 | pctrldesc->name = dev_name(dev); | 742 | pctrldesc->name = dev_name(dev); |
743 | pctrldesc->pins = pindesc; | 743 | pctrldesc->pins = pindesc; |
744 | pctrldesc->npins = npins; | 744 | pctrldesc->npins = npins; |
745 | pctrldesc->num_dt_params = ARRAY_SIZE(pmic_gpio_bindings); | 745 | pctrldesc->num_custom_params = ARRAY_SIZE(pmic_gpio_bindings); |
746 | pctrldesc->params = pmic_gpio_bindings; | 746 | pctrldesc->custom_params = pmic_gpio_bindings; |
747 | pctrldesc->conf_items = pmic_conf_items; | 747 | pctrldesc->custom_conf_items = pmic_conf_items; |
748 | 748 | ||
749 | for (i = 0; i < npins; i++, pindesc++) { | 749 | for (i = 0; i < npins; i++, pindesc++) { |
750 | pad = &pads[i]; | 750 | pad = &pads[i]; |
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index 342409f7f3ec..fe65962b264f 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h | |||
@@ -162,7 +162,7 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param | |||
162 | struct pinctrl_dev; | 162 | struct pinctrl_dev; |
163 | struct pinctrl_map; | 163 | struct pinctrl_map; |
164 | 164 | ||
165 | struct pinconf_generic_dt_params { | 165 | struct pinconf_generic_params { |
166 | const char * const property; | 166 | const char * const property; |
167 | enum pin_config_param param; | 167 | enum pin_config_param param; |
168 | u32 default_value; | 168 | u32 default_value; |
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index c58b3e11ba8e..66e4697516de 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -118,9 +118,12 @@ struct pinctrl_ops { | |||
118 | * @confops: pin config operations vtable, if you support pin configuration in | 118 | * @confops: pin config operations vtable, if you support pin configuration in |
119 | * your driver | 119 | * your driver |
120 | * @owner: module providing the pin controller, used for refcounting | 120 | * @owner: module providing the pin controller, used for refcounting |
121 | * @num_dt_params: Number of driver-specific DT parameters | 121 | * @num_custom_params: Number of driver-specific custom parameters to be parsed |
122 | * @params: List of DT parameters | 122 | * from the hardware description |
123 | * @conf_items: Information how to print @params in debugfs | 123 | * @custom_params: List of driver_specific custom parameters to be parsed from |
124 | * the hardware description | ||
125 | * @custom_conf_items: Information how to print @params in debugfs, must be | ||
126 | * the same size as the @custom_params, i.e. @num_custom_params | ||
124 | */ | 127 | */ |
125 | struct pinctrl_desc { | 128 | struct pinctrl_desc { |
126 | const char *name; | 129 | const char *name; |
@@ -130,10 +133,10 @@ struct pinctrl_desc { | |||
130 | const struct pinmux_ops *pmxops; | 133 | const struct pinmux_ops *pmxops; |
131 | const struct pinconf_ops *confops; | 134 | const struct pinconf_ops *confops; |
132 | struct module *owner; | 135 | struct module *owner; |
133 | #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF) | 136 | #ifdef CONFIG_GENERIC_PINCONF |
134 | unsigned int num_dt_params; | 137 | unsigned int num_custom_params; |
135 | const struct pinconf_generic_dt_params *params; | 138 | const struct pinconf_generic_params *custom_params; |
136 | const struct pin_config_item *conf_items; | 139 | const struct pin_config_item *custom_conf_items; |
137 | #endif | 140 | #endif |
138 | }; | 141 | }; |
139 | 142 | ||