Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1742737ybn; Thu, 26 Sep 2019 01:18:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf/v1s8Z+NZiUHoCFmQ2D5J7nkoE0BCMW51ZAh0skHKOD8/YSdhxdsLMY+IDetsbmPDvl1 X-Received: by 2002:a17:906:b84c:: with SMTP id ga12mr2037295ejb.0.1569485910515; Thu, 26 Sep 2019 01:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569485910; cv=none; d=google.com; s=arc-20160816; b=nZAyhPmG7olfe2Haf1GzQB1+c2xmZC2DinqKa3Alqq4NrnkNhT05Impoa+kikAjIXC i8czoW+Mmrigfs0jLDnVNZIPY/ofrr7Y5tAq4l/xin0zUYpxdez3EW541SwBmTev7pW9 a5M0kbi5Zif5l/NMcPVYGTJ0lufdEvrmTMlBjwYQXrEP7mmPCFhmxpIwziZv736VmMQ5 cDKXBz4Q5HiQ3UoNlUoWA1TwlrUCtwRMALB2w7IWaJ34qgA6bKM8Hz7qObFQvKJsY7EW TKlI001Ou6TmQ0/7g2wSJlYg2WAu7riSx63olODnXEvn/TFlFKcAilmAKjA9TjmBERxI OVlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g093irkxKPkHDpFn4RyPlld2gBhWe1EAWEgLqqQDkYY=; b=BS4Na+BOTkuVhUKG2BITRXPmYoTLIWmHOW/7NoygBdi0dzjvAkp8MCf73Go41UprFb 5dPrl6S7luWsqK32mJcCnomZDB5H2U0LWi8U8bXVK5xnVlmiU1YBVPh74sKj17aV4WjB +utrmaDPoMwV56QbOGcjrAO2PEIANwxG5mxkUoCR/IsdB9jVqgR7DFSSmk26V0jcvcaz guoBl8DTsCk3Bw97w5gUNJD7W61msClAAprp68XeDsY6K9NIeDx4GmU1GTXBjS/CqEtH Zm4FSHhz7QcKye5DR7TmPTTnZdiQg4Hf3pJLhawNN/XZHDYIszSz/IwyN41AvQF+NEbC 4g9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bu843byX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si900710edb.379.2019.09.26.01.18.07; Thu, 26 Sep 2019 01:18:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bu843byX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409744AbfIXOxK (ORCPT + 99 others); Tue, 24 Sep 2019 10:53:10 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:33964 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731244AbfIXOxK (ORCPT ); Tue, 24 Sep 2019 10:53:10 -0400 Received: by mail-yw1-f68.google.com with SMTP id h73so732175ywa.1; Tue, 24 Sep 2019 07:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=g093irkxKPkHDpFn4RyPlld2gBhWe1EAWEgLqqQDkYY=; b=Bu843byXFXusRsqoc3wLDtQaQlkuX9OfeAfvkSR6zRMHFzY+vtcqzK/+Qi7Qo76rg6 6+ILw4snjD929Z+i6eYTkAlu+/ERTEYtbMBNQw2/9OyJO9WIoXffouRCyM5G+chzAVEe Ylk3gZS3TKbxzuKgcyhyZMjw5WM5VBHbQrZeMujPJDh1ciC5MmX4ir5W5EYBDdH6PKen 2JodmIDdMgxFPKstIxcllwkmgEGwJ/CY9HmkajW9lus73cubhVhkiIvKnI5gss/YRqaT QSihRbrN89Z8sWLRpQX8HVMBsHBMLE3Fj2NBFTQWElIo8UbkwWnI3JeVD7VRvLq9bSM0 vmuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=g093irkxKPkHDpFn4RyPlld2gBhWe1EAWEgLqqQDkYY=; b=fOGG8jQBss+cN4+Q9G80U8DZGjOBDTSBXzZrRDg3oXYWsmjb8UmMzBT11z/IniTJSQ esTnwrxMqz6+79QjWLi8iEYW6wZq1EfB4tzzbCWEcp+bKSf/FVDXJ/MrkOIub+Up+RrQ 1P6QsYiVt7A/kr6COnO6nJBFo6zfAL3m+x8OcJc4PvJXQlnK19Ipfp1Hltmu5xJD6BSB YGqfKOCACChOZdpQtt2DAy/mqGHlRd8hvCHU19gcajV8BwvPUuz2OrDPZNyxMPiQvAFw 52X8wA4v9DsAIy4gX30Zd024OAhRrFfxv/fjRGBVoC6bY1lZy5yUEsbkWkYd1b3F+o8C w+/A== X-Gm-Message-State: APjAAAVx1JedczitPhYlPkdHpdKwSRqnvGVHxSaJT93GcJ9IqCZS8kAa LudQ2oX6a0xvkAyzryWqc8M= X-Received: by 2002:a81:48c8:: with SMTP id v191mr2121439ywa.113.1569336788391; Tue, 24 Sep 2019 07:53:08 -0700 (PDT) Received: from icarus (072-189-084-142.res.spectrum.com. [72.189.84.142]) by smtp.gmail.com with ESMTPSA id p10sm473710ywc.19.2019.09.24.07.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 07:53:07 -0700 (PDT) Date: Tue, 24 Sep 2019 23:52:44 +0900 From: William Breathitt Gray To: Fabien Lahoudere Cc: Jonathan Cameron , gwendal@chromium.org, egranata@chromium.org, kernel@collabora.com, Jonathan Corbet , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lee Jones , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Nicolas Ferre , Nick Vaccaro , linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] counter: cros_ec: Add synchronization sensor Message-ID: <20190924145244.GA5037@icarus> References: <20190826095612.7455cb05@archlinux> <8abbe9360938ab851d16c2c1494ba56034775823.camel@collabora.com> <6b50bdff184e6af664b7a61e0a8a2cddc5718f0a.camel@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6b50bdff184e6af664b7a61e0a8a2cddc5718f0a.camel@collabora.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 24, 2019 at 04:20:51PM +0200, Fabien Lahoudere wrote: > Hi all, > > After some discussions and investigation, the timestamp is very > important for that sync driver. > Google team uses that timestamp to compare with gyroscope timestamp. > > So the important data is timestamp and counter value is useless. > Just the event of counter increment is important to get a timestamp. > > In that case, my idea was to just use an IIO driver with a single > channel with IIO_TIMESTAMP. We discuss this here and it seems > controversial. > > So my question to Jonathan is if we have a timestamp coming from the EC > itself, can we consider this timestamp as a good IIO driver? > > Any other idea is welcome, however Google team would like to manage > only IIO drivers if possible. > > Thanks Keep in mind that while you will not need the counter value for your purposes, someone else might want it for some reason or other. Since it is a counter, somewhere down the line this device will end up with a driver in the Counter subsystem; and because timestamp support is already being discussed for other counter devices (cf. Intel QEP driver https://www.spinics.net/lists/linux-iio/msg46680.html), a conflict will arise if this device has an IIO driver holding the memory space for timestamps while a Counter driver tries to hold the same resources. It's better in this case to access timestamps through the Counter subsystem, rather than only partially support this device through IIO just for timestamps. William Breathitt Gray > Le jeudi 29 août 2019 à 13:10 +0200, Fabien Lahoudere a écrit : > > Le lundi 26 août 2019 à 09:56 +0100, Jonathan Cameron a écrit : > > > On Fri, 23 Aug 2019 14:41:27 +0200 > > > Fabien Lahoudere wrote: > > > > > > > From: Gwendal Grignou > > > > > > > > EC returns a counter when there is an event on camera vsync. > > > > This patch comes from chromeos kernel 4.4 > > > > > > > > Signed-off-by: Gwendal Grignou > > > > Signed-off-by: Fabien Lahoudere > > > > > > > > CROS EC sync sensor was originally designed as an IIO device. > > > > Now that the counter subsystem will replace IIO_COUNTER, we > > > > have to implement a new way to get sync count. > > > > > > I'm curious. What is this counter used for? > > > > It is a counter of a pin connected to a camera vsync. > > It is used to manage correct orientation of the camera when the > > gyroscope detect a change. > > > > > This combined counter and iio driver isn't something we would > > > normally > > > want to support. What is the reasoning behind doing both > > > interfaces? > > > > That patch was originally designed using only IIO with IIO_count and > > IIO_TIMESTAMP channel. As IIO_COUNT is deprecated, we need to use the > > new counter subsystem. So I just split the driver in two part counter > > and iio timestamp. > > > > However after your email I did some investigation and did not find > > any > > use of the timestamp for that sensor. Timestamp is just a common > > channel implemented on all CROS EC sensors. > > > > So I think I will drop it now and if a timestamp is needed, I will > > probably restart the discussion about timestamp in the counter > > subsystemif that make sense to have one. > > > > Thanks > > > > Fabien > > > > > > Signed-off-by: Fabien Lahoudere > > > > --- > > > > Documentation/driver-api/generic-counter.rst | 3 + > > > > MAINTAINERS | 7 + > > > > drivers/counter/Kconfig | 9 + > > > > drivers/counter/Makefile | 1 + > > > > drivers/counter/counter.c | 2 + > > > > drivers/counter/cros_ec_sensors_sync.c | 208 > > > > ++++++++++++++++++ > > > > .../cros_ec_sensors/cros_ec_sensors_core.c | 1 + > > > > drivers/mfd/cros_ec_dev.c | 3 + > > > > include/linux/counter.h | 1 + > > > > 9 files changed, 235 insertions(+) > > > > create mode 100644 drivers/counter/cros_ec_sensors_sync.c > > > > > > > > diff --git a/Documentation/driver-api/generic-counter.rst > > > > b/Documentation/driver-api/generic-counter.rst > > > > index 8382f01a53e3..beb80714ac8b 100644 > > > > --- a/Documentation/driver-api/generic-counter.rst > > > > +++ b/Documentation/driver-api/generic-counter.rst > > > > @@ -44,6 +44,9 @@ Counter interface provides the following > > > > available count data types: > > > > * COUNT_POSITION: > > > > Unsigned integer value representing position. > > > > > > > > +* COUNT_TALLY: > > > > + Unsigned integer value representing tally. > > > > + > > > > A Count has a count function mode which represents the update > > > > behavior > > > > for the count data. The Generic Counter interface provides the > > > > following > > > > available count function modes: > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > > index e60f5c361969..83bd291d103e 100644 > > > > --- a/MAINTAINERS > > > > +++ b/MAINTAINERS > > > > @@ -3902,6 +3902,13 @@ R: Guenter Roeck > > > > F: Documentation/devicetree/bindings/sound/google,cros-ec- > > > > codec.txt > > > > F: sound/soc/codecs/cros_ec_codec.* > > > > > > > > +CHROMEOS EC COUNTER DRIVER > > > > +M: Fabien Lahoudere > > > > +M: William Breathitt Gray > > > > +L: linux-iio@vger.kernel.org > > > > +S: Maintained > > > > +F: drivers/counter/cros_ec_sensors_sync.c > > > > + > > > > CIRRUS LOGIC AUDIO CODEC DRIVERS > > > > M: Brian Austin > > > > M: Paul Handrigan > > > > diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig > > > > index 2967d0a9ff91..22287f5715e5 100644 > > > > --- a/drivers/counter/Kconfig > > > > +++ b/drivers/counter/Kconfig > > > > @@ -59,4 +59,13 @@ config FTM_QUADDEC > > > > To compile this driver as a module, choose M here: the > > > > module will be called ftm-quaddec. > > > > > > > > +config IIO_CROS_EC_SENSORS_SYNC > > > > + tristate "ChromeOS EC Counter Sensors" > > > > + depends on IIO_CROS_EC_SENSORS_CORE && IIO > > > > + help > > > > + Module to handle synchronisation sensors presented by the > > > > ChromeOS EC > > > > + Sensor hub. > > > > + Synchronisation sensors are counter sensors triggered when > > > > events > > > > + occurs from other subsystems. > > > > + > > > > endif # COUNTER > > > > diff --git a/drivers/counter/Makefile b/drivers/counter/Makefile > > > > index 40d35522937d..6fe4c98a446f 100644 > > > > --- a/drivers/counter/Makefile > > > > +++ b/drivers/counter/Makefile > > > > @@ -9,3 +9,4 @@ obj-$(CONFIG_104_QUAD_8) += 104-quad-8.o > > > > obj-$(CONFIG_STM32_TIMER_CNT) += stm32-timer-cnt.o > > > > obj-$(CONFIG_STM32_LPTIMER_CNT) += stm32-lptimer-cnt.o > > > > obj-$(CONFIG_FTM_QUADDEC) += ftm-quaddec.o > > > > +obj-$(CONFIG_IIO_CROS_EC_SENSORS_SYNC) += cros_ec_sensors_sync.o > > > > diff --git a/drivers/counter/counter.c > > > > b/drivers/counter/counter.c > > > > index 106bc7180cd8..53525b109094 100644 > > > > --- a/drivers/counter/counter.c > > > > +++ b/drivers/counter/counter.c > > > > @@ -261,6 +261,7 @@ void counter_count_read_value_set(struct > > > > counter_count_read_value *const val, > > > > { > > > > switch (type) { > > > > case COUNTER_COUNT_POSITION: > > > > + case COUNTER_COUNT_TALLY: > > > > val->len = sprintf(val->buf, "%lu\n", *(unsigned long > > > > *)data); > > > > break; > > > > default: > > > > @@ -290,6 +291,7 @@ int counter_count_write_value_get(void *const > > > > data, > > > > > > > > switch (type) { > > > > case COUNTER_COUNT_POSITION: > > > > + case COUNTER_COUNT_TALLY: > > > > err = kstrtoul(val->buf, 0, data); > > > > if (err) > > > > return err; > > > > diff --git a/drivers/counter/cros_ec_sensors_sync.c > > > > b/drivers/counter/cros_ec_sensors_sync.c > > > > new file mode 100644 > > > > index 000000000000..b6f5e2c6da9f > > > > --- /dev/null > > > > +++ b/drivers/counter/cros_ec_sensors_sync.c > > > > @@ -0,0 +1,208 @@ > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > +/* > > > > + * Driver of counter incremented after events on interrupt line > > > > in > > > > EC. > > > > + * > > > > + * Copyright 2018 Google, Inc > > > > + */ > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +#define DRV_NAME "cros-ec-sync" > > > > + > > > > +/* > > > > + * One channel for counter, the other for timestamp. > > > > + */ > > > > +#define MAX_CHANNELS (1) > > > > + > > > > +/* State data for ec_sensors iio driver. */ > > > > +struct cros_ec_sensors_sync_state { > > > > + /* Shared by all sensors */ > > > > + struct cros_ec_sensors_core_state core; > > > > + struct counter_device counter; > > > > + struct iio_chan_spec channels[MAX_CHANNELS]; > > > > +}; > > > > + > > > > +static int cros_ec_sensors_sync_read(struct iio_dev *indio_dev, > > > > + struct iio_chan_spec const *chan, > > > > + int *val, int *val2, long mask) > > > > +{ > > > > + struct cros_ec_sensors_sync_state *st = iio_priv(indio_dev); > > > > + u16 data; > > > > + int ret; > > > > + > > > > + mutex_lock(&st->core.cmd_lock); > > > > + switch (mask) { > > > > + case IIO_CHAN_INFO_RAW: > > > > + ret = cros_ec_sensors_read_cmd(indio_dev, BIT(0), > > > > &data); > > > > + if (ret < 0) > > > > + break; > > > > + ret = IIO_VAL_INT; > > > > + *val = data; > > > > + break; > > > > + default: > > > > + ret = cros_ec_sensors_core_read(&st->core, chan, val, > > > > val2, > > > > + mask); > > > > + break; > > > > + } > > > > + mutex_unlock(&st->core.cmd_lock); > > > > + return ret; > > > > +} > > > > + > > > > +static struct iio_info cros_ec_sensors_sync_info = { > > > > + .read_raw = &cros_ec_sensors_sync_read, > > > > + .read_avail = &cros_ec_sensors_core_read_avail, > > > > +}; > > > > + > > > > +static struct counter_count cros_ec_sync_counts = { > > > > + .id = 0, > > > > + .name = "Cros EC sync counter", > > > > +}; > > > > + > > > > +static int cros_ec_sync_cnt_read(struct counter_device *counter, > > > > + struct counter_count *count, > > > > + struct counter_count_read_value *val) > > > > +{ > > > > + s16 cnt; > > > > + int ret; > > > > + struct iio_dev *indio_dev = counter->priv; > > > > + struct cros_ec_sensors_sync_state *const st = > > > > iio_priv(indio_dev); > > > > + unsigned long data; > > > > + > > > > + mutex_lock(&st->core.cmd_lock); > > > > + ret = cros_ec_sensors_read_cmd(indio_dev, BIT(0), &cnt); > > > > + mutex_unlock(&st->core.cmd_lock); > > > > + if (ret != 0) { > > > > + dev_warn(&indio_dev->dev, "Unable to read sensor > > > > data\n"); > > > > + return ret; > > > > + } > > > > + > > > > + data = (unsigned long) cnt; > > > > + counter_count_read_value_set(val, COUNTER_COUNT_TALLY, &data); > > > > + > > > > + return 0; > > > > +} > > > > + > > > > +static const struct counter_ops cros_ec_sync_cnt_ops = { > > > > + .count_read = cros_ec_sync_cnt_read, > > > > +}; > > > > + > > > > +static char *cros_ec_loc[] = { > > > > + [MOTIONSENSE_LOC_BASE] = "base", > > > > + [MOTIONSENSE_LOC_LID] = "lid", > > > > + [MOTIONSENSE_LOC_CAMERA] = "camera", > > > > + [MOTIONSENSE_LOC_MAX] = "unknown", > > > > +}; > > > > + > > > > +static ssize_t cros_ec_sync_id(struct counter_device *counter, > > > > + void *private, char *buf) > > > > +{ > > > > + struct iio_dev *indio_dev = counter->priv; > > > > + struct cros_ec_sensors_sync_state *const st = > > > > iio_priv(indio_dev); > > > > + > > > > + return snprintf(buf, PAGE_SIZE, "%d\n", st- > > > > > core.param.info.sensor_num); > > > > +} > > > > + > > > > +static ssize_t cros_ec_sync_loc(struct counter_device *counter, > > > > + void *private, char *buf) > > > > +{ > > > > + struct iio_dev *indio_dev = counter->priv; > > > > + struct cros_ec_sensors_sync_state *const st = > > > > iio_priv(indio_dev); > > > > + > > > > + return snprintf(buf, PAGE_SIZE, "%s\n", cros_ec_loc[st- > > > > > core.loc]); > > > > +} > > > > + > > > > +static struct counter_device_ext cros_ec_sync_cnt_ext[] = { > > > > + { > > > > + .name = "id", > > > > + .read = cros_ec_sync_id > > > > + }, > > > > + { > > > > + .name = "location", > > > > + .read = cros_ec_sync_loc > > > > + }, > > > > +}; > > > > + > > > > +static int cros_ec_sensors_sync_probe(struct platform_device > > > > *pdev) > > > > +{ > > > > + struct cros_ec_sensors_sync_state *state; > > > > + struct device *dev = &pdev->dev; > > > > + struct iio_chan_spec *channel; > > > > + struct iio_dev *indio_dev; > > > > + int ret; > > > > + > > > > + indio_dev = devm_iio_device_alloc(dev, sizeof(*state)); > > > > + if (!indio_dev) > > > > + return -ENOMEM; > > > > + > > > > + ret = cros_ec_sensors_core_init(pdev, indio_dev, true); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + indio_dev->info = &cros_ec_sensors_sync_info; > > > > + state = iio_priv(indio_dev); > > > > + > > > > + if (state->core.type != MOTIONSENSE_TYPE_SYNC) > > > > + return -EINVAL; > > > > + > > > > + /* Initialize IIO device */ > > > > + channel = state->channels; > > > > + channel->type = IIO_TIMESTAMP; > > > > + channel->channel = -1; > > > > + channel->scan_index = 1; > > > > + channel->scan_type.sign = 's'; > > > > + channel->scan_type.realbits = 64; > > > > + channel->scan_type.storagebits = 64; > > > > + > > > > + indio_dev->channels = state->channels; > > > > + indio_dev->num_channels = MAX_CHANNELS; > > > > + > > > > + state->core.read_ec_sensors_data = cros_ec_sensors_read_cmd; > > > > + > > > > + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, > > > > + cros_ec_sensors_capture, > > > > NULL); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + ret = devm_iio_device_register(dev, indio_dev); > > > > > > Hmm. Wasn't expecting to see that here if it's a counter device. > > > > > > > > > > + if (ret) > > > > + return ret; > > > > + > > > > + /* Initialize counter device */ > > > > + state->counter.name = dev_name(&pdev->dev); > > > > + state->counter.parent = &pdev->dev; > > > > + state->counter.counts = &cros_ec_sync_counts; > > > > + state->counter.num_counts = 1; > > > > + state->counter.priv = indio_dev; > > > > + state->counter.ops = &cros_ec_sync_cnt_ops; > > > > + state->counter.ext = cros_ec_sync_cnt_ext; > > > > + state->counter.num_ext = ARRAY_SIZE(cros_ec_sync_cnt_ext); > > > > + > > > > + return devm_counter_register(&pdev->dev, &state->counter); > > > > +} > > > > + > > > > +static const struct platform_device_id > > > > cros_ec_sensors_sync_ids[] > > > > = { > > > > + { .name = DRV_NAME, }, > > > > + { } > > > > +}; > > > > +MODULE_DEVICE_TABLE(platform, cros_ec_sensors_sync_ids); > > > > + > > > > +static struct platform_driver > > > > cros_ec_sensors_sync_platform_driver > > > > = { > > > > + .driver = { > > > > + .name = DRV_NAME, > > > > + .pm = &cros_ec_sensors_pm_ops, > > > > + }, > > > > + .probe = cros_ec_sensors_sync_probe, > > > > + .id_table = cros_ec_sensors_sync_ids, > > > > +}; > > > > +module_platform_driver(cros_ec_sensors_sync_platform_driver); > > > > + > > > > +MODULE_DESCRIPTION("ChromeOS EC synchronisation sensor 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 805652250960..2bf183425eaf 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 > > > > @@ -22,6 +22,7 @@ > > > > static char *cros_ec_loc[] = { > > > > [MOTIONSENSE_LOC_BASE] = "base", > > > > [MOTIONSENSE_LOC_LID] = "lid", > > > > + [MOTIONSENSE_LOC_CAMERA] = "camera", > > > > [MOTIONSENSE_LOC_MAX] = "unknown", > > > > }; > > > > > > > > diff --git a/drivers/mfd/cros_ec_dev.c > > > > b/drivers/mfd/cros_ec_dev.c > > > > index 41dccced5026..1c5c2c38af88 100644 > > > > --- a/drivers/mfd/cros_ec_dev.c > > > > +++ b/drivers/mfd/cros_ec_dev.c > > > > @@ -332,6 +332,9 @@ static void cros_ec_sensors_register(struct > > > > cros_ec_dev *ec) > > > > case MOTIONSENSE_TYPE_ACTIVITY: > > > > sensor_cells[id].name = "cros-ec-activity"; > > > > break; > > > > + case MOTIONSENSE_TYPE_SYNC: > > > > + sensor_cells[id].name = "cros-ec-sync"; > > > > + break; > > > > default: > > > > dev_warn(ec->dev, "unknown type %d\n", resp- > > > > > info.type); > > > > continue; > > > > diff --git a/include/linux/counter.h b/include/linux/counter.h > > > > index a061cdcdef7c..1198e675306f 100644 > > > > --- a/include/linux/counter.h > > > > +++ b/include/linux/counter.h > > > > @@ -488,6 +488,7 @@ enum counter_signal_value_type { > > > > > > > > enum counter_count_value_type { > > > > COUNTER_COUNT_POSITION = 0, > > > > + COUNTER_COUNT_TALLY > > > > }; > > > > > > > > void counter_signal_read_value_set(struct > > > > counter_signal_read_value *const val, > > > > >