pinctrl-wmt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /*
  2. * Pinctrl driver for the Wondermedia SoC's
  3. *
  4. * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. */
  15. #include <linux/err.h>
  16. #include <linux/gpio.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/io.h>
  19. #include <linux/irq.h>
  20. #include <linux/module.h>
  21. #include <linux/of.h>
  22. #include <linux/of_irq.h>
  23. #include <linux/pinctrl/consumer.h>
  24. #include <linux/pinctrl/machine.h>
  25. #include <linux/pinctrl/pinconf.h>
  26. #include <linux/pinctrl/pinconf-generic.h>
  27. #include <linux/pinctrl/pinctrl.h>
  28. #include <linux/pinctrl/pinmux.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/slab.h>
  31. #include "pinctrl-wmt.h"
  32. static inline void wmt_setbits(struct wmt_pinctrl_data *data, u32 reg,
  33. u32 mask)
  34. {
  35. u32 val;
  36. val = readl_relaxed(data->base + reg);
  37. val |= mask;
  38. writel_relaxed(val, data->base + reg);
  39. }
  40. static inline void wmt_clearbits(struct wmt_pinctrl_data *data, u32 reg,
  41. u32 mask)
  42. {
  43. u32 val;
  44. val = readl_relaxed(data->base + reg);
  45. val &= ~mask;
  46. writel_relaxed(val, data->base + reg);
  47. }
  48. enum wmt_func_sel {
  49. WMT_FSEL_GPIO_IN = 0,
  50. WMT_FSEL_GPIO_OUT = 1,
  51. WMT_FSEL_ALT = 2,
  52. WMT_FSEL_COUNT = 3,
  53. };
  54. static const char * const wmt_functions[WMT_FSEL_COUNT] = {
  55. [WMT_FSEL_GPIO_IN] = "gpio_in",
  56. [WMT_FSEL_GPIO_OUT] = "gpio_out",
  57. [WMT_FSEL_ALT] = "alt",
  58. };
  59. static int wmt_pmx_get_functions_count(struct pinctrl_dev *pctldev)
  60. {
  61. return WMT_FSEL_COUNT;
  62. }
  63. static const char *wmt_pmx_get_function_name(struct pinctrl_dev *pctldev,
  64. unsigned selector)
  65. {
  66. return wmt_functions[selector];
  67. }
  68. static int wmt_pmx_get_function_groups(struct pinctrl_dev *pctldev,
  69. unsigned selector,
  70. const char * const **groups,
  71. unsigned * const num_groups)
  72. {
  73. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  74. /* every pin does every function */
  75. *groups = data->groups;
  76. *num_groups = data->ngroups;
  77. return 0;
  78. }
  79. static int wmt_set_pinmux(struct wmt_pinctrl_data *data, unsigned func,
  80. unsigned pin)
  81. {
  82. u32 bank = WMT_BANK_FROM_PIN(pin);
  83. u32 bit = WMT_BIT_FROM_PIN(pin);
  84. u32 reg_en = data->banks[bank].reg_en;
  85. u32 reg_dir = data->banks[bank].reg_dir;
  86. if (reg_dir == NO_REG) {
  87. dev_err(data->dev, "pin:%d no direction register defined\n",
  88. pin);
  89. return -EINVAL;
  90. }
  91. /*
  92. * If reg_en == NO_REG, we assume it is a dedicated GPIO and cannot be
  93. * disabled (as on VT8500) and that no alternate function is available.
  94. */
  95. switch (func) {
  96. case WMT_FSEL_GPIO_IN:
  97. if (reg_en != NO_REG)
  98. wmt_setbits(data, reg_en, BIT(bit));
  99. wmt_clearbits(data, reg_dir, BIT(bit));
  100. break;
  101. case WMT_FSEL_GPIO_OUT:
  102. if (reg_en != NO_REG)
  103. wmt_setbits(data, reg_en, BIT(bit));
  104. wmt_setbits(data, reg_dir, BIT(bit));
  105. break;
  106. case WMT_FSEL_ALT:
  107. if (reg_en == NO_REG) {
  108. dev_err(data->dev, "pin:%d no alt function available\n",
  109. pin);
  110. return -EINVAL;
  111. }
  112. wmt_clearbits(data, reg_en, BIT(bit));
  113. }
  114. return 0;
  115. }
  116. static int wmt_pmx_enable(struct pinctrl_dev *pctldev,
  117. unsigned func_selector,
  118. unsigned group_selector)
  119. {
  120. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  121. u32 pinnum = data->pins[group_selector].number;
  122. return wmt_set_pinmux(data, func_selector, pinnum);
  123. }
  124. static void wmt_pmx_disable(struct pinctrl_dev *pctldev,
  125. unsigned func_selector,
  126. unsigned group_selector)
  127. {
  128. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  129. u32 pinnum = data->pins[group_selector].number;
  130. /* disable by setting GPIO_IN */
  131. wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, pinnum);
  132. }
  133. static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
  134. struct pinctrl_gpio_range *range,
  135. unsigned offset)
  136. {
  137. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  138. /* disable by setting GPIO_IN */
  139. wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, offset);
  140. }
  141. static int wmt_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
  142. struct pinctrl_gpio_range *range,
  143. unsigned offset,
  144. bool input)
  145. {
  146. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  147. wmt_set_pinmux(data, (input ? WMT_FSEL_GPIO_IN : WMT_FSEL_GPIO_OUT),
  148. offset);
  149. return 0;
  150. }
  151. static struct pinmux_ops wmt_pinmux_ops = {
  152. .get_functions_count = wmt_pmx_get_functions_count,
  153. .get_function_name = wmt_pmx_get_function_name,
  154. .get_function_groups = wmt_pmx_get_function_groups,
  155. .enable = wmt_pmx_enable,
  156. .disable = wmt_pmx_disable,
  157. .gpio_disable_free = wmt_pmx_gpio_disable_free,
  158. .gpio_set_direction = wmt_pmx_gpio_set_direction,
  159. };
  160. static int wmt_get_groups_count(struct pinctrl_dev *pctldev)
  161. {
  162. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  163. return data->ngroups;
  164. }
  165. static const char *wmt_get_group_name(struct pinctrl_dev *pctldev,
  166. unsigned selector)
  167. {
  168. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  169. return data->groups[selector];
  170. }
  171. static int wmt_get_group_pins(struct pinctrl_dev *pctldev,
  172. unsigned selector,
  173. const unsigned **pins,
  174. unsigned *num_pins)
  175. {
  176. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  177. *pins = &data->pins[selector].number;
  178. *num_pins = 1;
  179. return 0;
  180. }
  181. static int wmt_pctl_find_group_by_pin(struct wmt_pinctrl_data *data, u32 pin)
  182. {
  183. int i;
  184. for (i = 0; i < data->npins; i++) {
  185. if (data->pins[i].number == pin)
  186. return i;
  187. }
  188. return -EINVAL;
  189. }
  190. static int wmt_pctl_dt_node_to_map_func(struct wmt_pinctrl_data *data,
  191. struct device_node *np,
  192. u32 pin, u32 fnum,
  193. struct pinctrl_map **maps)
  194. {
  195. int group;
  196. struct pinctrl_map *map = *maps;
  197. if (fnum >= ARRAY_SIZE(wmt_functions)) {
  198. dev_err(data->dev, "invalid wm,function %d\n", fnum);
  199. return -EINVAL;
  200. }
  201. group = wmt_pctl_find_group_by_pin(data, pin);
  202. if (group < 0) {
  203. dev_err(data->dev, "unable to match pin %d to group\n", pin);
  204. return group;
  205. }
  206. map->type = PIN_MAP_TYPE_MUX_GROUP;
  207. map->data.mux.group = data->groups[group];
  208. map->data.mux.function = wmt_functions[fnum];
  209. (*maps)++;
  210. return 0;
  211. }
  212. static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data,
  213. struct device_node *np,
  214. u32 pin, u32 pull,
  215. struct pinctrl_map **maps)
  216. {
  217. int group;
  218. unsigned long *configs;
  219. struct pinctrl_map *map = *maps;
  220. if (pull > 2) {
  221. dev_err(data->dev, "invalid wm,pull %d\n", pull);
  222. return -EINVAL;
  223. }
  224. group = wmt_pctl_find_group_by_pin(data, pin);
  225. if (group < 0) {
  226. dev_err(data->dev, "unable to match pin %d to group\n", pin);
  227. return group;
  228. }
  229. configs = kzalloc(sizeof(*configs), GFP_KERNEL);
  230. if (!configs)
  231. return -ENOMEM;
  232. configs[0] = pull;
  233. map->type = PIN_MAP_TYPE_CONFIGS_PIN;
  234. map->data.configs.group_or_pin = data->groups[group];
  235. map->data.configs.configs = configs;
  236. map->data.configs.num_configs = 1;
  237. (*maps)++;
  238. return 0;
  239. }
  240. static void wmt_pctl_dt_free_map(struct pinctrl_dev *pctldev,
  241. struct pinctrl_map *maps,
  242. unsigned num_maps)
  243. {
  244. int i;
  245. for (i = 0; i < num_maps; i++)
  246. if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
  247. kfree(maps[i].data.configs.configs);
  248. kfree(maps);
  249. }
  250. static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
  251. struct device_node *np,
  252. struct pinctrl_map **map,
  253. unsigned *num_maps)
  254. {
  255. struct pinctrl_map *maps, *cur_map;
  256. struct property *pins, *funcs, *pulls;
  257. u32 pin, func, pull;
  258. int num_pins, num_funcs, num_pulls, maps_per_pin;
  259. int i, err;
  260. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  261. pins = of_find_property(np, "wm,pins", NULL);
  262. if (!pins) {
  263. dev_err(data->dev, "missing wmt,pins property\n");
  264. return -EINVAL;
  265. }
  266. funcs = of_find_property(np, "wm,function", NULL);
  267. pulls = of_find_property(np, "wm,pull", NULL);
  268. if (!funcs && !pulls) {
  269. dev_err(data->dev, "neither wm,function nor wm,pull specified\n");
  270. return -EINVAL;
  271. }
  272. /*
  273. * The following lines calculate how many values are defined for each
  274. * of the properties.
  275. */
  276. num_pins = pins->length / sizeof(u32);
  277. num_funcs = funcs ? (funcs->length / sizeof(u32)) : 0;
  278. num_pulls = pulls ? (pulls->length / sizeof(u32)) : 0;
  279. if (num_funcs > 1 && num_funcs != num_pins) {
  280. dev_err(data->dev, "wm,function must have 1 or %d entries\n",
  281. num_pins);
  282. return -EINVAL;
  283. }
  284. if (num_pulls > 1 && num_pulls != num_pins) {
  285. dev_err(data->dev, "wm,pull must have 1 or %d entries\n",
  286. num_pins);
  287. return -EINVAL;
  288. }
  289. maps_per_pin = 0;
  290. if (num_funcs)
  291. maps_per_pin++;
  292. if (num_pulls)
  293. maps_per_pin++;
  294. cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps),
  295. GFP_KERNEL);
  296. if (!maps)
  297. return -ENOMEM;
  298. for (i = 0; i < num_pins; i++) {
  299. err = of_property_read_u32_index(np, "wm,pins", i, &pin);
  300. if (err)
  301. goto fail;
  302. if (pin >= (data->nbanks * 32)) {
  303. dev_err(data->dev, "invalid wm,pins value\n");
  304. err = -EINVAL;
  305. goto fail;
  306. }
  307. if (num_funcs) {
  308. err = of_property_read_u32_index(np, "wm,function",
  309. (num_funcs > 1 ? i : 0), &func);
  310. if (err)
  311. goto fail;
  312. err = wmt_pctl_dt_node_to_map_func(data, np, pin, func,
  313. &cur_map);
  314. if (err)
  315. goto fail;
  316. }
  317. if (num_pulls) {
  318. err = of_property_read_u32_index(np, "wm,pull",
  319. (num_pulls > 1 ? i : 0), &pull);
  320. if (err)
  321. goto fail;
  322. err = wmt_pctl_dt_node_to_map_pull(data, np, pin, pull,
  323. &cur_map);
  324. if (err)
  325. goto fail;
  326. }
  327. }
  328. *map = maps;
  329. *num_maps = num_pins * maps_per_pin;
  330. return 0;
  331. /*
  332. * The fail path removes any maps that have been allocated. The fail path is
  333. * only called from code after maps has been kzalloc'd. It is also safe to
  334. * pass 'num_pins * maps_per_pin' as the map count even though we probably
  335. * failed before all the mappings were read as all maps are allocated at once,
  336. * and configs are only allocated for .type = PIN_MAP_TYPE_CONFIGS_PIN - there
  337. * is no failpath where a config can be allocated without .type being set.
  338. */
  339. fail:
  340. wmt_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin);
  341. return err;
  342. }
  343. static struct pinctrl_ops wmt_pctl_ops = {
  344. .get_groups_count = wmt_get_groups_count,
  345. .get_group_name = wmt_get_group_name,
  346. .get_group_pins = wmt_get_group_pins,
  347. .dt_node_to_map = wmt_pctl_dt_node_to_map,
  348. .dt_free_map = wmt_pctl_dt_free_map,
  349. };
  350. static int wmt_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
  351. unsigned long *config)
  352. {
  353. return -ENOTSUPP;
  354. }
  355. static int wmt_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
  356. unsigned long *configs, unsigned num_configs)
  357. {
  358. struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
  359. enum pin_config_param param;
  360. u16 arg;
  361. u32 bank = WMT_BANK_FROM_PIN(pin);
  362. u32 bit = WMT_BIT_FROM_PIN(pin);
  363. u32 reg_pull_en = data->banks[bank].reg_pull_en;
  364. u32 reg_pull_cfg = data->banks[bank].reg_pull_cfg;
  365. int i;
  366. if ((reg_pull_en == NO_REG) || (reg_pull_cfg == NO_REG)) {
  367. dev_err(data->dev, "bias functions not supported on pin %d\n",
  368. pin);
  369. return -EINVAL;
  370. }
  371. for (i = 0; i < num_configs; i++) {
  372. param = pinconf_to_config_param(configs[i]);
  373. arg = pinconf_to_config_argument(configs[i]);
  374. if ((param == PIN_CONFIG_BIAS_PULL_DOWN) ||
  375. (param == PIN_CONFIG_BIAS_PULL_UP)) {
  376. if (arg == 0)
  377. param = PIN_CONFIG_BIAS_DISABLE;
  378. }
  379. switch (param) {
  380. case PIN_CONFIG_BIAS_DISABLE:
  381. wmt_clearbits(data, reg_pull_en, BIT(bit));
  382. break;
  383. case PIN_CONFIG_BIAS_PULL_DOWN:
  384. wmt_clearbits(data, reg_pull_cfg, BIT(bit));
  385. wmt_setbits(data, reg_pull_en, BIT(bit));
  386. break;
  387. case PIN_CONFIG_BIAS_PULL_UP:
  388. wmt_setbits(data, reg_pull_cfg, BIT(bit));
  389. wmt_setbits(data, reg_pull_en, BIT(bit));
  390. break;
  391. default:
  392. dev_err(data->dev, "unknown pinconf param\n");
  393. return -EINVAL;
  394. }
  395. } /* for each config */
  396. return 0;
  397. }
  398. static struct pinconf_ops wmt_pinconf_ops = {
  399. .pin_config_get = wmt_pinconf_get,
  400. .pin_config_set = wmt_pinconf_set,
  401. };
  402. static struct pinctrl_desc wmt_desc = {
  403. .owner = THIS_MODULE,
  404. .name = "pinctrl-wmt",
  405. .pctlops = &wmt_pctl_ops,
  406. .pmxops = &wmt_pinmux_ops,
  407. .confops = &wmt_pinconf_ops,
  408. };
  409. static int wmt_gpio_request(struct gpio_chip *chip, unsigned offset)
  410. {
  411. return pinctrl_request_gpio(chip->base + offset);
  412. }
  413. static void wmt_gpio_free(struct gpio_chip *chip, unsigned offset)
  414. {
  415. pinctrl_free_gpio(chip->base + offset);
  416. }
  417. static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
  418. {
  419. struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev);
  420. u32 bank = WMT_BANK_FROM_PIN(offset);
  421. u32 bit = WMT_BIT_FROM_PIN(offset);
  422. u32 reg_dir = data->banks[bank].reg_dir;
  423. u32 val;
  424. val = readl_relaxed(data->base + reg_dir);
  425. if (val & BIT(bit))
  426. return GPIOF_DIR_OUT;
  427. else
  428. return GPIOF_DIR_IN;
  429. }
  430. static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
  431. {
  432. return pinctrl_gpio_direction_input(chip->base + offset);
  433. }
  434. static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
  435. int value)
  436. {
  437. return pinctrl_gpio_direction_output(chip->base + offset);
  438. }
  439. static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset)
  440. {
  441. struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev);
  442. u32 bank = WMT_BANK_FROM_PIN(offset);
  443. u32 bit = WMT_BIT_FROM_PIN(offset);
  444. u32 reg_data_in = data->banks[bank].reg_data_in;
  445. if (reg_data_in == NO_REG) {
  446. dev_err(data->dev, "no data in register defined\n");
  447. return -EINVAL;
  448. }
  449. return !!(readl_relaxed(data->base + reg_data_in) & BIT(bit));
  450. }
  451. static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset,
  452. int val)
  453. {
  454. struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev);
  455. u32 bank = WMT_BANK_FROM_PIN(offset);
  456. u32 bit = WMT_BIT_FROM_PIN(offset);
  457. u32 reg_data_out = data->banks[bank].reg_data_out;
  458. if (reg_data_out == NO_REG) {
  459. dev_err(data->dev, "no data out register defined\n");
  460. return;
  461. }
  462. if (val)
  463. wmt_setbits(data, reg_data_out, BIT(bit));
  464. else
  465. wmt_clearbits(data, reg_data_out, BIT(bit));
  466. }
  467. static struct gpio_chip wmt_gpio_chip = {
  468. .label = "gpio-wmt",
  469. .owner = THIS_MODULE,
  470. .request = wmt_gpio_request,
  471. .free = wmt_gpio_free,
  472. .get_direction = wmt_gpio_get_direction,
  473. .direction_input = wmt_gpio_direction_input,
  474. .direction_output = wmt_gpio_direction_output,
  475. .get = wmt_gpio_get_value,
  476. .set = wmt_gpio_set_value,
  477. .can_sleep = 0,
  478. };
  479. int wmt_pinctrl_probe(struct platform_device *pdev,
  480. struct wmt_pinctrl_data *data)
  481. {
  482. int err;
  483. struct resource *res;
  484. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  485. data->base = devm_ioremap_resource(&pdev->dev, res);
  486. if (IS_ERR(data->base))
  487. return PTR_ERR(data->base);
  488. wmt_desc.pins = data->pins;
  489. wmt_desc.npins = data->npins;
  490. data->gpio_chip = wmt_gpio_chip;
  491. data->gpio_chip.dev = &pdev->dev;
  492. data->gpio_chip.of_node = pdev->dev.of_node;
  493. data->gpio_chip.ngpio = data->nbanks * 32;
  494. platform_set_drvdata(pdev, data);
  495. data->dev = &pdev->dev;
  496. data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data);
  497. if (!data->pctl_dev) {
  498. dev_err(&pdev->dev, "Failed to register pinctrl\n");
  499. return -EINVAL;
  500. }
  501. err = gpiochip_add(&data->gpio_chip);
  502. if (err) {
  503. dev_err(&pdev->dev, "could not add GPIO chip\n");
  504. goto fail_gpio;
  505. }
  506. err = gpiochip_add_pin_range(&data->gpio_chip, dev_name(data->dev),
  507. 0, 0, data->nbanks * 32);
  508. if (err)
  509. goto fail_range;
  510. dev_info(&pdev->dev, "Pin controller initialized\n");
  511. return 0;
  512. fail_range:
  513. if (gpiochip_remove(&data->gpio_chip))
  514. dev_err(&pdev->dev, "failed to remove gpio chip\n");
  515. fail_gpio:
  516. pinctrl_unregister(data->pctl_dev);
  517. return err;
  518. }
  519. int wmt_pinctrl_remove(struct platform_device *pdev)
  520. {
  521. struct wmt_pinctrl_data *data = platform_get_drvdata(pdev);
  522. int err;
  523. err = gpiochip_remove(&data->gpio_chip);
  524. if (err)
  525. dev_err(&pdev->dev, "failed to remove gpio chip\n");
  526. pinctrl_unregister(data->pctl_dev);
  527. return 0;
  528. }