Re: [PATCH 2/2] gpio: axp209: add pinctrl support
From: kbuild test robot
Date: Wed Nov 23 2016 - 12:14:01 EST
Hi Quentin,
[auto build test ERROR on gpio/for-next]
[also build test ERROR on v4.9-rc6 next-20161123]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Quentin-Schulz/add-support-for-AXP209-GPIOs-functions/20161124-003102
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: i386-randconfig-i0-201647 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
>> drivers/gpio/gpio-axp209.c:60:27: error: field 'pin' has incomplete type
struct pinctrl_pin_desc pin;
^
>> drivers/gpio/gpio-axp209.c:95:2: error: field name not in record or union initializer
AXP20X_PIN(AXP20X_PINCTRL_PIN(0, "GPIO0", (void *)AXP20X_GPIO0_CTRL),
^
drivers/gpio/gpio-axp209.c:95:2: error: (near initialization for 'axp209_pins[0].pin')
>> drivers/gpio/gpio-axp209.c:95:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:95:2: error: (near initialization for 'axp209_pins[0].pin')
>> drivers/gpio/gpio-axp209.c:95:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:95:2: error: (near initialization for 'axp209_pins[0].pin')
drivers/gpio/gpio-axp209.c:100:2: error: field name not in record or union initializer
AXP20X_PIN(AXP20X_PINCTRL_PIN(1, "GPIO1", (void *)AXP20X_GPIO1_CTRL),
^
drivers/gpio/gpio-axp209.c:100:2: error: (near initialization for 'axp209_pins[1].pin')
drivers/gpio/gpio-axp209.c:100:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:100:2: error: (near initialization for 'axp209_pins[1].pin')
drivers/gpio/gpio-axp209.c:100:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:100:2: error: (near initialization for 'axp209_pins[1].pin')
drivers/gpio/gpio-axp209.c:105:2: error: field name not in record or union initializer
AXP20X_PIN(AXP20X_PINCTRL_PIN(2, "GPIO2", (void *)AXP20X_GPIO2_CTRL),
^
drivers/gpio/gpio-axp209.c:105:2: error: (near initialization for 'axp209_pins[2].pin')
drivers/gpio/gpio-axp209.c:105:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:105:2: error: (near initialization for 'axp209_pins[2].pin')
drivers/gpio/gpio-axp209.c:105:2: error: field name not in record or union initializer
drivers/gpio/gpio-axp209.c:105:2: error: (near initialization for 'axp209_pins[2].pin')
drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_get_direction':
>> drivers/gpio/gpio-axp209.c:131:49: error: request for member 'drv_data' in something not a structure or union
int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_set':
drivers/gpio/gpio-axp209.c:158:49: error: request for member 'drv_data' in something not a structure or union
int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_input':
>> drivers/gpio/gpio-axp209.c:168:2: error: implicit declaration of function 'pinctrl_gpio_direction_input' [-Werror=implicit-function-declaration]
return pinctrl_gpio_direction_input(chip->base + offset);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_set':
>> drivers/gpio/gpio-axp209.c:182:9: error: implicit declaration of function 'pinctrl_dev_get_drvdata' [-Werror=implicit-function-declaration]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
>> drivers/gpio/gpio-axp209.c:182:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c:183:49: error: request for member 'drv_data' in something not a structure or union
int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_func_cnt':
drivers/gpio/gpio-axp209.c:191:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_func_name':
drivers/gpio/gpio-axp209.c:199:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_func_groups':
drivers/gpio/gpio-axp209.c:209:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pinctrl_desc_find_func_by_name':
>> drivers/gpio/gpio-axp209.c:228:23: error: request for member 'name' in something not a structure or union
if (!strcmp(pin->pin.name, group)) {
^
>> drivers/gpio/gpio-axp209.c:228:3: warning: passing argument 1 of 'strcmp' from incompatible pointer type [enabled by default]
if (!strcmp(pin->pin.name, group)) {
^
In file included from arch/x86/include/asm/string.h:2:0,
from include/linux/string.h:18,
from arch/x86/include/asm/page_32.h:34,
from arch/x86/include/asm/page.h:13,
from arch/x86/include/asm/processor.h:17,
from include/linux/mutex.h:19,
from include/linux/kernfs.h:13,
from include/linux/sysfs.h:15,
from include/linux/kobject.h:21,
from include/linux/device.h:17,
from drivers/gpio/gpio-axp209.c:14:
arch/x86/include/asm/string_32.h:21:12: note: expected 'const char *' but argument is of type 'const struct axp20x_desc_pin *'
extern int strcmp(const char *cs, const char *ct);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_set_mux':
drivers/gpio/gpio-axp209.c:253:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c: In function 'axp20x_pctl_desc_find_func_by_pin':
>> drivers/gpio/gpio-axp209.c:276:15: error: request for member 'number' in something not a structure or union
if (pin->pin.number == offset) {
^
>> drivers/gpio/gpio-axp209.c:276:23: warning: comparison between pointer and integer [enabled by default]
if (pin->pin.number == offset) {
^
drivers/gpio/gpio-axp209.c: At top level:
>> drivers/gpio/gpio-axp209.c:293:7: warning: 'struct pinctrl_gpio_range' declared inside parameter list [enabled by default]
unsigned int offset, bool input)
^
>> drivers/gpio/gpio-axp209.c:293:7: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/gpio/gpio-axp209.c: In function 'axp20x_pmx_gpio_set_direction':
drivers/gpio/gpio-axp209.c:295:29: warning: initialization makes pointer from integer without a cast [enabled by default]
struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
^
drivers/gpio/gpio-axp209.c: At top level:
>> drivers/gpio/gpio-axp209.c:311:21: error: variable 'axp20x_pmx_ops' has initializer but incomplete type
static const struct pinmux_ops axp20x_pmx_ops = {
^
>> drivers/gpio/gpio-axp209.c:312:2: error: unknown field 'get_functions_count' specified in initializer
.get_functions_count = axp20x_pmx_func_cnt,
^
>> drivers/gpio/gpio-axp209.c:312:2: warning: excess elements in struct initializer [enabled by default]
drivers/gpio/gpio-axp209.c:312:2: warning: (near initialization for 'axp20x_pmx_ops') [enabled by default]
>> drivers/gpio/gpio-axp209.c:313:2: error: unknown field 'get_function_name' specified in initializer
.get_function_name = axp20x_pmx_func_name,
^
drivers/gpio/gpio-axp209.c:313:2: warning: excess elements in struct initializer [enabled by default]
drivers/gpio/gpio-axp209.c:313:2: warning: (near initialization for 'axp20x_pmx_ops') [enabled by default]
>> drivers/gpio/gpio-axp209.c:314:2: error: unknown field 'get_function_groups' specified in initializer
.get_function_groups = axp20x_pmx_func_groups,
^
drivers/gpio/gpio-axp209.c:314:2: warning: excess elements in struct initializer [enabled by default]
drivers/gpio/gpio-axp209.c:314:2: warning: (near initialization for 'axp20x_pmx_ops') [enabled by default]
>> drivers/gpio/gpio-axp209.c:315:2: error: unknown field 'set_mux' specified in initializer
.set_mux = axp20x_pmx_set_mux,
^
drivers/gpio/gpio-axp209.c:315:2: warning: excess elements in struct initializer [enabled by default]
drivers/gpio/gpio-axp209.c:315:2: warning: (near initialization for 'axp20x_pmx_ops') [enabled by default]
vim +/pin +60 drivers/gpio/gpio-axp209.c
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13 #include <linux/bitops.h>
> 14 #include <linux/device.h>
15 #include <linux/gpio/driver.h>
16 #include <linux/init.h>
17 #include <linux/interrupt.h>
18 #include <linux/kernel.h>
19 #include <linux/mfd/axp20x.h>
20 #include <linux/module.h>
21 #include <linux/of.h>
22 #include <linux/platform_device.h>
23 #include <linux/regmap.h>
24 #include <linux/slab.h>
25 #include <linux/pinctrl/pinctrl.h>
26 #include <linux/pinctrl/pinmux.h>
27 #include <linux/pinctrl/pinconf-generic.h>
28
29 #define AXP20X_GPIO_FUNCTIONS 0x7
30 #define AXP20X_GPIO_FUNCTION_OUT_LOW 0
31 #define AXP20X_GPIO_FUNCTION_OUT_HIGH 1
32 #define AXP20X_GPIO_FUNCTION_INPUT 2
33
34 #define AXP20X_PINCTRL_PIN(_pin_num, _pin, _regs) \
35 { \
36 .number = _pin_num, \
37 .name = _pin, \
38 .drv_data = _regs, \
39 }
40
41 #define AXP20X_PIN(_pin, ...) \
42 { \
43 .pin = _pin, \
44 .functions = (struct axp20x_desc_function[]) { \
45 __VA_ARGS__, { } }, \
46 }
47
48 #define AXP20X_FUNCTION(_val, _name) \
49 { \
50 .name = _name, \
51 .muxval = _val, \
52 }
53
54 struct axp20x_desc_function {
55 const char *name;
56 u8 muxval;
57 };
58
59 struct axp20x_desc_pin {
> 60 struct pinctrl_pin_desc pin;
61 struct axp20x_desc_function *functions;
62 };
63
64 struct axp20x_pinctrl_desc {
65 const struct axp20x_desc_pin *pins;
66 int npins;
67 unsigned int pin_base;
68 };
69
70 struct axp20x_pinctrl_function {
71 const char *name;
72 const char **groups;
73 unsigned int ngroups;
74 };
75
76 struct axp20x_pinctrl_group {
77 const char *name;
78 unsigned long config;
79 unsigned int pin;
80 };
81
82 struct axp20x_pctl {
83 struct pinctrl_dev *pctl_dev;
84 struct device *dev;
85 struct gpio_chip chip;
86 struct regmap *regmap;
87 const struct axp20x_pinctrl_desc *desc;
88 struct axp20x_pinctrl_group *groups;
89 unsigned int ngroups;
90 struct axp20x_pinctrl_function *functions;
91 unsigned int nfunctions;
92 };
93
94 static const struct axp20x_desc_pin axp209_pins[] = {
> 95 AXP20X_PIN(AXP20X_PINCTRL_PIN(0, "GPIO0", (void *)AXP20X_GPIO0_CTRL),
96 AXP20X_FUNCTION(0x0, "gpio_out"),
97 AXP20X_FUNCTION(0x2, "gpio_in"),
98 AXP20X_FUNCTION(0x3, "ldo"),
99 AXP20X_FUNCTION(0x4, "adc")),
100 AXP20X_PIN(AXP20X_PINCTRL_PIN(1, "GPIO1", (void *)AXP20X_GPIO1_CTRL),
101 AXP20X_FUNCTION(0x0, "gpio_out"),
102 AXP20X_FUNCTION(0x2, "gpio_in"),
103 AXP20X_FUNCTION(0x3, "ldo"),
104 AXP20X_FUNCTION(0x4, "adc")),
> 105 AXP20X_PIN(AXP20X_PINCTRL_PIN(2, "GPIO2", (void *)AXP20X_GPIO2_CTRL),
106 AXP20X_FUNCTION(0x0, "gpio_out"),
107 AXP20X_FUNCTION(0x2, "gpio_in")),
108 };
109
110 static const struct axp20x_pinctrl_desc axp20x_pinctrl_data = {
111 .pins = axp209_pins,
112 .npins = ARRAY_SIZE(axp209_pins),
113 };
114
115 static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
116 {
117 struct axp20x_pctl *pctl = gpiochip_get_data(chip);
118 unsigned int val;
119 int ret;
120
121 ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val);
122 if (ret)
123 return ret;
124
125 return !!(val & BIT(offset + 4));
126 }
127
128 static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
129 {
130 struct axp20x_pctl *pctl = gpiochip_get_data(chip);
> 131 int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
132 unsigned int val;
133 int ret;
134
135 ret = regmap_read(pctl->regmap, pin_reg, &val);
136 if (ret)
137 return ret;
138
139 /*
140 * This shouldn't really happen if the pin is in use already,
141 * or if it's not in use yet, it doesn't matter since we're
142 * going to change the value soon anyway. Default to output.
143 */
144 if ((val & AXP20X_GPIO_FUNCTIONS) > 2)
145 return 0;
146
147 /*
148 * The GPIO directions are the three lowest values.
149 * 2 is input, 0 and 1 are output
150 */
151 return val & 2;
152 }
153
154 static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset,
155 int value)
156 {
157 struct axp20x_pctl *pctl = gpiochip_get_data(chip);
> 158 int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
159
160 regmap_update_bits(pctl->regmap, pin_reg,
161 AXP20X_GPIO_FUNCTIONS,
162 value ? AXP20X_GPIO_FUNCTION_OUT_HIGH
163 : AXP20X_GPIO_FUNCTION_OUT_LOW);
164 }
165
166 static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset)
167 {
> 168 return pinctrl_gpio_direction_input(chip->base + offset);
169 }
170
171 static int axp20x_gpio_output(struct gpio_chip *chip, unsigned int offset,
172 int value)
173 {
174 chip->set(chip, offset, value);
175
176 return 0;
177 }
178
179 static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset,
180 u8 config)
181 {
> 182 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
183 int pin_reg = (int)pctl->desc->pins[offset].pin.drv_data;
184
185 return regmap_update_bits(pctl->regmap, pin_reg, AXP20X_GPIO_FUNCTIONS,
186 config);
187 }
188
189 static int axp20x_pmx_func_cnt(struct pinctrl_dev *pctldev)
190 {
191 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
192
193 return pctl->nfunctions;
194 }
195
196 static const char *axp20x_pmx_func_name(struct pinctrl_dev *pctldev,
197 unsigned int selector)
198 {
> 199 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
200
201 return pctl->functions[selector].name;
202 }
203
204 static int axp20x_pmx_func_groups(struct pinctrl_dev *pctldev,
205 unsigned int selector,
206 const char * const **groups,
207 unsigned int *num_groups)
208 {
> 209 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
210
211 *groups = pctl->functions[selector].groups;
212 *num_groups = pctl->functions[selector].ngroups;
213
214 return 0;
215 }
216
217 static struct axp20x_desc_function *
218 axp20x_pinctrl_desc_find_func_by_name(struct axp20x_pctl *pctl,
219 const char *group, const char *func)
220 {
221 const struct axp20x_desc_pin *pin;
222 struct axp20x_desc_function *desc_func;
223 int i;
224
225 for (i = 0; i < pctl->desc->npins; i++) {
226 pin = &pctl->desc->pins[i];
227
> 228 if (!strcmp(pin->pin.name, group)) {
229 desc_func = pin->functions;
230
231 while (desc_func->name) {
232 if (!strcmp(desc_func->name, func))
233 return desc_func;
234 desc_func++;
235 }
236
237 /*
238 * Pins are uniquely named. Groups are named after one
239 * pin name. If one pin matches group name but its
240 * function cannot be found, no other pin will match
241 * group name.
242 */
243 return NULL;
244 }
245 }
246
247 return NULL;
248 }
249
250 static int axp20x_pmx_set_mux(struct pinctrl_dev *pctldev,
251 unsigned int function, unsigned int group)
252 {
> 253 struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev);
254 struct axp20x_pinctrl_group *g = pctl->groups + group;
255 struct axp20x_pinctrl_function *func = pctl->functions + function;
256 struct axp20x_desc_function *desc_func =
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip