Received: by 10.223.185.116 with SMTP id b49csp2300453wrg; Sun, 4 Mar 2018 23:51:25 -0800 (PST) X-Google-Smtp-Source: AG47ELtCEWfd7tjX0E86qoOxbNa/C+BklA8oqsMEUUPGeOFaR4Dr+XaTlEWbUl8PI+Yes94GF11k X-Received: by 10.98.242.6 with SMTP id m6mr14360356pfh.230.1520236285722; Sun, 04 Mar 2018 23:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520236285; cv=none; d=google.com; s=arc-20160816; b=Zi6Jk5H+PZYdJVtY0xKeMjSoPHae2JrA6q1G3tGpMDxY97DkA0KSzNA5nMTa/wx1p0 IgYQXuTtTc+1Jxw2289+F11GJ7RTSzoXzK5mbjZspqk3U3cDhb56bJRAjltwQj6db5vZ EXjQBvXQtSLtBtYuTRYaCRjo86RSCJvQsxSfGiifyGwonZ0kSMBBQ2VnplX2xXSgk+QH X9FvANN+faY3k5fuYqEi2xE0szy6zprm/06ndA/EBQ7VMuyD0TvfqHboPzuFsQrtgH03 ya6068oFttklyZYPJGs1UhKpLZSetYBvWSTlnk6QEdU9ICIdJ6KyVvkxqZWWmFOJez1z dBDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=VscAhDu5+gSMHjowOelXJAj4o+f5j3UkRJjoVanPDK4=; b=tcUvyk9HTmnszVvHBLDCoiQvDejwqPnp6ZC1jufbsZamcSn8YqA5rbbyhtXCr1DbNX ZPD0mr7EeXvu3w8LNkQEXKhGuoSsXh3oNTKwVxQx1waz8xydzI7kVPt6c/P4pMr5ssRY C0NxochGIDKSIGRmVlVp1BJ1zlzVKnEdO/11w1IYtzzuDMLYtxiu7ovON41HHWMks8/z Fxad9QICyKGLhKQx4+dKknl7vF4AORvNfB5WDxhr6++iF493wqSIq8WlwD+vJvXANFFa RA0KnWeXOoMga9VIfqbvS1bg7tUUKlQy8r3rLoXmvImDFnyyYktVz2tBqD87En7Uy7Nm UAyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MVuhgJEH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s78si9754470pfa.374.2018.03.04.23.51.11; Sun, 04 Mar 2018 23:51:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MVuhgJEH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933238AbeCEHuU (ORCPT + 99 others); Mon, 5 Mar 2018 02:50:20 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42049 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933221AbeCEHuN (ORCPT ); Mon, 5 Mar 2018 02:50:13 -0500 Received: by mail-pl0-f65.google.com with SMTP id 93-v6so9203269plc.9; Sun, 04 Mar 2018 23:50:13 -0800 (PST) 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=VscAhDu5+gSMHjowOelXJAj4o+f5j3UkRJjoVanPDK4=; b=MVuhgJEHRDBAZYY2BvENjJ0nAsDXmEM+1/ahG+afS3U+l44gjg6OV8SvoJ+zw2GBJA 1PjBiQuyiNcXIAZC46GbZjjKEwdgTl/DJWF98mgsiYZPpTY8eogMz8lS6EiY72x2sgcY U7rviZAGA0mYCUbn4A0ZrvtCP/Iqu/f+mM9qGQ/s2s/2YWltCciD2GwHe84cgRKnkPdE n5oJlGZP2zTlKKgKteRM5sqH9oEoFrGF1kyRdclnU9GaGOuDkqLcU2ZsYKcgxqwyQF3D QAOymGEhpifeHDQrYM8wL1DBNxEjOpeAh1vF61Eq05fE79ZpSafBgnmkkEM0sEtbTppx Y69A== 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=VscAhDu5+gSMHjowOelXJAj4o+f5j3UkRJjoVanPDK4=; b=hH6gchsiekcHuG/aMYSr9QjTAWsqHV2iNlXSgVnpUOejKcZg5NqDclN25gboCXCF7V tblniLOqXiZJciNNkc1D/KAtPaoJ4lm7uNkKpdCX9W/hGWNTFLtWhNV5FL/r+WfW7iYk ozX4JmS+4vB1fvzKEegOzuU7OKLWwF/GDBBjUmONCURC/EQl70WZE/dI9q0m1g+RffUu JkRJwLzNIX06RVW0QQJlk9fz3LLH2PiUn2GQO1IJ3l4ROE2gRwFuOpHxLLfMa9R03mj+ A6WcGZCFUcxNtNoc2EXFO+oeLcFjGUeP/A3jNeou73Y28s1HvAjqLnFuTJsUXIrnpgzs 7YpQ== X-Gm-Message-State: APf1xPCz6uPObl65X0aJUEIrKoqfEL5+AumKxMQQx/aWahiVXVbi5G5N oYyh4cjV4gYFlECtW/F7kko= X-Received: by 2002:a17:902:3a3:: with SMTP id d32-v6mr12332989pld.219.1520236212745; Sun, 04 Mar 2018 23:50:12 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id 125sm21674256pff.114.2018.03.04.23.50.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 23:50:12 -0800 (PST) From: Himanshu Jha To: jic23@kernel.org Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com, Himanshu Jha Subject: [PATCH 05/11] Staging: iio: accel: Add _REG suffix to registers Date: Mon, 5 Mar 2018 13:19:24 +0530 Message-Id: <1520236170-14668-6-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> References: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Addition of _REG suffix to the register definitions allows a distinction between registers and register fields. The various registers and its field bits are grouped together to improve readability and easy indentification. Signed-off-by: Himanshu Jha --- drivers/staging/iio/accel/adis16201.c | 133 ++++++++++++++++------------------ 1 file changed, 61 insertions(+), 72 deletions(-) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index 445cb56..476b1c3 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -20,75 +20,64 @@ #include #include -#define ADIS16201_STARTUP_DELAY_MS 220 -#define ADIS16201_FLASH_CNT 0x00 +#define ADIS16201_STARTUP_DELAY_MS 220 +#define ADIS16201_FLASH_CNT 0x00 /* Data Output Register Information */ -#define ADIS16201_SUPPLY_OUT 0x02 -#define ADIS16201_XACCL_OUT 0x04 -#define ADIS16201_YACCL_OUT 0x06 -#define ADIS16201_AUX_ADC 0x08 -#define ADIS16201_TEMP_OUT 0x0A -#define ADIS16201_XINCL_OUT 0x0C -#define ADIS16201_YINCL_OUT 0x0E +#define ADIS16201_SUPPLY_OUT_REG 0x02 +#define ADIS16201_XACCL_OUT_REG 0x04 +#define ADIS16201_YACCL_OUT_REG 0x06 +#define ADIS16201_AUX_ADC_REG 0x08 +#define ADIS16201_TEMP_OUT_REG 0x0A +#define ADIS16201_XINCL_OUT_REG 0x0C +#define ADIS16201_YINCL_OUT_REG 0x0E /* Calibration Register Definition */ -#define ADIS16201_XACCL_OFFS 0x10 -#define ADIS16201_YACCL_OFFS 0x12 -#define ADIS16201_XACCL_SCALE 0x14 -#define ADIS16201_YACCL_SCALE 0x16 -#define ADIS16201_XINCL_OFFS 0x18 -#define ADIS16201_YINCL_OFFS 0x1A -#define ADIS16201_XINCL_SCALE 0x1C -#define ADIS16201_YINCL_SCALE 0x1E +#define ADIS16201_XACCL_OFFS_REG 0x10 +#define ADIS16201_YACCL_OFFS_REG 0x12 +#define ADIS16201_XACCL_SCALE_REG 0x14 +#define ADIS16201_YACCL_SCALE_REG 0x16 +#define ADIS16201_XINCL_OFFS_REG 0x18 +#define ADIS16201_YINCL_OFFS_REG 0x1A +#define ADIS16201_XINCL_SCALE_REG 0x1C +#define ADIS16201_YINCL_SCALE_REG 0x1E /* Alarm Register Definition */ -#define ADIS16201_ALM_MAG1 0x20 -#define ADIS16201_ALM_MAG2 0x22 -#define ADIS16201_ALM_SMPL1 0x24 -#define ADIS16201_ALM_SMPL2 0x26 -#define ADIS16201_ALM_CTRL 0x28 - -#define ADIS16201_AUX_DAC 0x30 -#define ADIS16201_GPIO_CTRL 0x32 -#define ADIS16201_MSC_CTRL 0x34 - -#define ADIS16201_SMPL_PRD 0x36 -#define ADIS16201_AVG_CNT 0x38 -#define ADIS16201_SLP_CNT 0x3A +#define ADIS16201_ALM_MAG1_REG 0x20 +#define ADIS16201_ALM_MAG2_REG 0x22 +#define ADIS16201_ALM_SMPL1_REG 0x24 +#define ADIS16201_ALM_SMPL2_REG 0x26 +#define ADIS16201_ALM_CTRL_REG 0x28 + +#define ADIS16201_AUX_DAC_REG 0x30 +#define ADIS16201_GPIO_CTRL_REG 0x32 +#define ADIS16201_MSC_CTRL_REG 0x34 +#define ADIS16201_SMPL_PRD_REG 0x36 +#define ADIS16201_AVG_CNT_REG 0x38 +#define ADIS16201_SLP_CNT_REG 0x3A + +/* Miscellaneous Control Register Definition */ +#define ADIS16201_MSC_CTRL_REG 0x34 +#define ADIS16201_MSC_CTRL_SELF_TEST_EN BIT(8) +#define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2) +#define ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH BIT(1) +#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1 BIT(0) /* Diagnostics, system status register */ -#define ADIS16201_DIAG_STAT 0x3C +#define ADIS16201_DIAG_STAT_REG 0x3C +#define ADIS16201_DIAG_STAT_ALARM2 BIT(9) +#define ADIS16201_DIAG_STAT_ALARM1 BIT(8) +#define ADIS16201_DIAG_STAT_SPI_FAIL_BIT 3 +#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT 2 +#define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1 +#define ADIS16201_DIAG_STAT_POWER_LOW_BIT 0 /* Operation, system command register */ -#define ADIS16201_GLOB_CMD 0x3E - - -#define ADIS16201_MSC_CTRL_SELF_TEST_EN BIT(8) - -#define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2) - -#define ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH BIT(1) - -#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1 BIT(0) - - -#define ADIS16201_DIAG_STAT_ALARM2 BIT(9) - -#define ADIS16201_DIAG_STAT_ALARM1 BIT(8) - -#define ADIS16201_DIAG_STAT_SPI_FAIL_BIT 3 - -#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT 2 - -#define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1 - -#define ADIS16201_DIAG_STAT_POWER_LOW_BIT 0 - -#define ADIS16201_GLOB_CMD_SW_RESET BIT(7) -#define ADIS16201_GLOB_CMD_FACTORY BIT(1) +#define ADIS16201_GLOB_CMD_REG 0x3E +#define ADIS16201_GLOB_CMD_SW_RESET BIT(7) +#define ADIS16201_GLOB_CMD_FACTORY BIT(1) -#define ADIS16201_ERROR_ACTIVE BIT(14) +#define ADIS16201_ERROR_ACTIVE BIT(14) enum adis16201_scan { ADIS16201_SCAN_ACC_X, @@ -101,10 +90,10 @@ enum adis16201_scan { }; static const u8 adis16201_addresses[] = { - [ADIS16201_SCAN_ACC_X] = ADIS16201_XACCL_OFFS, - [ADIS16201_SCAN_ACC_Y] = ADIS16201_YACCL_OFFS, - [ADIS16201_SCAN_INCLI_X] = ADIS16201_XINCL_OFFS, - [ADIS16201_SCAN_INCLI_Y] = ADIS16201_YINCL_OFFS, + [ADIS16201_SCAN_ACC_X] = ADIS16201_XACCL_OFFS_REG, + [ADIS16201_SCAN_ACC_Y] = ADIS16201_YACCL_OFFS_REG, + [ADIS16201_SCAN_INCLI_X] = ADIS16201_XINCL_OFFS_REG, + [ADIS16201_SCAN_INCLI_Y] = ADIS16201_YINCL_OFFS_REG, }; static int adis16201_read_raw(struct iio_dev *indio_dev, @@ -208,16 +197,16 @@ static int adis16201_write_raw(struct iio_dev *indio_dev, } static const struct iio_chan_spec adis16201_channels[] = { - ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT, ADIS16201_SCAN_SUPPLY, 0, 12), - ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT, ADIS16201_SCAN_TEMP, 0, 12), - ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT, ADIS16201_SCAN_ACC_X, + ADIS_SUPPLY_CHAN(ADIS16201_SUPPLY_OUT_REG, ADIS16201_SCAN_SUPPLY, 0, 12), + ADIS_TEMP_CHAN(ADIS16201_TEMP_OUT_REG, ADIS16201_SCAN_TEMP, 0, 12), + ADIS_ACCEL_CHAN(X, ADIS16201_XACCL_OUT_REG, ADIS16201_SCAN_ACC_X, BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), - ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT, ADIS16201_SCAN_ACC_Y, + ADIS_ACCEL_CHAN(Y, ADIS16201_YACCL_OUT_REG, ADIS16201_SCAN_ACC_Y, BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), - ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC, ADIS16201_SCAN_AUX_ADC, 0, 12), - ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT, ADIS16201_SCAN_INCLI_X, + ADIS_AUX_ADC_CHAN(ADIS16201_AUX_ADC_REG, ADIS16201_SCAN_AUX_ADC, 0, 12), + ADIS_INCLI_CHAN(X, ADIS16201_XINCL_OUT_REG, ADIS16201_SCAN_INCLI_X, BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), - ADIS_INCLI_CHAN(X, ADIS16201_YINCL_OUT, ADIS16201_SCAN_INCLI_Y, + ADIS_INCLI_CHAN(X, ADIS16201_YINCL_OUT_REG, ADIS16201_SCAN_INCLI_Y, BIT(IIO_CHAN_INFO_CALIBBIAS), 0, 14), IIO_CHAN_SOFT_TIMESTAMP(7) }; @@ -237,9 +226,9 @@ static const char * const adis16201_status_error_msgs[] = { static const struct adis_data adis16201_data = { .read_delay = 20, - .msc_ctrl_reg = ADIS16201_MSC_CTRL, - .glob_cmd_reg = ADIS16201_GLOB_CMD, - .diag_stat_reg = ADIS16201_DIAG_STAT, + .msc_ctrl_reg = ADIS16201_MSC_CTRL_REG, + .glob_cmd_reg = ADIS16201_GLOB_CMD_REG, + .diag_stat_reg = ADIS16201_DIAG_STAT_REG, .self_test_mask = ADIS16201_MSC_CTRL_SELF_TEST_EN, .self_test_no_autoclear = true, -- 2.7.4