[PATCH v2 1/2] platform/chrome: Use dev_groups to set device sysfs attributes

2021-04-05 Thread Gwendal Grignou
Signed-off-by: Gwendal Grignou --- New in v2. drivers/platform/chrome/cros_ec_sysfs.c | 28 + 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c index f07eabcf9494c..114b9dbe98

[PATCH v2 2/2] platform/chrome: Update cros_ec sysfs attributes on sensors discovery

2021-04-05 Thread Gwendal Grignou
been created. Fixes: d60ac88a62df ("mfd / platform / iio: cros_ec: Register sensor through sensorhub") Cc: sta...@vger.kernel.org Signed-off-by: Gwendal Grignou --- Changes in v2: Rebase after .dev_groups is used. drivers/platform/chrome/cros_ec_sensorhub.c | 6 +- driver

[PATCH v2 0/2] platform/chrome: Update cros_ec sysfs attribute after sensors are found

2021-04-05 Thread Gwendal Grignou
obed after the cros_ec_sysfs driver that sets the attribute. Therefore, we need to upgrade the cros_ec sysfs groups in the sensorhub probe routine. The first patch cleans up cros_ec_sysfs by using .dev_groups driver field, the second patch fixes the problem. Gwendal Grignou (2): platform/chrome: Use

[PATCH] platform/chrome: Update cros_ec sysfs attributes on sensors discovery

2021-04-03 Thread Gwendal Grignou
been created. Fixes: d60ac88a62df ("mfd / platform / iio: cros_ec: Register sensor through sensorhub") Cc: sta...@vger.kernel.org Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec_sensorhub.c | 5 - drivers/platform/chrome/cros_ec_sysfs.c | 2 ++ inc

