Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1744330yba; Sat, 27 Apr 2019 06:15:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxX6YwHnnTZ9/wPCoV2MKMzBAG8JO1IUnJMSb6t0pfI8WZKXiulSHcA5gvwR4R0Cuw11D9 X-Received: by 2002:a62:5ec2:: with SMTP id s185mr54203084pfb.16.1556370930630; Sat, 27 Apr 2019 06:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556370930; cv=none; d=google.com; s=arc-20160816; b=nH1sIyFOIQtUcpz/L+8qUpD+Rp/ODwvY4XDuPyKMLLa7TnzIxwmpcRUBn/gsvOSw+8 S7ek92BZ4FU5hfzTCIRLT2iZ0XlDo6yjFWu6ZjPXdnZrStiLk+numHqzrKnt7tQpvdcW rX3yQJnij5tgT4qERBSlZspoTQM9puGvffXPdLDYBOdTuOSXpZTYtcwPRT1BfJKuYIhC 5KyPnELFpwMGSkLx2TtE6dIT4JmYBsp7Zlc5AO0rYqlHLuwGuMrGD7/JCTXDj7i2v17W Cs0up6XJROeUamzfoQpmuABRT2kCf4+1KCo4eyq+SnT7mNEMi5RnhRri1xbDcm7nzI5e gzXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=BNwbCpgSm/x3HXmKQBD8KwGiCYgodJGYivpnR1aIq+g=; b=noJeNYvrti+/cDpHOZow0idyXNyk0cr52iBIeNHpG6Clp4KuW5p4SHsD3/Im+Pf7Xh 83JPtOuGciLDmu9q5pUQNo+xFS+R1wZFOeHRYgpNd90nxJksVyeWzajjJJ0JXsRbmzZR vJvkjgIbjJMWK81n3kj8y7XMqncAhB+QAG+nClvz/ps3rqaAL3KJ9SR0DNKn7wLzkqbg lI1sWghLi+USLB8J+7h/mQXOWAYYUvQJn9iTFbynFUinaTJPj4mYx+Jp5+IeYAe6/U8P +DZDq0FvzRTyYuhBqJkG9j6bAbNjO7GqTD2o5q7StpxTnMhN4D3ts8D2s/EwRzO6Ncxn tt9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0tcA2UTE; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cp15si592200plb.209.2019.04.27.06.15.14; Sat, 27 Apr 2019 06:15: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=@kernel.org header.s=default header.b=0tcA2UTE; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbfD0NOZ (ORCPT + 99 others); Sat, 27 Apr 2019 09:14:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:33724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfD0NOY (ORCPT ); Sat, 27 Apr 2019 09:14:24 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26973208C2; Sat, 27 Apr 2019 13:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556370863; bh=vV+980+kvm2sz+Ua30f5pPfe5BH81qRAUM33WJ54q68=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0tcA2UTEizBEhYtjXgDRxzBgGh2sG2FXaLVtHtH+pcJX+pJXKyPGiwq+8Huy9rM4x a4ngdn4akCGN0nzUCzLxby3Z1MMwo+eKv2Nzej22ALMsaFUqosnwfTm4P/nPFz5qKR hKSOkJcWqRWs+cQfXyVbun4e7g2Fh226OoXjV93M= Date: Sat, 27 Apr 2019 14:14:17 +0100 From: Jonathan Cameron To: Fabien Lahoudere Cc: Gwendal Grignou , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Wolfram Sang , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] iio: cros_ec: add 'id' sysfs entry Message-ID: <20190427141351.633ede62@archlinux> In-Reply-To: <20190426113917.10282-1-fabien.lahoudere@collabora.com> References: <20190426113917.10282-1-fabien.lahoudere@collabora.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Apr 2019 13:39:16 +0200 Fabien Lahoudere wrote: > From: Gwendal Grignou > > This new sysfs entry is used to interpret ring buffer information, > mainly by Android sensor HAL. > It expand to all sensors, the documentation about 'id' we can found > in Documentation/ABI/testing/sysfs-bus-iio-cros-ec. > > Also fix typo in docs, I replace 'Septembre' by 'September'. > > Signed-off-by: Gwendal Grignou > Signed-off-by: Fabien Lahoudere Hmm. I'm not 100% keen on non standard ABI like this, but given we already have it for one type of cros_ec, I guess the other one can have it as well. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Note this has probably just missed the coming merge window unless that is delayed for some reason. Thanks, Jonathan > --- > Documentation/ABI/testing/sysfs-bus-iio-cros-ec | 10 +++++----- > .../common/cros_ec_sensors/cros_ec_sensors_core.c | 14 ++++++++++++++ > 2 files changed, 19 insertions(+), 5 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-cros-ec b/Documentation/ABI/testing/sysfs-bus-iio-cros-ec > index 0e95c2ca105c..6158f831c761 100644 > --- a/Documentation/ABI/testing/sysfs-bus-iio-cros-ec > +++ b/Documentation/ABI/testing/sysfs-bus-iio-cros-ec > @@ -18,11 +18,11 @@ Description: > values are 'base' and 'lid'. > > What: /sys/bus/iio/devices/iio:deviceX/id > -Date: Septembre 2017 > +Date: September 2017 > KernelVersion: 4.14 > Contact: linux-iio@vger.kernel.org > Description: > - This attribute is exposed by the CrOS EC legacy accelerometer > - driver and represents the sensor ID as exposed by the EC. This > - ID is used by the Android sensor service hardware abstraction > - layer (sensor HAL) through the Android container on ChromeOS. > + This attribute is exposed by the CrOS EC sensors driver and > + represents the sensor ID as exposed by the EC. This ID is used > + by the Android sensor service hardware abstraction layer (sensor > + HAL) through the Android container on ChromeOS. > 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 719a0df5aeeb..130362ca421b 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 > @@ -125,6 +125,15 @@ static ssize_t cros_ec_sensors_calibrate(struct iio_dev *indio_dev, > return ret ? ret : len; > } > > +static ssize_t cros_ec_sensors_id(struct iio_dev *indio_dev, > + uintptr_t private, > + const struct iio_chan_spec *chan, char *buf) > +{ > + struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); > + > + return snprintf(buf, PAGE_SIZE, "%d\n", st->param.info.sensor_num); > +} > + > static ssize_t cros_ec_sensors_loc(struct iio_dev *indio_dev, > uintptr_t private, const struct iio_chan_spec *chan, > char *buf) > @@ -140,6 +149,11 @@ const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = { > .shared = IIO_SHARED_BY_ALL, > .write = cros_ec_sensors_calibrate > }, > + { > + .name = "id", > + .shared = IIO_SHARED_BY_ALL, > + .read = cros_ec_sensors_id > + }, > { > .name = "location", > .shared = IIO_SHARED_BY_ALL,