Re: [PATCH v4] wilco_ec: Add Dell's USB PowerShare Policy control

2019-10-11 Thread Nick Crews
Many thanks Enric! On Fri, Oct 11, 2019 at 9:08 AM Enric Balletbo i Serra wrote: > > Hi Daniel, Nick > > On 9/10/19 17:00, Nick Crews wrote: > > On Tue, Oct 8, 2019 at 4:18 PM Daniel Campello > > wrote: > >> > >> USB PowerShare is a policy which

Re: [PATCH v4] wilco_ec: Add Dell's USB PowerShare Policy control

2019-10-09 Thread Nick Crews
er. > - In S0ix, if usb_charge 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 usb_charge is enabled, then power will be supplied to > the port when on AC. Else no power is supplied. > > Signed-off-by: Da

[PATCH v4] rtc: wilco-ec: Handle reading invalid times

2019-10-04 Thread Nick Crews
. Signed-off-by: Nick Crews --- drivers/rtc/rtc-wilco-ec.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c index 8ad4c4e6d557..ff46066a68a4 100644 --- a/drivers/rtc/rtc-wilco-ec.c +++ b/drivers/rtc/rtc-wilco-ec.c

Re: [PATCH v3] rtc: wilco-ec: Handle reading invalid times

2019-10-03 Thread Nick Crews
> > > > > > Hi Nick, > > > > > > > > On 25/09/2019 14:32:09-0600, Nick Crews wrote: > > > > > If the RTC HW returns an invalid time, the rtc_year_days() > > > > > call would crash. This patch adds error logging in this &g

Re: [PATCH -next] platform/chrome: wilco_ec: Use kmemdup in enqueue_events()

2019-09-27 Thread Nick Crews
On Thu, Sep 26, 2019 at 4:43 PM Benson Leung wrote: > > Hey Nick, > On Fri, Jun 21, 2019 at 7:51 AM Nick Crews wrote: > > > > Thanks Yue, looks good to me. > > > > Nick > > > > On Fri, Jun 21, 2019 at 7:59 AM YueHaibing wrote: > > > > &

[PATCH v3] rtc: wilco-ec: Handle reading invalid times

2019-09-25 Thread Nick Crews
. Signed-off-by: Nick Crews --- drivers/rtc/rtc-wilco-ec.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c index 8ad4c4e6d557..53da355d996a 100644 --- a/drivers/rtc/rtc-wilco-ec.c +++ b/drivers/rtc/rtc-wilco-ec.c

Re: [PATCH v2 1/2] rtc: wilco-ec: Remove yday and wday calculations

2019-09-25 Thread Nick Crews
to rtc_valid_tm(), but we feel that it is required. Thanks, Nick On Mon, Sep 23, 2019 at 2:19 PM Alexandre Belloni wrote: > > On 23/09/2019 11:20:42-0600, Nick Crews wrote: > > > This is coming from struct tm, it is part of C89 but I think I was not > > > born when this decision wa

Re: [PATCH v5] platform/chrome: wilco_ec: Add debugfs test_event file

2019-09-24 Thread Nick Crews
send_ec_cmd > to be a common helper between h1_gpio_get and test_event_set. > > Signed-off-by: Daniel Campello Reviewed-by: Nick Crews > --- > Changes for v2: > - Cleaned up and added comments. > - Renamed and updated function signature from write_to_mailbox to > send_ec_c

Re: [PATCH v2 2/2] rtc: wilco-ec: Fix license to GPL from GPLv2

2019-09-24 Thread Nick Crews
On Tue, Sep 24, 2019 at 1:55 AM Pavel Machek wrote: > > On Sun 2019-09-22 22:43:53, Alexandre Belloni wrote: > > On 22/09/2019 22:29:48+0200, Pavel Machek wrote: > > > On Mon 2019-09-16 12:12:17, Nick Crews wrote: > > > > Signed-off-by: Nick Crews > > >

Re: [PATCH v2 1/2] rtc: wilco-ec: Remove yday and wday calculations

2019-09-23 Thread Nick Crews
On Sun, Sep 22, 2019 at 1:05 PM Alexandre Belloni wrote: > > On 22/09/2019 18:13:06+0200, Pavel Machek wrote: > > On Mon 2019-09-16 12:12:15, Nick Crews wrote: > > > The tm_yday and tm_wday fields are not used by userspace, > > > so since they aren't needed within

Re: [PATCH v2 2/2] rtc: wilco-ec: Fix license to GPL from GPLv2

2019-09-23 Thread Nick Crews
019 22:29:48+0200, Pavel Machek wrote: > > On Mon 2019-09-16 12:12:17, Nick Crews wrote: > > > Signed-off-by: Nick Crews > > > --- > > > drivers/rtc/rtc-wilco-ec.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > di

Re: [PATCH v4] platform/chrome: wilco_ec: Add debugfs test_event file

2019-09-18 Thread Nick Crews
Assuming that the Kbuild bot doesn't get mad about the format string now, LGTM. Thanks Daniel! Reviewed-by: Nick Crews On Wed, Sep 18, 2019 at 2:43 PM Daniel Campello wrote: > > This change introduces a new debugfs file 'test_event' that when written > to causes the EC to generate a t

[PATCH v2 1/2] rtc: wilco-ec: Remove yday and wday calculations

2019-09-16 Thread Nick Crews
The tm_yday and tm_wday fields are not used by userspace, so since they aren't needed within the driver, don't bother calculating them. This is especially needed since the rtc_year_days() call was crashing if the HW returned an invalid time. Signed-off-by: Nick Crews --- drivers/rtc/rtc-wilco

[PATCH v2 2/2] rtc: wilco-ec: Fix license to GPL from GPLv2

2019-09-16 Thread Nick Crews
Signed-off-by: Nick Crews --- drivers/rtc/rtc-wilco-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c index e84faa268caf..951268f5e690 100644 --- a/drivers/rtc/rtc-wilco-ec.c +++ b/drivers/rtc/rtc-wilco-ec.c @@ -184,5

Re: [PATCH] rtc: wilco-ec: Sanitize values received from RTC

2019-09-16 Thread Nick Crews
On Mon, Sep 16, 2019 at 2:02 AM Alexandre Belloni wrote: > > On 15/09/2019 23:44:03+0100, Nick Crews wrote: > > Hi Alexandre, thanks for the thoughts. > > > > On Thu, Sep 12, 2019 at 9:09 AM Alexandre Belloni > > wrote: > > > > > > Hi Nick, >

Re: [PATCH] rtc: wilco-ec: Sanitize values received from RTC

2019-09-15 Thread Nick Crews
Hi Alexandre, thanks for the thoughts. On Thu, Sep 12, 2019 at 9:09 AM Alexandre Belloni wrote: > > Hi Nick, > > On 10/09/2019 16:19:29+0100, Nick Crews wrote: > > Check that the time received from the RTC HW is valid, > > otherwise the computation of rtc_year_days() in

[PATCH] rtc: wilco-ec: Sanitize values received from RTC

2019-09-10 Thread Nick Crews
Check that the time received from the RTC HW is valid, otherwise the computation of rtc_year_days() in the next line could, and sometimes does, crash the kernel. While we're at it, fix the license to plain "GPL". Signed-off-by: Nick Crews --- drivers/rtc/rtc-wilco-ec.c | 12 +

Re: [PATCH] platform/chrome: wilco_ec: Add debugfs test_event file

2019-09-06 Thread Nick Crews
Thanks for the patch Daniel! A few thoughts that I didn't have on the review on Gerrit, sorry :) After those changes, Reviewed-by: Nick Crews On Fri, Sep 6, 2019 at 4:42 PM Daniel Campello wrote: > > This change introduces a new debugfs file 'test_event' that when written > to caus

Re: Policy to keep USB ports powered in low-power states

2019-08-29 Thread Nick Crews
answers below as you see fit? Also, sorry if I make some beginner > >>>> mistakes here, I'm just getting familiar with the USB subsystem, and > >>>> thanks for > >>>> your patience. > >>>> > >>>> On Wed, Aug 14, 2019 at

Re: [PATCH] platform/chrome: wilco_ec: Add batt_ppid_info command to telemetry driver

2019-08-22 Thread Nick Crews
Friendly bump on this :) On Mon, Aug 5, 2019 at 2:22 PM Nick Crews wrote: > > Add the GET_BATT_PPID_INFO=0x8A command to the allowlist of accepted > telemetry commands. In addition, since this new command requires > verifying the contents of some of the arguments, I also

[PATCH] platform/chrome: wilco_ec: Add batt_ppid_info command to telemetry driver

2019-08-05 Thread Nick Crews
each request, and change "whitelist" to "allowlist". Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/telemetry.c | 64 +--- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/plat

Re: [PATCH v4 1/1] power/supply/sbs-battery: Fix confusing battery status when idle or empty

2019-08-01 Thread Nick Crews
Thanks Richard, I still would like some more opinions on this changing the userspace experience, but LGTM otherwise. Reviewed-by: Nick Crews On Mon, Jul 29, 2019 at 8:00 PM Richard Tresidder wrote: > > When a battery or batteries in a system are in parallel then one or more

Re: [PATCH v3 1/1] power/supply/sbs-battery: Fix confusing battery status when idle or empty

2019-07-29 Thread Nick Crews
On Mon, Jul 29, 2019 at 2:07 AM Richard Tresidder wrote: > > When a battery or batteries in a system are in parallel then one or more > may not be providing any current to the system. > This fixes an incorrect status indication of FULL for the battery simply > because it wasn't discharging at

Re: [RESEND v2 1/1] power/supply/sbs-battery: Fix confusing battery status when idle or empty

2019-07-26 Thread Nick Crews
Hi Richard! Thanks for the patch. I'm not familiar with these batteries, but I have a few thoughts. For others, the SBS battery spec is at http://sbs-forum.org/specs/sbdat110.pdf, and section 5.1.21 at page 28 is useful. On Thu, Jul 25, 2019 at 2:55 AM Richard Tresidder wrote: > > When a

