public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/7] iio: kx022a: Support ROHM KX134ACR-LBZ
Date: Sat, 30 Nov 2024 18:06:40 +0000	[thread overview]
Message-ID: <20241130180640.6de3b5b4@jic23-huawei> (raw)
In-Reply-To: <27c43c595de1f3f698ace671922d4f5a48c3cd54.1732783834.git.mazziesaccount@gmail.com>

On Thu, 28 Nov 2024 11:02:45 +0200
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> The register interface of the ROHM KX134ACR-LBZ accelerometer is
> almost identical to the KX132ACR-LBZ. The main difference between these
> accelerometers is that the KX134ACR-LBZ supports different G-ranges. The
> driver can model this by informing different scale to users. Also, the
> content of the "who_am_I" register is different.
> 
> Add an ID and scales for the KX134ACR-LBZ.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Applied 2-4

Thanks,

Jonathan

> 
> ---
> Revision history:
>   v2 => v3:
>   - patch number changed because patches were dropped.
>   v1 => v2:
>   - patch number changed because a change was added to the series.
>   - rebased on iio/testing to avoid conflicts with queued fixes.
> ---
>  drivers/iio/accel/kionix-kx022a-i2c.c |  2 ++
>  drivers/iio/accel/kionix-kx022a-spi.c |  2 ++
>  drivers/iio/accel/kionix-kx022a.c     | 36 +++++++++++++++++++++++++++
>  drivers/iio/accel/kionix-kx022a.h     |  2 ++
>  4 files changed, 42 insertions(+)
> 
> diff --git a/drivers/iio/accel/kionix-kx022a-i2c.c b/drivers/iio/accel/kionix-kx022a-i2c.c
> index 8a1d4fc28ddd..9fd049c2b62e 100644
> --- a/drivers/iio/accel/kionix-kx022a-i2c.c
> +++ b/drivers/iio/accel/kionix-kx022a-i2c.c
> @@ -39,6 +39,7 @@ static const struct i2c_device_id kx022a_i2c_id[] = {
>  	{ .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info },
>  	{ .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info },
>  	{ .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info },
> +	{ .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, kx022a_i2c_id);
> @@ -47,6 +48,7 @@ static const struct of_device_id kx022a_of_match[] = {
>  	{ .compatible = "kionix,kx022a", .data = &kx022a_chip_info },
>  	{ .compatible = "kionix,kx132-1211", .data = &kx132_chip_info },
>  	{ .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info },
> +	{ .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, kx022a_of_match);
> diff --git a/drivers/iio/accel/kionix-kx022a-spi.c b/drivers/iio/accel/kionix-kx022a-spi.c
> index f798b964d0b5..b20978afc565 100644
> --- a/drivers/iio/accel/kionix-kx022a-spi.c
> +++ b/drivers/iio/accel/kionix-kx022a-spi.c
> @@ -39,6 +39,7 @@ static const struct spi_device_id kx022a_id[] = {
>  	{ .name = "kx022a", .driver_data = (kernel_ulong_t)&kx022a_chip_info },
>  	{ .name = "kx132-1211", .driver_data = (kernel_ulong_t)&kx132_chip_info },
>  	{ .name = "kx132acr-lbz", .driver_data = (kernel_ulong_t)&kx132acr_chip_info },
> +	{ .name = "kx134acr-lbz", .driver_data = (kernel_ulong_t)&kx134acr_chip_info },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, kx022a_id);
> @@ -47,6 +48,7 @@ static const struct of_device_id kx022a_of_match[] = {
>  	{ .compatible = "kionix,kx022a", .data = &kx022a_chip_info },
>  	{ .compatible = "kionix,kx132-1211", .data = &kx132_chip_info },
>  	{ .compatible = "rohm,kx132acr-lbz", .data = &kx132acr_chip_info },
> +	{ .compatible = "rohm,kx134acr-lbz", .data = &kx134acr_chip_info },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, kx022a_of_match);
> diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
> index b23a27623a46..9fe16802c125 100644
> --- a/drivers/iio/accel/kionix-kx022a.c
> +++ b/drivers/iio/accel/kionix-kx022a.c
> @@ -408,6 +408,14 @@ static const int kx022a_scale_table[][2] = {
>  	{ 0, 4788403 },
>  };
>  
> +/* KX134ACR-LBZ ranges are (+/-) 8, 16, 32, 64 G */
> +static const int kx134acr_lbz_scale_table[][2] = {
> +	{ 0, 2394202 },
> +	{ 0, 4788403 },
> +	{ 0, 9576807 },
> +	{ 0, 19153613 },
> +};
> +
>  static int kx022a_read_avail(struct iio_dev *indio_dev,
>  			     struct iio_chan_spec const *chan,
>  			     const int **vals, int *type, int *length,
> @@ -1236,6 +1244,34 @@ const struct kx022a_chip_info kx132acr_chip_info = {
>  };
>  EXPORT_SYMBOL_NS_GPL(kx132acr_chip_info, IIO_KX022A);
>  
> +const struct kx022a_chip_info kx134acr_chip_info = {
> +	.name				= "kx134acr-lbz",
> +	.regmap_config			= &kx022a_regmap_config,
> +	.channels			= kx022a_channels,
> +	.num_channels			= ARRAY_SIZE(kx022a_channels),
> +	.scale_table			= kx134acr_lbz_scale_table,
> +	.scale_table_size		= ARRAY_SIZE(kx134acr_lbz_scale_table) *
> +					  ARRAY_SIZE(kx134acr_lbz_scale_table[0]),
> +	.fifo_length			= KX022A_FIFO_LENGTH,
> +	.who				= KX022A_REG_WHO,
> +	.id				= KX134ACR_LBZ_ID,
> +	.cntl				= KX022A_REG_CNTL,
> +	.cntl2				= KX022A_REG_CNTL2,
> +	.odcntl				= KX022A_REG_ODCNTL,
> +	.buf_cntl1			= KX022A_REG_BUF_CNTL1,
> +	.buf_cntl2			= KX022A_REG_BUF_CNTL2,
> +	.buf_clear			= KX022A_REG_BUF_CLEAR,
> +	.buf_status1			= KX022A_REG_BUF_STATUS_1,
> +	.buf_read			= KX022A_REG_BUF_READ,
> +	.inc1				= KX022A_REG_INC1,
> +	.inc4				= KX022A_REG_INC4,
> +	.inc5				= KX022A_REG_INC5,
> +	.inc6				= KX022A_REG_INC6,
> +	.xout_l				= KX022A_REG_XOUT_L,
> +	.get_fifo_bytes_available	= kx022a_get_fifo_bytes_available,
> +};
> +EXPORT_SYMBOL_NS_GPL(kx134acr_chip_info, IIO_KX022A);
> +
>  int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chip_info)
>  {
>  	static const char * const regulator_names[] = {"io-vdd", "vdd"};
> diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h
> index 36e9d9de8c13..ea32fd252a38 100644
> --- a/drivers/iio/accel/kionix-kx022a.h
> +++ b/drivers/iio/accel/kionix-kx022a.h
> @@ -14,6 +14,7 @@
>  #define KX022A_REG_WHO		0x0f
>  #define KX022A_ID		0xc8
>  #define KX132ACR_LBZ_ID		0xd8
> +#define KX134ACR_LBZ_ID		0xcc
>  
>  #define KX022A_REG_CNTL2	0x19
>  #define KX022A_MASK_SRST	BIT(7)
> @@ -190,5 +191,6 @@ int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chi
>  extern const struct kx022a_chip_info kx022a_chip_info;
>  extern const struct kx022a_chip_info kx132_chip_info;
>  extern const struct kx022a_chip_info kx132acr_chip_info;
> +extern const struct kx022a_chip_info kx134acr_chip_info;
>  
>  #endif


  reply	other threads:[~2024-11-30 18:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28  9:01 [PATCH v3 0/7] Support ROHM KX134ACR-LBZ Matti Vaittinen
2024-11-28  9:01 ` [PATCH v3 1/7] iio: accel: kx022a: Use cleanup.h helpers Matti Vaittinen
2024-11-30 18:05   ` Jonathan Cameron
2024-11-28  9:02 ` [PATCH v3 2/7] iio: accel: kx022a: Support ICs with different G-ranges Matti Vaittinen
2024-12-02 10:25   ` Mehdi Djait
2024-12-02 11:05     ` Matti Vaittinen
2024-11-28  9:02 ` [PATCH v3 3/7] dt-bindings: ROHM KX134ACR-LBZ Matti Vaittinen
2024-11-28  9:02 ` [PATCH v3 4/7] iio: kx022a: Support " Matti Vaittinen
2024-11-30 18:06   ` Jonathan Cameron [this message]
2024-11-28  9:03 ` [PATCH v3 5/7] dt-bindings: iio: kx022a: Support KX134-1211 Matti Vaittinen
2024-11-28  9:03 ` [PATCH v3 6/7] iio: accel: " Matti Vaittinen
2024-11-30 18:07   ` Jonathan Cameron
2024-11-28  9:03 ` [PATCH v3 7/7] iio: accel: kx022a: align with subsystem way Matti Vaittinen
2024-11-28 17:20   ` kernel test robot
2024-11-30 18:08     ` Jonathan Cameron
2024-11-28 17:31   ` kernel test robot
2024-11-28 17:52   ` kernel test robot
2024-11-30 18:15   ` Jonathan Cameron
2024-11-30 18:26     ` Jonathan Cameron
2024-12-02  6:46       ` Matti Vaittinen

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=20241130180640.6de3b5b4@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=robh@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