From: Jonathan Cameron <jic23@kernel.org>
To: Akshay Jindal <akshayaj.lkd@gmail.com>
Cc: dan@dlrobertson.com, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, shuah@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/6] iio: accel: bma400: Reorganize and rename register and field macros
Date: Sun, 12 Oct 2025 16:52:28 +0100 [thread overview]
Message-ID: <20251012165228.4650cdac@jic23-huawei> (raw)
In-Reply-To: <20251007055511.108984-2-akshayaj.lkd@gmail.com>
On Tue, 7 Oct 2025 11:25:01 +0530
Akshay Jindal <akshayaj.lkd@gmail.com> wrote:
> Reorganize register and field macros to improve consistency with the
> datasheet and naming style:
>
> - Move field macros next to their corresponding register macros
> - Reorder register macros to follow address order from the datasheet
> - Rename field macros to include the register name in the macro name
> - Add a _REG suffix to register macros where missing
>
> No functional changes are intended.
>
> Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>
> ---
> drivers/iio/accel/bma400.h | 110 +++++++++--------
> drivers/iio/accel/bma400_core.c | 212 ++++++++++++++++----------------
> 2 files changed, 163 insertions(+), 159 deletions(-)
>
> diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h
> index 932358b45f17..ae3411c090c9 100644
> --- a/drivers/iio/accel/bma400.h
> +++ b/drivers/iio/accel/bma400.h
> @@ -16,31 +16,37 @@
> * Read-Only Registers
> */
>
> +/* Chip ID of BMA 400 devices found in the chip ID register. */
> +#define BMA400_ID_REG_VAL 0x90
> +
> /* Status and ID registers */
> #define BMA400_CHIP_ID_REG 0x00
> #define BMA400_ERR_REG 0x02
> #define BMA400_STATUS_REG 0x03
>
> /* Acceleration registers */
> -#define BMA400_X_AXIS_LSB_REG 0x04
> -#define BMA400_X_AXIS_MSB_REG 0x05
> -#define BMA400_Y_AXIS_LSB_REG 0x06
> -#define BMA400_Y_AXIS_MSB_REG 0x07
> -#define BMA400_Z_AXIS_LSB_REG 0x08
> -#define BMA400_Z_AXIS_MSB_REG 0x09
> +#define BMA400_ACC_X_LSB_REG 0x04
> +#define BMA400_ACC_X_MSB_REG 0x05
> +#define BMA400_ACC_Y_LSB_REG 0x06
> +#define BMA400_ACC_Y_MSB_REG 0x07
> +#define BMA400_ACC_Z_LSB_REG 0x08
> +#define BMA400_ACC_Z_MSB_REG 0x09
>
> /* Sensor time registers */
> -#define BMA400_SENSOR_TIME0 0x0a
> -#define BMA400_SENSOR_TIME1 0x0b
> -#define BMA400_SENSOR_TIME2 0x0c
> +#define BMA400_SENSOR_TIME0_REG 0x0a
> +#define BMA400_SENSOR_TIME1_REG 0x0b
> +#define BMA400_SENSOR_TIME2_REG 0x0c
>
> /* Event and interrupt registers */
> #define BMA400_EVENT_REG 0x0d
> +
> #define BMA400_INT_STAT0_REG 0x0e
> #define BMA400_INT_STAT1_REG 0x0f
> #define BMA400_INT_STAT2_REG 0x10
> -#define BMA400_INT12_MAP_REG 0x23
> -#define BMA400_INT_ENG_OVRUN_MSK BIT(4)
> +#define BMA400_ENG_OVRUN_INT_STAT_MASK BIT(4)
> +#define BMA400_STEP_INT_STAT_MASK GENMASK(9, 8)
> +#define BMA400_S_TAP_INT_STAT_MASK BIT(10)
> +#define BMA400_D_TAP_INT_STAT_MASK BIT(11)
Discussion on naming format and association with registers continues on v3
(busy week so I only just got back to reviewing!)
Also a bit on the weird 2 registers as one thing going on here.
>
> /* Temperature register */
> #define BMA400_TEMP_DATA_REG 0x11
> @@ -55,70 +61,68 @@
> #define BMA400_STEP_CNT1_REG 0x16
> #define BMA400_STEP_CNT3_REG 0x17
> #define BMA400_STEP_STAT_REG 0x18
> -#define BMA400_STEP_INT_MSK BIT(0)
> #define BMA400_STEP_RAW_LEN 0x03
> -#define BMA400_STEP_STAT_MASK GENMASK(9, 8)
Other than those outstanding bits this looks fine (though I'll take one more close
read once we have those questions resolved).
Jonathan
next prev parent reply other threads:[~2025-10-12 15:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 5:55 [PATCH v4 0/6] iio: accel: bma400: Refactor GENINTR config and register macros Akshay Jindal
2025-10-07 5:55 ` [PATCH v4 1/6] iio: accel: bma400: Reorganize and rename register and field macros Akshay Jindal
2025-10-12 15:52 ` Jonathan Cameron [this message]
2025-10-07 5:55 ` [PATCH v4 2/6] iio: accel: bma400: Use macros for generic event configuration values Akshay Jindal
2025-10-07 5:55 ` [PATCH v4 3/6] iio: accel: bma400: Use index-based register addressing and lookup Akshay Jindal
2025-10-07 5:55 ` [PATCH v4 4/6] iio: accel: bma400: Replace bit shifts with FIELD_PREP and FIELD_GET Akshay Jindal
2025-10-12 15:54 ` Jonathan Cameron
2025-10-07 5:55 ` [PATCH v4 5/6] iio: accel: bma400: Rename activity_event_en() to generic_event_en() Akshay Jindal
2025-10-07 5:55 ` [PATCH v4 6/6] iio: accel: bma400: Add detail to comments in GEN INTR configuration Akshay Jindal
2025-10-12 15:55 ` [PATCH v4 0/6] iio: accel: bma400: Refactor GENINTR config and register macros Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251012165228.4650cdac@jic23-huawei \
--to=jic23@kernel.org \
--cc=akshayaj.lkd@gmail.com \
--cc=andy@kernel.org \
--cc=dan@dlrobertson.com \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox