Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp980626ybz; Sat, 25 Apr 2020 08:23:34 -0700 (PDT) X-Google-Smtp-Source: APiQypLX/urBRyyK+feaVm8LyEx+Mzg4k4mHthmBuEpV4OqM3TjZmK9lCoPCc0sLwUTLVYfrXyJy X-Received: by 2002:a17:906:6992:: with SMTP id i18mr11547840ejr.293.1587828214217; Sat, 25 Apr 2020 08:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587828214; cv=none; d=google.com; s=arc-20160816; b=B1BBrJhHV7GN/Z0neZcc8HbXIThTKwcQB05tVYOrmBv3B2IvZ/sSGqSgHi79sYJ6rP VUygvyKVfVHzhKf5kiCAmL9JGUyoG/zirVHsmTEy06DLzIrBtm7YdLSEuwGskF3kHF/J vi/zsDzYe3/2sK5SP+XUJ3g4Ejt11XeJHVzgIFgk+T6EP7XgK9T9DJHz7tYkYh3ZnQIv Fg5lMu7DlmXPGlWGlR+qx05eMkud2P4D2EBton5bEH9Orsw0iSHRngXwym5Sc4cpGrDf k3dKGCp8bhil1ULMDAuC9GxS63cojihKlJ8ozjr8Vyzknol2rrIA1RZtL4lh1gS56A/A 70zA== 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=rPK6ADW193nZcpSnoYQoX87aItK1EGT6ZWkPPNq6FTY=; b=xc73tQmXQTxPEID4nLdjtNv/JAZ19rCHjdttJqhQ3MiHl2iISFe9fVX7w1cvnUZSQy Brg9mkzn2DMxRKyoiNJeeVZkq2HeW8xG8ok7y2tZ3axB8h/HI1D1BYCtdYARE2DduOYi SHIttbY5C6iuvlWYwdkMagy25IrdLfW8iOToqdGyIohNanzd+Nmw0vLyxakIIwuW5l5v BVy8euVAuEvX1ts+371j3qnU85PNV9N2QA/V0zvM3l9S6s6enROLF45c7rvNbNbmV2ZF okDymcXZr//PY7J6P6Yab24zv2es1cwNCsF4jnTCVFBUNZy7wqX9aW0wga0bxKXxsEQZ SnQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w2Z9xofF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id y20si5099745eje.323.2020.04.25.08.23.10; Sat, 25 Apr 2020 08:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w2Z9xofF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726146AbgDYPVH (ORCPT + 99 others); Sat, 25 Apr 2020 11:21:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbgDYPVG (ORCPT ); Sat, 25 Apr 2020 11:21:06 -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 E65EF2071C; Sat, 25 Apr 2020 15:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587828066; bh=XT458vq0XN1WLWI28Diyiv9sG8dG5RTg3qgKZyWEnqI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=w2Z9xofFm6mP3p6Bw0TBrKkoMEtxca6iBgpF3jQXay+xV8dAyXts2Urhhmz/slMR/ yMGhTyTJGLtDP5GC+hnN5LdkDx7oSonXPhx3zysAkHfEE6q98yHgwinUTuNJ1RiWsv cHFgEeh4gup0YcLboBlXX0hcg+YkFEx9Vg8SXxuU= Date: Sat, 25 Apr 2020 16:21:01 +0100 From: Jonathan Cameron To: William Breathitt Gray Cc: Gwendal Grignou , Enric Balletbo i Serra , Benson Leung , Guenter Roeck , linux-kernel , linux-iio Subject: Re: [PATCH v2] drivers: counter: Add Cros EC Sync counter Message-ID: <20200425162101.21f7960e@archlinux> In-Reply-To: <20200420190810.GA16124@icarus> References: <20200413195514.192868-1-gwendal@chromium.org> <20200414204814.GH7347@icarus> <20200420190810.GA16124@icarus> X-Mailer: Claws Mail 3.17.5 (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 Mon, 20 Apr 2020 15:08:10 -0400 William Breathitt Gray wrote: > On Mon, Apr 20, 2020 at 11:54:16AM -0700, Gwendal Grignou wrote: > > On Tue, Apr 14, 2020 at 1:48 PM William Breathitt Gray > > wrote: > > > > > > On Mon, Apr 13, 2020 at 12:55:14PM -0700, Gwendal Grignou wrote: > > > > When the camera vsync pin is connected to the embedded controller (EC) of > > > > a chromebook, the EC reports a sensor with a counter that increases > > > > at each GPIO rising edge. > > > > > > > > The sensor is presented using the counter subsystem. > > > > In addition, it is also presented via the IIO subsystem with a timestamp, > > > > allowing synchronisation with sensors connected to the same EC, for > > > > image stabilisation or augmented reality applications. > > > > > > Hi Gwendal, > > > > > > Sorry for the delay. I have some changes requested below. > > > > > > > To enable the counter: > > > > via counter ABI: > > > > echo "rising edge" > counterX/count0/signal_action > > > > via iio ABI > > > > echo 1 > iio:deviceY/en > > > > > > > > To disable the counter: > > > > via counter ABI: > > > > echo "none" > counterX/count0/signal_action > > > > via iio ABI > > > > echo 0 > iio:deviceY/en > > > > > > Although in theory a user could manually disable the actions for a > > > Signal, this is a very roundabout way of actually disabling the Count. > > > It's better to expose an "enable" attribute to allow the users to > > > perform this functionality; for example: > > > > > > echo 0 > counterX/count0/enable > > > echo 1 > counterX/count0/enable > > > > > > > > > > > To read the current counter value: > > > > via counter ABI: > > > > cat counterX/count0/count > > > > via iio ABI > > > > cat iio:deviceY/in_count_raw > > > > > > I know we discussed this in the last review but it's still the same as > > > before: IIO_COUNT interface is deprecated so new drivers won't be > > > allowed to use it. You'll have to remove the IIO_COUNT code in this > > > driver and replace it with Counter subsystem equivalents. > > I understand the need of a clean separation between counter and IIO subsystems. > > I will wait for counter to offer a way to gather timestamp'ed counts. > > Do you have a plan/proposed ABI you can share? > > > > Thanks, > > > > Gwendal. > > Hi Gwendal, > > I'm working on a reimplementation of the internals of the Counter > subsystem: https://gitlab.com/vilhelmgray/iio/-/tree/counter_chardev > > I'm hoping to submit it to the mailing list later this week if I don't > hit any delays; it'll include support as well for a character device > interface for userspace application. > > Once those changes are merged into IIO, I'll submit a patch to add > timestamp support -- hopefully within a week or two after. Right now I > haven't yet chosen any specific format for timestamps, but I will likely > match the format IIO subsystem currently has for its timestamp support > so that migration is easier for these drivers. > Don't copy our crazy clock choosing stuff. That's legacy rubbish for compatibility with a silly choice I made a long time ago. Pick a sensible clock type and stick to it. Jonathan > William Breathitt Gray