platform/chrome: wilco_ec: Add Boot on AC support
PATCH v2 1/2 platform/chrome: wilco_ec: Add Boot on AC support
Boot on AC is a policy which makes the device boot from S5 when AC power is connected. This is useful for users who want to run their device headless or with a dock.
v2 changes:
- Move documentation to Documentation/ABI/testing/sysfs-platform-wilco-ec
--- .../ABI/testing/sysfs-platform-wilco-ec | 11 +++ drivers/platform/chrome/wilco_ec/Makefile | 2 +- drivers/platform/chrome/wilco_ec/core.c | 9 +++ drivers/platform/chrome/wilco_ec/sysfs.c | 77 +++++++++++++++++++ include/linux/platform_data/wilco-ec.h | 3 + 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-platform-wilco-ec create mode 100644 drivers/platform/chrome/wilco_ec/sysfs.c
Documentation/ABI/testing/sysfs-platform-wilco-ec new file +11 -0
@@ -0,0 +1,11 @@ +What: /sys/bus/platform/devices/GOOG000C\:00/boot_on_ac +Date: April 2019 +KernelVersion: 5.2 +Description: + Boot on AC is a policy which makes the device boot from S5 + when AC power is connected. This is useful for users who + want to run their device headless or with a dock. + + Input should be parseable by kstrtou8() to 0 or 1. + Output will be either "0\n" or "1\n". +
drivers/platform/chrome/wilco_ec/Makefile +1 -1
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -wilco_ec-objs := core.o mailbox.o +wilco_ec-objs := core.o mailbox.o sysfs.o obj-$(CONFIG_WILCO_EC) += wilco_ec.o wilco_ec_debugfs-objs := debugfs.o obj-$(CONFIG_WILCO_EC_DEBUGFS) += wilco_ec_debugfs.o
drivers/platform/chrome/wilco_ec/core.c +9 -0
@@ -89,8 +89,16 @@ static int wilco_ec_probe(struct platform_device *pdev) goto unregister_debugfs; } + ret =wilco_ec_add_sysfs (ec); +if (ret <0 ) { +dev_err (dev,"Failed to create sysfs entries: %d" , ret); + goto unregister_rtc; + } +return 0 ; +unregister_rtc: +platform_device_unregister (ec->rtc_pdev); unregister_debugfs:if (ec->debugfs_pdev)platform_device_unregister (ec->debugfs_pdev);
@@ -102,6 +110,7 @@ static int wilco_ec_remove(struct platform_device *pdev) {struct wilco_ec_device *ec =platform_get_drvdata (pdev); +wilco_ec_remove_sysfs (ec);platform_device_unregister (ec->rtc_pdev);if (ec->debugfs_pdev)platform_device_unregister (ec->debugfs_pdev);
drivers/platform/chrome/wilco_ec/sysfs.c new file +77 -0
77 lines not on this page · raw message
include/linux/platform_data/wilco-ec.h +3 -0
@@ -123,4 +123,7 @@ struct wilco_ec_message {*/ int wilco_ec_mailbox (struct wilco_ec_device *ec,struct wilco_ec_message *msg); +int wilco_ec_add_sysfs (struct wilco_ec_device *ec); +void wilco_ec_remove_sysfs (struct wilco_ec_device *ec); +#endif /* WILCO_EC_H */
Signature · 1 line
2.20.1
PATCH v2 2/2 platform/chrome: wilco_ec: Add USB PowerShare Policy control
USB PowerShare is a policy which affects charging via the special USB PowerShare port (marked with a small lightning bolt or battery icon) when in low power states:
- In S0, the port will always provide power.
- In S0ix, if power_share is enabled, then power will be supplied to the port when on AC or if battery is > 50%. Else no power is supplied.
- In S5, if power_share is enabled, then power will be supplied to the port when on AC. Else no power is supplied.
v2 changes:
- Move documentation to Documentation/ABI/testing/sysfs-platform-wilco-ec
- Zero out reserved bytes in requests.
--- .../ABI/testing/sysfs-platform-wilco-ec | 16 ++++ drivers/platform/chrome/wilco_ec/sysfs.c | 93 +++++++++++++++++++ 2 files changed, 109 insertions(+)
Documentation/ABI/testing/sysfs-platform-wilco-ec +16 -0
@@ -9,3 +9,19 @@ Description: Input should be parseable by kstrtou8() to 0 or 1. Output will be either "0\n" or "1\n". +What: /sys/bus/platform/devices/GOOG000C\:00/usb_power_share +Date: April 2019 +KernelVersion: 5.2 +Description: + Control the USB PowerShare Policy. USB PowerShare is a policy + which affects charging via the special USB PowerShare port + (marked with a small lightning bolt or battery icon) when in + low power states: + - In S0, the port will always provide power. + - In S0ix, if power_share is enabled, then power will be + supplied to the port when on AC or if battery is > 50%. + Else no power is supplied. + - In S5, if power_share is enabled, then power will be supplied + to the port when on AC. Else no power is supplied. + + Input should be either "0" or "1".
drivers/platform/chrome/wilco_ec/sysfs.c +93 -0
107 lines not on this page · raw message
Signature · 1 line
2.20.1