linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: bleung@chromium.org, enric.balletbo@collabora.com,
	Jonathan.Cameron@huawei.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Gwendal Grignou <gwendal@chromium.org>
Subject: [PATCH v7 01/12] platform: chrome: sensorhub: Add the number of sensors in sensorhub
Date: Fri, 27 Mar 2020 15:34:32 -0700	[thread overview]
Message-ID: <20200327223443.6006-2-gwendal@chromium.org> (raw)
In-Reply-To: <20200327223443.6006-1-gwendal@chromium.org>

To better manage resources, store the number of sensors reported by
the EC.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
New in v7

 drivers/platform/chrome/cros_ec_sensorhub.c     | 4 +++-
 include/linux/platform_data/cros_ec_sensorhub.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c
index 79fefd3bb0fa6..134ee5e460472 100644
--- a/drivers/platform/chrome/cros_ec_sensorhub.c
+++ b/drivers/platform/chrome/cros_ec_sensorhub.c
@@ -65,6 +65,7 @@ static int cros_ec_sensorhub_register(struct device *dev,
 		return sensor_num;
 	}
 
+	sensorhub->sensor_num = sensor_num;
 	if (sensor_num == 0) {
 		dev_err(dev, "Zero sensors reported.\n");
 		return -EINVAL;
@@ -172,7 +173,8 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev)
 		 * If the device has sensors but does not claim to
 		 * be a sensor hub, we are in legacy mode.
 		 */
-		for (i = 0; i < 2; i++) {
+		data->sensor_num = 2;
+		for (i = 0; i < data->sensor_num; i++) {
 			ret = cros_ec_sensorhub_allocate_sensor(dev,
 						"cros-ec-accel-legacy", i);
 			if (ret)
diff --git a/include/linux/platform_data/cros_ec_sensorhub.h b/include/linux/platform_data/cros_ec_sensorhub.h
index bef7ffc7fce10..7e46a47fd642b 100644
--- a/include/linux/platform_data/cros_ec_sensorhub.h
+++ b/include/linux/platform_data/cros_ec_sensorhub.h
@@ -22,9 +22,11 @@ struct cros_ec_sensor_platform {
  * struct cros_ec_sensorhub - Sensor Hub device data.
  *
  * @ec: Embedded Controller where the hub is located.
+ * @sensor_num: Number of MEMS sensors present in the EC.
  */
 struct cros_ec_sensorhub {
 	struct cros_ec_dev *ec;
+	int sensor_num;
 };
 
 #endif   /* __LINUX_PLATFORM_DATA_CROS_EC_SENSORHUB_H */
-- 
2.26.0.rc2.310.g2932bb562d-goog


  reply	other threads:[~2020-03-27 22:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 22:34 [PATCH v7 00/12] Cros EC sensor hub FIFO support Gwendal Grignou
2020-03-27 22:34 ` Gwendal Grignou [this message]
2020-03-27 22:34 ` [PATCH v7 02/12] platform: chrome: sensorhub: Add " Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 03/12] platform: chrome: sensorhub: Add code to spread timestmap Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 04/12] platform: chrome: sensorhub: Add median filter Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 05/12] iio: cros_ec: Move function description to .c file Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 06/12] iio: expose iio_device_set_clock Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 07/12] iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 08/12] iio: cros_ec: Remove pm function Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 09/12] iio: cros_ec: Expose hwfifo_timeout Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 10/12] iio: cros_ec: Report hwfifo_watermark_max Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 11/12] iio: cros_ec: Use Hertz as unit for sampling frequency Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 12/12] iio: cros_ec: flush as hwfifo attribute Gwendal Grignou
2020-03-28  9:14   ` Enric Balletbo i Serra
2020-03-28 17:24     ` Jonathan Cameron
2020-03-28 17:22   ` Jonathan Cameron
2020-03-29  0:33     ` Gwendal Grignou
2020-03-29  9:31       ` Jonathan Cameron
2020-03-29 11:22   ` Andy Shevchenko
2020-03-30 12:56 ` [PATCH v7 00/12] Cros EC sensor hub FIFO support Enric Balletbo i Serra

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=20200327223443.6006-2-gwendal@chromium.org \
    --to=gwendal@chromium.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --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;
as well as URLs for NNTP newsgroup(s).