Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp117948imm; Mon, 2 Jul 2018 08:36:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcumJ4y/pBfn2lrKGryznsZbtVEgoWQJADA/Z+JjMRxFq9piY/oKSlRU8st9ZGr5IPde2NV X-Received: by 2002:a17:902:74c2:: with SMTP id f2-v6mr19481575plt.260.1530545814892; Mon, 02 Jul 2018 08:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530545814; cv=none; d=google.com; s=arc-20160816; b=uEYUVu2uiaHE8Y3CkK3bXBFlLZj+F+8uXgl9uk8ITPtDzJIQS7ZFpY3XrIiM5RslRp eFEhkUxgZsuobDez4oKv4ykQk9rr920XIL/2dRFRTbRRVgzRV3CEaXzkpt0Ih6G6Ay2R xXDZ2d+M6lZZOiXLGaWi5fyU6S0CuBKx0o0eRlDY4inIB0t7jhDm5rvdeRzbG2k5Q2rX 2WYwpNbJiBGKTRfs4itJAsO8n60P+mxZFKUvPGzltZJUkXAkFtgIwsHi5Punu6e9ec9/ pTG6sA6E0wJF7YPRApjEE9oo2cqlBspTYMbTgMUJ/x7cqxX9Jchx6KQn/I5rUpNsIy4K qhuQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=c7WgQN8f4KVdAgRpxJwouAFaex9x5PPeIrwDe8OSjo4=; b=yV0tgu1MyUgjvrXvGUhEmfj+AG39nVcFxLduPMcfNnEPOe/vOaj+U7SVr8bf1vE+0v Awv6QmmEO6usIZEVLjQSt17pEaNt+8y4PmWRdzr+h5wLrUyTUhR3kRSQUnFIKGRxHLyO TLv1KFydI8iI7JMRpjg35iIoX1m8amoeksuRIHKZSCl4+cNs9cp4gInIluO9M6psJ1KP W+TmOUzxRZ7/8r6447OhXpj5ZVhmcrOVxE0r4t7Ymp/Aie0bZD5OYjwH5wsWALAdhfq/ a1iRBGRvqESXLFR6St1HEqHJsij3w3Jq5YRtdhsoJXWoeN3R4Rfo9YF9ttYcD6BS/kjY Yaew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=OwYDNWe2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si16174770pls.405.2018.07.02.08.36.40; Mon, 02 Jul 2018 08:36:54 -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=fail header.i=@lechnology.com header.s=default header.b=OwYDNWe2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbeGBPd6 (ORCPT + 99 others); Mon, 2 Jul 2018 11:33:58 -0400 Received: from vern.gendns.com ([206.190.152.46]:37800 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbeGBPd4 (ORCPT ); Mon, 2 Jul 2018 11:33:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c7WgQN8f4KVdAgRpxJwouAFaex9x5PPeIrwDe8OSjo4=; b=OwYDNWe2VlSiZj2YKUhSH+rC1I 9C5GNB5zh9e6panR2dYT3EhM9FsLhVcs/BG7aMjUbAmhWgaeTOMAAFQ/JeCXzpdscSUf6OcUHh+oX 6OPJwoLDD4HDooERG+Pq0/w7k+MWqWMePfNARgvCBuaZo0+tjZTvTjZryFfb4J9dUPvwK2FHc2UZm RV4nUiUINjSBN4sUO1QDfEiKU7Eb/b4JByNV4funvgEzssK4V8/pDBZRXoRf6Ta+DYuS8Lzt3k13w mY5s8bLy5+1LSlbZHBO07YSly4c2D1LHzPRb0zsUM4alllNd3tXavFcnC8anee5D9CpQaVXkZnrgW E9HwrgeA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:59394 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1fa0pu-00DEL1-8u; Mon, 02 Jul 2018 11:33:54 -0400 Subject: Re: [PATCH] iio: add channel type for frequency To: Jonathan Cameron Cc: Lars-Peter Clausen , linux-iio@vger.kernel.org, Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , linux-kernel@vger.kernel.org, William Breathitt Gray References: <20180701025953.3561-1-david@lechnology.com> <308015e8-d203-c4d1-ba80-3c2adf4b377a@metafoo.de> <74c98fdc-b498-c593-e0b1-6aeb7057398a@lechnology.com> <20180702140352.00002c6c@huawei.com> From: David Lechner Message-ID: <51fa1708-a19e-aa05-6145-b2479a89805b@lechnology.com> Date: Mon, 2 Jul 2018 10:33:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180702140352.00002c6c@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/02/2018 08:03 AM, Jonathan Cameron wrote: > On Sun, 1 Jul 2018 17:24:34 -0500 > David Lechner wrote: > >> On 07/01/2018 02:18 AM, Lars-Peter Clausen wrote: >>> On 07/01/2018 04:59 AM, David Lechner wrote: >>>> This adds a new type for frequency to the IIO channel type enumeration. >>>> >>>> Units are in Hz. >>>> >>> >>> Documentation? >> >> I take it that you mean Documentation/ABI/testing/sysfs-bus-iio? Or >> somewhere else too? > > Yes. > >> >>> >>> We already have the altvoltage channel type with the frequency attribute. >>> Difficult to say if there are any overlaps without documentation on how this >>> new attribute is supposed to be used. >> >> I'm basically trying to implement a quadrature encoder in iio. I want to be >> able to use it in-kernel to get a rotational speed value for a motor. > > Have you seen the counters subsystem work that is pretty much ready to merge? I hadn't seen that. Thanks. It sounds like the way to go since I am dealing with a quadrature encoder. > > https://lkml.org/lkml/2018/6/21/659 > >> >> The motors (and encoder wheels) are hot-swapable, so we don't know how many >> counts from the quadrature encoder equals one rotation because it depends on >> which motor is being used. So using IIO_ANGL_VEL doesn't work for this case. > > Hmm. This always ugly when we have hotswappable external devices. Ideal is > to describe them with device tree or similar none the less as this stuff isn't > really something userspace should have to figure out. > >> >> It seems to me that the proper generic unit for "speed" from the quadrature >> encoder would be counts per second, hence the suggestion of a frequency unit. > > It is probably not that clear cut, as what is it frequency of? All depends on > what mode the quadrature counter is working in x4 or x1 for simplest options. > > >> I'm not sure if voltage frequency works here since a "count" on a quadrature >> encoder is derived from two different voltage signals (and may vary depending >> on how the encoder determines what one count it). >> >> Also, unrelated to my quadrature encoder project, I was thinking that >> frequency counters would use this unit as well (although the voltage alt >> makes more sense for this case). >> >> There are also sound sensors that measure frequency that could use this unit. > > I have not fundamental issue with having a frequency channel, but only > if we have a clear cut use case. I suspect the right option here is to > look at what extensions are needed to William's counter subsystem instead > of in IIO (which frankly failed to stretch far enough to support counters > well). > Agreed. Let's drop this patch.