mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jonas Rebmann <jre@pengutronix.de>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ian Ray <ian.ray@gehealthcare.com>
Subject: Re: [PATCH] (ina2xx) Drop bus_voltage_shift configuration
Date: Mon, 2 Mar 2026 13:04:41 -0800	[thread overview]
Message-ID: <c3fc43bb-9a4b-4b1c-aabe-5fee0302518b@roeck-us.net> (raw)
In-Reply-To: <b55cb982-6431-4db7-84d1-d64145bf4a66@pengutronix.de>

On 3/2/26 08:02, Jonas Rebmann wrote:
> Hi Guenter,
> 
> On 2026-03-02 16:50, Guenter Roeck wrote:
>> Hi,
>>
>> On 3/2/26 07:26, Jonas Rebmann wrote:
>>> The INA219 has the lowest three bits of the bus voltage register
>>> zero-reserved and the bus_voltage_shift ina2xx_config field was
>>> introduced to accommodate for that.
>>>
>>> The INA234 has four bits of the bus voltage, of the shunt voltage, and
>>> of the current registers zero-reserved but the latter two were
>>> implemented by choosing a 16x higher conversion constant instead of a
>>> separate field specifying a bit shift.
>>>
>>> For consistency and simplicity, drop bus_voltage_shift and adapt the
>>> conversion constants for INA219 and INA234 accordingly, yielding the
>>> same measurement values.
>>>
>>
>> This isn't about simplicity, it is about correctness.
>>
>> The datasheet for INA234 says for the lower 4 bits:
>>
>>       Always returns 0. Remove these bits from the full result by doing a
>>       right arithmetic shift
>>
>> which is what we should do for all chips with reserved bits instead of
>> assuming that the reserved bits always return 0.
> 
> It says that for the reserved-zero bits at the lower end of the shunt
> voltage and current registers of INA234 as well as for the bus voltage
> register.
> 
> If bus_voltage_shift is kept, wouldn't a shunt_voltage_shift and
> current_shift need to be introduced to support those registers of the
> INA234 with the same notion of correctness?
> 

shunt_voltage_shift, yes, but the current register is not used,
so a current_shift would be unnecessary.

Thanks,
Guenter


      reply	other threads:[~2026-03-02 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 15:26 Jonas Rebmann
2026-03-02 15:50 ` Guenter Roeck
2026-03-02 16:02   ` Jonas Rebmann
2026-03-02 21:04     ` Guenter Roeck [this message]

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=c3fc43bb-9a4b-4b1c-aabe-5fee0302518b@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=ian.ray@gehealthcare.com \
    --cc=jre@pengutronix.de \
    --cc=linux-hwmon@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

all inboxes | Powered by JetHome®