Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp801249ybb; Sat, 28 Mar 2020 10:25:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsBTzXfAP1aYHXj/BeafopJwx5ZVdNLks+kWweoyZ1PbVloxmfMZk/6m7v9vlh5YfAlFTvA X-Received: by 2002:a54:4e13:: with SMTP id a19mr2962019oiy.108.1585416330926; Sat, 28 Mar 2020 10:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585416330; cv=none; d=google.com; s=arc-20160816; b=FHsFW206Jv9h+ACr0xvOJ85YA3zwREbri8Ks3z2d6PeaJ9VPE93RYpOWHQSMu/kOG4 ngafKId4WnLl0ox+5w/SviyL0c6zTdmlXyPwYPL+7SDCZooKqXa7w01lZcJsGblBU5XQ 8fZgzPg7K+UC5ezvxQPhr9rTTQ/P//TGFX3PIyN+8rNsm1KDmsb6Q2SpOdyAhxl1MpSc mz0Mrd3h8Ad7l3kxm9D7Lve8iAabeNkJUE7vlnRPLcqoB5ot+x2GzeqSlIRpPQlBDzml U7Npp2Fosy7VdgUaPcig4XEeGyRTuXLehF/afz9csx6mkGe6ovPRackVg3l2AecZ++gO cEzQ== 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=1iROQiGzoN9HtRIz2SCIcNQ8cS20DCdyBwwaYM5Cl38=; b=PkUo+oU1zHByRum5Sby2iyy/KTEvG55fb9qCgYj4M2H2JqC+YwAtNmUhLrJMJFaVTJ izvWYwEbTwHy0KPRX80v19XfDbwad1qS6NOUDLF1hGAlvM79vYjzNGE9VBVlklVTkj0+ U7FK6y05iuw/Tn0Um0VuIpujfKdLtCCIMliOyeYmmi2ANGYw0CTimpj1sQmLd/GiExqu vWlpMxYquNFoo5tjTuNjd4cLI4xiLyqZrAsuc6WSK7Cyn19NnyFf0MAwotBMxEuuVY8y RoBRZoQEj4mmgx68/Js+A/7wIeyN5sFUAfW2Eh2XHK81ZDQeyMhTuYj1FW0i9Q7P0tcn vBHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0/Q8eIel"; 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 y19si3852396oie.128.2020.03.28.10.25.17; Sat, 28 Mar 2020 10:25: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="0/Q8eIel"; 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 S1726369AbgC1RYz (ORCPT + 99 others); Sat, 28 Mar 2020 13:24:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgC1RYz (ORCPT ); Sat, 28 Mar 2020 13:24:55 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 E28FB206F6; Sat, 28 Mar 2020 17:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585416293; bh=cfzFYS/oG1CrThIAkWAcRMT2ZQr5LIDVXad2fZshHtU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0/Q8eIelCZltuUoVh78VwZKzuHiGLaN31hDNO4IlSEUzHTkIQOlODwGInWw3v9f01 w4sLdEtl1J9nomFV/j5hkc+nqUQlFIQ/unQerzO9zkEqaG2CyDIQH/kXFGKc/A3GI8 8DY3ppYYV5jVN6N83mJHxvnJlD4lLiMlKkFLVEAE= Date: Sat, 28 Mar 2020 17:24:49 +0000 From: Jonathan Cameron To: Enric Balletbo i Serra Cc: Gwendal Grignou , bleung@chromium.org, Jonathan.Cameron@huawei.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 12/12] iio: cros_ec: flush as hwfifo attribute Message-ID: <20200328172449.530b1fd8@archlinux> In-Reply-To: References: <20200327223443.6006-1-gwendal@chromium.org> <20200327223443.6006-13-gwendal@chromium.org> X-Mailer: Claws Mail 3.17.4 (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 Sat, 28 Mar 2020 10:14:23 +0100 Enric Balletbo i Serra wrote: > Hi Jonathan and Gwendal, > > On 27/3/20 23:34, Gwendal Grignou wrote: > > Add buffer/hwfifo_flush. It is not part of the ABI, but it follows ST > > and HID lead: Tells the sensor hub to send to the host all pending > > sensor events. > > > > Signed-off-by: Gwendal Grignou > > I need an Ack from Jonathan to pick this. > > Jonathan, once you are fine with it, do you mind if I take the full series > through the platform chrome tree? Once 12 is sorted (or if you want to take up to 11 thats fine) then sure happy for you to take them. Thanks, Jonathan > > Thanks, > Enric > > > > --- > > No changes in v7. > > New in v6. > > > > .../cros_ec_sensors/cros_ec_sensors_core.c | 28 +++++++++++++++++++ > > 1 file changed, 28 insertions(+) > > > > 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 c831915ca7e56..aaf124a82e0e4 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 > > @@ -113,6 +113,33 @@ static int cros_ec_sensor_set_ec_rate(struct cros_ec_sensors_core_state *st, > > return ret; > > } > > > > +static ssize_t cros_ec_sensors_flush(struct device *dev, > > + struct device_attribute *attr, > > + const char *buf, size_t len) > > +{ > > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > + struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); > > + int ret = 0; > > + bool flush; > > + > > + ret = strtobool(buf, &flush); > > + if (ret < 0) > > + return ret; > > + if (!flush) > > + return -EINVAL; > > + > > + mutex_lock(&st->cmd_lock); > > + st->param.cmd = MOTIONSENSE_CMD_FIFO_FLUSH; > > + ret = cros_ec_motion_send_host_cmd(st, 0); > > + if (ret != 0) > > + dev_warn(&indio_dev->dev, "Unable to flush sensor\n"); > > + mutex_unlock(&st->cmd_lock); > > + return ret ? ret : len; > > +} > > + > > +static IIO_DEVICE_ATTR(hwfifo_flush, 0644, NULL, > > + cros_ec_sensors_flush, 0); > > + > > static ssize_t cros_ec_sensor_set_report_latency(struct device *dev, > > struct device_attribute *attr, > > const char *buf, size_t len) > > @@ -175,6 +202,7 @@ static ssize_t hwfifo_watermark_max_show(struct device *dev, > > static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0); > > > > const struct attribute *cros_ec_sensor_fifo_attributes[] = { > > + &iio_dev_attr_hwfifo_flush.dev_attr.attr, > > &iio_dev_attr_hwfifo_timeout.dev_attr.attr, > > &iio_dev_attr_hwfifo_watermark_max.dev_attr.attr, > > NULL, > >