From patchwork Tue Mar 13 16:05:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10279765 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 F03C66038F for ; Tue, 13 Mar 2018 16:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA8CF290D3 for ; Tue, 13 Mar 2018 16:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEA73290CC; Tue, 13 Mar 2018 16:05:40 +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 9ED0529039 for ; Tue, 13 Mar 2018 16:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934350AbeCMQFh (ORCPT ); Tue, 13 Mar 2018 12:05:37 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:37095 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933034AbeCMQFd (ORCPT ); Tue, 13 Mar 2018 12:05:33 -0400 Received: by mail-qt0-f196.google.com with SMTP id a23so142535qtm.4; Tue, 13 Mar 2018 09:05:33 -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=JK4XJmnASEm+kBujNs/+LHdgzDTEH8pLn5YhXbkdgWN4Kgi9bkRHky0IbGDN5ns/wk HfVFkSDxgLyAIkuIdYzs7mqW/6lbNS8rLl1aC3swtcD+00W8KWfElCO8qkjgnkyUo4ZC gUda/YHHwQNcEPozCKwiEAuDavx4H9HxcU5skn9jZUA9sYP/MjFQYQf/DRqhQF7LCwOV Kl/5cO/ApEdmMtFja4FAoUifSYmNrERs+lgNiTK9V/IhD+yHVn9koJfXZE+hku2IFenO aYpfnDd9ZGFGMnpo0jYsrCA95KGqRA9ybDnwiwOexXSouLmgzxNVzyg0YeLCMSlu/VTh veug== 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=f6IShPLev6W3Om+fu8DTtU2NpujnPVeNlHNHFeNppS3mErVbgztsxarJXmrC/Hw6sf ZbEmnkuvpIG77CYh6Byk9eAGfkklyCtgYNFCBC2WAKj6YZnsODxZsDERYzsKs3xf6IgE o5s18pxYZoZOWeFQonkBuxCnLZhzyEAKAFejPak/AoEgCF/Q1B0A+382vb9XH0ekOvAk grnUveCK5LIr61z53gO3/Kg2zMXmlwJsjCYWt9/TX4w8APyg5Fiai2nIr4liay8Iv+mu ThB6mlFPnrdfFGMi5sKehuNfhm305Wk2KqCdJYClH4/puM0cE6o1MM+4FN0oeZ9cvTlU HBNw== X-Gm-Message-State: AElRT7ELWi1E8cQiCRWgHJLvFtztx/+UW9xoBOOLHUC6Tsa3FubZlpS1 uw9lGUs4odyJUzLj0/F8Zc0= X-Google-Smtp-Source: AG47ELuXieGVgBRtFa1jGl4eUFF9RYlmrv1zoIqPNVuaufp5rNGlqrWKvg/bVYMTzgLZLKoomXayhg== X-Received: by 10.237.41.194 with SMTP id o60mr1912713qtd.128.1520957132801; Tue, 13 Mar 2018 09:05:32 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id l65sm23225qke.12.2018.03.13.09.05.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 09:05:32 -0700 (PDT) Date: Tue, 13 Mar 2018 13:05:28 -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 v2 1/3] staging:iio:ad2s1210: Add channel for fclkin and fexcit Message-ID: <335cf727d0583ccbe95f8bd97c282bf1fa210cae.1520956563.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,