[PATCH v2 2/2] platform/chrome: wilco_ec: Add circular buffer as event queue

2019-06-24 Thread Nick Crews
ist in hangup_device(). - Remove an unneeded null event pointer check in enqueue_events(). - Correct some comments. Signed-off-by: Nick Crews Reported-by: kbuild test robot --- A v1 of this was applied to the chrome-platform-5.3 branch, but then several errors were found, so Enric and Benson reverted the

[PATCH v2 1/2] platform/chrome: wilco_ec: Fix unreleased lock in event_read()

2019-06-24 Thread Nick Crews
When copying an event to userspace failed, the event queue lock was never released. This fixes that. Reported-by: Dan Carpenter Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome

Re: [PATCH] platform/chrome: cros_ec_lpc: fix stream_open.cocci warnings

2019-06-24 Thread Nick Crews
I applied this in the new version as well. On Fri, Jun 21, 2019 at 6:55 PM kbuild test robot wrote: > > From: kbuild test robot > > drivers/platform/chrome/wilco_ec/event.c:270:1-17: WARNING: event_fops: > .read() has stream semantic; safe to change nonseekable_open -> stream_open. > >

Re: [PATCH] platform/chrome: cros_ec_lpc: fix semicolon.cocci warnings

2019-06-24 Thread Nick Crews
I fixed this in the new version. On Fri, Jun 21, 2019 at 6:55 PM kbuild test robot wrote: > > From: kbuild test robot > > drivers/platform/chrome/wilco_ec/event.c:161:3-4: Unneeded semicolon > > > Remove unneeded semicolon. > > Generated by: scripts/coccinelle/misc/semicolon.cocci > > Fixes:

Re: [PATCH -next] platform/chrome: wilco_ec: Use kmemdup in enqueue_events()

2019-06-21 Thread Nick Crews
Thanks Yue, looks good to me. Nick On Fri, Jun 21, 2019 at 7:59 AM YueHaibing wrote: > > Use kmemdup rather than duplicating its implementation > > Signed-off-by: YueHaibing > --- > drivers/platform/chrome/wilco_ec/event.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff

Re: [PATCH][next] platform/chrome: wilco_ec: fix null pointer dereference on failed kzalloc

2019-06-19 Thread Nick Crews
On Tue, Jun 18, 2019 at 11:30 PM Dan Carpenter wrote: > > On Tue, Jun 18, 2019 at 04:39:24PM +0100, Colin King wrote: > > diff --git a/drivers/platform/chrome/wilco_ec/event.c > > b/drivers/platform/chrome/wilco_ec/event.c > > index c975b76e6255..e251a989b152 100644 > > ---

Re: [PATCH][next] platform/chrome: wilco_ec: fix null pointer dereference on failed kzalloc

2019-06-18 Thread Nick Crews
dev_data->events = event_queue_new(queue_size); > + if (!dev_data->events) { > + kfree(dev_data); > + error = -ENOMEM; > + goto free_minor; > + } > init_waitqueue_head(_data->wq); > dev_data->exist = true; > atomic_set(_data->available, 1); Signed-off-by: Nick Crews > -- > 2.20.1 >

Re: [PATCH v5 3/3] platform/chrome: cros_ec_lpc_mec: Fix kernel-doc comment first line

2019-06-18 Thread Nick Crews
bytes read / written > */ > u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type, > unsigned int offset, unsigned int length, Reviewed-by: Nick Crews > -- > 2.20.1 >

Re: [PATCH v5 2/3] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-18 Thread Nick Crews
at compile-time. > > While here also fix the alignment in Kconfig file for this config option > replacing the spaces by tabs. > > Signed-off-by: Enric Balletbo i Serra > Reviewed-by: Ezequiel Garcia > Tested-by: Nick Crews > --- > Hi, > > This is another atte

Re: [PATCH v5 1/3] platform/chrome: cros_ec_lpc: Merge cros_ec_lpc and cros_ec_lpc_reg

2019-06-18 Thread Nick Crews
t; - * Copyright (C) 2016 Google, Inc > - */ > - > -#ifndef __CROS_EC_LPC_REG_H > -#define __CROS_EC_LPC_REG_H > - > -/** > - * cros_ec_lpc_read_bytes - Read bytes from a given LPC-mapped address. > - * Returns 8-bit checksum of all bytes read. > - * > - * @offset: Base read address > - * @length: Number of bytes to read > - * @dest: Destination buffer > - */ > -u8 cros_ec_lpc_read_bytes(unsigned int offset, unsigned int length, u8 > *dest); > - > -/** > - * cros_ec_lpc_write_bytes - Write bytes to a given LPC-mapped address. > - * Returns 8-bit checksum of all bytes written. > - * > - * @offset: Base write address > - * @length: Number of bytes to write > - * @msg: Write data buffer > - */ > -u8 cros_ec_lpc_write_bytes(unsigned int offset, unsigned int length, u8 > *msg); > - > -/** > - * cros_ec_lpc_reg_init > - * > - * Initialize register I/O. > - */ > -void cros_ec_lpc_reg_init(void); > - > -/** > - * cros_ec_lpc_reg_destroy > - * > - * Cleanup reg I/O. > - */ > -void cros_ec_lpc_reg_destroy(void); > - > -#endif /* __CROS_EC_LPC_REG_H */ Reviewed-by: Nick Crews > -- > 2.20.1 >

