Commit Graph

13 Commits

Author SHA1 Message Date
Martin Roth
897ce78bdd Fix various misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403417
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:53 -08:00
Bill Richardson
bb15561db5 cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args
Since pretty much always, we've declared console commands to take
a "longhelp" argument with detailed explanations of what the
command does. But since almost as long, we've never actually used
that argument for anything - we just silently throw it away in
the macro. There's only one command (usbchargemode) that even
thinks it defines that argument.

We're never going to use this, let's just get rid of it.

BUG=none
BRANCH=none
CQ-DEPEND=CL:*279060
CQ-DEPEND=CL:*279158
CQ-DEPEND=CL:*279037
TEST=make buildall; tested on Cr50 hardware

Everything builds. Since we never used this arg anyway, there had
better not be any difference in the result.

Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374163
Reviewed-by: Myles Watson <mylesgw@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-08-24 16:30:10 +00:00
Alec Berg
a490cbfe80 gesture: fix double tap doesn't always work in suspend
Fix bug where sometimes on suspend tap for battery would never work,
but open a resume and suspend again it would work fine. Problem is
that if suspended when accel circular buffer index is 1, then
we would never run the detection algorithm, because the check for
if the history buffer has been initialized is incorrect.

This also fixes the algorithm so that on suspend, it requires the
full sensor history buffer  be filled up again before starting to
detect the double tap.

BUG=chrome-os-partner:45930
BRANCH=samus
TEST=go in to suspend when history_index is 1 and verify that tap
for battery works. wrote following console command to pause the
circular buffer at a specific index.

static int pause_index = -1;
static int check_pause;
static void gesture_chipset_resume(void)
{
        /* disable tap detection */
        check_pause = 1;
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, gesture_chipset_resume,
             GESTURE_HOOK_PRIO);

