pinmux.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. /*
  2. * Core driver for the pin muxing portions of the pin control subsystem
  3. *
  4. * Copyright (C) 2011-2012 ST-Ericsson SA
  5. * Written on behalf of Linaro for ST-Ericsson
  6. * Based on bits of regulator core, gpio core and clk core
  7. *
  8. * Author: Linus Walleij <linus.walleij@linaro.org>
  9. *
  10. * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
  11. *
  12. * License terms: GNU General Public License (GPL) version 2
  13. */
  14. #define pr_fmt(fmt) "pinmux core: " fmt
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/init.h>
  18. #include <linux/device.h>
  19. #include <linux/slab.h>
  20. #include <linux/radix-tree.h>
  21. #include <linux/err.h>
  22. #include <linux/list.h>
  23. #include <linux/string.h>
  24. #include <linux/sysfs.h>
  25. #include <linux/debugfs.h>
  26. #include <linux/seq_file.h>
  27. #include <linux/pinctrl/machine.h>
  28. #include <linux/pinctrl/pinmux.h>
  29. #include "core.h"
  30. #include "pinmux.h"
  31. int pinmux_check_ops(struct pinctrl_dev *pctldev)
  32. {
  33. const struct pinmux_ops *ops = pctldev->desc->pmxops;
  34. unsigned nfuncs;
  35. unsigned selector = 0;
  36. /* Check that we implement required operations */
  37. if (!ops ||
  38. !ops->get_functions_count ||
  39. !ops->get_function_name ||
  40. !ops->get_function_groups ||
  41. !ops->set_mux) {
  42. dev_err(pctldev->dev, "pinmux ops lacks necessary functions\n");
  43. return -EINVAL;
  44. }
  45. /* Check that all functions registered have names */
  46. nfuncs = ops->get_functions_count(pctldev);
  47. while (selector < nfuncs) {
  48. const char *fname = ops->get_function_name(pctldev,
  49. selector);
  50. if (!fname) {
  51. dev_err(pctldev->dev, "pinmux ops has no name for function%u\n",
  52. selector);
  53. return -EINVAL;
  54. }
  55. selector++;
  56. }
  57. return 0;
  58. }
  59. int pinmux_validate_map(struct pinctrl_map const *map, int i)
  60. {
  61. if (!map->data.mux.function) {
  62. pr_err("failed to register map %s (%d): no function given\n",
  63. map->name, i);
  64. return -EINVAL;
  65. }
  66. return 0;
  67. }
  68. /**
  69. * pin_request() - request a single pin to be muxed in, typically for GPIO
  70. * @pin: the pin number in the global pin space
  71. * @owner: a representation of the owner of this pin; typically the device
  72. * name that controls its mux function, or the requested GPIO name
  73. * @gpio_range: the range matching the GPIO pin if this is a request for a
  74. * single GPIO pin
  75. */
  76. static int pin_request(struct pinctrl_dev *pctldev,
  77. int pin, const char *owner,
  78. struct pinctrl_gpio_range *gpio_range)
  79. {
  80. struct pin_desc *desc;
  81. const struct pinmux_ops *ops = pctldev->desc->pmxops;
  82. int status = -EINVAL;
  83. desc = pin_desc_get(pctldev, pin);
  84. if (desc == NULL) {
  85. dev_err(pctldev->dev,
  86. "pin %d is not registered so it cannot be requested\n",
  87. pin);
  88. goto out;
  89. }
  90. dev_dbg(pctldev->dev, "request pin %d (%s) for %s\n",
  91. pin, desc->name, owner);
  92. if (gpio_range) {
  93. /* There's no need to support multiple GPIO requests */
  94. if (desc->gpio_owner) {
  95. dev_err(pctldev->dev,
  96. "pin %s already requested by %s; cannot claim for %s\n",
  97. desc->name, desc->gpio_owner, owner);
  98. goto out;
  99. }
  100. if (ops->strict && desc->mux_usecount &&
  101. strcmp(desc->mux_owner, owner)) {
  102. dev_err(pctldev->dev,
  103. "pin %s already requested by %s; cannot claim for %s\n",
  104. desc->name, desc->mux_owner, owner);
  105. goto out;
  106. }
  107. desc->gpio_owner = owner;
  108. } else {
  109. if (desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
  110. dev_err(pctldev->dev,
  111. "pin %s already requested by %s; cannot claim for %s\n",
  112. desc->name, desc->mux_owner, owner);
  113. goto out;
  114. }
  115. if (ops->strict && desc->gpio_owner) {
  116. dev_err(pctldev->dev,
  117. "pin %s already requested by %s; cannot claim for %s\n",
  118. desc->name, desc->gpio_owner, owner);
  119. goto out;
  120. }
  121. desc->mux_usecount++;
  122. if (desc->mux_usecount > 1)
  123. return 0;
  124. desc->mux_owner = owner;
  125. }
  126. /* Let each pin increase references to this module */
  127. if (!try_module_get(pctldev->owner)) {
  128. dev_err(pctldev->dev,
  129. "could not increase module refcount for pin %d\n",
  130. pin);
  131. status = -EINVAL;
  132. goto out_free_pin;
  133. }
  134. /*
  135. * If there is no kind of request function for the pin we just assume
  136. * we got it by default and proceed.
  137. */
  138. if (gpio_range && ops->gpio_request_enable)
  139. /* This requests and enables a single GPIO pin */
  140. status = ops->gpio_request_enable(pctldev, gpio_range, pin);
  141. else if (ops->request)
  142. status = ops->request(pctldev, pin);
  143. else
  144. status = 0;
  145. if (status) {
  146. dev_err(pctldev->dev, "request() failed for pin %d\n", pin);
  147. module_put(pctldev->owner);
  148. }
  149. out_free_pin:
  150. if (status) {
  151. if (gpio_range) {
  152. desc->gpio_owner = NULL;
  153. } else {
  154. desc->mux_usecount--;
  155. if (!desc->mux_usecount)
  156. desc->mux_owner = NULL;
  157. }
  158. }
  159. out:
  160. if (status)
  161. dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
  162. pin, owner, status);
  163. return status;
  164. }
  165. /**
  166. * pin_free() - release a single muxed in pin so something else can be muxed
  167. * @pctldev: pin controller device handling this pin
  168. * @pin: the pin to free
  169. * @gpio_range: the range matching the GPIO pin if this is a request for a
  170. * single GPIO pin
  171. *
  172. * This function returns a pointer to the previous owner. This is used
  173. * for callers that dynamically allocate an owner name so it can be freed
  174. * once the pin is free. This is done for GPIO request functions.
  175. */
  176. static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
  177. struct pinctrl_gpio_range *gpio_range)
  178. {
  179. const struct pinmux_ops *ops = pctldev->desc->pmxops;
  180. struct pin_desc *desc;
  181. const char *owner;
  182. desc = pin_desc_get(pctldev, pin);
  183. if (desc == NULL) {
  184. dev_err(pctldev->dev,
  185. "pin is not registered so it cannot be freed\n");
  186. return NULL;
  187. }
  188. if (!gpio_range) {
  189. /*
  190. * A pin should not be freed more times than allocated.
  191. */
  192. if (WARN_ON(!desc->mux_usecount))
  193. return NULL;
  194. desc->mux_usecount--;
  195. if (desc->mux_usecount)
  196. return NULL;
  197. }
  198. /*
  199. * If there is no kind of request function for the pin we just assume
  200. * we got it by default and proceed.
  201. */
  202. if (gpio_range && ops->gpio_disable_free)
  203. ops->gpio_disable_free(pctldev, gpio_range, pin);
  204. else if (ops->free)
  205. ops->free(pctldev, pin);
  206. if (gpio_range) {
  207. owner = desc->gpio_owner;
  208. desc->gpio_owner = NULL;
  209. } else {
  210. owner = desc->mux_owner;
  211. desc->mux_owner = NULL;
  212. desc->mux_setting = NULL;
  213. }
  214. module_put(pctldev->owner);
  215. return owner;
  216. }
  217. /**
  218. * pinmux_request_gpio() - request pinmuxing for a GPIO pin
  219. * @pctldev: pin controller device affected
  220. * @pin: the pin to mux in for GPIO
  221. * @range: the applicable GPIO range
  222. */
  223. int pinmux_request_gpio(struct pinctrl_dev *pctldev,
  224. struct pinctrl_gpio_range *range,
  225. unsigned pin, unsigned gpio)
  226. {
  227. const char *owner;
  228. int ret;
  229. /* Conjure some name stating what chip and pin this is taken by */
  230. owner = kasprintf(GFP_KERNEL, "%s:%d", range->name, gpio);
  231. if (!owner)
  232. return -ENOMEM;
  233. ret = pin_request(pctldev, pin, owner, range);
  234. if (ret < 0)
  235. kfree(owner);
  236. return ret;
  237. }
  238. /**
  239. * pinmux_free_gpio() - release a pin from GPIO muxing
  240. * @pctldev: the pin controller device for the pin
  241. * @pin: the affected currently GPIO-muxed in pin
  242. * @range: applicable GPIO range
  243. */
  244. void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
  245. struct pinctrl_gpio_range *range)
  246. {
  247. const char *owner;
  248. owner = pin_free(pctldev, pin, range);
  249. kfree(owner);
  250. }
  251. /**
  252. * pinmux_gpio_direction() - set the direction of a single muxed-in GPIO pin
  253. * @pctldev: the pin controller handling this pin
  254. * @range: applicable GPIO range
  255. * @pin: the affected GPIO pin in this controller
  256. * @input: true if we set the pin as input, false for output
  257. */
  258. int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
  259. struct pinctrl_gpio_range *range,
  260. unsigned pin, bool input)
  261. {
  262. const struct pinmux_ops *ops;
  263. int ret;
  264. ops = pctldev->desc->pmxops;
  265. if (ops->gpio_set_direction)
  266. ret = ops->gpio_set_direction(pctldev, range, pin, input);
  267. else
  268. ret = 0;
  269. return ret;
  270. }
  271. static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
  272. const char *function)
  273. {
  274. const struct pinmux_ops *ops = pctldev->desc->pmxops;
  275. unsigned nfuncs = ops->get_functions_count(pctldev);
  276. unsigned selector = 0;
  277. /* See if this pctldev has this function */
  278. while (selector < nfuncs) {
  279. const char *fname = ops->get_function_name(pctldev, selector);
  280. if (!strcmp(function, fname))
  281. return selector;
  282. selector++;
  283. }
  284. dev_err(pctldev->dev, "function '%s' not supported\n", function);
  285. return -EINVAL;
  286. }
  287. int pinmux_map_to_setting(struct pinctrl_map const *map,
  288. struct pinctrl_setting *setting)
  289. {
  290. struct pinctrl_dev *pctldev = setting->pctldev;
  291. const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
  292. char const * const *groups;
  293. unsigned num_groups;
  294. int ret;
  295. const char *group;
  296. if (!pmxops) {
  297. dev_err(pctldev->dev, "does not support mux function\n");
  298. return -EINVAL;
  299. }
  300. ret = pinmux_func_name_to_selector(pctldev, map->data.mux.function);
  301. if (ret < 0) {
  302. dev_err(pctldev->dev, "invalid function %s in map table\n",
  303. map->data.mux.function);
  304. return ret;
  305. }
  306. setting->data.mux.func = ret;
  307. ret = pmxops->get_function_groups(pctldev, setting->data.mux.func,
  308. &groups, &num_groups);
  309. if (ret < 0) {
  310. dev_err(pctldev->dev, "can't query groups for function %s\n",
  311. map->data.mux.function);
  312. return ret;
  313. }
  314. if (!num_groups) {
  315. dev_err(pctldev->dev,
  316. "function %s can't be selected on any group\n",
  317. map->data.mux.function);
  318. return -EINVAL;
  319. }
  320. if (map->data.mux.group) {
  321. group = map->data.mux.group;
  322. ret = match_string(groups, num_groups, group);
  323. if (ret < 0) {
  324. dev_err(pctldev->dev,
  325. "invalid group \"%s\" for function \"%s\"\n",
  326. group, map->data.mux.function);
  327. return ret;
  328. }
  329. } else {
  330. group = groups[0];
  331. }
  332. ret = pinctrl_get_group_selector(pctldev, group);
  333. if (ret < 0) {
  334. dev_err(pctldev->dev, "invalid group %s in map table\n",
  335. map->data.mux.group);
  336. return ret;
  337. }
  338. setting->data.mux.group = ret;
  339. return 0;
  340. }
  341. void pinmux_free_setting(struct pinctrl_setting const *setting)
  342. {
  343. /* This function is currently unused */
  344. }
  345. int pinmux_enable_setting(struct pinctrl_setting const *setting)
  346. {
  347. struct pinctrl_dev *pctldev = setting->pctldev;
  348. const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
  349. const struct pinmux_ops *ops = pctldev->desc->pmxops;
  350. int ret = 0;
  351. const unsigned *pins = NULL;
  352. unsigned num_pins = 0;
  353. int i;
  354. struct pin_desc *desc;
  355. if (pctlops->get_group_pins)
  356. ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
  357. &pins, &num_pins);
  358. if (ret) {
  359. const char *gname;
  360. /* errors only affect debug data, so just warn */
  361. gname = pctlops->get_group_name(pctldev,
  362. setting->data.mux.group);
  363. dev_warn(pctldev->dev,
  364. "could not get pins for group %s\n",
  365. gname);
  366. num_pins = 0;
  367. }
  368. /* Try to allocate all pins in this group, one by one */
  369. for (i = 0; i < num_pins; i++) {
  370. ret = pin_request(pctldev, pins[i], setting->dev_name, NULL);
  371. if (ret) {
  372. const char *gname;
  373. const char *pname;
  374. desc = pin_desc_get(pctldev, pins[i]);
  375. pname = desc ? desc->name : "non-existing";
  376. gname = pctlops->get_group_name(pctldev,
  377. setting->data.mux.group);
  378. dev_err(pctldev->dev,
  379. "could not request pin %d (%s) from group %s "
  380. " on device %s\n",
  381. pins[i], pname, gname,
  382. pinctrl_dev_get_name(pctldev));
  383. goto err_pin_request;
  384. }
  385. }
  386. /* Now that we have acquired the pins, encode the mux setting */
  387. for (i = 0; i < num_pins; i++) {
  388. desc = pin_desc_get(pctldev, pins[i]);
  389. if (desc == NULL) {
  390. dev_warn(pctldev->dev,
  391. "could not get pin desc for pin %d\n",
  392. pins[i]);
  393. continue;
  394. }
  395. desc->mux_setting = &(setting->data.mux);
  396. }
  397. ret = ops->set_mux(pctldev, setting->data.mux.func,
  398. setting->data.mux.group);
  399. if (ret)
  400. goto err_set_mux;
  401. return 0;
  402. err_set_mux:
  403. for (i = 0; i < num_pins; i++) {
  404. desc = pin_desc_get(pctldev, pins[i]);
  405. if (desc)
  406. desc->mux_setting = NULL;
  407. }
  408. err_pin_request:
  409. /* On error release all taken pins */
  410. while (--i >= 0)
  411. pin_free(pctldev, pins[i], NULL);
  412. return ret;
  413. }
  414. void pinmux_disable_setting(struct pinctrl_setting const *setting)
  415. {
  416. struct pinctrl_dev *pctldev = setting->pctldev;
  417. const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
  418. int ret = 0;
  419. const unsigned *pins = NULL;
  420. unsigned num_pins = 0;
  421. int i;
  422. struct pin_desc *desc;
  423. if (pctlops->get_group_pins)
  424. ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
  425. &pins, &num_pins);
  426. if (ret) {
  427. const char *gname;
  428. /* errors only affect debug data, so just warn */
  429. gname = pctlops->get_group_name(pctldev,
  430. setting->data.mux.group);
  431. dev_warn(pctldev->dev,
  432. "could not get pins for group %s\n",
  433. gname);
  434. num_pins = 0;
  435. }
  436. /* Flag the descs that no setting is active */
  437. for (i = 0; i < num_pins; i++) {
  438. desc = pin_desc_get(pctldev, pins[i]);
  439. if (desc == NULL) {
  440. dev_warn(pctldev->dev,
  441. "could not get pin desc for pin %d\n",
  442. pins[i]);
  443. continue;
  444. }
  445. if (desc->mux_setting == &(setting->data.mux)) {
  446. desc->mux_setting = NULL;
  447. /* And release the pin */
  448. pin_free(pctldev, pins[i], NULL);
  449. } else {
  450. const char *gname;
  451. gname = pctlops->get_group_name(pctldev,
  452. setting->data.mux.group);
  453. dev_warn(pctldev->dev,
  454. "not freeing pin %d (%s) as part of "
  455. "deactivating group %s - it is already "
  456. "used for some other setting",
  457. pins[i], desc->name, gname);
  458. }
  459. }
  460. }
  461. #ifdef CONFIG_DEBUG_FS
  462. /* Called from pincontrol core */
  463. static int pinmux_functions_show(struct seq_file *s, void *what)
  464. {
  465. struct pinctrl_dev *pctldev = s->private;
  466. const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
  467. unsigned nfuncs;
  468. unsigned func_selector = 0;
  469. if (!pmxops)
  470. return 0;
  471. mutex_lock(&pctldev->mutex);
  472. nfuncs = pmxops->get_functions_count(pctldev);
  473. while (func_selector < nfuncs) {
  474. const char *func = pmxops->get_function_name(pctldev,
  475. func_selector);
  476. const char * const *groups;
  477. unsigned num_groups;
  478. int ret;
  479. int i;
  480. ret = pmxops->get_function_groups(pctldev, func_selector,
  481. &groups, &num_groups);
  482. if (ret) {
  483. seq_printf(s, "function %s: COULD NOT GET GROUPS\n",
  484. func);
  485. func_selector++;
  486. continue;
  487. }
  488. seq_printf(s, "function: %s, groups = [ ", func);
  489. for (i = 0; i < num_groups; i++)
  490. seq_printf(s, "%s ", groups[i]);
  491. seq_puts(s, "]\n");
  492. func_selector++;
  493. }
  494. mutex_unlock(&pctldev->mutex);
  495. return 0;
  496. }
  497. static int pinmux_pins_show(struct seq_file *s, void *what)
  498. {
  499. struct pinctrl_dev *pctldev = s->private;
  500. const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
  501. const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
  502. unsigned i, pin;
  503. if (!pmxops)
  504. return 0;
  505. seq_puts(s, "Pinmux settings per pin\n");
  506. if (pmxops->strict)
  507. seq_puts(s,
  508. "Format: pin (name): mux_owner|gpio_owner (strict) hog?\n");
  509. else
  510. seq_puts(s,
  511. "Format: pin (name): mux_owner gpio_owner hog?\n");
  512. mutex_lock(&pctldev->mutex);
  513. /* The pin number can be retrived from the pin controller descriptor */
  514. for (i = 0; i < pctldev->desc->npins; i++) {
  515. struct pin_desc *desc;
  516. bool is_hog = false;
  517. pin = pctldev->desc->pins[i].number;
  518. desc = pin_desc_get(pctldev, pin);
  519. /* Skip if we cannot search the pin */
  520. if (desc == NULL)
  521. continue;
  522. if (desc->mux_owner &&
  523. !strcmp(desc->mux_owner, pinctrl_dev_get_name(pctldev)))
  524. is_hog = true;
  525. if (pmxops->strict) {
  526. if (desc->mux_owner)
  527. seq_printf(s, "pin %d (%s): device %s%s",
  528. pin, desc->name, desc->mux_owner,
  529. is_hog ? " (HOG)" : "");
  530. else if (desc->gpio_owner)
  531. seq_printf(s, "pin %d (%s): GPIO %s",
  532. pin, desc->name, desc->gpio_owner);
  533. else
  534. seq_printf(s, "pin %d (%s): UNCLAIMED",
  535. pin, desc->name);
  536. } else {
  537. /* For non-strict controllers */
  538. seq_printf(s, "pin %d (%s): %s %s%s", pin, desc->name,
  539. desc->mux_owner ? desc->mux_owner
  540. : "(MUX UNCLAIMED)",
  541. desc->gpio_owner ? desc->gpio_owner
  542. : "(GPIO UNCLAIMED)",
  543. is_hog ? " (HOG)" : "");
  544. }
  545. /* If mux: print function+group claiming the pin */
  546. if (desc->mux_setting)
  547. seq_printf(s, " function %s group %s\n",
  548. pmxops->get_function_name(pctldev,
  549. desc->mux_setting->func),
  550. pctlops->get_group_name(pctldev,
  551. desc->mux_setting->group));
  552. else
  553. seq_printf(s, "\n");
  554. }
  555. mutex_unlock(&pctldev->mutex);
  556. return 0;
  557. }
  558. void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map)
  559. {
  560. seq_printf(s, "group %s\nfunction %s\n",
  561. map->data.mux.group ? map->data.mux.group : "(default)",
  562. map->data.mux.function);
  563. }
  564. void pinmux_show_setting(struct seq_file *s,
  565. struct pinctrl_setting const *setting)
  566. {
  567. struct pinctrl_dev *pctldev = setting->pctldev;
  568. const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
  569. const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
  570. seq_printf(s, "group: %s (%u) function: %s (%u)\n",
  571. pctlops->get_group_name(pctldev, setting->data.mux.group),
  572. setting->data.mux.group,
  573. pmxops->get_function_name(pctldev, setting->data.mux.func),
  574. setting->data.mux.func);
  575. }
  576. static int pinmux_functions_open(struct inode *inode, struct file *file)
  577. {
  578. return single_open(file, pinmux_functions_show, inode->i_private);
  579. }
  580. static int pinmux_pins_open(struct inode *inode, struct file *file)
  581. {
  582. return single_open(file, pinmux_pins_show, inode->i_private);
  583. }
  584. static const struct file_operations pinmux_functions_ops = {
  585. .open = pinmux_functions_open,
  586. .read = seq_read,
  587. .llseek = seq_lseek,
  588. .release = single_release,
  589. };
  590. static const struct file_operations pinmux_pins_ops = {
  591. .open = pinmux_pins_open,
  592. .read = seq_read,
  593. .llseek = seq_lseek,
  594. .release = single_release,
  595. };
  596. void pinmux_init_device_debugfs(struct dentry *devroot,
  597. struct pinctrl_dev *pctldev)
  598. {
  599. debugfs_create_file("pinmux-functions", S_IFREG | S_IRUGO,
  600. devroot, pctldev, &pinmux_functions_ops);
  601. debugfs_create_file("pinmux-pins", S_IFREG | S_IRUGO,
  602. devroot, pctldev, &pinmux_pins_ops);
  603. }
  604. #endif /* CONFIG_DEBUG_FS */