linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<nuno.sa@analog.com>
Subject: Re: [PATCH v2 5/9] iio: imu: adis: Add self_test_reg variable
Date: Fri, 14 Feb 2020 14:33:05 +0000	[thread overview]
Message-ID: <20200214143305.5c991182@archlinux> (raw)
In-Reply-To: <20200210132606.9315-5-alexandru.ardelean@analog.com>

On Mon, 10 Feb 2020 15:26:02 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> From: Nuno Sá <nuno.sa@analog.com>
> 
> This patch adds a dedicated self_test_reg variable. This is also a step
> to let new drivers make use of `adis_initial_startup()`. Some devices
> use MSG_CTRL reg to request a self_test command while others use the
> GLOB_CMD register.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied.

thanks,
> ---
>  drivers/iio/accel/adis16201.c         | 1 +
>  drivers/iio/accel/adis16209.c         | 1 +
>  drivers/iio/gyro/adis16136.c          | 1 +
>  drivers/iio/gyro/adis16260.c          | 1 +
>  drivers/iio/imu/adis.c                | 6 +++---
>  drivers/iio/imu/adis16400.c           | 1 +
>  drivers/iio/imu/adis16460.c           | 2 ++
>  drivers/iio/imu/adis16480.c           | 1 +
>  drivers/staging/iio/accel/adis16203.c | 1 +
>  drivers/staging/iio/accel/adis16240.c | 1 +
>  include/linux/iio/imu/adis.h          | 2 ++
>  11 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c
> index 0f0f27a8184e..4154e7396bbe 100644
> --- a/drivers/iio/accel/adis16201.c
> +++ b/drivers/iio/accel/adis16201.c
> @@ -246,6 +246,7 @@ static const struct adis_data adis16201_data = {
>  	.diag_stat_reg = ADIS16201_DIAG_STAT_REG,
>  
>  	.self_test_mask = ADIS16201_MSC_CTRL_SELF_TEST_EN,
> +	.self_test_reg = ADIS16201_MSC_CTRL_REG,
>  	.self_test_no_autoclear = true,
>  	.timeouts = &adis16201_timeouts,
>  
> diff --git a/drivers/iio/accel/adis16209.c b/drivers/iio/accel/adis16209.c
> index c6dbd2424e10..31d45e7c5485 100644
> --- a/drivers/iio/accel/adis16209.c
> +++ b/drivers/iio/accel/adis16209.c
> @@ -256,6 +256,7 @@ static const struct adis_data adis16209_data = {
>  	.diag_stat_reg = ADIS16209_STAT_REG,
>  
>  	.self_test_mask = ADIS16209_MSC_CTRL_SELF_TEST_EN,
> +	.self_test_reg = ADIS16209_MSC_CTRL_REG,
>  	.self_test_no_autoclear = true,
>  	.timeouts = &adis16209_timeouts,
>  
> diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
> index 1db1131e5c67..a4c967a5fc5c 100644
> --- a/drivers/iio/gyro/adis16136.c
> +++ b/drivers/iio/gyro/adis16136.c
> @@ -471,6 +471,7 @@ static const char * const adis16136_status_error_msgs[] = {
>  	.diag_stat_reg = ADIS16136_REG_DIAG_STAT,			\
>  	.glob_cmd_reg = ADIS16136_REG_GLOB_CMD,				\
>  	.msc_ctrl_reg = ADIS16136_REG_MSC_CTRL,				\
> +	.self_test_reg = ADIS16136_REG_MSC_CTRL,			\
>  	.self_test_mask = ADIS16136_MSC_CTRL_SELF_TEST,			\
>  	.read_delay = 10,						\
>  	.write_delay = 10,						\
> diff --git a/drivers/iio/gyro/adis16260.c b/drivers/iio/gyro/adis16260.c
> index be09b3e5910c..9823573e811a 100644
> --- a/drivers/iio/gyro/adis16260.c
> +++ b/drivers/iio/gyro/adis16260.c
> @@ -346,6 +346,7 @@ static const struct adis_data adis16260_data = {
>  	.diag_stat_reg = ADIS16260_DIAG_STAT,
>  
>  	.self_test_mask = ADIS16260_MSC_CTRL_MEM_TEST,
> +	.self_test_reg = ADIS16260_MSC_CTRL,
>  	.timeouts = &adis16260_timeouts,
>  
>  	.status_error_msgs = adis1620_status_error_msgs,
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index e4897dad34ab..f7845a90f376 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -346,8 +346,8 @@ static int adis_self_test(struct adis *adis)
>  	int ret;
>  	const struct adis_timeout *timeouts = adis->data->timeouts;
>  
> -	ret = __adis_write_reg_16(adis, adis->data->msc_ctrl_reg,
> -			adis->data->self_test_mask);
> +	ret = __adis_write_reg_16(adis, adis->data->self_test_reg,
> +				  adis->data->self_test_mask);
>  	if (ret) {
>  		dev_err(&adis->spi->dev, "Failed to initiate self test: %d\n",
>  			ret);
> @@ -359,7 +359,7 @@ static int adis_self_test(struct adis *adis)
>  	ret = __adis_check_status(adis);
>  
>  	if (adis->data->self_test_no_autoclear)
> -		__adis_write_reg_16(adis, adis->data->msc_ctrl_reg, 0x00);
> +		__adis_write_reg_16(adis, adis->data->self_test_reg, 0x00);
>  
>  	return ret;
>  }
> diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
> index 1c0770e03ec9..05e70c1c4835 100644
> --- a/drivers/iio/imu/adis16400.c
> +++ b/drivers/iio/imu/adis16400.c
> @@ -956,6 +956,7 @@ static const char * const adis16400_status_error_msgs[] = {
>  	.read_delay = 50,						\
>  	.write_delay = 50,						\
>  	.self_test_mask = ADIS16400_MSC_CTRL_MEM_TEST,			\
> +	.self_test_reg = ADIS16400_MSC_CTRL,				\
>  	.status_error_msgs = adis16400_status_error_msgs,		\
>  	.status_error_mask = BIT(ADIS16400_DIAG_STAT_ZACCL_FAIL) |	\
>  		BIT(ADIS16400_DIAG_STAT_YACCL_FAIL) |			\
> diff --git a/drivers/iio/imu/adis16460.c b/drivers/iio/imu/adis16460.c
> index 9539cfe4a259..42fa473c6d81 100644
> --- a/drivers/iio/imu/adis16460.c
> +++ b/drivers/iio/imu/adis16460.c
> @@ -392,6 +392,8 @@ static const struct adis_timeout adis16460_timeouts = {
>  static const struct adis_data adis16460_data = {
>  	.diag_stat_reg = ADIS16460_REG_DIAG_STAT,
>  	.glob_cmd_reg = ADIS16460_REG_GLOB_CMD,
> +	.self_test_mask = BIT(2),
> +	.self_test_reg = ADIS16460_REG_GLOB_CMD,
>  	.has_paging = false,
>  	.read_delay = 5,
>  	.write_delay = 5,
> diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
> index 4c4de1b62769..acbe1701fc2d 100644
> --- a/drivers/iio/imu/adis16480.c
> +++ b/drivers/iio/imu/adis16480.c
> @@ -830,6 +830,7 @@ static int adis16480_enable_irq(struct adis *adis, bool enable);
>  	.read_delay = 5,						\
>  	.write_delay = 5,						\
>  	.self_test_mask = BIT(1),					\
> +	.self_test_reg = ADIS16480_REG_GLOB_CMD,			\
>  	.status_error_msgs = adis16480_status_error_msgs,		\
>  	.status_error_mask = BIT(ADIS16480_DIAG_STAT_XGYRO_FAIL) |	\
>  		BIT(ADIS16480_DIAG_STAT_YGYRO_FAIL) |			\
> diff --git a/drivers/staging/iio/accel/adis16203.c b/drivers/staging/iio/accel/adis16203.c
> index 39dfe3f7f254..fef52d9b5346 100644
> --- a/drivers/staging/iio/accel/adis16203.c
> +++ b/drivers/staging/iio/accel/adis16203.c
> @@ -250,6 +250,7 @@ static const struct adis_data adis16203_data = {
>  	.diag_stat_reg = ADIS16203_DIAG_STAT,
>  
>  	.self_test_mask = ADIS16203_MSC_CTRL_SELF_TEST_EN,
> +	.self_test_reg = ADIS16203_MSC_CTRL,
>  	.self_test_no_autoclear = true,
>  	.timeouts = &adis16203_timeouts,
>  
> diff --git a/drivers/staging/iio/accel/adis16240.c b/drivers/staging/iio/accel/adis16240.c
> index 39eb8364aa95..8bd35c6c56a1 100644
> --- a/drivers/staging/iio/accel/adis16240.c
> +++ b/drivers/staging/iio/accel/adis16240.c
> @@ -373,6 +373,7 @@ static const struct adis_data adis16240_data = {
>  	.diag_stat_reg = ADIS16240_DIAG_STAT,
>  
>  	.self_test_mask = ADIS16240_MSC_CTRL_SELF_TEST_EN,
> +	.self_test_reg = ADIS16240_MSC_CTRL,
>  	.self_test_no_autoclear = true,
>  	.timeouts = &adis16240_timeouts,
>  
> diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
> index 15e75670f923..b7feca4e5f26 100644
> --- a/include/linux/iio/imu/adis.h
> +++ b/include/linux/iio/imu/adis.h
> @@ -41,6 +41,7 @@ struct adis_timeout {
>   * @glob_cmd_reg: Register address of the GLOB_CMD register
>   * @msc_ctrl_reg: Register address of the MSC_CTRL register
>   * @diag_stat_reg: Register address of the DIAG_STAT register
> + * @self_test_reg: Register address to request self test command
>   * @status_error_msgs: Array of error messgaes
>   * @status_error_mask:
>   * @timeouts: Chip specific delays
> @@ -55,6 +56,7 @@ struct adis_data {
>  	unsigned int diag_stat_reg;
>  
>  	unsigned int self_test_mask;
> +	unsigned int self_test_reg;
>  	bool self_test_no_autoclear;
>  	const struct adis_timeout *timeouts;
>  


  reply	other threads:[~2020-02-14 14:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 13:25 [PATCH v2 1/9] iio: imu: adis16480: initialize adis_data statically Alexandru Ardelean
2020-02-10 13:25 ` [PATCH v2 2/9] iio: imu: adis16400: " Alexandru Ardelean
2020-02-14 14:29   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 3/9] iio: gyro: adis16136: " Alexandru Ardelean
2020-02-14 14:30   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 4/9] iio: imu: adis: add unlocked __adis_initial_startup() Alexandru Ardelean
2020-02-14 14:31   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 5/9] iio: imu: adis: Add self_test_reg variable Alexandru Ardelean
2020-02-14 14:33   ` Jonathan Cameron [this message]
2020-02-10 13:26 ` [PATCH v2 6/9] iio: imu: adis: Refactor adis_initial_startup Alexandru Ardelean
2020-02-14 14:39   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 7/9] iio: imu: adis: add support product ID check in adis_initial_startup Alexandru Ardelean
2020-02-14 14:41   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 8/9] iio: adis16480: Make use of __adis_initial_startup Alexandru Ardelean
2020-02-14 14:44   ` Jonathan Cameron
2020-02-10 13:26 ` [PATCH v2 9/9] iio: adis16460: " Alexandru Ardelean
2020-02-14 14:45   ` Jonathan Cameron
2020-02-14 14:28 ` [PATCH v2 1/9] iio: imu: adis16480: initialize adis_data statically 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=20200214143305.5c991182@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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;
as well as URLs for NNTP newsgroup(s).