From patchwork Fri Jul 20 17:34:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 10538085 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 D07FD6029B for ; Fri, 20 Jul 2018 17:34:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5FB72956B for ; Fri, 20 Jul 2018 17:34:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A86A82957B; Fri, 20 Jul 2018 17:34:49 +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 AEB642956B for ; Fri, 20 Jul 2018 17:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731556AbeGTSYD (ORCPT ); Fri, 20 Jul 2018 14:24:03 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51332 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387950AbeGTSYC (ORCPT ); Fri, 20 Jul 2018 14:24:02 -0400 Received: by mail-wm0-f68.google.com with SMTP id h3-v6so9743640wmb.1 for ; Fri, 20 Jul 2018 10:34:46 -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:in-reply-to:references; bh=jEy+wmDY/Rw4q2hAAk+jgpmOw/w89y+h3uGn1lCz/dE=; b=cr2lOLCuUz98C5hkf3bz9Ii1y7HJcUmFccXLBcXZDTWEFuHQmUrKM1vdDObDLwWVUz NraEcaC2duo2I4pyE3nQfRN2LWcg4pipqs1I3Q7Obh4qHqZJEO7UT3S1hJGMhRLCUMFy AYquccseM1xdzhGDdH2vsQlmVfjbuR6SK6+qB2ze9m2Jg7y4rqI11VT9xZ5GSUY7HTmV hJ7KxIRvRfU7dPAynWAwB0BRG/KJtfWR0mSyrUdl6YNeNgK7kuY6HiaIBfq0jkZnmwTz 3Ii4zoQMtmWmkkkCSR/Nu46Zodta6VswaU8kg6A1ncNleyaW+qued1YZX5Kv7EWIzM/1 HVxQ== 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:in-reply-to :references; bh=jEy+wmDY/Rw4q2hAAk+jgpmOw/w89y+h3uGn1lCz/dE=; b=tteUILZ/ZGGyrLl/K69V3M5v7c9wei9TlS/9COcVHEFOGp8HLEtGsSr1DwttnehAA/ am+PYXmBMOC/KcTT2eTpzjbf7frSXvVuub47D+/miO8zVrw58jkzDhb89A7Y6Loinoy0 lf4jw3mc1stLDeWVSzPuVBeF60TolPi7Zv4DfTiYVOLtOgWPVHFs5oiQQcY2xgfzbL4L u6hwpItipz29mCbUap6Nz8DhKxvHjuUEhdLKzH9ztbbh2BQIUZJaIlFSusYm2/2CZXuK yyjizDVgr3fL9LA6kuTGK7OsnBAm/enKp2olaDfR97/YNfz5VtFjBp7ZkPqa8YIoKZ0a 4SiQ== X-Gm-Message-State: AOUpUlFRZ2SPjkAwQVSYTtuT3pNfueS6Rrg14aLhNRiodZICWYxNQgVi 31Yw23CoUFj46qRMBCoP5859dS6F9xi8Gw== X-Google-Smtp-Source: AAOMgpcIS+ho+fg15EcagMbWmteG2t4eSlgwuL+t3vwqN+Hgnnw4Qo02XKIFLn/EwP5ycAmsJKN6dg== X-Received: by 2002:a1c:6d1c:: with SMTP id i28-v6mr2195893wmc.97.1532108085429; Fri, 20 Jul 2018 10:34:45 -0700 (PDT) Received: from localhost.localdomain (host-94-248-151-107.kabelnet.hu. [94.248.151.107]) by smtp.gmail.com with ESMTPSA id s12-v6sm2740863wrf.0.2018.07.20.10.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 10:34:44 -0700 (PDT) From: Mathieu Othacehe To: jic23@jic23.retrosnub.co.uk, linux-iio@vger.kernel.org Cc: jonathan.cameron@huawei.com, pmeerw@pmeerw.net, pierre-moana.levesque@parrot.com, Mathieu Othacehe Subject: [PATCH v6 1/3] iio: Add channel for Phase Date: Fri, 20 Jul 2018 19:34:25 +0200 Message-Id: <20180720173427.30445-2-m.othacehe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720173427.30445-1-m.othacehe@gmail.com> References: <20180720173427.30445-1-m.othacehe@gmail.com> 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 c7353030670a..c9cfa833cf47 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -1675,3 +1675,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 ed1b3ebade94..a16ad5a4ab0c 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -86,6 +86,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_INDEX] = "index", [IIO_GRAVITY] = "gravity", [IIO_POSITIONRELATIVE] = "positionrelative", + [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 033c7d28924e..e4df3cc268db 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -45,6 +45,7 @@ enum iio_chan_type { IIO_INDEX, IIO_GRAVITY, IIO_POSITIONRELATIVE, + IIO_PHASE, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 148f69dfae75..f478f5558720 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_UVINDEX] = "uvindex", [IIO_GRAVITY] = "gravity", [IIO_POSITIONRELATIVE] = "positionrelative", + [IIO_PHASE] = "phase", }; static const char * const iio_ev_type_text[] = { @@ -153,6 +154,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_UVINDEX: case IIO_GRAVITY: case IIO_POSITIONRELATIVE: + case IIO_PHASE: break; default: return false;