[PATCH 2/2] platform/chrome: wilco_ec: Add circular buffer as event queue

2019-06-14 Thread Nick Crews
some logging, removes an unneeded lock() from around a check for dev_data->exist in hangup_device(), removes an unneeded null event pointer check in enqueue_events(), adds some helper macros to calculate the size of events, and corrects some comments. Signed-off-by: Nick Crews --- drivers/platf

[PATCH 1/2] platform/chrome: wilco_ec: Fix unreleased lock in event_read()

2019-06-14 Thread Nick Crews
When copying an event to userspace failed, the event queue lock was never released. This fixes that. Reported-by: Dan Carpenter Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome

Re: [PATCH v4] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-14 Thread Nick Crews
lso fix the alignment in Kconfig file for this config option > replacing the spaces by tabs. > > Signed-off-by: Enric Balletbo i Serra > Reviewed-by: Ezequiel Garcia > Tested-by: Nick Crews > --- > Hi, > > This is another attempt to solve the issue to be able to select at &g

Re: [PATCH v3] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-13 Thread Nick Crews
ct the > EC variant at compile-time. > > While here also fix the alignment in Kconfig file for this config option > replacing the spaces by tabs. > > Signed-off-by: Enric Balletbo i Serra > Reviewed-by: Ezequiel Garcia > Tested-by: Nick Crews > --- > Hi, > > Th

Re: [PATCH v2] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-10 Thread Nick Crews
A few nits below, and otherwise looks good to me! On Fri, Jun 7, 2019 at 2:51 PM Enric Balletbo Serra wrote: > > Hi, > > Missatge de Guenter Roeck del dia dv., 7 de juny > 2019 a les 22:11: > > > > On Fri, Jun 7, 2019 at 12:27 PM Nick Crews wrote: > > >

Re: [PATCH v2] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-07 Thread Nick Crews
Actually adding Stefan Reinauer this time... On Fri, Jun 7, 2019 at 1:26 PM Nick Crews wrote: > > Hi! > > On Fri, Jun 7, 2019 at 12:03 PM Ezequiel Garcia > wrote: > > > > On Fri, 2019-06-07 at 12:27 +0200, Enric Balletbo i Serra wrote: > > > On many boar

Re: [PATCH v2] platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime

2019-06-07 Thread Nick Crews
Hi! On Fri, Jun 7, 2019 at 12:03 PM Ezequiel Garcia wrote: > > On Fri, 2019-06-07 at 12:27 +0200, Enric Balletbo i Serra wrote: > > On many boards, communication between the kernel and the Embedded > > Controller happens over an LPC bus. In these cases, the kernel config > > CONFIG_CROS_EC_LPC

Re: [PATCH v2] platform/chrome: wilco_ec: Add version sysfs entries

2019-06-05 Thread Nick Crews
sys/bus/platform/devices/GOOG000C:00 > > $ tail build_date build_revision version model_number > > ==> build_date <== > > 04/25/19 > > > > ==> build_revision <== > > d2592cae0 > > > > ==> version <== > > 00.00.14 > > > &

Re: [PATCH v5] platform/chrome: wilco_ec: Add telemetry char device interface

2019-05-24 Thread Nick Crews
Hey Enric, thanks for the review! On Fri, May 24, 2019 at 3:51 AM Enric Balletbo i Serra wrote: > > Hi Nick, > > I'm mostly fine with it but ... > > On 21/5/19 21:20, Nick Crews wrote: > > The Wilco Embedded Controller is able to send telemetry data > >

Re: [PATCH] platform/chrome: wilco_ec: Add version sysfs entries

2019-05-23 Thread Nick Crews
On Tue, May 21, 2019 at 9:15 AM Raul E Rangel wrote: > > Add the ability to extract version information from the EC. > > Signed-off-by: Raul E Rangel Looks good to me, thanks Raul! I applied to the chromium branch, and it works. Reviewed-by: Nick Crews Tested-by

[PATCH v4] platform/chrome: wilco_ec: Add event handling

2019-05-23 Thread Nick Crews
the binary data with $ cat /dev/wilco_event0 | hexdump -ve '1/1 "%x\n"' and then create an event by plugging/unplugging the battery. Signed-off-by: Nick Crews --- v4 changes: - Added size limit to queue to kernel would not run out of memory if there were no userspace consumers - Chan

[PATCH v5] platform/chrome: wilco_ec: Add telemetry char device interface

2019-05-21 Thread Nick Crews
the EC's firmware build date, by sending the WILCO_EC_TELEM_GET_VERSION command with argument index=3. i.e. write [0x38, 0x00, 0x03] to the device node. An ASCII string of the build date is returned. Signed-off-by: Nick Crews --- v5 changes: - Free device data in callback so that it isn't freed while

