public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Radu Sabau <radu.sabau@analog.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: pmbus: adp1050 : Add driver support
Date: Mon, 18 Mar 2024 17:12:37 +0100	[thread overview]
Message-ID: <04b39945-e4e1-43bd-83bf-0d7eb3730352@linaro.org> (raw)
In-Reply-To: <20240318112140.385244-3-radu.sabau@analog.com>

On 18/03/2024 12:21, Radu Sabau wrote:
> Add support for ADP1050 Digital Controller for Isolated Power Supplies
> with PMBus interface Voltage, Current and Temperature Monitor.
> 

...

> +static int adp1050_probe(struct i2c_client *client)
> +{
> +	u32 vin_scale_monitor, iin_scale_monitor;
> +	int ret;
> +
> +	if (!i2c_check_functionality(client->adapter,
> +				     I2C_FUNC_SMBUS_WRITE_WORD_DATA))
> +		return -ENODEV;
> +
> +	/* Unlock CHIP's password in order to be able to read/write to it's
> +	 * VIN_SCALE and IIN_SCALE registers.
> +	*/
> +	ret = i2c_smbus_write_word_data(client, ADP1050_CHIP_PASSWORD, 0xFFFF);
> +	if (ret < 0) {
> +		dev_err_probe(&client->dev, "Device can't be unlocked.\n");

Syntax is: return dev_err_probe(). Same in other places.

> +		return ret;
> +	}
> +
> +	ret = i2c_smbus_write_word_data(client, ADP1050_CHIP_PASSWORD, 0xFFFF);
> +	if (ret < 0) {
> +		dev_err_probe(&client->dev, "Device couldn't be unlocked.\n");
> +		return ret;
> +	}
> +
> +	/* If adi,vin-scale-monitor isn't set or is set to 0 means that the
> +	 * VIN monitor isn't used, therefore 0 is used as scale in order
> +	 * for the readings to return 0.
> +	*/

Please use Linux coding style comments. /* and aligned */.


> +	if (device_property_read_u32(&client->dev, "adi,vin-scale-monitor",
> +				     &vin_scale_monitor))
> +		vin_scale_monitor = 0;
> +
> +	/* If adi,iin-scale-monitor isn't set or is set to 0 means that the
> +	 * IIN monitor isn't used, therefore 0 is used as scale in order
> +	 * for the readings to return 0.
> +	*/
> +	if (device_property_read_u32(&client->dev, "adi,iin-scale-monitor",
> +				     &iin_scale_monitor))
> +		iin_scale_monitor = 0;
> +
> +	ret = i2c_smbus_write_word_data(client, ADP1050_VIN_SCALE_MONITOR,
> +					vin_scale_monitor);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = i2c_smbus_write_word_data(client, ADP1050_IIN_SCALE_MONITOR,
> +					iin_scale_monitor);
> +	if (ret < 0)
> +		return ret;
> +
> +	return pmbus_do_probe(client, &adp1050_info);
> +}
> +
> +static const struct i2c_device_id adp1050_id[] = {
> +	{"adp1050", 0},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, adp1050_id);
> +
> +static const struct of_device_id adp1050_of_match[] = {
> +	{ .compatible = "adi,adp1050"},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, adp1050_of_match);
> +
> +static struct i2c_driver adp1050_driver = {
> +	.driver = {
> +		.name = "adp1050",
> +		.of_match_table = of_match_ptr(adp1050_of_match),

Drop of_match_ptr, you will have here warnings.

> +	},
> +	.probe = adp1050_probe,
> +	.id_table = adp1050_id,
> +};
> +module_i2c_driver(adp1050_driver);
> +
> +MODULE_AUTHOR("Radu Sabau <radu.sabau@analog.com>");
> +MODULE_DESCRIPTION("Analog Devices ADP1050 HWMON PMBus Driver");
> +MODULE_LICENSE("GPL");
> +MODULE_IMPORT_NS(PMBUS);

Best regards,
Krzysztof


  parent reply	other threads:[~2024-03-18 16:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 11:21 [PATCH 0/2] Add ADP1050 support Radu Sabau
2024-03-18 11:21 ` [PATCH 1/2] dt-bindings: hwmon: pmbus: adp1050 : add bindings Radu Sabau
2024-03-18 13:32   ` Rob Herring
2024-03-18 15:17   ` Guenter Roeck
2024-03-18 16:10   ` Krzysztof Kozlowski
2024-03-18 11:21 ` [PATCH 2/2] hwmon: pmbus: adp1050 : Add driver support Radu Sabau
2024-03-18 15:06   ` Guenter Roeck
2024-03-19 10:46     ` Sabau, Radu bogdan
2024-03-18 16:12   ` Krzysztof Kozlowski [this message]
2024-03-18 16:48     ` Guenter Roeck
2024-03-18 18:00       ` Krzysztof Kozlowski
2024-03-18 21:28   ` kernel test robot
2024-03-19  0:25   ` kernel test robot

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=04b39945-e4e1-43bd-83bf-0d7eb3730352@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=radu.sabau@analog.com \
    --cc=robh+dt@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