Support accelerometers for veyron_minnie
Subsystems (2)
v3 cover Support accelerometers for veyron_minnie
veyron_minnie - ASUS Chromebook Flip C100PA - embedded controller controls two accelerometers, one in the lid, one in the base. However, the EC firmware does not follow the new interface that cros_ec_accel driver use.
Extend the legacy driver used on glimmer - Lenovo ThinkPad 11e Chromebook - 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 (2):
iio: cros_ec: Add sign vector in core for backward compatibility
iio: cros_ec: Extend legacy support to ARM device
Changes in v3:
- Fix commit message, add reviewed-by for first patch.
Changes in v2:
- Readd empty line to reduce amount of change in patch.
- Remove Keywords used by ChromeOS commit queue.
drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 ++++-------------- .../cros_ec_sensors/cros_ec_sensors_core.c | 4 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + 4 files changed, 84 insertions(+), 275 deletions(-)
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
PATCH v3 1/2 iio: cros_ec: Add sign vector in core for backward compatibility
To allow cros_ec iio core library to be used with legacy device, add a vector to rotate sensor data if necessary: legacy devices are not reporting data in HTML5/Android sensor referential.
Check the data is not rotated on recent chromebooks that use the HTML5 standard to present sensor data.
--- 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(+)
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +4 -0
@@ -66,6 +66,9 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, } state->type = state->resp->info.type; state->loc = state->resp->info.location; + +/* Set sign vector, only used for backward compatibility. */ +memset (state->sign,1 ,CROS_EC_SENSOR_MAX_AXIS ); }return 0 ;
@@ -254,6 +257,7 @@ static int cros_ec_sensors_read_data_unsafe(struct iio_dev *indio_dev,if (ret <0 )return ret; + *data *= st->sign[i]; data++; }
include/linux/iio/common/cros_ec_sensors_core.h +1 -0
@@ -71,6 +71,7 @@ struct cros_ec_sensors_core_state {enum motionsensor_location loc;s16 calib[CROS_EC_SENSOR_MAX_AXIS ]; +s8 sign[CROS_EC_SENSOR_MAX_AXIS ];u8 samples[CROS_EC_SAMPLE_SIZE ];
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
PATCH v3 2/2 iio: cros_ec: Extend legacy support to ARM device
In reply to Gwendal GrignouAdd support to ARM based device, that lack LPC access code. Allow cros-ec-accel-legacy to use cros-ec-sensors-core, add specific command to capture sensor data.
On rk3288-veyron-minnie, check chrome detect tablet mode and rotates screen when in tablet mode.
Check only a subset of the attributes are presented.
--- drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 +++++------------------ 2 files changed, 79 insertions(+), 275 deletions(-)
drivers/iio/accel/Kconfig +1 -3
@@ -201,9 +201,7 @@ config HID_SENSOR_ACCEL_3D config IIO_CROS_EC_ACCEL_LEGACY tristate "ChromeOS EC Legacy Accelerometer Sensor" - select IIO_BUFFER - select IIO_TRIGGERED_BUFFER - select CROS_EC_LPC_REGISTER_DEVICE + depends on IIO_CROS_EC_SENSORS_CORE help Say yes here to get support for accelerometers on Chromebook using legacy EC firmware.
drivers/iio/accel/cros_ec_accel_legacy.c +78 -272
442 lines not on this page · raw message
Signature · 1 line
2.22.0.410.gd8fdbe21b5-goog
Re: [PATCH v3 2/2] iio: cros_ec: Extend legacy support to ARM device
Hi,
drivers/iio/accel/cros_ec_accel_legacy.c line 37
Quoted 5 lines · Gwendal Grignou
drivers/iio/accel/cros_ec_accel_legacy.c +2
-2-static int read_ec_accel_data (struct cros_ec_accel_legacy_state *st, -unsigned long scan_mask,s16 *data) +int cros_ec_accel_legacy_read_cmd (struct iio_dev *indio_dev, +unsigned long scan_mask,s16 *data)
As found by 0day (see https://crrev.com/c/1678822), the cros_ec_accel_legacy_read_cmd() should have been static.
I presume this will cause less confusion if a maintainer just fixes this up when landing the patch so Gwendal shouldn't send out a new version to fix it. ...but if this is not the case then yell! :-)
-Doug
Re: [PATCH v3 2/2] iio: cros_ec: Extend legacy support to ARM device
Hi,
Missatge de Doug Anderson <[email protected]> del dia dc., 26 de juny 2019 a les 23:06:
Quoted 13 lines
Hi,
drivers/iio/accel/cros_ec_accel_legacy.c line 37
Quoted 5 lines · Gwendal Grignou
drivers/iio/accel/cros_ec_accel_legacy.c +2
-2-static int read_ec_accel_data (struct cros_ec_accel_legacy_state *st, -unsigned long scan_mask,s16 *data) +int cros_ec_accel_legacy_read_cmd (struct iio_dev *indio_dev, +unsigned long scan_mask,s16 *data)As found by 0day (see https://crrev.com/c/1678822), the
cros_ec_accel_legacy_read_cmd()should have been static.
Quoted 4 lines
I presume this will cause less confusion if a maintainer just fixes this up when landing the patch so Gwendal shouldn't send out a new version to fix it. ...but if this is not the case then yell! :-)
As probably will go through the chrome-platform tree I'll fix this when I apply the patch. No need to resend.
Gwendal, Doug, to have cros-ec-sensors legacy support for ARM in upstream, could you spend 5 min reviewing the following patch?
https://lore.kernel.org/patchwork/patch/1094790/
I'll also test it.
Thanks,
~ Enric
Quoted 1 line
-Doug
Hi,
Quoted 20 lines · Gwendal Grignou
veyron_minnie- ASUS Chromebook Flip C100PA - embedded controller controls two accelerometers, one in the lid, one in the base. However, the EC firmware does not follow the new interface thatcros_ec_acceldriver use.
Extend the legacy driver used on glimmer - Lenovo ThinkPad 11e Chromebook - toveyron_minnie.veyron_minniebeing ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC.Gwendal Grignou (2):
iio:cros_ec: Add sign vector in core for backward compatibility
iio:cros_ec: Extend legacy support to ARM deviceChanges in v3:
- Fix commit message, add reviewed-by for first patch.Changes in v2:
- Readd empty line to reduce amount of change in patch.
- Remove Keywords used by ChromeOS commit queue.
Quoted 6 lines
drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 ++++-------------- .../cros_ec_sensors/cros_ec_sensors_core.c | 4 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + 4 files changed, 84 insertions(+), 275 deletions(-)
Just a side note that I think that this patch depends on [1] to have the legacy sensors working on veyron minnie.
For the full series:
Quoted 30 lines · On Tue, 25 Jun 2019 19:09:50 +0200 Enric Balletbo i Serra…
Hi,
Quoted 20 lines · Gwendal Grignou
veyron_minnie- ASUS Chromebook Flip C100PA - embedded controller controls two accelerometers, one in the lid, one in the base. However, the EC firmware does not follow the new interface thatcros_ec_acceldriver use.
Extend the legacy driver used on glimmer - Lenovo ThinkPad 11e Chromebook - toveyron_minnie.veyron_minniebeing ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC.Gwendal Grignou (2):
iio:cros_ec: Add sign vector in core for backward compatibility
iio:cros_ec: Extend legacy support to ARM deviceChanges in v3:
- Fix commit message, add reviewed-by for first patch.Changes in v2:
- Readd empty line to reduce amount of change in patch.
- Remove Keywords used by ChromeOS commit queue.Quoted 6 lines
drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 ++++-------------- .../cros_ec_sensors/cros_ec_sensors_core.c | 4 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + 4 files changed, 84 insertions(+), 275 deletions(-)
Quoted 6 lines
Just a side note that I think that this patch depends on [1] to have the legacy sensors working on veyron minnie.
For the full series:
Ah. I was assuming you mean a runtime dependency. Whereas applying this on it's own is giving me a build problem:
drivers/iio/accel/cros_ec_accel_legacy.c: In function ‘cros_ec_accel_legacy_read_cmd’:drivers/iio/accel/cros_ec_accel_legacy.c:50:16: error: ‘struct <anonymous>’ has no member named ‘max_sensor_count’
50 | st->param.dump.max_sensor_count = CROS_EC_SENSOR_LEGACY_NUM;
| ^
make[3]: *** [scripts/Makefile.build:285: drivers/iio/accel/cros_ec_accel_legacy.o] Error 1 make[2]: *** [scripts/Makefile.build:489: drivers/iio/accel] Error 2
make[1]: *** [scripts/Makefile.build:489: drivers/iio] Error 2
Which I'll assume is related to that other set.
I'm happy for these to go another route to sit on top of that series. If not I'll pick them up for the next cycle via IIO.
Should they go another route,
Quoted 3 lines
Hi Jonathan,
Quoted 36 lines · Jonathan Cameron
Quoted 33 lines · On Tue, 25 Jun 2019 19:09:50 +0200 Enric Balletbo i Serra…
Hi,
Quoted 20 lines · Gwendal Grignou
veyron_minnie- ASUS Chromebook Flip C100PA - embedded controller controls two accelerometers, one in the lid, one in the base. However, the EC firmware does not follow the new interface thatcros_ec_acceldriver use.
Extend the legacy driver used on glimmer - Lenovo ThinkPad 11e Chromebook - toveyron_minnie.veyron_minniebeing ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC.Gwendal Grignou (2):
iio:cros_ec: Add sign vector in core for backward compatibility
iio:cros_ec: Extend legacy support to ARM deviceChanges in v3:
- Fix commit message, add reviewed-by for first patch.Changes in v2:
- Readd empty line to reduce amount of change in patch.
- Remove Keywords used by ChromeOS commit queue.Quoted 6 lines
drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 ++++-------------- .../cros_ec_sensors/cros_ec_sensors_core.c | 4 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + 4 files changed, 84 insertions(+), 275 deletions(-)Just a side note that I think that this patch depends on [1] to have the legacy sensors working on veyron minnie.
Quoted 8 lines
Quoted 3 lines
For the full series:
Ah. I was assuming you mean a runtime dependency. Whereas applying this on it's own is giving me a build problem:
drivers/iio/accel/cros_ec_accel_legacy.c: In function ‘cros_ec_accel_legacy_read_cmd’:drivers/iio/accel/cros_ec_accel_legacy.c:50:16: error: ‘struct <anonymous>’ has no member named ‘max_sensor_count’
Right, this also build depends on the immutable branch (ib-mfd-cros-v5.3).
Quoted 6 lines
50 | st->param.dump.max_sensor_count = CROS_EC_SENSOR_LEGACY_NUM; | ^make[3]: *** [
scripts/Makefile.build:285:drivers/iio/accel/cros_ec_accel_legacy.o] Error 1 make[2]: *** [scripts/Makefile.build:489:drivers/iio/accel] Error 2 make[1]: *** [scripts/Makefile.build:489:drivers/iio] Error 2
Quoted 8 lines
Which I'll assume is related to that other set.
I'm happy for these to go another route to sit on top of that series. If not I'll pick them up for the next cycle via IIO.
Should they go another route,
I'd be happy to pick this patch and add to the chrome-platform tree, ideally once we manage to get [1] ready for land.
Thanks,
~ Enric
Quoted 5 lines
Quoted 4 lines
Jonathan Cameron
maintainerQuoted 41 lines · On Wed, 26 Jun 2019 22:40:00 +0200 Enric Balletbo i Serra…
Hi Jonathan,
Quoted 38 lines · Jonathan Cameron
Quoted 35 lines · On Tue, 25 Jun 2019 19:09:50 +0200 Enric Balletbo i Serra…
Hi,
Quoted 20 lines · Gwendal Grignou
veyron_minnie- ASUS Chromebook Flip C100PA - embedded controller controls two accelerometers, one in the lid, one in the base. However, the EC firmware does not follow the new interface thatcros_ec_acceldriver use.
Extend the legacy driver used on glimmer - Lenovo ThinkPad 11e Chromebook - toveyron_minnie.veyron_minniebeing ARM based, issue command over the I2C bus to the EC instead of relying on the shared registers over LPC.Gwendal Grignou (2):
iio:cros_ec: Add sign vector in core for backward compatibility
iio:cros_ec: Extend legacy support to ARM deviceChanges in v3:
- Fix commit message, add reviewed-by for first patch.Changes in v2:
- Readd empty line to reduce amount of change in patch.
- Remove Keywords used by ChromeOS commit queue.Quoted 6 lines
drivers/iio/accel/Kconfig | 4 +- drivers/iio/accel/cros_ec_accel_legacy.c | 350 ++++-------------- .../cros_ec_sensors/cros_ec_sensors_core.c | 4 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + 4 files changed, 84 insertions(+), 275 deletions(-)Just a side note that I think that this patch depends on [1] to have the legacy sensors working on veyron minnie.
For the full series:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Ah. I was assuming you mean a runtime dependency. Whereas applying this on it's own is giving me a build problem:
drivers/iio/accel/cros_ec_accel_legacy.c: In function ‘cros_ec_accel_legacy_read_cmd’:drivers/iio/accel/cros_ec_accel_legacy.c:50:16: error: ‘struct <anonymous>’ has no member named ‘max_sensor_count’Right, this also build depends on the immutable branch (ib-mfd-cros-v5.3).
Ah. I'd forgotten about that set.
Quoted 13 lines
Quoted 13 lines
50 | st->param.dump.max_sensor_count = CROS_EC_SENSOR_LEGACY_NUM; | ^make[3]: *** [
scripts/Makefile.build:285:drivers/iio/accel/cros_ec_accel_legacy.o] Error 1 make[2]: *** [scripts/Makefile.build:489:drivers/iio/accel] Error 2 make[1]: *** [scripts/Makefile.build:489:drivers/iio] Error 2Which I'll assume is related to that other set.
I'm happy for these to go another route to sit on top of that series. If not I'll pick them up for the next cycle via IIO.
Quoted 6 lines
Quoted 3 lines
Should they go another route,
I'd be happy to pick this patch and add to the chrome-platform tree, ideally once we manage to get [1] ready for land.
Let's go with that. If you change your mind, let me know.
Thanks,
Jonathan
Quoted 9 lines
Thanks,
~ EnricQuoted 5 lines
Quoted 4 lines