Re: [PATCH v3 1/2] platform/chrome: wilco_ec: Add Boot on AC support

2019-05-10 Thread Nick Crews
Thanks for the review Enric! I can resend the patch with the fixes, or if you think the fixes are simple enough, you could tweak them as you apply them. Let me know if you want me to resend a clean version. > > + > > +static DEVICE_ATTR_WO(boot_on_ac); > > Is not possible to read the flag? From

[PATCH v4 1/2] platform/chrome: wilco_ec: Remove 256 byte transfers

2019-05-08 Thread Nick Crews
The 0xF6 command, intended to send and receive 256 byte payloads to and from the EC, is not needed. The 0xF5 command for 32 byte payloads is sufficient. This patch removes support for the 0xF6 command and 256 byte payloads. Signed-off-by: Nick Crews --- v4 changes: - Fix debug format string

[PATCH v4 2/2] platform/chrome: wilco_ec: Add telemetry char device interface

2019-05-08 Thread Nick Crews
. For testing purposes, try requesting the EC's firmware build date, by sending the WILCO_EC_TELEM_GET_VERSION command with argument index=3. i.e. write [0x38, 0x00, 0x03, ...(29 more 0s)] to the device node. An ASCII string of the build date is returned. Signed-off-by: Nick Crews --- v3 changes

[PATCH v9 1/2] power_supply: wilco_ec: Add charging config driver

2019-05-08 Thread Nick Crews
Add a driver to control the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews Reviewed-by: Enric Balletbo i Serra --- v9 changes: -Split up adding the driver and adding the device

[PATCH v9 2/2] platform/chrome: wilco_ec: Add charging config device

2019-05-08 Thread Nick Crews
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. Signed-off-by: Nick Crews Reviewed-by: Enric

[PATCH v3 2/2] platform/chrome: wilco_ec: Add telemetry char device interface

2019-05-06 Thread Nick Crews
. For testing purposes, try requesting the EC's firmware build date, by sending the WILCO_EC_TELEM_GET_VERSION command with argument index=3. i.e. write [0x38, 0x00, 0x03, ...(29 more 0s)] to the device node. An ASCII string of the build date is returned. Signed-off-by: Nick Crews --- v3 changes

[PATCH v3 1/2] platform/chrome: wilco_ec: Remove 256 byte transfers

2019-05-06 Thread Nick Crews
The 0xF6 command, intended to send and receive 256 byte payloads to and from the EC, is not needed. The 0xF5 command for 32 byte payloads is sufficient. This patch removes support for the 0xF6 command and 256 byte payloads. Signed-off-by: Nick Crews --- Documentation/ABI/testing/debugfs-wilco

[PATCH v2 1/2] platform/chrome: wilco_ec: Remove 256 byte transfers

2019-05-02 Thread Nick Crews
The 0xF6 command, intended to send and receive 256 byte payloads to and from the EC, is not needed. The 0xF5 command for 32 byte payloads is sufficient. This patch removes support for the 0xF6 command and 256 byte payloads. Signed-off-by: Nick Crews --- Documentation/ABI/testing/debugfs-wilco

[PATCH v2 2/2] platform/chrome: wilco_ec: Add telemetry char device interface

2019-05-02 Thread Nick Crews
. For testing purposes, try requesting the EC's firmware build date, by sending the WILCO_EC_CMD_GET_VERSION command with argument index=3. i.e. write [0x38, 0x00, 0x03, ...(29 more 0s)] to the device node. An ASCII string of the build date is returned. Signed-off-by: Nick Crews --- v2 changes

Re: [PATCH v3 1/2] platform/chrome: wilco_ec: Add Boot on AC support

2019-05-01 Thread Nick Crews
Hi Enric, Are these two patches an acceptable use of sysfs? There were concerns earlier about abusing sysfs, but I think that these two uses follow other sysfs use-cases well. Thanks, Nick

