From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B633E13AA2F for ; Tue, 20 May 2025 04:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747713668; cv=none; b=vGDEAE3LfDmS/i/qhgJPEklKv4XPDew+IrLO7RO03yKVLu5pSaI3KjJGwIjhd2pcCesmuMH5zuxGDYTMH6wtF4G3tJCCm/4ydQrIZglyJ/0U2ovsLi6BWNOZB9XtQ0LxfHSrq8N+kDXEpkbJkmK7q19PoTNmxYHFEU3qV42Zm/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747713668; c=relaxed/simple; bh=lLWLIAhKZMwtGWkARu8NP9uMC4XW9FPXago8m/HItac=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ir1RgshARNJgWF0RM+EedzJu0O8iBlUqo5oxic2zUswcVIgi4B8Xxotc+RatoC1YWDrcHqTJW38DYpUQIaB8SsFSWN4nxgR/PVF1paroewvuw4iC42PPJlYSUQsASvoVBGv2ZsgsItjjG2JXCqfRGigxMXIyz3EiVWAtkwFyeso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=O1cjWE5j; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="O1cjWE5j" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-30e57a37294so4726446a91.2 for ; Mon, 19 May 2025 21:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1747713665; x=1748318465; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HaoLaHC+j8wcJOMxwQ26DSCNDoC+SchHVCzNja1lEvQ=; b=O1cjWE5jfD+Ljm34AVPQuqf//IHCjBV1KVpyoSOg/I7epSMK0wQBrZoe+XbTx2b/wh Z48mnmm846/dXxFseLkdYblQhRyZ4DzALzjXkQUoWgUZYjgK5RyYyWcccqTt4xGdYH89 mGlJThc4ltgskn+nWjwJmOH+tKlB3Kr9F1hos= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747713665; x=1748318465; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HaoLaHC+j8wcJOMxwQ26DSCNDoC+SchHVCzNja1lEvQ=; b=erVsuR7b0K3tHfsjEmkCW4hsOnTPewqda8F2RBDDkXqO+9qRB1TpAC6kRkIrB3acVR BZFLB99hS4d1WsEHP59j7ucTHy09zJACZQDJHoKHCq+U/pynz0Ykosn4EsBsgeNnyFHg 6+1/MS3lckKhFDmQqI1Cr4vukWx2CD6QenG118bGlY1Yt8ATKf4NlEBRXznrNfZM9Djg LwepDz+rJHxi+M7RJV0qPYxAdI1sZJ6cOl7R9P+L71L3BfM8RCTl82GC+OUwiT6MLjDa CJ3NwgnRwzU6qPEkHh6dg8C9J4ZC1+ZeGquRdCMJNBzStkCFI0n95Yh90P0Arhat5Wr8 DFJA== X-Forwarded-Encrypted: i=1; AJvYcCVhss8pU2HeoEp50oevldMwvTYR9/0YuCj/O9KvBHthkXFsdwwk8ogPx+CMrdPfvD9ewM3B/Fyc/kM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2q7b814suZgzK6aByHy1v/51UxCmj6XqSjhPrPBOkpswFUoUk 6qvSqfVlMMD/GTe/CIJn6ofzzb1x30D6Xe/ZG9oUBy33o/lhhdm8ykgJAluHnFA6Dg== X-Gm-Gg: ASbGncvm2FAR33x25ZhQjbU23OwpczCycnFCTJt57CkWsg0wzCZKvwIufNxAsWNGEZJ YW1+xwMVBR4tU3BbO7uk+zo9m24tYCTa7bJPCUNXxXhfyhiqRaTTZK83O+AeMnxNEs5EPeYhyTK 4huiZnT48Q6cLtmsl7THAXuj1r9KTV1HcHSHRwCf6jsjQPg03vSFLDFiINLxDoh0+28GnieMLrt ZJVixlZFtGYmjz0o+LhSVXj3bCQUYtquDW9XG3+bJJQFlTZJa4ivoscp8DNMWlieg+WwnFlpoX2 A5hCuhrTtUj/m9EovJKh95qOzVc5CxCWsWRPBHisLB3C X-Google-Smtp-Source: AGHT+IF3RLCYnvT295SuTJuh8gisAuSxUejG8vRmLzIgjN1ZsbWKmSBStjaq4G0BFlcUkxdtsKRBvg== X-Received: by 2002:a17:90a:e7c4:b0:30e:7b3b:b901 with SMTP id 98e67ed59e1d1-30e8314dbe6mr25520218a91.18.1747713664692; Mon, 19 May 2025 21:01:04 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:316b:d917:c3ba:aa9c]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-b26eb0a4af6sm7004202a12.77.2025.05.19.21.01.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 May 2025 21:01:03 -0700 (PDT) From: Gwendal Grignou X-Google-Original-From: Gwendal Grignou To: jic23@kernel.org Cc: tzungbi@kernel.org, chrome-platform@lists.linux.dev, linux-iio@vger.kernel.org, Gwendal Grignou Subject: [PATCH] iio: cros_ec_sensors: add cros_ec_activity driver Date: Mon, 19 May 2025 21:01:00 -0700 Message-ID: <20250520040101.3950845-1-gwendal@google.com> X-Mailer: git-send-email 2.49.0.1112.g889b7c5bd8-goog Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ChromeOS EC can report activity information derived from the accelerometer: - reports on-body/off-body as a proximity event. - reports significant motion as an activity event. This new sensor is a virtual sensor, included only when the EC firmware is compiled with the appropriate module. Signed-off-by: Gwendal Grignou --- drivers/iio/common/cros_ec_sensors/Kconfig | 10 + drivers/iio/common/cros_ec_sensors/Makefile | 1 + .../common/cros_ec_sensors/cros_ec_activity.c | 330 ++++++++++++++++++ .../cros_ec_sensors/cros_ec_sensors_core.c | 10 + .../linux/iio/common/cros_ec_sensors_core.h | 1 + .../linux/platform_data/cros_ec_commands.h | 36 +- 6 files changed, 382 insertions(+), 6 deletions(-) create mode 100644 drivers/iio/common/cros_ec_sensors/cros_ec_activity.c diff --git a/drivers/iio/common/cros_ec_sensors/Kconfig b/drivers/iio/common/cros_ec_sensors/Kconfig index fefad9572790..7ef925850a62 100644 --- a/drivers/iio/common/cros_ec_sensors/Kconfig +++ b/drivers/iio/common/cros_ec_sensors/Kconfig @@ -30,3 +30,13 @@ config IIO_CROS_EC_SENSORS_LID_ANGLE convertible devices. This module is loaded when the EC can calculate the angle between the base and the lid. + +config IIO_CROS_EC_ACTIVITY + tristate "ChromeOS EC Activity Sensors" + depends on IIO_CROS_EC_SENSORS_CORE + help + Module to handle activity events detections presented by the ChromeOS + EC Sensor hub. + Activities can be a proximity detector (on body/off body detection) + or an activity to trigger an event on significant motion. + Creates an IIO device to manage all activities. diff --git a/drivers/iio/common/cros_ec_sensors/Makefile b/drivers/iio/common/cros_ec_sensors/Makefile index e0a33ab66d21..a7849c52f3c8 100644 --- a/drivers/iio/common/cros_ec_sensors/Makefile +++ b/drivers/iio/common/cros_ec_sensors/Makefile @@ -3,6 +3,7 @@ # Makefile for sensors seen through the ChromeOS EC sensor hub. # +obj-$(CONFIG_IIO_CROS_EC_ACTIVITY) += cros_ec_activity.o obj-$(CONFIG_IIO_CROS_EC_SENSORS_CORE) += cros_ec_sensors_core.o obj-$(CONFIG_IIO_CROS_EC_SENSORS) += cros_ec_sensors.o obj-$(CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE) += cros_ec_lid_angle.o diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c new file mode 100644 index 000000000000..01e4323abd36 --- /dev/null +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_activity.c @@ -0,0 +1,330 @@ +// SPDX-License-Identifier: GPL-2.0 +// +/* + * cros_ec_sensors_activity - Driver for activities/gesture recognition. + * + * Copyright 2025 Google, Inc + * + * This driver uses the cros-ec interface to communicate with the Chrome OS + * EC about activity data. Accelerometer access is presented through iio sysfs. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "cros-ec-activity" + +/* state data for ec_sensors iio driver. */ +struct cros_ec_sensors_state { + /* Shared by all sensors */ + struct cros_ec_sensors_core_state core; + + struct iio_chan_spec *channels; + + int body_detection_channel_index; + int sig_motion_channel_index; +}; + +static const struct iio_event_spec cros_ec_activity_single_shot[] = { + { + .type = IIO_EV_TYPE_CHANGE, + /* significant motion trigger when we get out of still. */ + .dir = IIO_EV_DIR_FALLING, + .mask_separate = BIT(IIO_EV_INFO_ENABLE), + }, +}; + +static const struct iio_event_spec cros_ec_body_detect_events[] = { + { + .type = IIO_EV_TYPE_CHANGE, + .dir = IIO_EV_DIR_EITHER, + .mask_separate = BIT(IIO_EV_INFO_ENABLE), + }, +}; + +static int ec_sensors_read(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct cros_ec_sensors_state *st = iio_priv(indio_dev); + int ret; + + mutex_lock(&st->core.cmd_lock); + if (chan->type == IIO_PROXIMITY && + mask == IIO_CHAN_INFO_RAW) { + st->core.param.cmd = MOTIONSENSE_CMD_GET_ACTIVITY; + st->core.param.get_activity.activity = + MOTIONSENSE_ACTIVITY_BODY_DETECTION; + if (cros_ec_motion_send_host_cmd(&st->core, 0) != + EC_RES_SUCCESS) { + ret = -EIO; + } else { + *val = st->core.resp->get_activity.state; + ret = IIO_VAL_INT; + } + } else { + ret = -EINVAL; + } + mutex_unlock(&st->core.cmd_lock); + return ret; +} + +static int cros_ec_read_event_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir) +{ + struct cros_ec_sensors_state *st = iio_priv(indio_dev); + int ret; + + if (chan->type != IIO_ACTIVITY && chan->type != IIO_PROXIMITY) + return -EINVAL; + + mutex_lock(&st->core.cmd_lock); + st->core.param.cmd = MOTIONSENSE_CMD_LIST_ACTIVITIES; + ret = cros_ec_motion_send_host_cmd(&st->core, 0); + if (ret) + goto done; + switch (chan->type) { + case IIO_PROXIMITY: + ret = !!(st->core.resp->list_activities.enabled & + (1 << MOTIONSENSE_ACTIVITY_BODY_DETECTION)); + break; + case IIO_ACTIVITY: + if (chan->channel2 == IIO_MOD_STILL) { + ret = !!(st->core.resp->list_activities.enabled & + (1 << MOTIONSENSE_ACTIVITY_SIG_MOTION)); + } else { + dev_warn(&indio_dev->dev, "Unknown activity: %d\n", + chan->channel2); + ret = -EINVAL; + } + break; + default: + dev_warn(&indio_dev->dev, "Unknown channel type: %d\n", + chan->type); + ret = -EINVAL; + } +done: + mutex_unlock(&st->core.cmd_lock); + return ret; +} + +static int cros_ec_write_event_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + enum iio_event_type type, + enum iio_event_direction dir, int state) +{ + struct cros_ec_sensors_state *st = iio_priv(indio_dev); + int ret; + + if (chan->type != IIO_ACTIVITY && chan->type != IIO_PROXIMITY) + return -EINVAL; + + mutex_lock(&st->core.cmd_lock); + st->core.param.cmd = MOTIONSENSE_CMD_SET_ACTIVITY; + switch (chan->type) { + case IIO_PROXIMITY: + st->core.param.set_activity.activity = + MOTIONSENSE_ACTIVITY_BODY_DETECTION; + break; + case IIO_ACTIVITY: + if (chan->channel2 == IIO_MOD_STILL) { + st->core.param.set_activity.activity = + MOTIONSENSE_ACTIVITY_SIG_MOTION; + } else { + dev_warn(&indio_dev->dev, "Unknown activity: %d\n", + chan->channel2); + } + break; + default: + dev_warn(&indio_dev->dev, "Unknown channel type: %d\n", + chan->type); + } + st->core.param.set_activity.enable = state; + + ret = cros_ec_motion_send_host_cmd(&st->core, 0); + + mutex_unlock(&st->core.cmd_lock); + return ret; +} + +static int cros_ec_activity_push_data(struct iio_dev *indio_dev, + s16 *data, + s64 timestamp) +{ + struct ec_response_activity_data *activity_data = + (struct ec_response_activity_data *)data; + enum motionsensor_activity activity = activity_data->activity; + u8 state = activity_data->state; + const struct cros_ec_sensors_state *st = iio_priv(indio_dev); + const struct iio_chan_spec *chan; + const struct iio_event_spec *event; + enum iio_event_direction dir; + int index; + u64 ev; + + switch (activity) { + case MOTIONSENSE_ACTIVITY_BODY_DETECTION: + index = st->body_detection_channel_index; + dir = state ? IIO_EV_DIR_FALLING : IIO_EV_DIR_RISING; + break; + case MOTIONSENSE_ACTIVITY_SIG_MOTION: + index = st->sig_motion_channel_index; + dir = IIO_EV_DIR_FALLING; + break; + default: + dev_warn(&indio_dev->dev, "Unknown activity: %d\n", activity); + return 0; + } + chan = &st->channels[index]; + event = &chan->event_spec[0]; + + ev = IIO_UNMOD_EVENT_CODE(chan->type, index, event->type, dir); + iio_push_event(indio_dev, ev, timestamp); + return 0; +} + +static irqreturn_t cros_ec_activity_capture(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + + dev_warn(&indio_dev->dev, "%s: Not Expected\n", __func__); + return IRQ_NONE; +} + +static const struct iio_info ec_sensors_info = { + .read_raw = &ec_sensors_read, + .read_event_config = cros_ec_read_event_config, + .write_event_config = cros_ec_write_event_config, +}; + +static int cros_ec_sensors_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct cros_ec_device *ec_device = dev_get_drvdata(dev->parent); + struct iio_dev *indio_dev; + struct cros_ec_sensors_state *st; + struct iio_chan_spec *channel; + unsigned long activities; + int i, index, ret, nb_activities; + + if (!ec_device) { + dev_warn(&pdev->dev, "No CROS EC device found.\n"); + return -EINVAL; + } + + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); + if (!indio_dev) + return -ENOMEM; + + ret = cros_ec_sensors_core_init(pdev, indio_dev, true, + cros_ec_activity_capture); + if (ret) + return ret; + + indio_dev->info = &ec_sensors_info; + st = iio_priv(indio_dev); + st->core.type = st->core.resp->info.type; + + /* + * List all available activities + */ + st->core.param.cmd = MOTIONSENSE_CMD_LIST_ACTIVITIES; + ret = cros_ec_motion_send_host_cmd(&st->core, 0); + if (ret) + return ret; + activities = st->core.resp->list_activities.enabled | + st->core.resp->list_activities.disabled; + nb_activities = hweight_long(activities) + 1; + + if (!activities) + return -ENODEV; + + /* Allocate a channel per activity and one for timestamp */ + st->channels = devm_kcalloc(&pdev->dev, nb_activities, + sizeof(*st->channels), GFP_KERNEL); + if (!st->channels) + return -ENOMEM; + + channel = &st->channels[0]; + index = 0; + for_each_set_bit(i, &activities, BITS_PER_LONG) { + channel->scan_index = index; + + /* List all available activities */ + if (i == MOTIONSENSE_ACTIVITY_BODY_DETECTION) { + channel->type = IIO_PROXIMITY; + channel->info_mask_separate = BIT(IIO_CHAN_INFO_RAW); + channel->modified = 0; + channel->event_spec = cros_ec_body_detect_events; + channel->num_event_specs = + ARRAY_SIZE(cros_ec_body_detect_events); + st->body_detection_channel_index = index; + } else { + channel->type = IIO_ACTIVITY; + channel->modified = 1; + channel->event_spec = cros_ec_activity_single_shot; + channel->num_event_specs = + ARRAY_SIZE(cros_ec_activity_single_shot); + if (i == MOTIONSENSE_ACTIVITY_SIG_MOTION) { + channel->channel2 = IIO_MOD_STILL; + st->sig_motion_channel_index = index; + } else { + dev_warn(&pdev->dev, + "Unknown activity: %d\n", i); + continue; + } + } + channel->ext_info = cros_ec_sensors_limited_info; + channel++; + index++; + } + + /* Timestamp */ + channel->scan_index = index; + channel->type = IIO_TIMESTAMP; + channel->channel = -1; + channel->scan_type.sign = 's'; + channel->scan_type.realbits = 64; + channel->scan_type.storagebits = 64; + + indio_dev->channels = st->channels; + indio_dev->num_channels = index + 1; + + st->core.read_ec_sensors_data = cros_ec_sensors_read_cmd; + + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_activity_push_data); +} + +static void cros_ec_sensors_remove(struct platform_device *pdev) +{ + struct iio_dev *indio_dev = platform_get_drvdata(pdev); + + iio_device_unregister(indio_dev); +} + +static struct platform_driver cros_ec_sensors_platform_driver = { + .driver = { + .name = DRV_NAME, + }, + .probe = cros_ec_sensors_probe, + .remove = cros_ec_sensors_remove, +}; +module_platform_driver(cros_ec_sensors_platform_driver); + +MODULE_DESCRIPTION("ChromeOS EC activity sensors driver"); +MODULE_ALIAS("platform:" DRV_NAME); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 64bada1e8678..1bd07ca3abfe 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -489,6 +489,16 @@ const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = { }; EXPORT_SYMBOL_GPL(cros_ec_sensors_ext_info); +const struct iio_chan_spec_ext_info cros_ec_sensors_limited_info[] = { + { + .name = "id", + .shared = IIO_SHARED_BY_ALL, + .read = cros_ec_sensors_id + }, + { }, +}; +EXPORT_SYMBOL_GPL(cros_ec_sensors_limited_info); + /** * cros_ec_sensors_idx_to_reg - convert index into offset in shared memory * @st: pointer to state information for device diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h index e72167b96d27..bb966abcde53 100644 --- a/include/linux/iio/common/cros_ec_sensors_core.h +++ b/include/linux/iio/common/cros_ec_sensors_core.h @@ -126,5 +126,6 @@ extern const struct dev_pm_ops cros_ec_sensors_pm_ops; /* List of extended channel specification for all sensors. */ extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[]; +extern const struct iio_chan_spec_ext_info cros_ec_sensors_limited_info[]; #endif /* __CROS_EC_SENSORS_CORE_H */ diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index ecf290a0c98f..0f6d53e7cb97 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -2388,6 +2388,12 @@ enum motionsense_command { */ MOTIONSENSE_CMD_SENSOR_SCALE = 18, + /* + * Activity management + * Retrieve current status of given activity. + */ + MOTIONSENSE_CMD_GET_ACTIVITY = 20, + /* Number of motionsense sub-commands. */ MOTIONSENSE_NUM_CMDS }; @@ -2447,6 +2453,11 @@ enum motionsensor_orientation { MOTIONSENSE_ORIENTATION_UNKNOWN = 4, }; +struct ec_response_activity_data { + uint8_t activity; /* motionsensor_activity */ + uint8_t state; +} __ec_todo_packed; + struct ec_response_motion_sensor_data { /* Flags for each sensor. */ uint8_t flags; @@ -2454,15 +2465,14 @@ struct ec_response_motion_sensor_data { uint8_t sensor_num; /* Each sensor is up to 3-axis. */ union { - int16_t data[3]; + int16_t data[3]; struct __ec_todo_packed { - uint16_t reserved; - uint32_t timestamp; + uint16_t reserved; + uint32_t timestamp; }; struct __ec_todo_unpacked { - uint8_t activity; /* motionsensor_activity */ - uint8_t state; - int16_t add_info[2]; + struct ec_response_activity_data activity_data; + int16_t add_info[2]; }; }; } __ec_todo_packed; @@ -2494,6 +2504,7 @@ enum motionsensor_activity { MOTIONSENSE_ACTIVITY_SIG_MOTION = 1, MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2, MOTIONSENSE_ACTIVITY_ORIENTATION = 3, + MOTIONSENSE_ACTIVITY_BODY_DETECTION = 4, }; struct ec_motion_sense_activity { @@ -2671,6 +2682,7 @@ struct ec_params_motion_sense { uint32_t max_data_vector; } fifo_read; + /* Used for MOTIONSENSE_CMD_SET_ACTIVITY */ struct ec_motion_sense_activity set_activity; /* Used for MOTIONSENSE_CMD_LID_ANGLE */ @@ -2716,6 +2728,14 @@ struct ec_params_motion_sense { */ int16_t hys_degree; } tablet_mode_threshold; + + /* + * Used for MOTIONSENSE_CMD_GET_ACTIVITY. + */ + struct __ec_todo_unpacked { + uint8_t sensor_num; + uint8_t activity; /* enum motionsensor_activity */ + } get_activity; }; } __ec_todo_packed; @@ -2833,6 +2853,10 @@ struct ec_response_motion_sense { uint16_t hys_degree; } tablet_mode_threshold; + /* USED for MOTIONSENSE_CMD_GET_ACTIVITY. */ + struct __ec_todo_unpacked { + uint8_t state; + } get_activity; }; } __ec_todo_packed; -- 2.49.0.1112.g889b7c5bd8-goog