Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Javier Carrasco <javier.carrasco.cruz@gmail.com>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	Emil Gedenryd <emil.gedenryd@axis.com>,
	Arthur Becker <arthur.becker@sentec.com>,
	Mudit Sharma <muditsharma.info@gmail.com>,
	Per-Daniel Olsson <perdaniel.olsson@axis.com>,
	Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>,
	Ivan Orlov <ivan.orlov0322@gmail.com>,
	David Heidelberg <david@ixit.cz>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 2/3] iio: light: Add support for AL3000a illuminance sensor
Date: Sun, 16 Feb 2025 22:57:03 +0200	[thread overview]
Message-ID: <Z7JRH8ITxA2KOozH@smile.fi.intel.com> (raw)
In-Reply-To: <20250216162721.124834-3-clamor95@gmail.com>

On Sun, Feb 16, 2025 at 06:27:20PM +0200, Svyatoslav Ryhel wrote:
> AL3000a is a simple I2C-based ambient light sensor, which is
> closely related to AL3010 and AL3320a, but has significantly
> different way of processing data generated by the sensor.

...

> +static int al3000a_set_pwr_on(struct al3000a_data *data)
> +{
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
> +
> +	ret = regulator_enable(data->vdd_supply);
> +	if (ret) {
> +		dev_err(dev, "failed to enable vdd power supply\n");
> +		return ret;
> +	}
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_ENABLE);
> +	if (ret) {
> +		dev_err(dev, "failed to write system register\n");

> +		return ret;
> +	}
> +
> +	return 0;

	return ret;

> +}

...

> +static void al3000a_set_pwr_off(void *_data)
> +{
> +	struct al3000a_data *data = _data;
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_DISABLE);
> +	if (ret) {
> +		dev_err(dev, "failed to write system register\n");
> +		return;
> +	}
> +
> +	ret = regulator_disable(data->vdd_supply);
> +	if (ret) {
> +		dev_err(dev, "failed to disable vdd power supply\n");

> +		return;

This is not needed, but I understand the intention. To me, nevertheless, seems
better to return an error to upper layer.

> +	}
> +}
> +
> +static int al3000a_init(struct al3000a_data *data)
> +{
> +	int ret;
> +
> +	ret = al3000a_set_pwr_on(data);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_RESET);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_ENABLE);
> +	if (ret)
> +		return ret;
> +
> +	return 0;

	return regmap_write(...);

> +}

...

> +static const struct i2c_device_id al3000a_id[] = {
> +	{"al3000a", },

Remove redundant inner comma. And make style consistent with OF, i.e. surround
string with spaces.

> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, al3010_id);

Copy'n'paste error, obviously. Please, test every version before sending.

> +
> +static const struct of_device_id al3000a_of_match[] = {
> +	{ .compatible = "dynaimage,al3000a" },
> +	{ /* sentinel */ }
> +};


-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2025-02-16 20:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16 16:27 [PATCH v3 0/3] iio: light: add al3000a als support Svyatoslav Ryhel
2025-02-16 16:27 ` [PATCH v3 1/3] dt-bindings: iio: light: al3010: add al3000a support Svyatoslav Ryhel
2025-02-16 16:27 ` [PATCH v3 2/3] iio: light: Add support for AL3000a illuminance sensor Svyatoslav Ryhel
2025-02-16 19:09   ` kernel test robot
2025-02-16 20:57   ` Andy Shevchenko [this message]
2025-02-16 20:57   ` kernel test robot
2025-02-16 21:24   ` Christophe JAILLET
2025-02-16 16:27 ` [PATCH v3 3/3] ARM: tegra: tf101: Add al3000a illuminance sensor node Svyatoslav Ryhel

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=Z7JRH8ITxA2KOozH@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arthur.becker@sentec.com \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=emil.gedenryd@axis.com \
    --cc=ivan.orlov0322@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=muditsharma.info@gmail.com \
    --cc=perdaniel.olsson@axis.com \
    --cc=robh@kernel.org \
    --cc=subhajit.ghosh@tweaklogic.com \
    --cc=thierry.reding@gmail.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