void gesture_calc(void)
{
        if (check_pause) {
                if (pause_index < 0 || history_idx == pause_index) {
                        ccprintf("Paused at %d\n", pause_index);
                        tap_detection = 0;
                        pause_index = -1;
                        check_pause = 0;
                }
        }
	...

static int command_tap_pause(int argc, char **argv)
{
        char *e;
        int v;

        if (argc == 2) {
                v = strtoi(argv[1], &e, 0);
                if (*e)
                        return EC_ERROR_PARAM1;

                pause_index = v;
        }

        return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(tappause, command_tap_pause,
                        "",
                        "", NULL);

Change-Id: I2ba4ab2c807ec6ac1885a4829efedac3c83b32f1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302648
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-29 11:28:40 -07:00
Gwendal Grignou
bde89ebc20 common: motion: move gesture actions in motion task.
Change the IRQ interface to allow adding events.
Move code to send the lightbar sequence from gesture.c to motion task.

TEST=compile, works on Ryu.
BRANCH=smaug
BUG=chrome-os-partner:44754

Change-Id: I981ea123ebef0e8e3d6aa320eade89f10e83b6fc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296822
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 17:55:32 -07:00
Gwendal Grignou
32867104da samus: Use new config, fix gesture
Use new config table.
Move ODR setting in motion sense, fix variable names.

BRANCH=samus
BUG=chromium:513458
TEST=Test accelerator and double tap on Samus

Change-Id: I341add11a18de8e4cc97c57da29f9114bd2014cf
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295638
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-08-29 01:34:15 -07:00
Gwendal Grignou
7a2299163b driver: change get_ interface.
Simplify sensor get_data_rate, get_range and get_resolution.
Error code was not checked and these functions as currently implemented
have no reason to fail.

BRANCH=ryu,samus,cyan,strago
BUG=chromium:513458
TEST=Check on ryu, compile

Change-Id: I40dca41cee29a19f65b2f84d434b4c19eb6cbf3c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295635
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2015-08-29 00:04:15 -07:00
Gwendal Grignou
34677eed4e motion_sense: Fix init routines
active state is global, remove it from motion_sensor structure.

Reinit sensors when entering RW, fix regression introduced by CL:284616.

Improve EC polling rate calculation by excluding suspended sensors.

Wake up sensor thread in case the motion task was in deep sleep.

Do not send sense interrupt while suspened. Will revisit once wakeup
sensors are implemented.

BRANCH=smaug
TEST=Check when in RW the sensors are exposed.
Check EC rate are correct in different power state.
Check when jumping from RO to RW and back, after setting the
frequencies parameters via sysfs properly, AndroSensor acquires
the data properly.

BUG=chrome-os-partner:43132,chrome-os-partner:40741

Change-Id: Ie70732b135a432d64935eead4200ddc0e1a7c0b4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288201
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-27 22:19:26 +00:00
Bill Richardson
99737a2fef cleanup: rename motion sensor CONFIG_ options
This renames some motion sensor options to start with more
consistent prefixes.

For gesture (tap) detection:

  CONFIG_GESTURE_DETECTION:
    CONFIG_SENSOR_BATTERY_TAP   =>    CONFIG_GESTURE_SENSOR_BATTERY_TAP

For detecting lid angle:

  CONFIG_LID_ANGLE:
    CONFIG_SENSOR_BASE          =>    CONFIG_LID_ANGLE_SENSOR_BASE
    CONFIG_SENSOR_LID           =>    CONFIG_LID_ANGLE_SENSOR_LID

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ib8f645902a5585346e1d8d2cbf73d825c896a521
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/268777
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-05-01 20:46:37 +00:00
Alec Berg
ae82f824ab gesture: add absolute threshold for start of tap for battery
Add absolute threshold on delta_z_inner for tap for battery to guarantee
that we have at least some minimum absolute change in z that has started
the tap for battery.

This change makes it such that if the accel readings are really steady
for a while, then a sudden noisy signal doesn't trigger tap for battery.

BUG=chrome-os-partner:34592
BRANCH=samus
TEST=use tapinfo on to observe tap values and do a double tap of varying
intensities. note that it should be just a little less sensitive to weak
taps.

Change-Id: I95367bc7f99b888e15e9ac3a2bc8c9cca32d30d6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/237666
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-12-30 22:04:11 +00:00
Alec Berg
9d25fa9006 gesture: double tap for battery accelereomter ODR
Double the output data rate setting for accels for tap
for battery because with the lsm6ds0 sensor, the current
ODR does not guarantee that we get fresh data every time
we do a read.

BUG=chrome-os-partner:34592
BRANCH=samus
TEST=load onto samus, go to G3, use tapinfo on to see
ODR set to 476000Hz. add printf to lsm6ds0 to print when
data is not ready, and see that without this change, the
printf is hit once a minute or so, and with this change,
the printf is never hit, meaning new data is always ready.

Change-Id: Ib09cba0d70642f59df8a35b5b6bb4fd7b9a4fa3d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/237665
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-12-30 22:04:05 +00:00
Alec Berg
13579c3570 samus: accel: fix initialization bug in tap gesture
Fix bug in tap gesture. When turning on tap detection, don't
clear the history circular array index. This was causing inconsitent
tap for battery recognition because the inner window sum of z-axis
data (sum_z_inner) was relying on subtracting out old historical
data and adding in the new data, but when the array index changed,
it was subtracting out the wrong old data. This really only came in
to play if there was significant z motion before the last wakeup.

BUG=none
BRANCH=samus
TEST=keep going to sleep and waking up and test that tap for
battery works every time.

Change-Id: I55e00c805d504dd6d257a81f2cd25fe384a53257
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226591
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2014-10-31 04:29:16 +00:00
Gwendal Grignou
a86b4b0a78 gesture: Minor fixes
Set state or numeric when needed
Add debug for the idle state.

BUG=None
BRANCH=ToT
TEST=Check debug appears when enabled. Check tap still works.

Change-Id: Ic4660f70a27464dc68c02fdaef60dc36d7c2edad
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225487
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
2014-10-29 22:23:59 +00:00
Gwendal Grignou
f3b29e3fec Samus: move gesture to common
Move gesture to common directory, 1st step to be reused by
other board.
Cleanup motion_sense shutdown path.

BUG=chrome-os-partner:33102
TEST=Double tap still works on Samus
BRANCH=ToT

Change-Id: I0a3b38c4a7dbe95c27dcdebff04c1176aaf932d1
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225235
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-10-29 22:23:43 +00:00