From: Krzysztof Kozlowski <krzk@kernel.org>
To: Leo Yang <leo.yang.sy0@gmail.com>,
jdelvare@suse.com, linux@roeck-us.net, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, Leo-Yang@quantatw.com,
corbet@lwn.net, Delphine_CC_Chiu@Wiwynn.com,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor
Date: Mon, 6 Jan 2025 11:52:46 +0100 [thread overview]
Message-ID: <428c034c-79a2-4753-9af8-4dc5af7d310f@kernel.org> (raw)
In-Reply-To: <20250106071337.3017926-3-Leo-Yang@quantatw.com>
On 06/01/2025 08:13, Leo Yang wrote:
> Support ina233 driver for Meta Yosemite V4.
>
> Driver for Texas Instruments INA233 Current and Power Monitor
> With I2C-, SMBus-, and PMBus-Compatible Interface
>
> According to the mail
> https://lore.kernel.org/all/
> 20230920054739.1561080-1-Delphine_CC_Chiu@wiwynn.com
Don't break the URLs. It makes them difficult to use.
> maintainer's suggested rewrite driver
>
> +INA233 HARDWARE MONITOR DRIVER
> +M: Leo Yang <Leo-Yang@quantatw.com>
> +M: Leo Yang <leo.yang.sy0@gmail.com>
> +L: linux-hwmon@vger.kernel.org
> +S: Odd Fixes
> +F: Documentation/devicetree/bindings/hwmon/ina233.txt
There is no such file.
...
> +
> +struct pmbus_driver_info ina233_info = {
Why this cannot be const and static?
> + .pages = 1,
> + .format[PSC_VOLTAGE_IN] = direct,
> + .format[PSC_VOLTAGE_OUT] = direct,
> + .format[PSC_CURRENT_OUT] = direct,
> + .format[PSC_POWER] = direct,
> + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_INPUT
> + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
> + | PMBUS_HAVE_POUT
> + | PMBUS_HAVE_VMON | PMBUS_HAVE_STATUS_VMON,
> + .m[PSC_VOLTAGE_IN] = 8,
> + .R[PSC_VOLTAGE_IN] = 2,
> + .m[PSC_VOLTAGE_OUT] = 8,
> + .R[PSC_VOLTAGE_OUT] = 2,
> + .read_word_data = ina233_read_word_data,
> +};
> +
> +static int ina233_probe(struct i2c_client *client)
> +{
> + int ret, m, R;
> + u32 rshunt;
> + u16 current_lsb;
> + u16 calibration;
> +
> + /* If INA233 skips current/power, shunt-resistor and current-lsb aren't needed. */
> +
> + /* read rshunt value (uOhm) */
> + ret = of_property_read_u32(client->dev.of_node, "shunt-resistor", &rshunt);
> + if (ret < 0 || !rshunt) {
> + dev_err(&client->dev, "Unable to read shunt-resistor or value is 0, default value %d uOhm is used.\n",
> + INA233_RSHUNT_DEFAULT);
Your binding said this is optional, so how this can be an error?
> + rshunt = INA233_RSHUNT_DEFAULT;
> + }
> +
> + /* read current_lsb value (uA/bit) */
> + ret = of_property_read_u16(client->dev.of_node, "current-lsb", ¤t_lsb);
> + if (ret < 0 || !current_lsb) {
> + dev_err(&client->dev, "Unable to read current_lsb or value is 0, default value %d uA/bit is used.\n",
> + INA233_CURRENT_LSB_DEFAULT);
Same problem
> + current_lsb = INA233_CURRENT_LSB_DEFAULT;
> + }
> +
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-01-06 10:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 7:13 [PATCH 0/2] hwmon: Add support for INA233 Leo Yang
2025-01-06 7:13 ` [PATCH 1/2] dt-bindings: Add INA233 device Leo Yang
2025-01-06 10:50 ` Krzysztof Kozlowski
2025-01-06 15:06 ` Guenter Roeck
2025-01-06 14:56 ` Rob Herring (Arm)
2025-01-06 7:13 ` [PATCH 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor Leo Yang
2025-01-06 9:45 ` kernel test robot
2025-01-06 10:52 ` Krzysztof Kozlowski [this message]
2025-01-06 15:31 ` Guenter Roeck
2025-01-09 0:50 ` Leo Yang
2025-01-09 3:04 ` Guenter Roeck
2025-01-07 17:08 ` kernel test robot
2025-01-09 10:15 ` kernel test robot
2025-01-09 14:59 ` 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=428c034c-79a2-4753-9af8-4dc5af7d310f@kernel.org \
--to=krzk@kernel.org \
--cc=Delphine_CC_Chiu@Wiwynn.com \
--cc=Leo-Yang@quantatw.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=leo.yang.sy0@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--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