History

platform/chrome: wilco_ec: Add charging config driver

Add a device to control the charging algorithm used on Wilco devices, which will be picked up by the drivers/power/supply/wilco-charger.c driver. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info.

Nick Crews committed 7 years ago

Commit 3c4d77b1 parent fdf0fe22 files · +16 −1Browse files

Unified · Split

2 files
  1. drivers/platform/chrome/wilco_ec/core.c +14 −1
  2. include/linux/platform_data/wilco-ec.h +2 −0
drivers/platform/chrome/wilco_ec/core.c+14−1
@@ -93,6 +93,16 @@ static int wilco_ec_probe(struct platform_device *pdev) · 92 unmodified lines
9393 goto unregister_rtc;
9494 }
9595
96+ /* Register child device to be found by charger config driver. */
97+ ec->charger_pdev = platform_device_register_data(dev, "wilco-charger",
98+ PLATFORM_DEVID_AUTO,
99+ NULL, 0);
100+ if (IS_ERR(ec->charger_pdev)) {
101+ dev_err(dev, "Failed to create charger platform device\n");
102+ ret = PTR_ERR(ec->charger_pdev);
103+ goto remove_sysfs;
104+ }
105+
96106 /* Register child device that will be found by the telemetry driver. */
97107 ec->telem_pdev = platform_device_register_data(dev, "wilco_telem",
98108 PLATFORM_DEVID_AUTO,
@@ -100,11 +110,13 @@ static int wilco_ec_probe(struct platform_device *pdev) · 1 unmodified line
100110 if (IS_ERR(ec->telem_pdev)) {
101111 dev_err(dev, "Failed to create telemetry platform device\n");
102112 ret = PTR_ERR(ec->telem_pdev);
103− goto remove_sysfs;
113+ goto unregister_charge_config;
104114 }
105115
106116 return 0;
107117
118+unregister_charge_config:
119+ platform_device_unregister(ec->charger_pdev);
108120 remove_sysfs:
109121 wilco_ec_remove_sysfs(ec);
110122 unregister_rtc:
@@ -120,6 +132,7 @@ static int wilco_ec_remove(struct platform_device *pdev) · 9 unmodified lines
120132 {
121133 struct wilco_ec_device *ec = platform_get_drvdata(pdev);
122134
135+ platform_device_unregister(ec->charger_pdev);
123136 wilco_ec_remove_sysfs(ec);
124137 platform_device_unregister(ec->telem_pdev);
125138 platform_device_unregister(ec->rtc_pdev);
include/linux/platform_data/wilco-ec.h+2−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 * @data_size: Size of the data buffer used for EC communication.
3030 * @debugfs_pdev: The child platform_device used by the debugfs sub-driver.
3131 * @rtc_pdev: The child platform_device used by the RTC sub-driver.
32+ * @charger_pdev: Child platform_device used by the charger config sub-driver.
3233 * @telem_pdev: The child platform_device used by the telemetry sub-driver.
3334 */
3435 struct wilco_ec_device {
@@ -41,6 +42,7 @@ struct wilco_ec_device { · 6 unmodified lines
4142 size_t data_size;
4243 struct platform_device *debugfs_pdev;
4344 struct platform_device *rtc_pdev;
45+ struct platform_device *charger_pdev;
4446 struct platform_device *telem_pdev;
4547 };
4648

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t