From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B33D3439019 for ; Tue, 3 Mar 2026 17:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772557361; cv=none; b=Kpp82hZA4cBmAVCWaT0230plVKOZhR7adUdeXldOtEEmA6FHjfvgr30WQPoNyaVFwU6GDOnIZuzBTYqpAG2+GEBiwe83Ud7QRbyxVFF8opdmoAx9SO+0ikJpqyQ4cBJE0TgUhTUdfputomzWobqZp5KikRyhK03aLvBqiYPEnJE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772557361; c=relaxed/simple; bh=c9sAb0xHLBh6N0aOPyj+zMqFuqKW7h4L7dRFz9K73uI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j5PeYzOC44m/8yI+C/YppnMqV60vQ7Hdt+qg3WFo9WGZLlth49sjEb22FOzllnuOjeTgUg6CcAheqlKbaY8VPk189c0f7KKPguSCPXWsmFrXQMNFB/FpZSy4lOknNJOxmyPwk1SDO6B0V5aHbmmqgqC00eROkAmVExv09wo1zPM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LbdT8ck9; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LbdT8ck9" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-827336c0994so3488588b3a.0 for ; Tue, 03 Mar 2026 09:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772557360; x=1773162160; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=eYkG6kBom6xkGiVWltyG7jkGst9QV8WXBklk6Zic4FM=; b=LbdT8ck9aBUrZ9jwBemE9oz0LYExrwiHlI14XKmagbO5eoJxgxYlts3CfXKPwafWp1 Oy60oFeC20js5/NdeAlTa+uiod/HJtCjFMbPUtoxruFf/0cVlj11S+ci3BOfvu/wz6aW K63I1Ho3QmDnYpJtIOJSYtSZVIEfIphMsoX2VbQBYqMlvws2T3K9NuGQNxntooT2OTjh qsi7OIGzRpsE52iK1zF30/PhsFz+NjgqiWR16BhsZ/qn/bayf5Jn/ItWYem2Qnct114/ TAMnCjfZEpadM0/i1ds/RqwIc8/oXNnschZ+gTUKHIE3iP6ZMnFVVNZIk4pETZLEz4PF X6jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772557360; x=1773162160; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=eYkG6kBom6xkGiVWltyG7jkGst9QV8WXBklk6Zic4FM=; b=lQqQUtKwGnVGawze5I5LsA87f/dPeCAwWH6lUJOuTmdUrPFI3/vEcyqliaRtZzvPuC 64Mpp8RYHjqWEtF4g6ge+9/Ya1Pac9ZOzunnQqNXnSOJpnI0sEfNv93hWEvuKgr15PRH D4HmbtkTpWNDLjB4v0Q5TLvHvtIykyF3XP9KxWxr+od34uRPOI2HL1obd54cbez8Bkin G0+luFvnmB59Mc8fuvfFM0/k/A28TxWkxbCja0tUw0WEUWzmLrTJoPw2w3rIjQDKd1dR Cked2WHZB4m0qBo88MT862rZUAzpgv5o6qOjO8OInNMUC2lAAnzvWICxWsBNS0+7Jt9J 6+jA== X-Forwarded-Encrypted: i=1; AJvYcCXwkY1EHEAftgRTZm8JzeoHfOk3nhNRFVCyw8sFhO4B1uqNFUZQb6NYUAbHBkMcTnatzQT34giRJCx1Wjg=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+FY6qqEE+VNAnMDXJnHVhP5+IfOxvQ48TmEpV0++/qfLL0x09 5cBiITk64fsEnaMXaYEeQxcgjIaQzbn1moRERpVKHVTFbklJ9bXMFymI X-Gm-Gg: ATEYQzxDXne1vqg5ez42qtEOoyeoYX5G+wcHdg0NVlyKA8Qb++UsjthQjeTS3y/lMWL XfFWgvqRHn+5VmhTuHRXVs1F5YFrDG5wTHEq1gd029g3+fuxtndCcg21+g7CBFdVuqn2Ky76efF oby3EmhZE/8SsYe+Re4XfNYrdKSkIwY+lymv/mLLpfJ+tn6Gbv8WVjCVwuURPxiLTz70WYTGkG5 fFOpyLK879CRIrPTEGzknS3kLdOKQfKe/Mh1PzSBHUlRoQG06fBMpyDfLXDlkEWrKsMgvGQftGJ zx9Ih+V8WOQBESVSXvidFM/D1Kha0CtPWhS4VtcwfbiLCHBDd692u3jHPK2Aa8pPlqy9cJjatbG Yz0cNsl4rfg0AZAvPW0cYloq3ZncecR8HdsFhgWkqP2jKq/MrQVSxQPb1R2RONDrvBWwnL+tlYU qagd42/ntIsSNyvL9FNggjE8gE26VLKh0mzu7S X-Received: by 2002:a05:6a21:3cca:b0:35d:cc9a:8bc1 with SMTP id adf61e73a8af0-39814456fd1mr2347413637.27.1772557359838; Tue, 03 Mar 2026 09:02:39 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c70fa848471sm14541102a12.30.2026.03.03.09.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 09:02:39 -0800 (PST) Sender: Guenter Roeck Date: Tue, 3 Mar 2026 09:02:38 -0800 From: Guenter Roeck To: Jonas Rebmann Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] hwmon: (ina2xx) Shift INA234 shunt and current registers Message-ID: <245e095d-d357-4fb7-b202-4b63e5cfbee6@roeck-us.net> References: <20260303-ina234-shift-v1-0-318c33ac4480@pengutronix.de> <20260303-ina234-shift-v1-2-318c33ac4480@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260303-ina234-shift-v1-2-318c33ac4480@pengutronix.de> On Tue, Mar 03, 2026 at 12:07:02PM +0100, Jonas Rebmann wrote: > The INA219 has the lowest three bits of the bus voltage register > zero-reserved, 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 shunt_div instead of a separate > field specifying a bit shift. > > This is possible because shunt voltage and current are divided by > shunt_div, hence a 16x higher shunt_div results in a 16x smaller LSB for > both the shunt voltage and the current register, perfectly accounting > for the missing bit shift. > > For consistency and correctness, account for the reserved bits via > shunt_voltage_shift and current_shift configuration fields as already > done for voltage registers and use the conversion constants given in the > INA234 datasheet. > > Signed-off-by: Jonas Rebmann Applied. Thanks, Guenter