From patchwork Sat May 18 21:35:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?B=C3=A1rbara_Fernandes?= X-Patchwork-Id: 10949193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACECB76 for ; Sat, 18 May 2019 21:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DC221FE95 for ; Sat, 18 May 2019 21:35:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9246828569; Sat, 18 May 2019 21:35:21 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3FF821FE95 for ; Sat, 18 May 2019 21:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728813AbfERVfV (ORCPT ); Sat, 18 May 2019 17:35:21 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45331 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfERVfU (ORCPT ); Sat, 18 May 2019 17:35:20 -0400 Received: by mail-qk1-f194.google.com with SMTP id j1so6585462qkk.12 for ; Sat, 18 May 2019 14:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HjafOF3we2ISgKmws+AAmSPCOfvoMlLfEcLpwFAOH20=; b=Idg02TPx+T27kQzFx9Ad4TKrU7/CmGjWW/b6QxPiELeEJUSNf5d6nEbVgI9Yi5u73m mCewTHJYaARQnQlcI1aeQ61mv7XycV4hgB0FNg8OHIra00wMr9gQ4PlqQkSAhwf1f9kY ZUFWKdEaalH2O5XCqUpLsbpctqZA10HyivfwI4uZFLNS3YQO7Z3LKqpD+n5gVBlXwBgr xHEMh+HvLFfqXpztEb5RYzij2RJFaKubjHwj2OYj+gWDcM9ZBMRUJ3vLGxUfv+dFBEKh Mb4OSvrD3inq42YG8glrYVLxQboENXg+BneK3twCKDcYw/MWHidL6XaQ8FRlpC3BFIOo 8RVQ== 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:mime-version:content-transfer-encoding; bh=HjafOF3we2ISgKmws+AAmSPCOfvoMlLfEcLpwFAOH20=; b=Mkb2f4B7V7tszMmeVa1xWM56jy4IeDZ2/BmQXMQuyBlnUQrlZgWFWsSn7aXhmeZyPJ xt/M/ca0hgoFs7skgmySrlhmO1eeWd1rpw1oqLi9WEpdm28AMct/z7dSwyJ8wKKSD68V LJG7T2PlDRtaOtN/hlTltfl0zSfmBakGrogRTItLLVBG9/sSoBYsLdsOSk+KWFXIuKT7 NwtpozwHcNAPlAaFbJ5+jWVoNmVjBrH3MC0hT/BfgmOFWMvfszcqU5qlS7OVQ4+qI9do Laj0VbHRiOLDxfAjt4EYXMn4XQepXE7tIWm2h2+j6aeJFjv5bENhp1srJLxe9b9hAaoS 4aIQ== X-Gm-Message-State: APjAAAUiXMwvWnLUuaHZYEUANfb/gKpsyB2hI+teggbR9Hgj+TSqDA53 lP1u1eUI3MJ4bBJuWEx5REl2pjHvIDI= X-Google-Smtp-Source: APXvYqyAj45jx+hMSMOodhJuwtgh30L2XYcgQYQHvPmVeJhWjh0veWlFmRlfmxfqlLtCVHTzBsMOvg== X-Received: by 2002:ae9:de87:: with SMTP id s129mr50958449qkf.63.1558215319581; Sat, 18 May 2019 14:35:19 -0700 (PDT) Received: from greta.semfio.usp.br ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id e133sm3168333qkb.76.2019.05.18.14.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 May 2019 14:35:19 -0700 (PDT) From: =?utf-8?q?B=C3=A1rbara_Fernandes?= To: linux-iio@vger.kernel.org Cc: =?utf-8?q?B=C3=A1rbara_Fernandes?= , Melissa Wen , Wilson Sales Subject: [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Date: Sat, 18 May 2019 18:35:10 -0300 Message-Id: <20190518213511.23253-2-barbara.fernandes@usp.br> X-Mailer: git-send-email 2.22.0.rc0.1.g337bb99195.dirty In-Reply-To: <20190518213511.23253-1-barbara.fernandes@usp.br> References: <20190518213511.23253-1-barbara.fernandes@usp.br> MIME-Version: 1.0 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 Create structure of type of_device_id in order to register all devices the driver is able to manage. Signed-off-by: Bárbara Fernandes Signed-off-by: Melissa Wen Co-developed-by: Melissa Wen Signed-off-by: Wilson Sales Co-developed-by: Wilson Sales Acked-by: Alexandru Ardelean --- drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index 4b1c90e1b0ea..072094227e1b 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = { {} }; +static const struct of_device_id ad7150_of_i2c_match[] = { + { .compatible = "adi,ad7150" }, + { .compatible = "adi,ad7151" }, + { .compatible = "adi,ad7156" }, + {} +}; + +MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match); + MODULE_DEVICE_TABLE(i2c, ad7150_id); static struct i2c_driver ad7150_driver = { .driver = { .name = "ad7150", + .of_match_table = ad7150_of_i2c_match }, .probe = ad7150_probe, .id_table = ad7150_id, From patchwork Sat May 18 21:35:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?B=C3=A1rbara_Fernandes?= X-Patchwork-Id: 10949195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 619C676 for ; Sat, 18 May 2019 21:35:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 530BE1FE95 for ; Sat, 18 May 2019 21:35:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47C0828569; Sat, 18 May 2019 21:35: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 E9D111FE95 for ; Sat, 18 May 2019 21:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729041AbfERVfX (ORCPT ); Sat, 18 May 2019 17:35:23 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43682 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfERVfX (ORCPT ); Sat, 18 May 2019 17:35:23 -0400 Received: by mail-qt1-f196.google.com with SMTP id i26so12045969qtr.10 for ; Sat, 18 May 2019 14:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jKyoBKDfoJbBN8ZdJzWAMlrp7KnkxmJ6vA1sEgIrsvE=; b=A9hJJsNgzHTIBXWrT4kKKaOgpXcypIv15DqAp0mgO8ZoSdfDRLE6EH7YYr3QTb7Z9a hhgD6YF2Yyj29lRZpPLnqJHRfK35jaxoxx/QUbWJcRkfGJhm/04UaflPxiQV20mzNJ+g gcz/3h3A0uv0FyFzlUYEODvtD/X2sv2729y9ullVSBtu0qyl7WAlGY0wy2O8nCGvf9Z/ jgc3HIXSvVA5/v1ETq1l2dHgDUjuQzK1oQ5dCX7C6H4ZKiTUnM06Yp3wUqkYS/sJOV3O Jr7dg9zKAHs0k9QuRUoHAmj81XmMnigB2cFqugtd+pmKG6H+1zBcE3xETy9g9M12XnWh WWVQ== 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:mime-version:content-transfer-encoding; bh=jKyoBKDfoJbBN8ZdJzWAMlrp7KnkxmJ6vA1sEgIrsvE=; b=iNWdqAMjA2Wc6BhsI3iN7G1Lw33HWhqo15lIMgx2wg17hSGfrPk2my5QPr/l6A1kgc +y0f6uSOfTLI0/HFYrgNle/lYsSKyHnZ+Aep2Fy3jmDWdDSCOXkgRGQXf5sqLBG1877x tGqvwsiMsTObFU2s57sLcUicXfTJjvJhx0Vro/cIfh21wbipabvQxhAnP/JVOcKRkTzF 5KHzpZyUeryQ00AqrUDqHrR3bo0l9Z3raa1Oa8WLPQjMw2WgANo4BKxkQ8ywnKevUT42 ngSazO482+woILyNtsfpjUVP2LNVC4UqzNW4uXCppLOs0WKwYw4sEIM/uJyCkoHO6VjK m/PA== X-Gm-Message-State: APjAAAWClJDaZgQOpDmcx0LAh7Rzenbbm3y27laWesQuFl/tLJbipjl6 qzyqr6Cj7fPQ5VHEg/+nRXH0W0jCJIY= X-Google-Smtp-Source: APXvYqzAx/e+UzvQ6iJthYYHtEkloEggrVUZpJuTuLBoEsTWcBkm73DN/KGEHmkf1Utyp7P1VBQJ+Q== X-Received: by 2002:ac8:2bb3:: with SMTP id m48mr3217146qtm.218.1558215321814; Sat, 18 May 2019 14:35:21 -0700 (PDT) Received: from greta.semfio.usp.br ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id e133sm3168333qkb.76.2019.05.18.14.35.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 May 2019 14:35:21 -0700 (PDT) From: =?utf-8?q?B=C3=A1rbara_Fernandes?= To: linux-iio@vger.kernel.org Cc: =?utf-8?q?B=C3=A1rbara_Fernandes?= , Wilson Sales Subject: [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Date: Sat, 18 May 2019 18:35:11 -0300 Message-Id: <20190518213511.23253-3-barbara.fernandes@usp.br> X-Mailer: git-send-email 2.22.0.rc0.1.g337bb99195.dirty In-Reply-To: <20190518213511.23253-1-barbara.fernandes@usp.br> References: <20190518213511.23253-1-barbara.fernandes@usp.br> MIME-Version: 1.0 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 Create macro for capacitance channels in order to remove the repeated code and improve its readability. Signed-off-by: Bárbara Fernandes Signed-off-by: Wilson Sales Co-developed-by: Wilson Sales --- drivers/staging/iio/cdc/ad7150.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index 072094227e1b..d8c43cabce25 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -468,24 +468,19 @@ static const struct iio_event_spec ad7150_events[] = { }, }; +#define AD7150_CAPACITANCE_CHAN(_chan) { \ + .type = IIO_CAPACITANCE, \ + .indexed = 1, \ + .channel = _chan, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_AVERAGE_RAW), \ + .event_spec = ad7150_events, \ + .num_event_specs = ARRAY_SIZE(ad7150_events), \ + } + static const struct iio_chan_spec ad7150_channels[] = { - { - .type = IIO_CAPACITANCE, - .indexed = 1, - .channel = 0, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_AVERAGE_RAW), - .event_spec = ad7150_events, - .num_event_specs = ARRAY_SIZE(ad7150_events), - }, { - .type = IIO_CAPACITANCE, - .indexed = 1, - .channel = 1, - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | - BIT(IIO_CHAN_INFO_AVERAGE_RAW), - .event_spec = ad7150_events, - .num_event_specs = ARRAY_SIZE(ad7150_events), - }, + AD7150_CAPACITANCE_CHAN(0), + AD7150_CAPACITANCE_CHAN(1) }; /*