From patchwork Thu Jun 28 14:31: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: 10494069 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 3D98D603EE for ; Thu, 28 Jun 2018 14:31:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2981B2A4CB for ; Thu, 28 Jun 2018 14:31:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D9572A4D6; Thu, 28 Jun 2018 14:31:45 +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 B80A92A4CB for ; Thu, 28 Jun 2018 14:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966488AbeF1Obo (ORCPT ); Thu, 28 Jun 2018 10:31:44 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35018 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965966AbeF1Obn (ORCPT ); Thu, 28 Jun 2018 10:31:43 -0400 Received: by mail-wr0-f195.google.com with SMTP id c13-v6so5755608wrq.2 for ; Thu, 28 Jun 2018 07:31:42 -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=csdBZgBu3iCP3J0wXRcf+8SjQjKMdASV+HKiKb7Z7VGVdguslrRbv3uE0sErsXVEpU 8cK4xyxSzF41U3XRSoKwhhOnnGpHKIYWx0+LgtCwBF4s82ch5ZTiybTDx1Y2ewiF3f5e qRvSwXOOGZNXAfnDaiBCQagnk1iOLYEha/dSxmwhHrx+X95Kbev868g4F6k5cqIwVIIx +r6IZ2U11zm/yLtGAbgNPBJXIs3LceoQH43BWb5xlg0AIorQISzrrTnUABe6qqu+hU9g LksSZYNn5kkTYUJKxfSu9fE5RhdOnm5urpkVtXJn5X+qg7JcsYgDAZ+iJ0uQWOc1xi6e NbgA== 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=pl0atAkzIlwdRQxgJMP6/zsgvjJ/RFz1n7SAUO4GUuIqFMUq3ZVJ/FR2AS1Ww3GyHM xWBwKRnAOBttbq48664KXu2kxJ7E/Hxgid+GDlnmFyZjjD0wIVA71x8uD8fGxgMRJnR0 rt3KNt14GuMZ/BIteb3/m5Clm1FOf3Cu/7tBVjx0RcEN0eFtVl/QR89Kg+61bh6oyDQ9 1Iis8QpP+ADFLqYQFU/hBF7rWtNaUXPqkw//nDGRWXGuoN3BjxA3zbg1oG87CoI0jrqU YfmP7aJGCS2+bOQ/DFDjAINLG2Hl/lN0zCdXVYkUQx6pF9npkdN1kx231oSvUt7b1C7T DmhQ== X-Gm-Message-State: APt69E2koNFiMcTgvY2tAE4My9hoigZ5W3SiS76KFlC3BdA2yP8Q5Ep+ w+DPLbKVMckTkKWcgc0fL78q9Q== X-Google-Smtp-Source: AAOMgpfcOot/7/so7epOwkcdg/vMNCOJBEADKTuUdZwSCqecj4mcv1W8IP0tscVqIti6JvNf6LeDTA== X-Received: by 2002:adf:b782:: with SMTP id s2-v6mr8706235wre.247.1530196301975; Thu, 28 Jun 2018 07:31:41 -0700 (PDT) Received: from denali.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id m58-v6sm13024892wrf.61.2018.06.28.07.31.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jun 2018 07:31:40 -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 v4 1/2] iio: Add channel for Phase Date: Thu, 28 Jun 2018 16:31:25 +0200 Message-Id: <1530196286-18891-2-git-send-email-m.othacehe@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530196286-18891-1-git-send-email-m.othacehe@gmail.com> References: <1530196286-18891-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;