From patchwork Mon Jul 2 08:59:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 10500719 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 8710A6028F for ; Mon, 2 Jul 2018 09:00:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76C0D287F2 for ; Mon, 2 Jul 2018 09:00:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B6F0287F3; Mon, 2 Jul 2018 09:00:03 +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 0B360287EF for ; Mon, 2 Jul 2018 09:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754468AbeGBJAC (ORCPT ); Mon, 2 Jul 2018 05:00:02 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33619 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932819AbeGBI76 (ORCPT ); Mon, 2 Jul 2018 04:59:58 -0400 Received: by mail-wr0-f194.google.com with SMTP id k7-v6so11180785wrq.0 for ; Mon, 02 Jul 2018 01:59:57 -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=vFGIAI53JcwK8ed0uJa59RWso2glv/7PNqltrNAqsR4=; b=GXGTYL11jfuGIaC1Udb4weW9BQwcQPxZTx835sX+6DZZfGXz/TzKPUkK1dR6GGJS7u Wo1QOO1FFgYbUpKp5oQnPQSh6MFgN7M9Kbm3xuXSQdhhc7SIuMc0/R+Mp+lieKUlsci0 MDPLNTM7SYMLKBTXxYM+vCM/NMuSkxugnUTIs9C3ZC9GFKdQiK+dSNvfUBRguKJug9ol B4qcjdy7t6+uZANbwiHi1jw4EFX4ot8OVKRBoOQCUMhSvtDECcODQjQzPBQocY2qYb2d 1lCB2A+a85jW3VjYxEYizEIsWUpTQfpOoIw5tzDiJWGzA9mt/QBaWYCPvIQkGCbLf/li mtAQ== 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=vFGIAI53JcwK8ed0uJa59RWso2glv/7PNqltrNAqsR4=; b=h4m2QXcOebbTnEsbx5W3FiygWpLSMsC0j/zORuyjitlIOhOcGm2EimA0gLjGU2nqco U6VoxKExvidcDirIXRBIvvGJ3KbalgFuRt74Y0lcJ0FgOwcVuu7vlyrTdw/XjqjcAoAb OPm776fbzga/HHPs1JWch/ZcxWoxixcDVxj5CEws5uLS/gMLf8OYSArUHbOdfeIUAPhH o1DoYEbA7jPYMvB1ggPWBSeqtP87xIFTzYTGYxRVjBQ1lOjZ5xacTmynrJzHdy3MRkf6 fq7xraSgCajkYjUEOmUdrzhsCyo0i77H2CpHAk8HwUH1WXHWKCR5MP5NSiYO1cDIdmsc wNzg== X-Gm-Message-State: APt69E3FPnk8DToNHgRRU7HJ7nSEGqIN6yzXDVyvJIKNYnN3BUOf8zIJ bRWXuu03U9fiSCOSpdinHl3RAg== X-Google-Smtp-Source: AAOMgpdge+DZVZUD3dakP6rO8O2aqrZFaMZ7wSn+a46QbVqFXWk7S1MTgoWf/jabpbNFz20w9emLrg== X-Received: by 2002:adf:f28c:: with SMTP id k12-v6mr7947462wro.263.1530521996901; Mon, 02 Jul 2018 01:59:56 -0700 (PDT) Received: from denali.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id s2-v6sm20480181wrn.75.2018.07.02.01.59.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jul 2018 01:59:56 -0700 (PDT) From: Mathieu Othacehe To: linux-iio@vger.kernel.org, jonathan.cameron@huawei.com, pmeerw@pmeerw.net Cc: pierre-moana.levesque@parrot.com, Mathieu Othacehe Subject: [PATCH v5 1/2] iio: Add channel for Phase Date: Mon, 2 Jul 2018 10:59:26 +0200 Message-Id: <1530521967-10152-2-git-send-email-m.othacehe@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530521967-10152-1-git-send-email-m.othacehe@gmail.com> References: <1530521967-10152-1-git-send-email-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 c735303..c9cfa83 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 ed1b3eb..a16ad5a 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 033c7d2..e4df3cc 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 148f69d..f478f55 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;