Re: [PATCH v6 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-03-12 Thread Gwendal Grignou
he kernel of proximity. Similarly, when proximity detects > > > > something far away it sets the switch bit to 0. For now this driver > > > > exposes a single sensor, but it could be expanded in the future via more > > > > MKBP bits if desired. > >

Re: [PATCH v6 03/24] iio: make use of devm_iio_kfifo_buffer_setup() helper

2021-02-16 Thread Gwendal Grignou
Reviewed-by: Gwendal Grignou On Mon, Feb 15, 2021 at 4:11 AM Jonathan Cameron wrote: > > On Mon, 15 Feb 2021 12:40:22 +0200 > Alexandru Ardelean wrote: > > > All drivers that already call devm_iio_kfifo_allocate() & > > iio_device_attach_bu

Re: [PATCH v5 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-02-12 Thread Gwendal Grignou
On Wed, Feb 10, 2021 at 9:45 AM Stephen Boyd wrote: > > Quoting Gwendal Grignou (2021-02-10 00:29:45) > > On Tue, Feb 9, 2021 at 6:51 PM Stephen Boyd wrote: > > > + if (event_type == EC_MKBP_EVENT_SWITCH) { > > > +

Re: [PATCH v5 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-02-10 Thread Gwendal Grignou
c: Guenter Roeck > Cc: Douglas Anderson > Cc: Gwendal Grignou > Reviewed-by: Enric Balletbo i Serra > Signed-off-by: Stephen Boyd > --- > > Changes from v4: > * Dropped of_match_ptr() > > drivers/iio/proximity/Kconfig | 11 + &

Re: [PATCH 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-01-26 Thread Gwendal Grignou
On Mon, Jan 25, 2021 at 3:44 PM Stephen Boyd wrote: > > Quoting Gwendal Grignou (2021-01-25 14:28:46) > > On Mon, Jan 25, 2021 at 10:52 AM Stephen Boyd wrote: > > > > > > Quoting Gwendal Grignou (2021-01-24 13:41:44) > > > > On Sun, Jan 24, 2021 a

Re: [PATCH 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-01-25 Thread Gwendal Grignou
On Mon, Jan 25, 2021 at 10:52 AM Stephen Boyd wrote: > > Quoting Gwendal Grignou (2021-01-24 13:41:44) > > On Sun, Jan 24, 2021 at 9:38 AM Jonathan Cameron wrote: > > > > > > On Fri, 22 Jan 2021 14:54:43 -0800 > > > Stephen Boyd wrote: > > > &g

Re: [PATCH 3/3] iio: proximity: Add a ChromeOS EC MKBP proximity driver

2021-01-24 Thread Gwendal Grignou
n the future via more > > MKBP bits if desired. > > > > Cc: Dmitry Torokhov > > Cc: Benson Leung > > Cc: Guenter Roeck > > Cc: Douglas Anderson > > Cc: Gwendal Grignou > > Signed-off-by: Stephen Boyd > > Hi Stephen, > > Looks more or l

Re: [PATCH 2/3] dt-bindings: iio: Add cros ec proximity yaml doc

2021-01-24 Thread Gwendal Grignou
de that is a child of the main cros_ec device node. Devices that > > have this ability will describe this in firmware. > > > > Cc: Dmitry Torokhov > > Cc: Benson Leung > > Cc: Guenter Roeck > > Cc: Douglas Anderson > > Cc: Gwendal Grignou > > Cc: &g

Re: [PATCH v4 2/2] mfd: cros_ec: Add peripheral device charger

2021-01-23 Thread Gwendal Grignou
If there is a feature flag in the EC (see ec_feature_code), you can use cros_subdevices instead. > }; > > static const struct mfd_cell cros_ec_vbc_cells[] = { > -- > 2.30.0.280.ga3ce27912f-goog > Reviewed-by: Gwendal Grignou

Re: [PATCH v4 1/2] power: supply: PCHG: Peripheral device charger

2021-01-23 Thread Gwendal Grignou
On Sat, Jan 23, 2021 at 7:53 AM Daisuke Nojiri wrote: > > This patch adds a driver for PCHG (Peripheral CHarGer). PCHG is a > framework managing power supplies for peripheral devices. > > This driver creates a sysfs node for each peripheral charge port: > > /sys/class/power_supply/PCHGn >

[PATCH v2 1/2] platform: cros_ec: Call interrupt bottom half in ISH or RPMSG mode

2021-01-21 Thread Gwendal Grignou
Call the same bottom half for all EC protocols (threaded code). Signed-off-by: Gwendal Grignou --- Changes since v1: - Fix merge issues, make changes in cros_ec.h instead of cros_ec_proto.h - Fix function comments syntax. drivers/platform/chrome/cros_ec.c | 26

[PATCH v2 0/2] platform: chrome: Simplify interrupt path

2021-01-21 Thread Gwendal Grignou
comments syntax. Gwendal Grignou (2): platform: cros_ec: Call interrupt bottom half in ISH or RPMSG mode platform: cros_ec: Call interrupt bottom half at probe time drivers/platform/chrome/cros_ec.c | 33 - drivers/platform/chrome/cros_ec.h | 4 ++- drivers

[PATCH v2 2/2] platform: cros_ec: Call interrupt bottom half at probe time

2021-01-21 Thread Gwendal Grignou
While the AP was powered off, the EC may have send messages. If the message is not serviced within 3s, the EC stops sending message. Unlock the EC by purging stale messages at probe time. Signed-off-by: Gwendal Grignou --- Changes since v1: None. drivers/platform/chrome/cros_ec.c | 7

[PATCH 2/2] platform: cros_ec: Call interrupt bottom half at probe time

2020-12-10 Thread Gwendal Grignou
While the AP was powered off, the EC may have send messages. If the message is not serviced within 3s, the EC stops sending message. Unlock the EC by purging stale messages at probe time. Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec.c | 7 +++ 1 file changed, 7

[PATCH 0/2] platform: chrome: Simplify interrupt path

2020-12-10 Thread Gwendal Grignou
Irrespective of the transport (i2c, spi, ish, rpmsg), have all cros ec interrupt stack call the threaded part (bottom half) of the interrupt handler. Fix an issue where EC could be stuck if it sends a message while the AP is not powered on. Gwendal Grignou (2): platform: cros_ec: Call interrupt

[PATCH 1/2] platform: cros_ec: Call interrupt bottom half in ISH or RPMSG mode

2020-12-10 Thread Gwendal Grignou
Call the same bottom half for all EC protocols (threaded code). Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec.c | 26 - drivers/platform/chrome/cros_ec_ishtp.c | 6 + drivers/platform/chrome/cros_ec_rpmsg.c | 6 + include

Re: [PATCH 1/2] platform/chrome: cros_ec_proto: Update cros_ec_cmd_xfer() call-sites

2020-09-18 Thread Gwendal Grignou
t; > > > As part of this update, change the error handling inside > > > cros_ec_get_sensor_count() such that the legacy LPC interface is tried > > > on all error values, not just when msg->result != EC_RESULT_SUCCESS. > > > > > > Signed-off-by: Prashant

Re: [PATCH] platform/chrome: Kconfig: Remove the transitional MFD_CROS_EC config

2020-09-03 Thread Gwendal Grignou
red anymore > > because all the defconfigs have been removed this option and migrated to > > enable the CrOS EC parts individually. > > > > Signed-off-by: Enric Balletbo i Serra > > Reviewed-by: Guenter Roeck Tested-by: Gwendal Grignou > > > --- > > > > dri

Re: [PATCH v2] platform: cros_ec: Reduce ligthbar get version command

2020-08-30 Thread Gwendal Grignou
On Sat, Aug 29, 2020 at 8:54 AM Jonathan Cameron wrote: > > On Tue, 25 Aug 2020 17:29:45 -0700 > Gwendal Grignou wrote: > > > By default, the lightbar commands are set to the > > biggest lightbar command and response. That length is greater than 128 > > bytes an

[PATCH v3] platform: cros_ec: Reduce ligthbar get version command

2020-08-30 Thread Gwendal Grignou
be: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128, result: 0 Afer: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 1, insize: 8, result: 0 Fixes: a841178445bb7 ("mfd: cros_ec: Use a zero-length array for command data") Signed-off-by: Gwend

Re: [PATCH v2] platform: cros_ec: Reduce ligthbar get version command

2020-08-28 Thread Gwendal Grignou
[-iio list][+kernel list] On Tue, Aug 25, 2020 at 5:29 PM Gwendal Grignou wrote: > > By default, the lightbar commands are set to the > biggest lightbar command and response. That length is greater than 128 > bytes and may not work on all machines. > But all EC are prob

[PATCH] platform: cros_ec: Add fields to command traces

2020-08-15 Thread Gwendal Grignou
026: cros_ec_request_done: version: 0, offset: 1, command: EC_CMD_USB_PD_POWER_INFO, outsize: 1, insize: 16, ec result: EC_RES_SUCCESS, retval: 16 Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec_trace.h | 27 +++-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --

[PATCH] platform: cros_ec: Reduce ligthbar get version command

2020-08-15 Thread Gwendal Grignou
the command would be: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128, result: 0 Afer: cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 1, insize: 8, result: 0 Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec_lightbar.c | 2 ++ 1

[PATCH] platform: cros_ec: sensorhub: Simplify legacy timestamp spreading

2020-07-28 Thread Gwendal Grignou
5ms-+-+-+---> t Afer, at host level 1 2 3 4 5 --interrupt delay--+-2.5ms-+-2.5ms-+-2.5ms-+-2.5ms-+---> t Signed-off-by: Gwendal Grignou --- .../platform/chrome/cros_ec_sensorhub_ring.c | 94 +++ 1 file changed, 33 insertio

[PATCH] platform: chrome: Fix EC timestamp overflow

2020-06-30 Thread Gwendal Grignou
EC is using 32 bit timestamps (us), and before converting it to 64bit they were not casted, so it would overflow every 4s. Regular overflow every ~70 minutes was not taken into acoun either. Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec_sensorhub_ring.c | 4 +--- 1 file

Re: [PATCH] platform/chrome: cros_ec_spi: Document missing function parameters

2020-06-25 Thread Gwendal Grignou
Reviewed-by: Gwendal Grignou On Thu, Jun 25, 2020 at 10:02 AM Enric Balletbo i Serra wrote: > > Kerneldoc expects all kernel function members to be documented. > > Fixes the following W=1 level warnings: > > cros_ec_spi.c:153: warning: Function parameter or member 'ec_dev

Re: [PATCH] platform/chrome: cros_ec_rpmsg: Document missing struct parameters

2020-06-25 Thread Gwendal Grignou
Reviewed-by: Gwendal Grignou On Thu, Jun 25, 2020 at 10:03 AM Enric Balletbo i Serra wrote: > > Kerneldoc expects all kernel structure member to be documented. > > Fixes the following W=1 level warnings: > > cros_ec_rpmsg.c:49: warning: Function parameter or member 'ept

[PATCH] iio: cros_ec: Reapply range at resume

2020-05-26 Thread Gwendal Grignou
EC does not currently preserve range across sensor reinit. If sensor is powered down at suspend, it will default to the EC default range at resume, not the range set by the host. Save range if modified, and apply at resume. Signed-off-by: Gwendal Grignou --- .../common/cros_ec_sensors

[PATCH v2] platform: cros_ec_debugfs: control uptime information request

2020-05-26 Thread Gwendal Grignou
When EC does not support uptime command (EC_CMD_GET_UPTIME_INFO), do not create the uptime sysfs entry point. User space application will not probe the file needlessly. The EC console log will not contain EC_CMD_GET_UPTIME_INFO anymore. Signed-off-by: Gwendal Grignou --- drivers/platform

Re: [PATCH] platform: cros_ec_debugfs: control uptime information request

2020-05-26 Thread Gwendal Grignou
On Thu, May 21, 2020 at 2:21 AM Enric Balletbo i Serra wrote: > > Hi Gwendal, > > Thank you for your patch. > > On 21/5/20 7:28, Gwendal Grignou wrote: > > When EC does not support uptime command (EC_CMD_GET_UPTIME_INFO), > > return -EPROTO to read of /sys/kerne

[PATCH] platform: cros_ec_debugfs: control uptime information request

2020-05-20 Thread Gwendal Grignou
When EC does not support uptime command (EC_CMD_GET_UPTIME_INFO), return -EPROTO to read of /sys/kernel/debug/cros_ec/uptime without calling the EC after the first try. The EC console log will not contain EC_CMD_GET_UPTIME_INFO anymore. Signed-off-by: Gwendal Grignou --- drivers/platform

Re: [PATCH v2 1/3] iio: Add in_illumincance vectors in different color spaces

2020-05-11 Thread Gwendal Grignou
On Fri, May 8, 2020 at 8:16 AM Jonathan Cameron wrote: > > On Wed, 6 May 2020 16:03:22 -0700 > Gwendal Grignou wrote: > > Illuminance in the title. Plus I'm still arguing these > aren't illuminance values. > > The Y value is illuminance but X and Z definitely aren

[PATCH v2 3/3] iio: cros_ec_light: Add support for RGB sensor

2020-05-06 Thread Gwendal Grignou
tools can be used to gather sensor information: iio_readdev -s 10 cros-ec-light \ illuminance_clear illuminance_x illuminance_y illuminance_z To match IIO ABI, the clear illuminance channel has been renamed in_illuminance_clear_raw from in_illuminance_input. Signed-off-by: Gwendal Grignou --- d

[PATCH v3 0/3] iio: cros_ec: Add support for RGB light sensor

2020-05-06 Thread Gwendal Grignou
1931 XYZ color space (XYZ) and take adavantage of color sensor autocalibration to provide the most accurate measurements. Gwendal Grignou (3): iio: Add in_illumincance vectors in different color spaces iio: cros_ec: Allow enabling/disabling calibration mode iio: cros_ec_light: Add support

[PATCH v2 1/3] iio: Add in_illumincance vectors in different color spaces

2020-05-06 Thread Gwendal Grignou
is illumincance, and XY caries the chromaticity information. The matrix is model specific, as the color sensor can be behing a glass that can filter some wavelengths. Signed-off-by: Gwendal Grignou --- New in v2. Documentation/ABI/testing/sysfs-bus-iio | 27 + 1 file changed, 27

[PATCH v2 2/3] iio: cros_ec: Allow enabling/disabling calibration mode

2020-05-06 Thread Gwendal Grignou
calibration was a one-shot event sent to the sensor to calibrate itself. It is used on Bosch sensors (BMI160, BMA254). For TCS3400 light sensor, we need to stay in calibration mode to run tests. Accept boolean true and false (not just true) to enter/exit calibration. Signed-off-by: Gwendal

Re: [PATCH 2/2] iio: cros_ec_light: Add support for RGB sensor

2020-04-30 Thread Gwendal Grignou
On Sat, Apr 25, 2020 at 10:31 AM Jonathan Cameron wrote: > > On Wed, 22 Apr 2020 17:02:30 -0700 > Gwendal Grignou wrote: > > > Add support for color sensors behind EC like TCS3400. > > The color data can be presented in Red Green Blue color space (RGB) or > > the

Re: [PATCH 2/2] iio: cros_ec_light: Add support for RGB sensor

2020-04-30 Thread Gwendal Grignou
On Thu, Apr 23, 2020 at 12:50 AM Peter Meerwald-Stadler wrote: > > On Wed, 22 Apr 2020, Gwendal Grignou wrote: > > comments below > > > Add support for color sensors behind EC like TCS3400. > > The color data can be presented in Red Green Blue color space (RGB) or >

Re: [PATCH v2 18/18] iio: cros_ec: Use Hertz as unit for sampling frequency

2019-10-22 Thread Gwendal Grignou
On Mon, Oct 21, 2019 at 9:45 AM Jonathan Cameron wrote: > > On Sun, 20 Oct 2019 22:54:03 -0700 > Gwendal Grignou wrote: > > > To be compliant with other sensors, set and get sensor sampling > > frequency in Hz, not mHz. > > > > Fixes: ae7b02ad2f32 (&

Re: [PATCH v2 10/18] platform: chrome: sensorhub: Add FIFO support

2019-10-21 Thread Gwendal Grignou
On Mon, Oct 21, 2019 at 9:27 AM Jonathan Cameron wrote: > > On Sun, 20 Oct 2019 22:53:55 -0700 > Gwendal Grignou wrote: > > > cros_ec_sensorhub registers a listener and query motion sense FIFO, > > spread to iio sensors registers. > > > > To test, we can use

[PATCH v2 01/18] platform: chrome: Put docs with the code

2019-10-20 Thread Gwendal Grignou
To avoid doc rot, put function documentations with code, not header. Use kernel-doc style comments for exported functions. Signed-off-by: Gwendal Grignou --- New in v2. drivers/platform/chrome/cros_ec.c | 33 +++ drivers/platform/chrome/cros_ec_proto.c | 70

[PATCH v2 08/18] Revert "Input: cros_ec_keyb - add back missing mask for event_type"

2019-10-20 Thread Gwendal Grignou
This reverts commit 62c3801619e16b68a37ea899b76572145dfe41c9. This patch is not needed anymore since we clear EC_MKBP_HAS_MORE_EVENTS flag before calling the notifiers in patch "9d9518f5b52a (platform: chrome: cros_ec: handle MKBP more events flag)" Signed-off-by: Gwendal Grignou ---

[PATCH v2 06/18] platform: chrome: cros_ec: Do not attempt to register a non-positive IRQ number

2019-10-20 Thread Gwendal Grignou
From: Enrico Granata Add a layer of sanity checking to cros_ec_register against attempting to register IRQ values that are not strictly greater than 0. Signed-off-by: Enrico Granata Signed-off-by: Gwendal Grignou --- Changes in v2: Remove dual Enrico's signature. drivers/platform/chrome

[PATCH v2 16/18] iio: cros_ec: Expose hwfifo_timeout

2019-10-20 Thread Gwendal Grignou
. Rename frequency to sampling_frequency to match IIO ABI. Signed-off-by: Gwendal Grignou --- Changes in v2: - Register fifo_attributes in sensors drivers that previously advertise that feature. .../common/cros_ec_sensors/cros_ec_sensors.c | 4 +- .../cros_ec_sensors/cros_ec_sensors_core.c

[PATCH v2 18/18] iio: cros_ec: Use Hertz as unit for sampling frequency

2019-10-20 Thread Gwendal Grignou
To be compliant with other sensors, set and get sensor sampling frequency in Hz, not mHz. Fixes: ae7b02ad2f32 ("iio: common: cros_ec_sensors: Expose cros_ec_sensors frequency range via iio sysfs") Signed-off-by: Gwendal Grignou --- No changes in v2. .../cros_ec_sensors/cros_ec_sens

[PATCH v2 04/18] platform/mfd:iio: cros_ec: Register sensor through sensorhub

2019-10-20 Thread Gwendal Grignou
- Remove duplicate code in mfd, since mfd just register cros_ec_sensorhub if at least one sensor is present - Change iio cros_ec driver to get the pointer to the cros_ec_dev through cros_ec_sensorhub. Signed-off-by: Gwendal Grignou --- Changes in v2: - Remove unerelated changes. - Remove ec

[PATCH v2 12/18] platform: chrome: sensorhub: Add median filter

2019-10-20 Thread Gwendal Grignou
. To mitigate worst offenders, add a median filter to weed out bigger than expected delays. Signed-off-by: Gwendal Grignou --- Changes in v2: - Move some #define in .c to prevent name collisions. - Add proper doxygen comments. - Use /* instead of // .../platform/chrome/cros_ec_sensorhub_ring.c | 504

[PATCH v2 17/18] iio: cros_ec: Report hwfifo_watermark_max

2019-10-20 Thread Gwendal Grignou
Report the maximum amount of sample the EC can hold. This is not tunable, but can be useful for application to find out the maximum amount of time it can sleep when hwfifo_timeout is set to a large number. Signed-off-by: Gwendal Grignou --- Changes in v2: - Remove double lines, add line before

[PATCH v2 09/18] Revert "Input: cros_ec_keyb: mask out extra flags in event_type"

2019-10-20 Thread Gwendal Grignou
This reverts commit d096aa3eb6045a6a475a0239f3471c59eedf3d61. This patch is not needed anymore since we clear EC_MKBP_HAS_MORE_EVENTS flag before calling the notifiers in patch "9d9518f5b52a (platform: chrome: cros_ec: handle MKBP more events flag)" Signed-off-by: Gwendal Grignou ---

[PATCH v2 03/18] platform: cros_ec: Add cros_ec_sensor_hub driver

2019-10-20 Thread Gwendal Grignou
uto/ cros-ec-accel.15.auto/ iio:device1 It will be expanded to control EC sensor FIFO. Signed-off-by: Gwendal Grignou --- Changes in v2: - Remove unerelated changes. - Fix spelling. - Use !x instead of x == NULL - Use platform_

[PATCH v2 13/18] iio: cros_ec: Move function description to .c file

2019-10-20 Thread Gwendal Grignou
To prevent comment rot, move function description to cros_ec_sensors_core.c. Signed-off-by: Gwendal Grignou --- New in v2. .../cros_ec_sensors/cros_ec_sensors_core.c| 69 .../linux/iio/common/cros_ec_sensors_core.h | 80 --- 2 files changed, 69 insertions

[PATCH v2 15/18] iio: cros_ec: Remove pm function

2019-10-20 Thread Gwendal Grignou
Since cros_ec_sensorhub is shutting down the FIFO when the device suspends, no need to slow down the EC sampling period rate. It was necesseary to do that before command CMD_FIFO_INT_ENABLE was introduced, but now all supported chromebooks have it. Signed-off-by: Gwendal Grignou --- New in v2

[PATCH v2 11/18] platform: chrome: sensorhub: Add code to spread timestmap

2019-10-20 Thread Gwendal Grignou
TSb | +---+ +---+ | TSb | +---+ Signed-off-by: Gwendal Grignou --- Changes in v2: - Use CROS_EC_SENSOR_LAST_TS instead of LAST_TS to avoid name colisions. .../platform/chrome/cros_ec_sensorhub_ring.c | 99 ++- 1 file changed, 96 insertions(+)

[PATCH v2 07/18] platform: chrome: cros_ec: handle MKBP more events flag

2019-10-20 Thread Gwendal Grignou
beneficial to sensor timestamping as it keeps the desired synchronization of event times between the two processors. This patch adds kernel support for this EC feature, allowing the ec_irq to loop until all events have been served. Signed-off-by: Enrico Granata Signed-off-by: Gwendal Grignou

[PATCH v2 10/18] platform: chrome: sensorhub: Add FIFO support

2019-10-20 Thread Gwendal Grignou
cros_ec_sensorhub registers a listener and query motion sense FIFO, spread to iio sensors registers. To test, we can use libiio: iiod& iio_readdev -u ip:localhost -T 1 -s 25 -b 16 cros-ec-gyro | od -x Signed-off-by: Gwendal Grignou --- Changes sunce v2: - Do not register a .remove rout

[PATCH v2 14/18] iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO

2019-10-20 Thread Gwendal Grignou
will be in the FIFO. To be sure events generated by cros_ec_sensorhub or the trigger uses the same time domain, current_timestamp_clock must be set to "boottime". When no FIFO, the user space app needs to call trigger_new, or better register a high precision timer. Signed-off-by: Gwend

[PATCH v2 02/18] mfd: cros_ec: Add sensor_count and make check_features public

2019-10-20 Thread Gwendal Grignou
Controller supports. Signed-off-by: Gwendal Grignou --- Changes in v2: Fix spelling in commit message. Cleanup the case where DUMP command is not supported. Move code from mfd to platform/chrome/ drivers/mfd/cros_ec_dev.c | 32 -- drivers/platform/chrome/cros_ec_proto.c

[PATCH v2 05/18] platform: chrome: cros-ec: record event timestamp in the hard irq

2019-10-20 Thread Gwendal Grignou
To improve sensor timestamp precision, given EC and AP are in different time domains, the AP needs to try to record the exact moment an event was signalled to the AP by the EC as soon as possible after it happens. First thing in the hard irq is the best place for this. Signed-off-by: Gwendal

[PATCH v2 00/18] cros_ec: Add sensorhub driver and FIFO processing*** SUBJECT HERE

2019-10-20 Thread Gwendal Grignou
s built upon the master branch of git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git Enrico Granata (2): platform: chrome: cros_ec: Do not attempt to register a non-positive IRQ number platform: chrome: cros_ec: handle MKBP more events flag Gwendal Grignou (16): platform: chro

Re: [PATCH 01/13] mfd: cros_ec: Add sensor_count and make check_features public

2019-09-30 Thread Gwendal Grignou
Sounds good to me, I will make the change in rev2. On Mon, Sep 30, 2019 at 6:15 AM Enric Balletbo i Serra wrote: > > Hi Gwendal, > > Many thanks for the patches. > > On 22/9/19 19:50, Gwendal Grignou wrote: > > Add a new function to return the number of MEMS sensors ava

[PATCH 13/13] iio: cros_ec: Use Hertz as unit for sampling frequency

2019-09-22 Thread Gwendal Grignou
To be compliant with other sensors, set and get sensor sampling frequency in Hz, not mHz. Fixes: ae7b02ad2f32 ("iio: common: cros_ec_sensors: Expose cros_ec_sensors frequency range via iio sysfs") Signed-off-by: Gwendal Grignou --- .../cros_ec_sensors/cros_ec_sensors_core

[PATCH 12/13] iio: cros_ec: Report hwfifo_watermark_max

2019-09-22 Thread Gwendal Grignou
Report the maximum amount of sample the EC can hold. This is not tunable, but can be useful for application to find out the maximum amount of time it can sleep when hwfifo_timeout is set to a large number. Signed-off-by: Gwendal Grignou --- .../cros_ec_sensors/cros_ec_sensors_core.c| 35

[PATCH 03/13] platform/mfd:iio: cros_ec: Register sensor through sensorhub

2019-09-22 Thread Gwendal Grignou
- Add sensorhub include file - Remove duplicate code in mfd, since mfd just register cros_ec_sensorhub if at least one sensor is present - Change iio cros_ec driver to get the pointer to the cros_ec_dev through cros_ec_sensorhub. Signed-off-by: Gwendal Grignou --- drivers/iio/accel

[PATCH 06/13] platform: chrome: cros_ec: handle MKBP more events flag

2019-09-22 Thread Gwendal Grignou
timestamping as it keeps the desired synchronization of event times between the two processors. This patch adds kernel support for this EC feature, allowing the ec_irq to loop until all events have been served. Signed-off-by: Enrico Granata Signed-off-by: Gwendal Grignou --- drivers/platform/chrome

[PATCH 11/13] iio: cros_ec: Expose hwfifo_timeout

2019-09-22 Thread Gwendal Grignou
Expose EC sampling rate through buffer/hwfifo_timeout. Rename frequency to sampling_frequency to match IIO ABI. Signed-off-by: Gwendal Grignou --- .../common/cros_ec_sensors/cros_ec_sensors.c | 1 - .../cros_ec_sensors/cros_ec_sensors_core.c| 110 +- drivers/iio/light

[PATCH 05/13] platform: chrome: cros_ec: Do not attempt to register a non-positive IRQ number

2019-09-22 Thread Gwendal Grignou
From: Enrico Granata Add a layer of sanity checking to cros_ec_register against attempting to register IRQ values that are not strictly greater than 0. Signed-off-by: Enrico Granata Signed-off-by: Enrico Granata Signed-off-by: Gwendal Grignou --- drivers/platform/chrome/cros_ec.c | 2 +- 1

[PATCH 10/13] iio: cros_ec: Use triggered buffer only when EC does not support FIFO

2019-09-22 Thread Gwendal Grignou
When EC supports FIFO, the samples will flow from the kernel by themselves. When no FIFO, the user space app needs to call trigger_new, or better register a high precision timer. Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c | 8 +-- .../cros_ec_sensors

[PATCH 09/13] platform: chrome: sensorhub: Add median filter

2019-09-22 Thread Gwendal Grignou
. To mitigate worst offenders, add a median filter to weed out bigger than expected delays. Signed-off-by: Gwendal Grignou --- .../platform/chrome/cros_ec_sensorhub_ring.c | 485 +- .../linux/platform_data/cros_ec_sensorhub.h | 65 +++ 2 files changed, 533 insertions(+), 17 deletions

[PATCH 02/13] platform: cros_ec: Add cros_ec_sensor_hub driver

2019-09-22 Thread Gwendal Grignou
uto/ cros-ec-accel.15.auto/ iio:device1 It will be expanded to control EC sensor FIFO. Signed-off-by: Gwendal Grignou --- drivers/iio/common/cros_ec_sensors/Kconfig| 2 +- drivers/platform/chrome/Kconfig |

[PATCH 08/13] platform: chrome: sensorhub: Add code to spread timestmap

2019-09-22 Thread Gwendal Grignou
TSb | +---+ +---+ | TSb | +---+ Signed-off-by: Gwendal Grignou --- .../platform/chrome/cros_ec_sensorhub_ring.c | 99 ++- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/driv

[PATCH 01/13] mfd: cros_ec: Add sensor_count and make check_features public

2019-09-22 Thread Gwendal Grignou
Controller supports. Signed-off-by: Gwendal Grignou --- drivers/mfd/cros_ec_dev.c | 61 - include/linux/mfd/cros_ec.h | 17 +++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index

[PATCH 00/13] cros_ec: Add sensorhub driver and FIFO processing

2019-09-22 Thread Gwendal Grignou
z. This set is built upon the master branch of git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git Enrico Granata (2): platform: chrome: cros_ec: Do not attempt to register a non-positive IRQ number platform: chrome: cros_ec: handle MKBP more events flag Gwendal Grignou

[PATCH 07/13] platform: chrome: sensorhub: Add FIFO support

2019-09-22 Thread Gwendal Grignou
cros_ec_sensorhub registers a listener and query motion sense FIFO, spread to iio sensors registers. To test, we can use libiio: iiod& iio_readdev -u ip:localhost -T 1 -s 25 -b 16 cros-ec-gyro | od -x Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c |

[PATCH 04/13] platform: chrome: cros-ec: record event timestamp in the hard irq

2019-09-22 Thread Gwendal Grignou
To improve sensor timestamp precision, given EC and AP are in different time domains, the AP needs to try to record the exact moment an event was signalled to the AP by the EC as soon as possible after it happens. First thing in the hard irq is the best place for this. Signed-off-by: Gwendal

Re: [PATCH v2] platform/chrome: cros_ec_chardev: Add a poll handler to receive MKBP events

2019-09-05 Thread Gwendal Grignou
string, it still does it when no > > event mask or an empty event is set for backward compatibility (despite > > nobody really using this feature). > > > > This will be used, for example, by the userspace daemon to receive and > > treat the EC_MKBP_EVENT_FINGERPRINT se

[PATCH] iio: cros_ec: set calibscale for 3d MEMS to unit vector

2019-08-19 Thread Gwendal Grignou
By default, set the calibscale vector to unit vector. It prevents sending 0 as calibscale when not initialized. Signed-off-by: Gwendal Grignou --- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iio

[PATCH] iio: cros_ec: Add calibscale for 3d MEMS

2019-07-18 Thread Gwendal Grignou
Add calibration scale support to accel, gyro and magnetometer. Check on eve with current firmware, check reading calibscale returns 1.0, check with newer firmware values are applied. Signed-off-by: Gwendal Grignou --- .../common/cros_ec_sensors/cros_ec_sensors.c | 51

[PATCH] iio: cros_ec: Remove replacing error code with -EIO

2019-07-18 Thread Gwendal Grignou
Due to an API misread, error code can be different for -EIO when reading a sysfs entry. Return the error reported by the cros_ec stack. Check the proper error message (protocol error, not supported) is reported when there is an error returned by the EC stack. Signed-off-by: Gwendal Grignou

Re: [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read()

2019-07-15 Thread Gwendal Grignou
Let's use Matthias CL. On Mon, Jul 15, 2019 at 4:17 PM Gwendal Grignou wrote: > > Sorry for the original mistake. I upload a patch at > https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1702884. > > On Mon, Jul 15, 2019 at 1:04 PM Matthias Kaehlcke wr

Re: [PATCH] iio: cros_ec_accel_legacy: Always release lock when returning from _read()

2019-07-15 Thread Gwendal Grignou
Sorry for the original mistake. I upload a patch at https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1702884. On Mon, Jul 15, 2019 at 1:04 PM Matthias Kaehlcke wrote: > > Hi Benson, > > On Mon, Jul 15, 2019 at 12:55:57PM -0700, Benson Leung wrote: > > Hi Matthias, > > >

[PATCH v6 2/4] iio: cros_ec_accel_legacy: Fix incorrect channel setting

2019-07-15 Thread Gwendal Grignou
INFO_SCALE is set both for each channel and all channels. iio is using all channel setting, so the error was not user visible. Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c

[PATCH v6 3/4] iio: cros_ec_accel_legacy: Use cros_ec_sensors_core

2019-07-15 Thread Gwendal Grignou
Remove duplicate code in cros-ec-accel-legacy, use cros-ec-sensors-core functions and structures when possible. On glimmer, check the 2 accelerometers are presented and working. Signed-off-by: Gwendal Grignou Acked-by: Jonathan Cameron --- drivers/iio/accel/Kconfig| 4

[PATCH v6 0/4] Support accelerometers for veyron_minnie

2019-07-15 Thread Gwendal Grignou
- to veyron_minnie. veyron_minnie being ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC. Gwendal Grignou (4): iio: cros_ec: Add sign vector in core for backward compatibility iio: cros_ec_accel_legacy: Fix incorrect channel setting iio

[PATCH v6 1/4] iio: cros_ec: Add sign vector in core for backward compatibility

2019-07-15 Thread Gwendal Grignou
. Signed-off-by: Gwendal Grignou Reviewed-by: Douglas Anderson --- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 4 include/linux/iio/common/cros_ec_sensors_core.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/iio/common/cros_ec_sensors

[PATCH v6 4/4] iio: cros_ec_accel_legacy: Add support for veyron-minnie

2019-07-15 Thread Gwendal Grignou
Veyron minnie embedded controller presents 2 accelerometers using an older interface. Add function to query the data in cros_ec_accel. Verify accelerometers on veyron-minnie are presented and working. Signed-off-by: Gwendal Grignou Acked-by: Jonathan Cameron --- drivers/iio/accel

[PATCH v5 0/4] Support accelerometers for veyron_minnie

2019-07-15 Thread Gwendal Grignou
- to veyron_minnie. veyron_minnie being ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC. Gwendal Grignou (4): iio: cros_ec: Add sign vector in core for backward compatibility iio: cros_ec_accel_legacy: Fix incorrect channel setting iio

[PATCH v5 3/4] iio: cros_ec_accel_legacy: Use cros_ec_sensors_core

2019-07-15 Thread Gwendal Grignou
Remove duplicate code in cros-ec-accel-legacy, use cros-ec-sensors-core functions and structures when possible. On glimmer, check the 2 accelerometers are presented and working. Signed-off-by: Gwendal Grignou Acked-by: Jonathan Cameron --- drivers/iio/accel/Kconfig| 4

[PATCH v5 1/4] iio: cros_ec: Add sign vector in core for backward compatibility

2019-07-15 Thread Gwendal Grignou
. Signed-off-by: Gwendal Grignou Reviewed-by: Douglas Anderson --- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 4 include/linux/iio/common/cros_ec_sensors_core.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/iio/common/cros_ec_sensors

[PATCH v5 4/4] iio: cros_ec_accel_legacy: Add support for veyron-minnie

2019-07-15 Thread Gwendal Grignou
Veyron minnie embedded controller presents 2 accelerometers using an older interface. Add function to query the data in cros_ec_accel. Verify accelerometers on veyron-minnie are presented and working. Signed-off-by: Gwendal Grignou Acked-by: Jonathan Cameron --- drivers/iio/accel

[PATCH v5 2/4] iio: cros_ec_accel_legacy: Fix incorrect channel setting

2019-07-15 Thread Gwendal Grignou
INFO_SCALE is set both for each channel and all channels. iio is using all channel setting, so the error was not user visible. Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c

Re: [PATCH v4 03/11] mfd / platform: cros_ec: Miscellaneous character device to talk with the EC

2019-07-15 Thread Gwendal Grignou
tem. The idea is > to move all the functionality that extends the bounds of what MFD was > designed to platform/chrome subsystem. > > Signed-off-by: Enric Balletbo i Serra > Acked-by: Andy Shevchenko > Tested-by: Gwendal Grignou > --- > > Changes in v4: None > Changes in

Re: [PATCH] mfd: cros_ec: Update cros_ec_commands.h

2019-07-11 Thread Gwendal Grignou
Reviewed-by: Gwendal Grignou Note there is a patch series that move cros_ec_commands.h from nclude/linux/mfd/ to include/linux/platform_data. On Mon, Jul 8, 2019 at 11:16 AM Yicheng Li wrote: > > Update cros_ec_commands.h to match the fingerprint MCU section in > the current ec_c

Re: [PATCH v4 01/11] mfd / platform: cros_ec: Handle chained ECs as platform devices

2019-06-29 Thread Gwendal Grignou
Review and tested the whole series: Reviewed-by: Gwendal Grignou Tested-by: Gwendal Grignou On Thu, Jun 27, 2019 at 3:40 AM Enric Balletbo i Serra wrote: > > An MFD is a device that contains several sub-devices (cells). For instance, > the ChromeOS EC fits in this description a

[PATCH v4 1/4] iio: cros_ec: Add sign vector in core for backward compatibility

2019-06-28 Thread Gwendal Grignou
. Signed-off-by: Gwendal Grignou Reviewed-by: Douglas Anderson --- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 4 include/linux/iio/common/cros_ec_sensors_core.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/iio/common/cros_ec_sensors

[PATCH v4 4/4] iio: cros_ec_accel_legacy: Add support for veyron-minnie

2019-06-28 Thread Gwendal Grignou
Veyron minnie embedded controller presents 2 accelerometers using an older interface. Add function to query the data in cros_ec_accel. Verify accelerometers on veyron-minnie are presented and working. Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c | 40

[PATCH v4 2/4] iio: cros_ec_accel_legacy: Fix incorrect channel setting

2019-06-28 Thread Gwendal Grignou
INFO_SCALE is set both for each channel and all channels. iio is using all channel setting, so the error was not user visible. Signed-off-by: Gwendal Grignou --- drivers/iio/accel/cros_ec_accel_legacy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c

  1   2   3   4   5   >