Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2984520lqp; Mon, 25 Mar 2024 15:39:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXX8chdjq05zVzfstqB0y3bZO0Fv/NZ56BamK5s8ELs8iiK97WC+8/VjjU7h3dD3Cty8ck7cpXWRIg51/dZ/1jqWu+aQMhfOKYFYwuCmQ== X-Google-Smtp-Source: AGHT+IGkOALRdslEUfY56MUjSBpRf80qqahVPxwnJULqOXiqLfsH3rCAJotV7tSJHOvhgxLpVOXU X-Received: by 2002:a17:90a:5981:b0:29b:bd37:34f2 with SMTP id l1-20020a17090a598100b0029bbd3734f2mr6397540pji.14.1711406381174; Mon, 25 Mar 2024 15:39:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711406381; cv=pass; d=google.com; s=arc-20160816; b=upouM8tdJ7wfBlsg+PqsewhMFzyCJIpX0myUxhXPJ0FJRVYmA6snd9fxf+FR/bOq2Q gpKN1xBkn3bpjZOzBfAXSlhkQNzuC4Km5Cc/URmFA7wF4athGebB23OCSrI4T/oOIx5T zcsA8IMpbk/kVnk7xlmOT6qGGmt3hxfhqvrN3G1Y9RShG9Zx1NTMbJIbQwNjwKrzPa5r HpXHu1crINdjUHS+cIKdX3bf8RHQs1o1zizOCfTSSkxMEf5DVYMa9S58A0F3aGnE1lO5 7jwOat16xJLDeDMHdGUiy9RcHgbVrVrBLNDF0CCFUXPUVVTcdV/7hSwODzJd+n4bZT7T 66XA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PRyL2dhzaW6eUI5gOVnZcHnarOYXwzosHg6YqH3UA9A=; fh=qfh+MjOZtZChoI+xxJxwhwL7XRjko27rvelJHS/IBfM=; b=GiKGqYFkiQVsZ0fD0mtpP8xcxgdX4Tx3vK6DqHaebA4Y79QYKQqEDNxYJlvVe7r53W HcbaZnf2BreUZY5xI7lQU4tL54ybVL1UJSKwROe9xiLPe9JIjQQDWOYjzgJdmF+ymPD4 YULU8bF1mk9ggc/Jqc8Ymc8PUXIgRoI0fEQgK3E3LCGc+CZal4D0mf+W/9pmo68zX7h4 X0VDMCl6156Sg0OwVlsE5N0kjQbvrwXB8111KX9Ax1iyCXLY8HAmtGth51MoB0lgQLtn /dU/CudF5x3CAKk/V9QDa3mz50xWOqYGHRVIPoZysEFlTNblnxV1ofiBnuIw6PBybKkt 3a3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VcOJ9JWS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-117376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bf12-20020a17090b0b0c00b002a0493ae5bbsi6367384pjb.111.2024.03.25.15.39.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 15:39:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VcOJ9JWS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-117376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3B3BCB2AE2F for ; Mon, 25 Mar 2024 17:04:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3410382D90; Mon, 25 Mar 2024 15:34:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VcOJ9JWS" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43904811F1; Mon, 25 Mar 2024 15:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380893; cv=none; b=n4zCYfKDq15U9+Q3lpYd+ftn3muefrlsj1ntvzzwJpw0qq6fUUSVZlaQDR0/4WhMzo3FFzQDcd3btEre77WpufwCbWIv/cMBefn7AbXORv2k310y7nLupsVkIdkr9ZNbn7bIbDwXo8s85558kd+U8xnbqFUYQ1GE0zcfinFHs2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380893; c=relaxed/simple; bh=+V8DFNWF4YEqwBXLncKDoMI1ttfk7hCpvo+Y4VoMUTM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YBgxbs3RGCNccfpAJLMp2DXodAjEQ++XeoJh1yx5O/GZpQ8E0lYpuby3sozyReXALAju05ky2z7zBfj/O/t1AXgLNBPqH4UdKARx19qSvQToLQy+CjN5xkDgYO0cabgTYoPagkE/81ypzcRzMWOljdxqmLjrZCpLK3dgktymN4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VcOJ9JWS; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a47385a4379so462572766b.0; Mon, 25 Mar 2024 08:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711380889; x=1711985689; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PRyL2dhzaW6eUI5gOVnZcHnarOYXwzosHg6YqH3UA9A=; b=VcOJ9JWSkCj3qt2q6g4PUc12NA3+8AytBhnf0w730yY0Azo8VvXAdKDSdw6EqfDnf5 eba4isRxopwtRW/waS7Mn9nk58BeBdl3c840ORMUnj8swts2Wx7ciTtlfyyniFtZopS2 gSpK/K1WBBOKO/PYZ8rNC8NDc90RznWiA+4URurmtunpEKCyE39H4cLEV+2uyLctPfRH uRgatNG4UKHpb7eXES846jn8dR0FIyCqvqQ+k3L8mfflhTNJkXH4pTWFBC5v1OW9iDBU pkf8IoSKChXZL64njcrpKLgYDpHEc0TsMNadpuaPMyJ75UvsEE7DOjyh0MJUnr8r/XK1 lF6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711380889; x=1711985689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PRyL2dhzaW6eUI5gOVnZcHnarOYXwzosHg6YqH3UA9A=; b=OEiY0mmPVrugYPQ6OROBlabPTPZJoAxyHlLp7Diba6hUFIb1gm+1hgnENCZCk5gDhu ajoCMq9pXt54VRCxPWawmNEMR96sj5We3vg+SVOHfzANMuO6bhs9fsMoh01UGML5I2Rr OgEJMpmZ0enC7zDnltrnOCFd/cwPP7IQtqPy6e3R69GqY7LJb8vy9g2EkVRKg/9p3jAu 5zUEnOCWh6i2eHOAyo+q5AZBLwMRvKcLbDrhD6TT7dW2oJDnf1j1TKWPT4hflevH9tnI Ywv0XmHc5N9GPEWJl+vtnOQlYrOMhfusuw7WPm5xCzvO+PFX8Fj9D5frOqOqQK37ZXcE cEGA== X-Forwarded-Encrypted: i=1; AJvYcCVJS4cwt6uUmxzKJGvEmAgaqBKphjnjH+7FARnUixDSF1BH4Sb6sza0taKt4QbU7DxfHxFedZcdIj5GVRtnrG7vNSX+mF7/Oi7bBf0n9o7MDWULScgd9tQ6ZFWvbKrYWMwpUI3GYa6SKw== X-Gm-Message-State: AOJu0YxjSUgfjflk2L35Rcc+suOTyV4gN0/Bz+hdNLkkNaP+xEbL9De0 uoUlxDhy5IbfsNVxVWxPnZnZRI8Fro1oGHrx+SpfuMRu9n1epkdK X-Received: by 2002:a17:906:744:b0:a45:f9c5:3024 with SMTP id z4-20020a170906074400b00a45f9c53024mr5255862ejb.11.1711380889407; Mon, 25 Mar 2024 08:34:49 -0700 (PDT) Received: from 764c7355c69b.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id u13-20020a17090626cd00b00a45200fe2b5sm3142382ejc.224.2024.03.25.08.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:34:49 -0700 (PDT) From: Lothar Rubusch To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, eraretuya@gmail.com, l.rubusch@gmail.com Subject: [PATCH v4 3/7] iio: accel: adxl345: Move defines to header Date: Mon, 25 Mar 2024 15:33:52 +0000 Message-Id: <20240325153356.46112-4-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240325153356.46112-1-l.rubusch@gmail.com> References: <20240325153356.46112-1-l.rubusch@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Move defines to the header file. This keeps the defines block together in one location, when extended by new shared defines which then have to be in the header file. Signed-off-by: Lothar Rubusch --- drivers/iio/accel/adxl345.h | 31 +++++++++++++++++++++++++++++++ drivers/iio/accel/adxl345_core.c | 29 ----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h index 284bd387c..ee169fed4 100644 --- a/drivers/iio/accel/adxl345.h +++ b/drivers/iio/accel/adxl345.h @@ -8,6 +8,37 @@ #ifndef _ADXL345_H_ #define _ADXL345_H_ +#include + +#define ADXL345_REG_DEVID 0x00 +#define ADXL345_REG_OFSX 0x1E +#define ADXL345_REG_OFSY 0x1F +#define ADXL345_REG_OFSZ 0x20 +#define ADXL345_REG_OFS_AXIS(index) (ADXL345_REG_OFSX + (index)) +#define ADXL345_REG_BW_RATE 0x2C +#define ADXL345_REG_POWER_CTL 0x2D +#define ADXL345_REG_DATA_FORMAT 0x31 +#define ADXL345_REG_DATAX0 0x32 +#define ADXL345_REG_DATAY0 0x34 +#define ADXL345_REG_DATAZ0 0x36 +#define ADXL345_REG_DATA_AXIS(index) \ + (ADXL345_REG_DATAX0 + (index) * sizeof(__le16)) + +#define ADXL345_BW_RATE GENMASK(3, 0) +#define ADXL345_BASE_RATE_NANO_HZ 97656250LL + +#define ADXL345_POWER_CTL_MEASURE BIT(3) +#define ADXL345_POWER_CTL_STANDBY 0x00 + +#define ADXL345_DATA_FORMAT_FULL_RES BIT(3) /* Up to 13-bits resolution */ +#define ADXL345_DATA_FORMAT_2G 0 +#define ADXL345_DATA_FORMAT_4G 1 +#define ADXL345_DATA_FORMAT_8G 2 +#define ADXL345_DATA_FORMAT_16G 3 +#define ADXL345_DATA_FORMAT_MSK ~((u8) BIT(6)) /* ignore spi-3wire */ + +#define ADXL345_DEVID 0xE5 + /* * In full-resolution mode, scale factor is maintained at ~4 mg/LSB * in all g ranges. diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 469015e9c..eba9c048a 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -17,35 +17,6 @@ #include "adxl345.h" -#define ADXL345_REG_DEVID 0x00 -#define ADXL345_REG_OFSX 0x1e -#define ADXL345_REG_OFSY 0x1f -#define ADXL345_REG_OFSZ 0x20 -#define ADXL345_REG_OFS_AXIS(index) (ADXL345_REG_OFSX + (index)) -#define ADXL345_REG_BW_RATE 0x2C -#define ADXL345_REG_POWER_CTL 0x2D -#define ADXL345_REG_DATA_FORMAT 0x31 -#define ADXL345_REG_DATAX0 0x32 -#define ADXL345_REG_DATAY0 0x34 -#define ADXL345_REG_DATAZ0 0x36 -#define ADXL345_REG_DATA_AXIS(index) \ - (ADXL345_REG_DATAX0 + (index) * sizeof(__le16)) - -#define ADXL345_BW_RATE GENMASK(3, 0) -#define ADXL345_BASE_RATE_NANO_HZ 97656250LL - -#define ADXL345_POWER_CTL_MEASURE BIT(3) -#define ADXL345_POWER_CTL_STANDBY 0x00 - -#define ADXL345_DATA_FORMAT_FULL_RES BIT(3) /* Up to 13-bits resolution */ -#define ADXL345_DATA_FORMAT_2G 0 -#define ADXL345_DATA_FORMAT_4G 1 -#define ADXL345_DATA_FORMAT_8G 2 -#define ADXL345_DATA_FORMAT_16G 3 -#define ADXL345_DATA_FORMAT_MSK ~((u8) BIT(6)) /* ignore spi-3wire */ - -#define ADXL345_DEVID 0xE5 - struct adxl345_data { const struct adxl345_chip_info *info; struct regmap *regmap; -- 2.25.1