virtio_regulator.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #define pr_fmt(fmt) "%s: " fmt, __func__
  6. #include <linux/spinlock.h>
  7. #include <linux/slab.h>
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <linux/interrupt.h>
  11. #include <linux/virtio.h>
  12. #include <linux/virtio_regulator.h>
  13. #include <linux/scatterlist.h>
  14. #include <linux/delay.h>
  15. #include <linux/completion.h>
  16. #include <linux/mutex.h>
  17. #include <linux/of.h>
  18. #include <linux/regulator/driver.h>
  19. #include <linux/regulator/machine.h>
  20. #include <linux/regulator/of_regulator.h>
  21. #include <linux/regulator/debug-regulator.h>
  22. #define VIRTIO_REGULATOR_MAX_NAME 20
  23. #define VIRTIO_REGULATOR_VOLTAGE_UNKNOWN 1
  24. struct reg_virtio;
  25. struct virtio_regulator {
  26. struct virtio_device *vdev;
  27. struct virtqueue *vq;
  28. struct completion rsp_avail;
  29. struct mutex lock;
  30. struct reg_virtio *regs;
  31. int regs_count;
  32. };
  33. struct reg_virtio {
  34. struct device_node *of_node;
  35. struct regulator_desc rdesc;
  36. struct regulator_dev *rdev;
  37. struct virtio_regulator *vreg;
  38. char name[VIRTIO_REGULATOR_MAX_NAME];
  39. bool enabled;
  40. };
  41. static int virtio_regulator_enable(struct regulator_dev *rdev)
  42. {
  43. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  44. struct virtio_regulator *vreg = reg->vreg;
  45. struct virtio_regulator_msg *req, *rsp;
  46. struct scatterlist sg[1];
  47. unsigned int len;
  48. int ret = 0;
  49. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  50. if (!req)
  51. return -ENOMEM;
  52. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  53. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_ENABLE);
  54. sg_init_one(sg, req, sizeof(*req));
  55. mutex_lock(&vreg->lock);
  56. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  57. if (ret) {
  58. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  59. goto out;
  60. }
  61. virtqueue_kick(vreg->vq);
  62. wait_for_completion(&vreg->rsp_avail);
  63. rsp = virtqueue_get_buf(vreg->vq, &len);
  64. if (!rsp) {
  65. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  66. ret = -EIO;
  67. goto out;
  68. }
  69. ret = virtio32_to_cpu(vreg->vdev, rsp->result);
  70. if (!ret)
  71. reg->enabled = true;
  72. out:
  73. mutex_unlock(&vreg->lock);
  74. kfree(req);
  75. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  76. return ret;
  77. }
  78. static int virtio_regulator_disable(struct regulator_dev *rdev)
  79. {
  80. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  81. struct virtio_regulator *vreg = reg->vreg;
  82. struct virtio_regulator_msg *req, *rsp;
  83. struct scatterlist sg[1];
  84. unsigned int len;
  85. int ret = 0;
  86. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  87. if (!req)
  88. return -ENOMEM;
  89. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  90. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_DISABLE);
  91. sg_init_one(sg, req, sizeof(*req));
  92. mutex_lock(&vreg->lock);
  93. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  94. if (ret) {
  95. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  96. goto out;
  97. }
  98. virtqueue_kick(vreg->vq);
  99. wait_for_completion(&vreg->rsp_avail);
  100. rsp = virtqueue_get_buf(vreg->vq, &len);
  101. if (!rsp) {
  102. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  103. ret = -EIO;
  104. goto out;
  105. }
  106. ret = virtio32_to_cpu(vreg->vdev, rsp->result);
  107. if (!ret)
  108. reg->enabled = false;
  109. out:
  110. mutex_unlock(&vreg->lock);
  111. kfree(req);
  112. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  113. return ret;
  114. }
  115. static int virtio_regulator_is_enabled(struct regulator_dev *rdev)
  116. {
  117. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  118. pr_debug("%s return %d\n", reg->rdesc.name, reg->enabled);
  119. return reg->enabled;
  120. }
  121. static int virtio_regulator_set_voltage(struct regulator_dev *rdev, int min_uV,
  122. int max_uV, unsigned int *selector)
  123. {
  124. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  125. struct virtio_regulator *vreg = reg->vreg;
  126. struct virtio_regulator_msg *req, *rsp;
  127. struct scatterlist sg[1];
  128. unsigned int len;
  129. int ret = 0;
  130. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  131. if (!req)
  132. return -ENOMEM;
  133. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  134. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_SET_VOLTAGE);
  135. req->data[0] = cpu_to_virtio32(vreg->vdev, DIV_ROUND_UP(min_uV, 1000));
  136. req->data[1] = cpu_to_virtio32(vreg->vdev, max_uV / 1000);
  137. sg_init_one(sg, req, sizeof(*req));
  138. mutex_lock(&vreg->lock);
  139. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  140. if (ret) {
  141. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  142. goto out;
  143. }
  144. virtqueue_kick(vreg->vq);
  145. wait_for_completion(&vreg->rsp_avail);
  146. rsp = virtqueue_get_buf(vreg->vq, &len);
  147. if (!rsp) {
  148. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  149. ret = -EIO;
  150. goto out;
  151. }
  152. ret = virtio32_to_cpu(vreg->vdev, rsp->result);
  153. out:
  154. mutex_unlock(&vreg->lock);
  155. kfree(req);
  156. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  157. return ret;
  158. }
  159. static int virtio_regulator_get_voltage(struct regulator_dev *rdev)
  160. {
  161. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  162. struct virtio_regulator *vreg = reg->vreg;
  163. struct virtio_regulator_msg *req, *rsp;
  164. struct scatterlist sg[1];
  165. unsigned int len;
  166. int ret = 0;
  167. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  168. if (!req)
  169. return -ENOMEM;
  170. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  171. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_GET_VOLTAGE);
  172. sg_init_one(sg, req, sizeof(*req));
  173. mutex_lock(&vreg->lock);
  174. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  175. if (ret) {
  176. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  177. goto out;
  178. }
  179. virtqueue_kick(vreg->vq);
  180. wait_for_completion(&vreg->rsp_avail);
  181. rsp = virtqueue_get_buf(vreg->vq, &len);
  182. if (!rsp) {
  183. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  184. ret = -EIO;
  185. goto out;
  186. }
  187. if (rsp->result) {
  188. pr_debug("%s: error response (%d)\n", reg->rdesc.name,
  189. virtio32_to_cpu(vreg->vdev, rsp->result));
  190. ret = VIRTIO_REGULATOR_VOLTAGE_UNKNOWN;
  191. } else
  192. ret = virtio32_to_cpu(vreg->vdev, rsp->data[0]) * 1000;
  193. out:
  194. mutex_unlock(&vreg->lock);
  195. kfree(req);
  196. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  197. return ret;
  198. }
  199. static int virtio_regulator_set_mode(struct regulator_dev *rdev,
  200. unsigned int mode)
  201. {
  202. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  203. struct virtio_regulator *vreg = reg->vreg;
  204. struct virtio_regulator_msg *req, *rsp;
  205. struct scatterlist sg[1];
  206. unsigned int len;
  207. int ret = 0;
  208. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  209. if (!req)
  210. return -ENOMEM;
  211. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  212. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_SET_MODE);
  213. req->data[0] = cpu_to_virtio32(vreg->vdev, mode);
  214. sg_init_one(sg, req, sizeof(*req));
  215. mutex_lock(&vreg->lock);
  216. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  217. if (ret) {
  218. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  219. goto out;
  220. }
  221. virtqueue_kick(vreg->vq);
  222. wait_for_completion(&vreg->rsp_avail);
  223. rsp = virtqueue_get_buf(vreg->vq, &len);
  224. if (!rsp) {
  225. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  226. ret = -EIO;
  227. goto out;
  228. }
  229. ret = virtio32_to_cpu(vreg->vdev, rsp->result);
  230. out:
  231. mutex_unlock(&vreg->lock);
  232. kfree(req);
  233. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  234. return ret;
  235. }
  236. static unsigned int virtio_regulator_get_mode(struct regulator_dev *rdev)
  237. {
  238. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  239. struct virtio_regulator *vreg = reg->vreg;
  240. struct virtio_regulator_msg *req, *rsp;
  241. struct scatterlist sg[1];
  242. unsigned int len;
  243. int ret = 0;
  244. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  245. if (!req)
  246. return -ENOMEM;
  247. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  248. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_GET_MODE);
  249. sg_init_one(sg, req, sizeof(*req));
  250. mutex_lock(&vreg->lock);
  251. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  252. if (ret) {
  253. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  254. goto out;
  255. }
  256. virtqueue_kick(vreg->vq);
  257. wait_for_completion(&vreg->rsp_avail);
  258. rsp = virtqueue_get_buf(vreg->vq, &len);
  259. if (!rsp) {
  260. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  261. ret = -EIO;
  262. goto out;
  263. }
  264. if (rsp->result) {
  265. pr_err("%s: error response (%d)\n", reg->rdesc.name,
  266. virtio32_to_cpu(vreg->vdev, rsp->result));
  267. ret = 0;
  268. } else
  269. ret = virtio32_to_cpu(vreg->vdev, rsp->data[0]);
  270. out:
  271. mutex_unlock(&vreg->lock);
  272. kfree(req);
  273. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  274. return ret;
  275. }
  276. static int virtio_regulator_set_load(struct regulator_dev *rdev, int load_ua)
  277. {
  278. struct reg_virtio *reg = rdev_get_drvdata(rdev);
  279. struct virtio_regulator *vreg = reg->vreg;
  280. struct virtio_regulator_msg *req, *rsp;
  281. struct scatterlist sg[1];
  282. unsigned int len;
  283. int ret = 0;
  284. req = kzalloc(sizeof(struct virtio_regulator_msg), GFP_KERNEL);
  285. if (!req)
  286. return -ENOMEM;
  287. strscpy(req->name, reg->rdesc.name, sizeof(req->name));
  288. req->type = cpu_to_virtio32(vreg->vdev, VIRTIO_REGULATOR_T_SET_LOAD);
  289. req->data[0] = cpu_to_virtio32(vreg->vdev, load_ua);
  290. sg_init_one(sg, req, sizeof(*req));
  291. mutex_lock(&vreg->lock);
  292. ret = virtqueue_add_outbuf(vreg->vq, sg, 1, req, GFP_KERNEL);
  293. if (ret) {
  294. pr_err("%s: fail to add output buffer\n", reg->rdesc.name);
  295. goto out;
  296. }
  297. virtqueue_kick(vreg->vq);
  298. wait_for_completion(&vreg->rsp_avail);
  299. rsp = virtqueue_get_buf(vreg->vq, &len);
  300. if (!rsp) {
  301. pr_err("%s: fail to get virtqueue buffer\n", reg->rdesc.name);
  302. ret = -EIO;
  303. goto out;
  304. }
  305. ret = virtio32_to_cpu(vreg->vdev, rsp->result);
  306. out:
  307. mutex_unlock(&vreg->lock);
  308. kfree(req);
  309. pr_debug("%s return %d\n", reg->rdesc.name, ret);
  310. return ret;
  311. }
  312. static const struct regulator_ops virtio_regulator_ops = {
  313. .enable = virtio_regulator_enable,
  314. .disable = virtio_regulator_disable,
  315. .is_enabled = virtio_regulator_is_enabled,
  316. .set_voltage = virtio_regulator_set_voltage,
  317. .get_voltage = virtio_regulator_get_voltage,
  318. .set_mode = virtio_regulator_set_mode,
  319. .get_mode = virtio_regulator_get_mode,
  320. .set_load = virtio_regulator_set_load,
  321. };
  322. static const struct regulator_ops virtio_regulator_switch_ops = {
  323. .enable = virtio_regulator_enable,
  324. .disable = virtio_regulator_disable,
  325. .is_enabled = virtio_regulator_is_enabled,
  326. };
  327. static void virtio_regulator_isr(struct virtqueue *vq)
  328. {
  329. struct virtio_regulator *vregulator = vq->vdev->priv;
  330. complete(&vregulator->rsp_avail);
  331. }
  332. static int virtio_regulator_init_vqs(struct virtio_regulator *vreg)
  333. {
  334. struct virtqueue *vqs[1];
  335. vq_callback_t *cbs[] = { virtio_regulator_isr };
  336. static const char * const names[] = { "regulator" };
  337. int ret;
  338. ret = virtio_find_vqs(vreg->vdev, 1, vqs, cbs, names, NULL);
  339. if (ret)
  340. return ret;
  341. vreg->vq = vqs[0];
  342. return 0;
  343. }
  344. static int virtio_regulator_allocate_reg(struct virtio_regulator *vreg)
  345. {
  346. struct device_node *parent_node, *node, *child_node;
  347. int i, ret;
  348. vreg->regs_count = 0;
  349. parent_node = vreg->vdev->dev.parent->of_node;
  350. for_each_available_child_of_node(parent_node, node) {
  351. for_each_available_child_of_node(node, child_node) {
  352. /* Skip child nodes handled by other drivers. */
  353. if (of_find_property(child_node, "compatible", NULL))
  354. continue;
  355. vreg->regs_count++;
  356. }
  357. }
  358. if (vreg->regs_count == 0) {
  359. dev_err(&vreg->vdev->dev,
  360. "could not find any regulator subnodes\n");
  361. return -ENODEV;
  362. }
  363. vreg->regs = devm_kcalloc(&vreg->vdev->dev, vreg->regs_count,
  364. sizeof(*vreg->regs), GFP_KERNEL);
  365. if (!vreg->regs)
  366. return -ENOMEM;
  367. i = 0;
  368. for_each_available_child_of_node(parent_node, node) {
  369. for_each_available_child_of_node(node, child_node) {
  370. /* Skip child nodes handled by other drivers. */
  371. if (of_find_property(child_node, "compatible", NULL))
  372. continue;
  373. vreg->regs[i].of_node = child_node;
  374. vreg->regs[i].vreg = vreg;
  375. ret = of_property_read_string(child_node, "regulator-name",
  376. &vreg->regs[i].rdesc.name);
  377. if (ret) {
  378. dev_err(&vreg->vdev->dev,
  379. "could not read regulator-name\n");
  380. return ret;
  381. }
  382. i++;
  383. }
  384. }
  385. return 0;
  386. }
  387. static int virtio_regulator_init_reg(struct reg_virtio *reg)
  388. {
  389. struct device *dev = reg->vreg->vdev->dev.parent;
  390. struct regulator_config reg_config = {};
  391. struct regulator_init_data *init_data;
  392. int ret = 0;
  393. reg->rdesc.owner = THIS_MODULE;
  394. reg->rdesc.type = REGULATOR_VOLTAGE;
  395. reg->rdesc.ops = &virtio_regulator_ops;
  396. init_data = of_get_regulator_init_data(dev, reg->of_node, &reg->rdesc);
  397. if (init_data == NULL)
  398. return -ENOMEM;
  399. if (init_data->constraints.min_uV == 0 &&
  400. init_data->constraints.max_uV == 0)
  401. reg->rdesc.n_voltages = 0;
  402. else if (init_data->constraints.min_uV == init_data->constraints.max_uV)
  403. reg->rdesc.n_voltages = 1;
  404. else
  405. reg->rdesc.n_voltages = 2;
  406. if (reg->rdesc.n_voltages == 0) {
  407. reg->rdesc.ops = &virtio_regulator_switch_ops;
  408. } else {
  409. init_data->constraints.input_uV = init_data->constraints.max_uV;
  410. init_data->constraints.valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
  411. }
  412. reg_config.dev = dev;
  413. reg_config.init_data = init_data;
  414. reg_config.of_node = reg->of_node;
  415. reg_config.driver_data = reg;
  416. reg->rdev = devm_regulator_register(dev, &reg->rdesc, &reg_config);
  417. if (IS_ERR(reg->rdev)) {
  418. ret = PTR_ERR(reg->rdev);
  419. reg->rdev = NULL;
  420. dev_err(&reg->vreg->vdev->dev, "fail to register regulator\n");
  421. return ret;
  422. }
  423. return ret;
  424. }
  425. static int virtio_regulator_probe(struct virtio_device *vdev)
  426. {
  427. struct virtio_regulator *vreg;
  428. unsigned int i;
  429. int ret;
  430. if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
  431. return -ENODEV;
  432. vreg = devm_kzalloc(&vdev->dev, sizeof(struct virtio_regulator),
  433. GFP_KERNEL);
  434. if (!vreg)
  435. return -ENOMEM;
  436. vdev->priv = vreg;
  437. vreg->vdev = vdev;
  438. mutex_init(&vreg->lock);
  439. init_completion(&vreg->rsp_avail);
  440. ret = virtio_regulator_init_vqs(vreg);
  441. if (ret) {
  442. dev_err(&vdev->dev, "fail to initialize virtqueue\n");
  443. return ret;
  444. }
  445. virtio_device_ready(vdev);
  446. ret = virtio_regulator_allocate_reg(vreg);
  447. if (ret) {
  448. dev_err(&vdev->dev, "fail to allocate regulators\n");
  449. goto err_allocate_reg;
  450. }
  451. for (i = 0; i < vreg->regs_count; i++) {
  452. ret = virtio_regulator_init_reg(&vreg->regs[i]);
  453. if (ret) {
  454. dev_err(&vdev->dev, "fail to initialize regulator %s\n",
  455. vreg->regs[i].rdesc.name);
  456. goto err_init_reg;
  457. }
  458. ret = devm_regulator_debug_register(&vdev->dev, vreg->regs[i].rdev);
  459. if (ret) {
  460. dev_err(&vdev->dev, "fail to register regulator %s debugfs\n",
  461. vreg->regs[i].rdesc.name);
  462. goto err_register_reg_debug;
  463. }
  464. }
  465. dev_dbg(&vdev->dev, "virtio regulator probe successfully\n");
  466. return 0;
  467. err_register_reg_debug:
  468. err_init_reg:
  469. err_allocate_reg:
  470. vdev->config->del_vqs(vdev);
  471. return ret;
  472. }
  473. static void virtio_regulator_remove(struct virtio_device *vdev)
  474. {
  475. struct virtio_regulator *vreg = vdev->priv;
  476. void *buf;
  477. vdev->config->reset(vdev);
  478. while ((buf = virtqueue_detach_unused_buf(vreg->vq)) != NULL)
  479. kfree(buf);
  480. vdev->config->del_vqs(vdev);
  481. }
  482. static const struct virtio_device_id id_table[] = {
  483. { VIRTIO_ID_REGULATOR, VIRTIO_DEV_ANY_ID },
  484. { 0 },
  485. };
  486. static unsigned int features[] = {
  487. };
  488. static struct virtio_driver virtio_regulator_driver = {
  489. .feature_table = features,
  490. .feature_table_size = ARRAY_SIZE(features),
  491. .driver.name = KBUILD_MODNAME,
  492. .driver.owner = THIS_MODULE,
  493. .id_table = id_table,
  494. .probe = virtio_regulator_probe,
  495. .remove = virtio_regulator_remove,
  496. };
  497. static int __init virtio_regulator_init(void)
  498. {
  499. return register_virtio_driver(&virtio_regulator_driver);
  500. }
  501. static void __exit virtio_regulator_exit(void)
  502. {
  503. unregister_virtio_driver(&virtio_regulator_driver);
  504. }
  505. subsys_initcall(virtio_regulator_init);
  506. module_exit(virtio_regulator_exit);
  507. MODULE_DEVICE_TABLE(virtio, id_table);
  508. MODULE_DESCRIPTION("Virtio regulator driver");
  509. MODULE_LICENSE("GPL");