From patchwork Tue Jun 19 10:16:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 10473995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD1AD60230 for ; Tue, 19 Jun 2018 10:17:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD45728AE0 for ; Tue, 19 Jun 2018 10:17:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C120628AF2; Tue, 19 Jun 2018 10:17:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F37BC28AE0 for ; Tue, 19 Jun 2018 10:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757174AbeFSKRI (ORCPT ); Tue, 19 Jun 2018 06:17:08 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39266 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757163AbeFSKRF (ORCPT ); Tue, 19 Jun 2018 06:17:05 -0400 Received: by mail-wr0-f196.google.com with SMTP id w7-v6so19926959wrn.6 for ; Tue, 19 Jun 2018 03:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=1UVfRartf4nPvly3cuNSd113cL8r/vaEMmqtS40ArUc=; b=X+7elzipspBVpISBupw5+8CFA5bSEsWN/VEryTS0rO3Zg+uCdcAicAZ+5mACC5ldK1 kGFLVSUvDa5M3XeHEqoquy6uDu0OmelKIkurqDoaVtIFXDWtySKx/i+IzBbJaHbQRTwg o7BiYAZxmPyEadUeW0GLal8kluOQqd2Ds7pUu1q4b5tfFj7+VXQvdYukwV2+qlr1Cr5b vPAY2ovrVQIQioWUkuEkd8a7xQ1sYqAZPG9a5IW/+Dzdzi5zO3JnzvXJviz9yL8FgyCx AXHQvbfRWsuOTK9SZROYgioY3MalHKalMYaBR9o0x/Yc+1wNeV27tRM17j9siW0qQpXP h3CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1UVfRartf4nPvly3cuNSd113cL8r/vaEMmqtS40ArUc=; b=BrLXbgBNc5efod4vTlBZZ3Xt+Mk/phGoHOFnxT5AA6MXE59N7EOvaFGygraHdfbf4R PUh2kXb6GXHOBCIRRgLgj+xQ/M4ILapzZkokoc9fNvEWdBVaOAAtnPMKw9opakbk254s wsGjo3FFL/Wp6g0dSOQxc7YlqMRYa3D0NTVd/upumPav963KGaWapEaqByeRlcYSAMeP yZdV4hTqdh9Y49iPCGG2F7NBCE6xScZA5dNa0ngJ8EM6hHof/sn8an8DTsUdehO/g2Tj Rrd+BB8diuX4O7xLPfUIpuaqaR92yb3VFgB+E5S6KkVx+Q9Fwp2IXVQgayW0rGhu4Q4r nvYA== X-Gm-Message-State: APt69E3xCflgG5dRi9Zof8e43Om8lUmZFGj49qPpFEIE6SGBfZFk4yhx ysjJ/ZtBlrBi9U9Y8geQjz0kPA== X-Google-Smtp-Source: ADUXVKIKHzCA7uip/4pyINeRBdksAKImY8C8YJfz8kSBaLMj67WmtYGHSCAul0FSS4B+POCQ17L5bw== X-Received: by 2002:adf:b445:: with SMTP id v5-v6mr13119489wrd.67.1529403424013; Tue, 19 Jun 2018 03:17:04 -0700 (PDT) Received: from denali.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id b190-v6sm14288432wma.24.2018.06.19.03.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jun 2018 03:17:03 -0700 (PDT) From: Mathieu Othacehe To: linux-iio@vger.kernel.org Cc: pierre-moana.levesque@parrot.com, Mathieu Othacehe Subject: [PATCH 1/2] iio: Add channel for Phase Date: Tue, 19 Jun 2018 12:16:48 +0200 Message-Id: <1529403409-15179-1-git-send-email-m.othacehe@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add new channel type support for phase. This channel may be used by Time-of-flight sensors to express the phase difference between emitted and received signals. Those sensor will then use the phase shift of return signals to approximate the distance to objects. Signed-off-by: Mathieu Othacehe --- Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 731146c..e0ff2b7 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -1663,3 +1663,10 @@ KernelVersion: 4.12 Contact: linux-iio@vger.kernel.org Description: Raw counter device counters direction for channel Y. + +What: /sys/bus/iio/devices/iio:deviceX/in_phaseY_raw +KernelVersion: 4.18 +Contact: linux-iio@vger.kernel.org +Description: + Raw (unscaled) phase difference reading from channel Y + that can be processed to radians. \ No newline at end of file diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 19bdf3d..34333de 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -85,6 +85,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_COUNT] = "count", [IIO_INDEX] = "index", [IIO_GRAVITY] = "gravity", + [IIO_PHASE] = "phase", }; static const char * const iio_modifier_names[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 4213cdf..6252a0b 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -44,6 +44,7 @@ enum iio_chan_type { IIO_COUNT, IIO_INDEX, IIO_GRAVITY, + IIO_PHASE, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index b61245e..34190f4 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -58,6 +58,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_PH] = "ph", [IIO_UVINDEX] = "uvindex", [IIO_GRAVITY] = "gravity", + [IIO_PHASE] = "phase", }; static const char * const iio_ev_type_text[] = { @@ -151,6 +152,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_PH: case IIO_UVINDEX: case IIO_GRAVITY: + case IIO_PHASE: break; default: return false;