From patchwork Thu Jun 28 13:49:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 10493995 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 B540C6022E for ; Thu, 28 Jun 2018 13:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FA33296EB for ; Thu, 28 Jun 2018 13:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 934D12A22C; Thu, 28 Jun 2018 13:49:20 +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 2B56A296EB for ; Thu, 28 Jun 2018 13:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbeF1NtT (ORCPT ); Thu, 28 Jun 2018 09:49:19 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38739 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753318AbeF1NtT (ORCPT ); Thu, 28 Jun 2018 09:49:19 -0400 Received: by mail-wr0-f193.google.com with SMTP id e18-v6so5608613wrs.5 for ; Thu, 28 Jun 2018 06:49:18 -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=Y4hs8AOtZPEKjEE+r4PeRj1wyPTTcHX/sYWLqgdSLnM8wwsRcYlw9YOZeFJd7XeAOA ygpHEQTwU/vnJqQ6ruatzuHqjdMWxXxlfn23Fsxtf2JVb95O165MwNwbVGw4xXcegokP SCNwHrgkTstnd14I5pxbWUkaLAaytFXm9hTGPlsx5Dfe8o52QYzLzgHhfgZJiefIU1q7 vNSjdB9kGaAcdpUwls45pkfw8QeCsMpA9c7HUrjSqW3vB2WLrWs73F/ZbGXRBd8jfk1N D0yNtStPGarS6Fz4lXbi2iUKg7bUCP7iL4QRRd6TjiaxQgAwuW3Swi3rP2uk11OKBBHq Gpnw== 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=niBAzJu7wdYxkATyibJX5/Pwrk4B7QkvydE9hEJSK76Yd6m1n37mW6gKhyhba+AgtF JBatra+yXUwta9Fs8ClhrLvpCFHGPROPI+JMivMdZjWBzmVzS4jrsdAM1PcsUu/kPwIE 3e13bTpmJTNlmGfhKc+2g6H/GKeyJ+m3mbetpqecQUIMceZCYVlfYWZeU96jQbjrw0V6 91NFK9W6RB0IGJzzvrADYH9kCb9UUcef0LLO5nkkykN455ELBQijqLzGQmMgBm6MIVBs G2iCkouo7mVB9qAdF9M7KIxl5DJcHYr1i0ztGqz4huVpvRP1hFGVOH9g5aOaqi9I5jUn eGrA== X-Gm-Message-State: APt69E2I1g6iP7+cymnbHo5/0vXMRxcJ3JYbWfl5Ij41SJB5JS3ScgSQ VFdSxBkyqOgqaZFwabqfIigp1A== X-Google-Smtp-Source: AAOMgpeR1HdtCCvc1vc1FNyYyQGMgotG0Dimz868DfW/DIv1z9dgXla/BFUeGEFJIu/pUDJK+r4HYQ== X-Received: by 2002:adf:d142:: with SMTP id b2-v6mr3565366wri.17.1530193757721; Thu, 28 Jun 2018 06:49:17 -0700 (PDT) Received: from denali.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id m185-v6sm8202009wma.36.2018.06.28.06.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jun 2018 06:49:16 -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 v3 1/2] iio: Add channel for Phase Date: Thu, 28 Jun 2018 15:49:11 +0200 Message-Id: <1530193752-13171-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;