Re: [PATCH v7 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-05-01 Thread Nick Crews
Hi Enric and Sebastian, I sent out a v8 to address Enric's nits: https://lore.kernel.org/patchwork/patch/1065815/ Thanks, Nick

[PATCH v8 1/2] platform/chrome: wilco_ec: Add property helper library

2019-04-24 Thread Nick Crews
be more complex binary data. This patch adds support for getting and setting properties. This will be useful for setting the charge algorithm and charge schedules, which all use properties. Signed-off-by: Nick Crews Acked-for-chrome-by: Enric Balletbo i Serra --- v7 changes: -Remove bogus gerrit

[PATCH v8 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-24 Thread Nick Crews
Add control of the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews Reviewed-by: Enric Balletbo i Serra --- v8 changes: -Several documentation and comment fixups. v6 changes

[PATCH v7 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-22 Thread Nick Crews
Add control of the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews --- v6 changes: -Remove CHARGE_MODE_ILLEGAL from enum charge_mode. It's not a public type, and error checking

[PATCH v7 1/2] platform/chrome: wilco_ec: Add property helper library

2019-04-22 Thread Nick Crews
be more complex binary data. This patch adds support for getting and setting properties. This will be useful for setting the charge algorithm and charge schedules, which all use properties. Signed-off-by: Nick Crews --- v7 changes: -Remove bogus gerrit FROMLIST tag in commit title v6 changes: -Add

[PATCH v6 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-22 Thread Nick Crews
Add control of the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews --- v6 changes: -Remove CHARGE_MODE_ILLEGAL from enum charge_mode. It's not a public type, and error checking

[PATCH v6 1/2] FROMLIST: platform/chrome: wilco_ec: Add property helper library

2019-04-22 Thread Nick Crews
be more complex binary data. This patch adds support for getting and setting properties. This will be useful for setting the charge algorithm and charge schedules, which all use properties. Signed-off-by: Nick Crews --- v6 changes: -Add EC_* prefix to enum property_ops so they are more unique

[PATCH v5] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-18 Thread Nick Crews
of power_supply_register(), which simplifies things -Add extra error checking on property messages received from the EC -Fix bug in memcpy() calls in properties.c -Refactor fill_property_id() -Add valid input checks to charge_type -Properly convert charge_type when get()ting Signed-off-by: Nick Crews --- .../ABI

Re: [PATCH v4 1/2] power_supply: Add more charge types and CHARGE_CONTROL_* properties

2019-04-18 Thread Nick Crews
On Wed, Apr 17, 2019 at 3:40 PM Sebastian Reichel wrote: > > Hi, > > The changes itself look all good to me, but this does multiple > things in a single patch, so please split it into multiple commits. Thanks Sebastian! I split this into 3 commits: -add more charge_type's -add more

[PATCH v5 1/3] power_supply: Add Standard, Adaptive, and Custom charge types

2019-04-18 Thread Nick Crews
L_END_THRESHOLD properties into two different commits. v4 changes: - Add documentation for the new properties, and add documentation for the the previously missing charge_control_limit and charge_control_limit_max properties. Signed-off-by: Nick Crews --- Documentation/ABI/testing/sys

[PATCH v5 2/3] power_supply: Add CHARGE_CONTROL_{START_THRESHOLD,END_THRESHOLD} properties

2019-04-18 Thread Nick Crews
trol_limit and charge_control_limit_max properties. Signed-off-by: Nick Crews --- Documentation/ABI/testing/sysfs-class-power | 20 drivers/power/supply/power_supply_sysfs.c | 2 ++ include/linux/power_supply.h| 2 ++ 3 files changed, 24 insertions(+) diff --git a/Doc

[PATCH v5 3/3] power_supply: Add missing documentation for CHARGE_CONTROL_* properties

2019-04-18 Thread Nick Crews
The existing POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT and POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX properties don't have documentation. I add that documentation here. v5 changes: - Split this commit out from the previous two commits. Signed-off-by: Nick Crews --- Documentation/ABI/testing

Re: [PATCH v3 1/2] platform/chrome: wilco_ec: Add Boot on AC support

2019-04-18 Thread Nick Crews
There's one error that Guenter just found... > + > +int wilco_ec_add_sysfs(struct wilco_ec_device *ec) > +{ > + return sysfs_create_group(>dev->kobj, _dev_attr_group); > +} > + > +void wilco_ec_remove_sysfs(struct wilco_ec_device *ec) > +{ > + sysfs_create_group(>dev->kobj,

[PATCH v3 2/2] platform/chrome: wilco_ec: Add USB PowerShare Policy control

2019-04-16 Thread Nick Crews
documentation to Documentation/ABI/testing/sysfs-platform-wilco-ec - Zero out reserved bytes in requests. Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-platform-wilco-ec | 16 drivers/platform/chrome/wilco_ec/sysfs.c | 92 +++ 2 files changed, 108 insertions(

[PATCH v3 1/2] platform/chrome: wilco_ec: Add Boot on AC support

2019-04-16 Thread Nick Crews
v2 changes: - Move documentation to Documentation/ABI/testing/sysfs-platform-wilco-ec Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-platform-wilco-ec | 11 +++ drivers/platform/chrome/wilco_ec/Makefile | 2 +- drivers/platform/chrome/wilco_ec/core.c | 9 +++ drivers/plat

[PATCH v4 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-16 Thread Nick Crews
get()ting Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-class-power-wilco | 30 +++ drivers/platform/chrome/wilco_ec/Kconfig | 9 + drivers/platform/chrome/wilco_ec/Makefile | 2 + drivers/platform/chrome/wilco_ec/core.c | 16 ++ drivers/platform/chrome/wilco_ec

[PATCH v4 1/2] power_supply: Add more charge types and CHARGE_CONTROL_* properties

2019-04-16 Thread Nick Crews
ONTROL_END_THRESHOLD. v4 changes: - Add documentation for the new properties, and add documentation for the the previously missing charge_control_limit and charge_control_limit_max properties. Signed-off-by: Nick Crews --- Documentation/ABI/testing/sysfs-class-power | 51 +++-- drivers/p

[PATCH] platform/chrome: wilco_ec: Add telemetry data char device interface

2019-04-12 Thread Nick Crews
, it will return an inverted copy of the input sequence. For an example, run the simple python script from https://gist.github.com/52ab07c8519b56c0ec671d3338760516 Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/Kconfig | 7 + drivers/platform/chrome/wilco_ec/Makefile

[PATCH v4 1/2] platform/chrome: wilco_ec: Fix documentation for debugfs raw attribute

2019-04-12 Thread Nick Crews
well as de-duplicates the documentation by removing it from the source file header comment. Signed-off-by: Nick Crews --- Documentation/ABI/testing/debugfs-wilco-ec | 32 ++ drivers/platform/chrome/wilco_ec/debugfs.c | 27 +- 2 files changed, 22 inserti

[PATCH v4 2/2] platform/chrome: wilco_ec: Add h1_gpio status to debugfs

2019-04-12 Thread Nick Crews
hanges in v2: - Zero out the unused fields in the request. - Format result as "%02x\n" instead of as a decimal. Signed-off-by: Nick Crews --- Documentation/ABI/testing/debugfs-wilco-ec | 13 ++ drivers/platform/chrome/wilco_ec/debugfs.c | 47 ++ 2 files changed

[PATCH v3 2/2] power_supply: platform/chrome: wilco_ec: Add charging config driver

2019-04-11 Thread Nick Crews
-Fix bug in memcpy() calls in properties.c -Refactor fill_property_id() -Add valid input checks to charge_type -Properly convert charge_type when get()ting Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-class-power-wilco | 30 +++ drivers/platform/chrome/wilco_ec/Kconfig | 9

[PATCH v3 1/2] power_supply: Add more charge types and CHARGE_CONTROL_* properties

2019-04-11 Thread Nick Crews
for some other algorithm. For example, in the use case that I am supporting, this means the battery begins charging when the percentage level drops below POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD and charging ceases when the percentage level goes above POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRE

[PATCH v2 1/2] power_supply: Add more charge types and CHARGE_CONTROL_* properties

2019-04-11 Thread Nick Crews
for some other algorithm. For example, in the use case that I am supporting, this means the battery begins charging when the percentage level drops below POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD and charging ceases when the percentage level goes above POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRE

[PATCH v2 2/2] power_supply: wilco_ec: Add charging config driver for Wilco EC

2019-04-11 Thread Nick Crews
Add control of the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-class-power-wilco | 30 +++ drivers/platform/chrome/wilco_ec/Kconfig

Re: [PATCH v3] platform/chrome: wilco_ec: Add h1_gpio status to debugfs

2019-04-11 Thread Nick Crews
Thanks for the comments Enric! I'll resend in a day or two. On Thu, Apr 11, 2019 at 3:43 PM Enric Balletbo Serra wrote: > > Hi Nick, > > Some comments below ... > > Missatge de Nick Crews del dia dj., 11 d’abr. > 2019 a les 0:09: > > > > As part of Chrome OS

[PATCH v2 2/2] platform/chrome: wilco_ec: Add USB PowerShare Policy control

2019-04-10 Thread Nick Crews
sts. Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-platform-wilco-ec | 16 drivers/platform/chrome/wilco_ec/sysfs.c | 93 +++ 2 files changed, 109 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-wilco-ec b/Documentation/ABI/testing/sy

[PATCH v2 1/2] platform/chrome: wilco_ec: Add Boot on AC support

2019-04-10 Thread Nick Crews
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 Signed-off-by: Nick Crews --- .../ABI

[PATCH v3] platform/chrome: wilco_ec: Add h1_gpio status to debugfs

2019-04-10 Thread Nick Crews
even related to the AP. The GPIO runs between the EC and the H1 security chip. Changes in v3: - Fix documentation to correspond with formatting change in v2. Changes in v2: - Zero out the unused fields in the request. - Format result as "%02x\n" instead of as a decimal. Signed-off-by:

[PATCH v2] platform/chrome: wilco_ec: Add h1_gpio status to debugfs

2019-04-10 Thread Nick Crews
even related to the AP. The GPIO runs between the EC and the H1 security chip. Changes in v2: - Zero out the unused fields in the request. - Format result as "%02x\n" instead of as a decimal. Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/debugfs.c | 64 +++

[PATCH] platform/chrome: wilco_ec: Add h1_gpio status to debugfs

2019-04-10 Thread Nick Crews
even related to the AP. The GPIO runs between the EC and the H1 security chip. Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/debugfs.c | 66 +- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers

Re: [PATCH v3] platform/chrome: Add Wilco EC Event Handling

2019-04-09 Thread Nick Crews
Hi! I know people had questions with the structure/uses of the events in the previous versions of this patch. Does this clear things up? Thanks, Nick On Wed, Apr 3, 2019 at 6:31 PM Nick Crews wrote: > > The Wilco Embedded Controller can create custom events that > are not handled as

[PATCH v6] platform/chrome: Add Wilco EC keyboard backlight LEDs support

2019-04-08 Thread Nick Crews
Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/Kconfig | 9 + drivers/platform/chrome/wilco_ec/Makefile | 2 + drivers/platform/chrome/wilco_ec/core.c | 58 ++ .../chrome/wilco_ec/kbd_led_backlight.c | 166 ++ include/linux/platform_

Re: [PATCH v5 3/3] platform/chrome: Standardize Chrome OS keyboard backlight name

2019-04-08 Thread Nick Crews
I've just found a few [embarrassing :)] bugs in this version, so after we figure out the naming, please wait for me to send out another patch that fixes these. Thanks, Nick On Thu, Apr 4, 2019 at 11:10 AM Nick Crews wrote: > > We want all backlights for the system keyboard to > use

[PATCH 2/2] power_supply: wilco_ec: Add charging config driver for Wilco EC

2019-04-05 Thread Nick Crews
Add control of the charging algorithm used on Wilco devices. See Documentation/ABI/testing/sysfs-class-power-wilco for the userspace interface and other info. Signed-off-by: Nick Crews --- .../ABI/testing/sysfs-class-power-wilco | 30 +++ drivers/platform/chrome/wilco_ec/Kconfig

[PATCH 1/2] power_supply: Add more charge types and CHARGE_CONTROL_* properties

2019-04-05 Thread Nick Crews
for some other algorithm. For example, in the use case that I am supporting, this means the battery begins charging when the percentage level drops below POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD and charging ceases when the percentage level goes above POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRE

Re: [PATCH 1/3] platform/chrome: wilco_ec: Standardize mailbox interface

2019-04-05 Thread Nick Crews
> > Now I'm confused, isn't this the same patch I picked this morning from > you and is already applied in chrome-platform for-next? > Sorry, I didn't see that it was already applied in for-next. Just ignore this patch and assume that the next two in this series are based off the current state of

[PATCH 2/3] platform/chrome: wilco_ec: Add USB PowerShare Policy control

2019-04-05 Thread Nick Crews
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. Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/Makefile | 2 +- drivers/platform/chrome/wilco_ec/cor

[PATCH 1/3] platform/chrome: wilco_ec: Standardize mailbox interface

2019-04-05 Thread Nick Crews
wilco_ec_message. This results in the reduction of total code, and makes it much more maintainable and understandable. Signed-off-by: Nick Crews Acked-by: Alexandre Belloni --- drivers/platform/chrome/wilco_ec/debugfs.c | 43 --- drivers/platform/chrome/wilco_ec/mailbox.c | 53 ---

[PATCH 3/3] platform/chrome: wilco_ec: Add Boot on AC support

2019-04-05 Thread Nick Crews
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. Signed-off-by: Nick Crews --- drivers/platform/chrome/wilco_ec/sysfs.c | 52 1 file changed, 52

[PATCH] platform/chrome: wilco_ec: Standardize mailbox interface

2019-04-04 Thread Nick Crews
in the reduction of total code, and makes it much more maintainable and understandable. Signed-off-by: Nick Crews Acked-by: Alexandre Belloni --- drivers/platform/chrome/wilco_ec/debugfs.c | 43 --- drivers/platform/chrome/wilco_ec/mailbox.c | 53 -- drivers/rt

Re: [PATCH v5 3/3] platform/chrome: Standardize Chrome OS keyboard backlight name

2019-04-04 Thread Nick Crews
On Thu, Apr 4, 2019 at 11:43 AM Dmitry Torokhov wrote: > > On Thu, Apr 4, 2019 at 10:36 AM Guenter Roeck wrote: > > > > On Thu, Apr 4, 2019 at 10:11 AM Nick Crews wrote: > > > > > > We want all backlights for the system keyboard to > > > use a comm

[PATCH v5 3/3] platform/chrome: Standardize Chrome OS keyboard backlight name

2019-04-04 Thread Nick Crews
t;platform" name. We want to make it so all Chrome OS devices are consistent, so we'll change the name here too. The Power Manager daemon only looks for LEDs that match the pattern "*:kbd_backlight", so this change won't affect that. Signed-off-by: Nick Crews --- drivers/platform/chrome

[PATCH v5 2/3] platform/chrome: Add Wilco EC keyboard backlight LEDs support

2019-04-04 Thread Nick Crews
elf. -Use a __packed struct as message instead of opaque array -Add exported wilco_ec_keyboard_leds_exist() so the core driver now only creates a platform _device if relevant -Fix use of keyboard_led_set_brightness() since it can sleep Signed-off-by: Nick Crews Acked-by: Jacek Anaszewski -

[PATCH v5 1/3] platform/chrome: wilco_ec: Standardize mailbox interface

2019-04-04 Thread Nick Crews
wilco_ec_message. This results in the reduction of total code, and makes it much more maintainable and understandable. Signed-off-by: Nick Crews Acked-by: Alexandre Belloni --- drivers/platform/chrome/wilco_ec/debugfs.c | 43 --- drivers/platform/chrome/wilco_ec/mailbox.c | 53 ---

  1   2   3   >