mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thierry Escande <thierry.escande@collabora.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Gwendal Grignou <gwendal@chromium.org>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: [PATCH 1/3] mfd: cros_ec: Add activity motion sense definitions
Date: Mon,  5 Dec 2016 10:13:16 +0100	[thread overview]
Message-ID: <1480929198-13671-2-git-send-email-thierry.escande@collabora.com> (raw)
In-Reply-To: <1480929198-13671-1-git-send-email-thierry.escande@collabora.com>

From: Gwendal Grignou <gwendal@chromium.org>

This adds motion sense definitions to the commands header related to the
activity sensors attached behind the ChromeOS Embedded Controller.
Supported activities are MOTION and DOUBLE_TAP.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
---
 include/linux/mfd/cros_ec_commands.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 1683003..80e6060 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1417,6 +1417,18 @@ enum motionsense_command {
 	 */
 	MOTIONSENSE_CMD_SENSOR_OFFSET = 11,
 
+	/*
+	 * List available activities for a MOTION sensor.
+	 * Indicates if they are enabled or disabled.
+	 */
+	MOTIONSENSE_CMD_LIST_ACTIVITIES = 12,
+
+	/*
+	 * Activity management
+	 * Enable/Disable activity recognition.
+	 */
+	MOTIONSENSE_CMD_SET_ACTIVITY = 13,
+
 	/* Number of motionsense sub-commands. */
 	MOTIONSENSE_NUM_CMDS
 };
@@ -1494,6 +1506,21 @@ struct ec_response_motion_sensor_data {
 	};
 } __packed;
 
+/* List supported activity recognition */
+enum motionsensor_activity {
+	MOTIONSENSE_ACTIVITY_RESERVED = 0,
+	MOTIONSENSE_ACTIVITY_SIG_MOTION = 1,
+	MOTIONSENSE_ACTIVITY_DOUBLE_TAP = 2,
+};
+
+struct ec_motion_sense_activity {
+	uint8_t sensor_num;
+	uint8_t activity;       /* one of enum motionsensor_activity */
+	uint8_t enable;         /* 1: enable, 0: disable */
+	uint8_t reserved;
+	uint16_t parameters[3]; /* activity dependent parameters */
+};
+
 struct ec_params_motion_sense {
 	uint8_t cmd;
 	union {
@@ -1561,6 +1588,8 @@ struct ec_params_motion_sense {
 			/* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
 			int32_t data;
 		} sensor_odr, sensor_range;
+
+		struct ec_motion_sense_activity set_activity;
 	};
 } __packed;
 
@@ -1611,6 +1640,12 @@ struct ec_response_motion_sense {
 			int16_t temp;
 			int16_t offset[3];
 		} sensor_offset, perform_calib;
+
+		struct {
+			uint16_t reserved;
+			uint32_t enabled;
+			uint32_t disabled;
+		} __packed list_activities;
 	};
 } __packed;
 
-- 
2.7.4

  reply	other threads:[~2016-12-05  9:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05  9:13 [PATCH 0/3] Add ChromeOS EC Activity Sensors driver Thierry Escande
2016-12-05  9:13 ` Thierry Escande [this message]
2017-01-03 15:51   ` [PATCH 1/3] mfd: cros_ec: Add activity motion sense definitions Lee Jones
2016-12-05  9:13 ` [PATCH 2/3] iio: core: Add double tap as possible gesture Thierry Escande
2016-12-06 11:25   ` Peter Meerwald-Stadler
2016-12-19 21:11     ` Jonathan Cameron
2017-06-08  1:10       ` Gwendal Grignou
2017-06-11 14:46         ` Jonathan Cameron
2016-12-05  9:13 ` [PATCH 3/3] iio: cros_ec_activity: add ChromeOS EC Activity Sensors Thierry Escande
2016-12-07  2:15   ` kbuild test robot
2016-12-18 16:37   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480929198-13671-2-git-send-email-thierry.escande@collabora.com \
    --to=thierry.escande@collabora.com \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®