From patchwork Mon Mar 12 18:21:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10276963 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 7D2DE60467 for ; Mon, 12 Mar 2018 18:21:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6668628AF1 for ; Mon, 12 Mar 2018 18:21:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A92C28B00; Mon, 12 Mar 2018 18:21:24 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 0184128AF1 for ; Mon, 12 Mar 2018 18:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751295AbeCLSVX (ORCPT ); Mon, 12 Mar 2018 14:21:23 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:41297 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbeCLSVW (ORCPT ); Mon, 12 Mar 2018 14:21:22 -0400 Received: by mail-qk0-f194.google.com with SMTP id s78so2956447qkl.8; Mon, 12 Mar 2018 11:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iJTw5ylpTtAB9XmKRih0/kdYslzViWEdoL/W726WxME=; b=VO7VMChtgYavDrEzH1kO6+Nj9GF7op71aNqywjPIaa2tkF3uIPOTXDewf1KtX5hKa+ wBK81OeHK6OVd/tHGyi5qLb3cP08NjNKL0PZE7nDHrQnUhl8OCPMK64lBdBiok/4+jrT inkcPlCJgITjFWWmThKISpJzQdwyQqPRxuE4CADhuYpBcHSR072zH2E74Hwz55NFzoxe WOq4GGklsDDJuvq0hgqY2qyM0lO7TVXMNtbi7L/q7VlJaZx7U7Lymaed2sj8vtA0o8sV aiXcjRpsMLOOOyyu4SZceGgbtzU/iPsUQroqltoND7s5FsxFR17VcDpQ3CA7oy1QRb0l zf6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iJTw5ylpTtAB9XmKRih0/kdYslzViWEdoL/W726WxME=; b=npARaDqX7lPtLfOlqnsGoJV/imF7QtPgzPrKlP1OtCh3l5uiWoiXDzafFe6lA/fDJN uP+pRL99F8VX8hJAcJfwuIY9fUaoHUXa9FTS6Yzj2qMvm67/j416WwV2yLQevdprAkuC SfpBv4YTxxp39ml98Qq6o+VLtJhRmtuBm4+FP9kq1FLjVSvGuV+JE+SL4IOK6ZAToFv8 DbIRh0K+mCQgmXNwtO/bzCyKCB1g2WNLBWW5t9e0XO4LI6U8NcPbeAjumpnN9CiZmdBD KVZDKt6gD8swHJ0BfJYSEd1mLcNvMi8Oel63PJyMVeP74jlmHHQSQd1IzWrSwAZ1NySD Zvew== X-Gm-Message-State: AElRT7FZqVHpt8nweHBH3s78rCpYxgaQCMT96EZip7nkR96N6KhL81DK KnVqLKf63LWC5nvL91f6YpUAmLZZ X-Google-Smtp-Source: AG47ELsPVBZ6tA1QrIaQibEyQEFlh/2ENftqKrD2/SQgJVCbIcjiaSTdEA40oijBJXPc9uRBnIr2iw== X-Received: by 10.55.79.19 with SMTP id d19mr13071939qkb.328.1520878881408; Mon, 12 Mar 2018 11:21:21 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id b125sm5516731qkd.29.2018.03.12.11.21.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Mar 2018 11:21:20 -0700 (PDT) Date: Mon, 12 Mar 2018 15:21:16 -0300 From: Rodrigo Siqueira To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , Graff Yang Cc: daniel.baluta@nxp.com, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] staging:iio:ad2s1210: Add channel for fclkin and fexcit Message-ID: <335cf727d0583ccbe95f8bd97c282bf1fa210cae.1520878492.git.rodrigosiqueiramelo@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 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 The ad2s1210 does not contain any channel for the fclkin and fexcit. As a result, it uses IIO_DEVICE_ATTR to expose this information. This patch adds one channel for fclkin and another for fexcit. It also adds an enum to easily address the correct channel. Signed-off-by: Rodrigo Siqueira --- drivers/staging/iio/resolver/ad2s1210.c | 43 ++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index ac13b99bd9cb..28c3fd439663 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -67,6 +67,11 @@ enum ad2s1210_mode { MOD_RESERVED, }; +enum ad2s1210_frequency_channel { + FCLKIN = 0, + FEXCIT, +}; + static const unsigned int ad2s1210_resolution_value[] = { 10, 12, 14, 16 }; struct ad2s1210_state { @@ -88,6 +93,30 @@ static const int ad2s1210_mode_vals[4][2] = { [MOD_CONFIG] = { 1, 0 }, }; +static const struct iio_chan_spec ad2s1210_channels[] = { + { + .type = IIO_ANGL, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_ANGL_VEL, + .indexed = 1, + .channel = 0, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_CHAN_INFO_FREQUENCY, + .indexed = 1, + .channel = FCLKIN, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, { + .type = IIO_CHAN_INFO_FREQUENCY, + .indexed = 1, + .channel = FEXCIT, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + }, +}; + static inline void ad2s1210_set_mode(enum ad2s1210_mode mode, struct ad2s1210_state *st) { @@ -552,20 +581,6 @@ static IIO_DEVICE_ATTR(lot_low_thrd, 0644, ad2s1210_show_reg, ad2s1210_store_reg, AD2S1210_REG_LOT_LOW_THRD); -static const struct iio_chan_spec ad2s1210_channels[] = { - { - .type = IIO_ANGL, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - }, { - .type = IIO_ANGL_VEL, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), - } -}; - static struct attribute *ad2s1210_attributes[] = { &iio_dev_attr_fclkin.dev_attr.attr, &iio_dev_attr_fexcit.dev_attr.attr,