Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Cibil <cibil.pankiras@aerq.com>
Cc: ktsai@capellamicro.com, lars@metafoo.de,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: light: cm3232: Reset before reading HW ID
Date: Sun, 24 Nov 2024 12:59:53 +0000	[thread overview]
Message-ID: <20241124125953.75d241b2@jic23-huawei> (raw)
In-Reply-To: <20241114131656.1707358-1-cibil.pankiras@aerq.com>

On Thu, 14 Nov 2024 14:16:56 +0100
Cibil <cibil.pankiras@aerq.com> wrote:

> From: Cibil Pankiras <cibil.pankiras@aerq.com>
> 
> According to the datasheet, the chip requires a reset before any data
> can be read. This commit moves the device identification logic to
> occur after the reset to ensure proper initialization.
> 
> Cc: Kevin Tsai <ktsai@capellamicro.com>
> Signed-off-by: Cibil Pankiras <cibil.pankiras@aerq.com>
Hi Cibil,

If you are resending for any reason make sure you add
[RESEND to the patch title and say why under the ---

That let's people know it is the same code if they have multiple
copies.

Thanks,

Jonathan

> ---
>  drivers/iio/light/cm3232.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c
> index 2c80a0535d2c..db33671c448c 100644
> --- a/drivers/iio/light/cm3232.c
> +++ b/drivers/iio/light/cm3232.c
> @@ -89,6 +89,15 @@ static int cm3232_reg_init(struct cm3232_chip *chip)
>  
>  	chip->als_info = &cm3232_als_info_default;
>  
> +	/* Disable and reset device */
> +	chip->regs_cmd = CM3232_CMD_ALS_DISABLE | CM3232_CMD_ALS_RESET;
> +	ret = i2c_smbus_write_byte_data(client, CM3232_REG_ADDR_CMD,
> +					chip->regs_cmd);
> +	if (ret < 0) {
> +		dev_err(&chip->client->dev, "Error writing reg_cmd\n");
> +		return ret;
> +	}
> +
>  	/* Identify device */
>  	ret = i2c_smbus_read_word_data(client, CM3232_REG_ADDR_ID);
>  	if (ret < 0) {
> @@ -99,15 +108,6 @@ static int cm3232_reg_init(struct cm3232_chip *chip)
>  	if ((ret & 0xFF) != chip->als_info->hw_id)
>  		return -ENODEV;
>  
> -	/* Disable and reset device */
> -	chip->regs_cmd = CM3232_CMD_ALS_DISABLE | CM3232_CMD_ALS_RESET;
> -	ret = i2c_smbus_write_byte_data(client, CM3232_REG_ADDR_CMD,
> -					chip->regs_cmd);
> -	if (ret < 0) {
> -		dev_err(&chip->client->dev, "Error writing reg_cmd\n");
> -		return ret;
> -	}
> -
>  	/* Register default value */
>  	chip->regs_cmd = chip->als_info->regs_cmd_default;
>  


  reply	other threads:[~2024-11-24 13:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 13:16 [PATCH] iio: light: cm3232: Reset before reading HW ID Cibil
2024-11-24 12:59 ` Jonathan Cameron [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-14  9:13 Cibil Pankiras
2024-11-24 12:58 ` 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=20241124125953.75d241b2@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=cibil.pankiras@aerq.com \
    --cc=ktsai@capellamicro.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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