test_power.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Power supply driver for testing.
  4. *
  5. * Copyright 2010 Anton Vorontsov <cbouatmailru@gmail.com>
  6. *
  7. * Dynamic module parameter code from the Virtual Battery Driver
  8. * Copyright (C) 2008 Pylone, Inc.
  9. * By: Masashi YOKOTA <yokota@pylone.jp>
  10. * Originally found here:
  11. * http://downloads.pylone.jp/src/virtual_battery/virtual_battery-0.0.1.tar.bz2
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/module.h>
  15. #include <linux/power_supply.h>
  16. #include <linux/errno.h>
  17. #include <linux/delay.h>
  18. #include <generated/utsrelease.h>
  19. enum test_power_id {
  20. TEST_AC,
  21. TEST_BATTERY,
  22. TEST_USB,
  23. TEST_POWER_NUM,
  24. };
  25. static int ac_online = 1;
  26. static int usb_online = 1;
  27. static int battery_status = POWER_SUPPLY_STATUS_DISCHARGING;
  28. static int battery_health = POWER_SUPPLY_HEALTH_GOOD;
  29. static int battery_present = 1; /* true */
  30. static int battery_technology = POWER_SUPPLY_TECHNOLOGY_LION;
  31. static int battery_capacity = 50;
  32. static int battery_voltage = 3300;
  33. static int battery_charge_counter = -1000;
  34. static int battery_current = -1600;
  35. static enum power_supply_charge_behaviour battery_charge_behaviour =
  36. POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO;
  37. static bool module_initialized;
  38. static int test_power_get_ac_property(struct power_supply *psy,
  39. enum power_supply_property psp,
  40. union power_supply_propval *val)
  41. {
  42. switch (psp) {
  43. case POWER_SUPPLY_PROP_ONLINE:
  44. val->intval = ac_online;
  45. break;
  46. default:
  47. return -EINVAL;
  48. }
  49. return 0;
  50. }
  51. static int test_power_get_usb_property(struct power_supply *psy,
  52. enum power_supply_property psp,
  53. union power_supply_propval *val)
  54. {
  55. switch (psp) {
  56. case POWER_SUPPLY_PROP_ONLINE:
  57. val->intval = usb_online;
  58. break;
  59. default:
  60. return -EINVAL;
  61. }
  62. return 0;
  63. }
  64. static int test_power_get_battery_property(struct power_supply *psy,
  65. enum power_supply_property psp,
  66. union power_supply_propval *val)
  67. {
  68. switch (psp) {
  69. case POWER_SUPPLY_PROP_MODEL_NAME:
  70. val->strval = "Test battery";
  71. break;
  72. case POWER_SUPPLY_PROP_MANUFACTURER:
  73. val->strval = "Linux";
  74. break;
  75. case POWER_SUPPLY_PROP_SERIAL_NUMBER:
  76. val->strval = UTS_RELEASE;
  77. break;
  78. case POWER_SUPPLY_PROP_STATUS:
  79. val->intval = battery_status;
  80. break;
  81. case POWER_SUPPLY_PROP_CHARGE_TYPE:
  82. val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
  83. break;
  84. case POWER_SUPPLY_PROP_HEALTH:
  85. val->intval = battery_health;
  86. break;
  87. case POWER_SUPPLY_PROP_PRESENT:
  88. val->intval = battery_present;
  89. break;
  90. case POWER_SUPPLY_PROP_TECHNOLOGY:
  91. val->intval = battery_technology;
  92. break;
  93. case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
  94. val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
  95. break;
  96. case POWER_SUPPLY_PROP_CAPACITY:
  97. case POWER_SUPPLY_PROP_CHARGE_NOW:
  98. val->intval = battery_capacity;
  99. break;
  100. case POWER_SUPPLY_PROP_CHARGE_COUNTER:
  101. val->intval = battery_charge_counter;
  102. break;
  103. case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
  104. case POWER_SUPPLY_PROP_CHARGE_FULL:
  105. val->intval = 100;
  106. break;
  107. case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
  108. case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW:
  109. val->intval = 3600;
  110. break;
  111. case POWER_SUPPLY_PROP_TEMP:
  112. val->intval = 26;
  113. break;
  114. case POWER_SUPPLY_PROP_VOLTAGE_NOW:
  115. val->intval = battery_voltage;
  116. break;
  117. case POWER_SUPPLY_PROP_CURRENT_AVG:
  118. case POWER_SUPPLY_PROP_CURRENT_NOW:
  119. val->intval = battery_current;
  120. break;
  121. case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
  122. val->intval = battery_charge_behaviour;
  123. break;
  124. default:
  125. pr_info("%s: some properties deliberately report errors.\n",
  126. __func__);
  127. return -EINVAL;
  128. }
  129. return 0;
  130. }
  131. static int test_power_battery_property_is_writeable(struct power_supply *psy,
  132. enum power_supply_property psp)
  133. {
  134. return psp == POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR;
  135. }
  136. static int test_power_set_battery_property(struct power_supply *psy,
  137. enum power_supply_property psp,
  138. const union power_supply_propval *val)
  139. {
  140. switch (psp) {
  141. case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
  142. if (val->intval < 0 ||
  143. val->intval >= BITS_PER_TYPE(typeof(psy->desc->charge_behaviours)) ||
  144. !(BIT(val->intval) & psy->desc->charge_behaviours)) {
  145. return -EINVAL;
  146. }
  147. battery_charge_behaviour = val->intval;
  148. break;
  149. default:
  150. return -EINVAL;
  151. }
  152. return 0;
  153. }
  154. static enum power_supply_property test_power_ac_props[] = {
  155. POWER_SUPPLY_PROP_ONLINE,
  156. };
  157. static enum power_supply_property test_power_battery_props[] = {
  158. POWER_SUPPLY_PROP_STATUS,
  159. POWER_SUPPLY_PROP_CHARGE_TYPE,
  160. POWER_SUPPLY_PROP_HEALTH,
  161. POWER_SUPPLY_PROP_PRESENT,
  162. POWER_SUPPLY_PROP_TECHNOLOGY,
  163. POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
  164. POWER_SUPPLY_PROP_CHARGE_FULL,
  165. POWER_SUPPLY_PROP_CHARGE_NOW,
  166. POWER_SUPPLY_PROP_CHARGE_COUNTER,
  167. POWER_SUPPLY_PROP_CAPACITY,
  168. POWER_SUPPLY_PROP_CAPACITY_LEVEL,
  169. POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
  170. POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
  171. POWER_SUPPLY_PROP_MODEL_NAME,
  172. POWER_SUPPLY_PROP_MANUFACTURER,
  173. POWER_SUPPLY_PROP_SERIAL_NUMBER,
  174. POWER_SUPPLY_PROP_TEMP,
  175. POWER_SUPPLY_PROP_VOLTAGE_NOW,
  176. POWER_SUPPLY_PROP_CURRENT_AVG,
  177. POWER_SUPPLY_PROP_CURRENT_NOW,
  178. POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR,
  179. };
  180. static char *test_power_ac_supplied_to[] = {
  181. "test_battery",
  182. };
  183. static struct power_supply *test_power_supplies[TEST_POWER_NUM];
  184. static const struct power_supply_desc test_power_desc[] = {
  185. [TEST_AC] = {
  186. .name = "test_ac",
  187. .type = POWER_SUPPLY_TYPE_MAINS,
  188. .properties = test_power_ac_props,
  189. .num_properties = ARRAY_SIZE(test_power_ac_props),
  190. .get_property = test_power_get_ac_property,
  191. },
  192. [TEST_BATTERY] = {
  193. .name = "test_battery",
  194. .type = POWER_SUPPLY_TYPE_BATTERY,
  195. .properties = test_power_battery_props,
  196. .num_properties = ARRAY_SIZE(test_power_battery_props),
  197. .get_property = test_power_get_battery_property,
  198. .set_property = test_power_set_battery_property,
  199. .property_is_writeable = test_power_battery_property_is_writeable,
  200. .charge_behaviours = BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_AUTO)
  201. | BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_INHIBIT_CHARGE)
  202. | BIT(POWER_SUPPLY_CHARGE_BEHAVIOUR_FORCE_DISCHARGE),
  203. },
  204. [TEST_USB] = {
  205. .name = "test_usb",
  206. .type = POWER_SUPPLY_TYPE_USB,
  207. .properties = test_power_ac_props,
  208. .num_properties = ARRAY_SIZE(test_power_ac_props),
  209. .get_property = test_power_get_usb_property,
  210. },
  211. };
  212. static const struct power_supply_config test_power_configs[] = {
  213. {
  214. /* test_ac */
  215. .supplied_to = test_power_ac_supplied_to,
  216. .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
  217. }, {
  218. /* test_battery */
  219. }, {
  220. /* test_usb */
  221. .supplied_to = test_power_ac_supplied_to,
  222. .num_supplicants = ARRAY_SIZE(test_power_ac_supplied_to),
  223. },
  224. };
  225. static int __init test_power_init(void)
  226. {
  227. int i;
  228. int ret;
  229. BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies));
  230. BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_configs));
  231. for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++) {
  232. test_power_supplies[i] = power_supply_register(NULL,
  233. &test_power_desc[i],
  234. &test_power_configs[i]);
  235. if (IS_ERR(test_power_supplies[i])) {
  236. pr_err("%s: failed to register %s\n", __func__,
  237. test_power_desc[i].name);
  238. ret = PTR_ERR(test_power_supplies[i]);
  239. goto failed;
  240. }
  241. }
  242. module_initialized = true;
  243. return 0;
  244. failed:
  245. while (--i >= 0)
  246. power_supply_unregister(test_power_supplies[i]);
  247. return ret;
  248. }
  249. module_init(test_power_init);
  250. static void __exit test_power_exit(void)
  251. {
  252. int i;
  253. /* Let's see how we handle changes... */
  254. ac_online = 0;
  255. usb_online = 0;
  256. battery_status = POWER_SUPPLY_STATUS_DISCHARGING;
  257. for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++)
  258. power_supply_changed(test_power_supplies[i]);
  259. pr_info("%s: 'changed' event sent, sleeping for 10 seconds...\n",
  260. __func__);
  261. ssleep(10);
  262. for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++)
  263. power_supply_unregister(test_power_supplies[i]);
  264. module_initialized = false;
  265. }
  266. module_exit(test_power_exit);
  267. #define MAX_KEYLENGTH 256
  268. struct battery_property_map {
  269. int value;
  270. char const *key;
  271. };
  272. static struct battery_property_map map_ac_online[] = {
  273. { 0, "off" },
  274. { 1, "on" },
  275. { -1, NULL },
  276. };
  277. static struct battery_property_map map_status[] = {
  278. { POWER_SUPPLY_STATUS_CHARGING, "charging" },
  279. { POWER_SUPPLY_STATUS_DISCHARGING, "discharging" },
  280. { POWER_SUPPLY_STATUS_NOT_CHARGING, "not-charging" },
  281. { POWER_SUPPLY_STATUS_FULL, "full" },
  282. { -1, NULL },
  283. };
  284. static struct battery_property_map map_health[] = {
  285. { POWER_SUPPLY_HEALTH_GOOD, "good" },
  286. { POWER_SUPPLY_HEALTH_OVERHEAT, "overheat" },
  287. { POWER_SUPPLY_HEALTH_DEAD, "dead" },
  288. { POWER_SUPPLY_HEALTH_OVERVOLTAGE, "overvoltage" },
  289. { POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, "failure" },
  290. { -1, NULL },
  291. };
  292. static struct battery_property_map map_present[] = {
  293. { 0, "false" },
  294. { 1, "true" },
  295. { -1, NULL },
  296. };
  297. static struct battery_property_map map_technology[] = {
  298. { POWER_SUPPLY_TECHNOLOGY_NiMH, "NiMH" },
  299. { POWER_SUPPLY_TECHNOLOGY_LION, "LION" },
  300. { POWER_SUPPLY_TECHNOLOGY_LIPO, "LIPO" },
  301. { POWER_SUPPLY_TECHNOLOGY_LiFe, "LiFe" },
  302. { POWER_SUPPLY_TECHNOLOGY_NiCd, "NiCd" },
  303. { POWER_SUPPLY_TECHNOLOGY_LiMn, "LiMn" },
  304. { -1, NULL },
  305. };
  306. static int map_get_value(struct battery_property_map *map, const char *key,
  307. int def_val)
  308. {
  309. char buf[MAX_KEYLENGTH];
  310. int cr;
  311. strscpy(buf, key, MAX_KEYLENGTH);
  312. cr = strnlen(buf, MAX_KEYLENGTH) - 1;
  313. if (cr < 0)
  314. return def_val;
  315. if (buf[cr] == '\n')
  316. buf[cr] = '\0';
  317. while (map->key) {
  318. if (strncasecmp(map->key, buf, MAX_KEYLENGTH) == 0)
  319. return map->value;
  320. map++;
  321. }
  322. return def_val;
  323. }
  324. static const char *map_get_key(struct battery_property_map *map, int value,
  325. const char *def_key)
  326. {
  327. while (map->key) {
  328. if (map->value == value)
  329. return map->key;
  330. map++;
  331. }
  332. return def_key;
  333. }
  334. static inline void signal_power_supply_changed(struct power_supply *psy)
  335. {
  336. if (module_initialized)
  337. power_supply_changed(psy);
  338. }
  339. static int param_set_ac_online(const char *key, const struct kernel_param *kp)
  340. {
  341. ac_online = map_get_value(map_ac_online, key, ac_online);
  342. signal_power_supply_changed(test_power_supplies[TEST_AC]);
  343. return 0;
  344. }
  345. static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
  346. {
  347. return sprintf(buffer, "%s\n",
  348. map_get_key(map_ac_online, ac_online, "unknown"));
  349. }
  350. static int param_set_usb_online(const char *key, const struct kernel_param *kp)
  351. {
  352. usb_online = map_get_value(map_ac_online, key, usb_online);
  353. signal_power_supply_changed(test_power_supplies[TEST_USB]);
  354. return 0;
  355. }
  356. static int param_get_usb_online(char *buffer, const struct kernel_param *kp)
  357. {
  358. return sprintf(buffer, "%s\n",
  359. map_get_key(map_ac_online, usb_online, "unknown"));
  360. }
  361. static int param_set_battery_status(const char *key,
  362. const struct kernel_param *kp)
  363. {
  364. battery_status = map_get_value(map_status, key, battery_status);
  365. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  366. return 0;
  367. }
  368. static int param_get_battery_status(char *buffer, const struct kernel_param *kp)
  369. {
  370. return sprintf(buffer, "%s\n",
  371. map_get_key(map_ac_online, battery_status, "unknown"));
  372. }
  373. static int param_set_battery_health(const char *key,
  374. const struct kernel_param *kp)
  375. {
  376. battery_health = map_get_value(map_health, key, battery_health);
  377. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  378. return 0;
  379. }
  380. static int param_get_battery_health(char *buffer, const struct kernel_param *kp)
  381. {
  382. return sprintf(buffer, "%s\n",
  383. map_get_key(map_ac_online, battery_health, "unknown"));
  384. }
  385. static int param_set_battery_present(const char *key,
  386. const struct kernel_param *kp)
  387. {
  388. battery_present = map_get_value(map_present, key, battery_present);
  389. signal_power_supply_changed(test_power_supplies[TEST_AC]);
  390. return 0;
  391. }
  392. static int param_get_battery_present(char *buffer,
  393. const struct kernel_param *kp)
  394. {
  395. return sprintf(buffer, "%s\n",
  396. map_get_key(map_ac_online, battery_present, "unknown"));
  397. }
  398. static int param_set_battery_technology(const char *key,
  399. const struct kernel_param *kp)
  400. {
  401. battery_technology = map_get_value(map_technology, key,
  402. battery_technology);
  403. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  404. return 0;
  405. }
  406. static int param_get_battery_technology(char *buffer,
  407. const struct kernel_param *kp)
  408. {
  409. return sprintf(buffer, "%s\n",
  410. map_get_key(map_ac_online, battery_technology,
  411. "unknown"));
  412. }
  413. static int param_set_battery_capacity(const char *key,
  414. const struct kernel_param *kp)
  415. {
  416. int tmp;
  417. if (1 != sscanf(key, "%d", &tmp))
  418. return -EINVAL;
  419. battery_capacity = tmp;
  420. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  421. return 0;
  422. }
  423. #define param_get_battery_capacity param_get_int
  424. static int param_set_battery_voltage(const char *key,
  425. const struct kernel_param *kp)
  426. {
  427. int tmp;
  428. if (1 != sscanf(key, "%d", &tmp))
  429. return -EINVAL;
  430. battery_voltage = tmp;
  431. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  432. return 0;
  433. }
  434. #define param_get_battery_voltage param_get_int
  435. static int param_set_battery_charge_counter(const char *key,
  436. const struct kernel_param *kp)
  437. {
  438. int tmp;
  439. if (1 != sscanf(key, "%d", &tmp))
  440. return -EINVAL;
  441. battery_charge_counter = tmp;
  442. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  443. return 0;
  444. }
  445. #define param_get_battery_charge_counter param_get_int
  446. static int param_set_battery_current(const char *key,
  447. const struct kernel_param *kp)
  448. {
  449. int tmp;
  450. if (1 != sscanf(key, "%d", &tmp))
  451. return -EINVAL;
  452. battery_current = tmp;
  453. signal_power_supply_changed(test_power_supplies[TEST_BATTERY]);
  454. return 0;
  455. }
  456. #define param_get_battery_current param_get_int
  457. static const struct kernel_param_ops param_ops_ac_online = {
  458. .set = param_set_ac_online,
  459. .get = param_get_ac_online,
  460. };
  461. static const struct kernel_param_ops param_ops_usb_online = {
  462. .set = param_set_usb_online,
  463. .get = param_get_usb_online,
  464. };
  465. static const struct kernel_param_ops param_ops_battery_status = {
  466. .set = param_set_battery_status,
  467. .get = param_get_battery_status,
  468. };
  469. static const struct kernel_param_ops param_ops_battery_present = {
  470. .set = param_set_battery_present,
  471. .get = param_get_battery_present,
  472. };
  473. static const struct kernel_param_ops param_ops_battery_technology = {
  474. .set = param_set_battery_technology,
  475. .get = param_get_battery_technology,
  476. };
  477. static const struct kernel_param_ops param_ops_battery_health = {
  478. .set = param_set_battery_health,
  479. .get = param_get_battery_health,
  480. };
  481. static const struct kernel_param_ops param_ops_battery_capacity = {
  482. .set = param_set_battery_capacity,
  483. .get = param_get_battery_capacity,
  484. };
  485. static const struct kernel_param_ops param_ops_battery_voltage = {
  486. .set = param_set_battery_voltage,
  487. .get = param_get_battery_voltage,
  488. };
  489. static const struct kernel_param_ops param_ops_battery_charge_counter = {
  490. .set = param_set_battery_charge_counter,
  491. .get = param_get_battery_charge_counter,
  492. };
  493. static const struct kernel_param_ops param_ops_battery_current = {
  494. .set = param_set_battery_current,
  495. .get = param_get_battery_current,
  496. };
  497. #define param_check_ac_online(name, p) __param_check(name, p, void);
  498. #define param_check_usb_online(name, p) __param_check(name, p, void);
  499. #define param_check_battery_status(name, p) __param_check(name, p, void);
  500. #define param_check_battery_present(name, p) __param_check(name, p, void);
  501. #define param_check_battery_technology(name, p) __param_check(name, p, void);
  502. #define param_check_battery_health(name, p) __param_check(name, p, void);
  503. #define param_check_battery_capacity(name, p) __param_check(name, p, void);
  504. #define param_check_battery_voltage(name, p) __param_check(name, p, void);
  505. #define param_check_battery_charge_counter(name, p) __param_check(name, p, void);
  506. #define param_check_battery_current(name, p) __param_check(name, p, void);
  507. module_param(ac_online, ac_online, 0644);
  508. MODULE_PARM_DESC(ac_online, "AC charging state <on|off>");
  509. module_param(usb_online, usb_online, 0644);
  510. MODULE_PARM_DESC(usb_online, "USB charging state <on|off>");
  511. module_param(battery_status, battery_status, 0644);
  512. MODULE_PARM_DESC(battery_status,
  513. "battery status <charging|discharging|not-charging|full>");
  514. module_param(battery_present, battery_present, 0644);
  515. MODULE_PARM_DESC(battery_present,
  516. "battery presence state <good|overheat|dead|overvoltage|failure>");
  517. module_param(battery_technology, battery_technology, 0644);
  518. MODULE_PARM_DESC(battery_technology,
  519. "battery technology <NiMH|LION|LIPO|LiFe|NiCd|LiMn>");
  520. module_param(battery_health, battery_health, 0644);
  521. MODULE_PARM_DESC(battery_health,
  522. "battery health state <good|overheat|dead|overvoltage|failure>");
  523. module_param(battery_capacity, battery_capacity, 0644);
  524. MODULE_PARM_DESC(battery_capacity, "battery capacity (percentage)");
  525. module_param(battery_voltage, battery_voltage, 0644);
  526. MODULE_PARM_DESC(battery_voltage, "battery voltage (millivolts)");
  527. module_param(battery_charge_counter, battery_charge_counter, 0644);
  528. MODULE_PARM_DESC(battery_charge_counter,
  529. "battery charge counter (microampere-hours)");
  530. module_param(battery_current, battery_current, 0644);
  531. MODULE_PARM_DESC(battery_current, "battery current (milliampere)");
  532. MODULE_DESCRIPTION("Power supply driver for testing");
  533. MODULE_AUTHOR("Anton Vorontsov <cbouatmailru@gmail.com>");
  534. MODULE_LICENSE("GPL");