Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2809932lqo; Tue, 14 May 2024 09:44:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfSfUZpSS2y7h9uqPS3Vfklaz7vlqLdKnk5deDYh2KDRPgQOG/6wkJUwGZavKHnTZl2RIK0MYpFU1pcfp0HnJSMxewXRH1WJgAVdFbYw== X-Google-Smtp-Source: AGHT+IEQc/PfpJwzcXekq/MKxNyfe/c5XhUaPUCZ/dMq73owK97LJqrxUI5JzhtcFCUtj5OW4JZW X-Received: by 2002:a05:6871:215:b0:229:929a:b127 with SMTP id 586e51a60fabf-24172bdf8bamr17218841fac.37.1715705068115; Tue, 14 May 2024 09:44:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715705068; cv=pass; d=google.com; s=arc-20160816; b=Jz7m2DCXsuwmmlHxh54nr5C99DEOyOHKgy5YT4TBDTGBEQ452mk65KixQOYprO6TU4 +7LV8aXOIeQnQ7LgFaPFlZKPO1q9lZBL9kDF83wkMBcB3PuIZ67T4EOl/mFxg1vKBJVK RP6xt2yHM4t9v2EQjIKF+gOolJ95H1P7ZzjmIvVwE8iBZ1sBspTC0p2+GtgRHuDKcCEh VQFnfrbb2CIhFIKgchnQJ4PT+FpHkChUxOtSiosI9+tjR3l0t6lNF8jbdg7fcwdrVcJb 7ZZ28RHHwy8nIgZm5QBEDQSSvU6MB8lB9D7a/aGhR/nhv5FJJaKqi+jheAw3cR4M49Lu uVNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=Ybj1VVny4pX1Hop1gzKlQUO6BxWECSsxknSFeM7x8Fk=; fh=RxRpMf5huMtij1huTBX4nSass0gV1Y0EhGC+TKTQRSA=; b=0ylJMeZ41JP1rEHl7mFtO0AqSCL+QIo8m7y0dX2tc2K5DGukEoQVnG04SkjY/Bfg1R TcADJ9panndROPPp81m0ltlarXYQt7Xo0iihOc0JRcCQRzmNpHJRstESo0G5rx/AuSLm wo3ljbOzfOQVWkUSm6c7Ls4qHDzjuO0ya0xa5GMCt4AQgavzKKE/1CtQ9TZyfuuNQkKL iEOLmrzn5RHmUDnB4DPN9WJVKwUlK735+DfvNTHtAqgwGXahXKK4gv49OutKb2sglE3L IEHe8SyGC23uWQ+2W+BotsoKH3Anp3Sj2zfrUxwAQiTp0kf9wsZkUE4vwlSHioKVf2T7 n2YQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hkpc2g2X; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178962-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-63409e824f0si11150031a12.111.2024.05.14.09.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 09:44:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Hkpc2g2X; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-178962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178962-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 63F42B20E91 for ; Tue, 14 May 2024 16:44:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F66517EBBD; Tue, 14 May 2024 16:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hkpc2g2X" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 9C22D2AF09; Tue, 14 May 2024 16:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715705052; cv=none; b=j2YPetC8/z4s8Kr1w1vurpYFCzkla9aePEcY63ImCkirMB4vTcW4MgAnHxY6kmYAw0ZHSZ9InrOjff3yURYma6GFbuPgPuz+SrarFkHF4VivZKNaS/3aERKwnaAqJ5GgMWnVdUBEO6g5mrxDyD6h+MT3zCTag2w/Q5YkJl5uE+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715705052; c=relaxed/simple; bh=TF6OcNMMClZDu0+KfMH2AcPi5DjWoWCLW6YTjXSjd6M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ZN+q0wkp+rnJ3qtZM2FgIc96EVvSPN2YcOs6fN20vc1o6iFBnAlQFDykqZip7nwD/pcD0YVcg6wrRUzQgIGK1Aj/e/E9pXx+tMaaHnHsS5/8o6v+PWkIj7rUkXNOMAhk0ITwQ7M2ZGFFgczuKl7F9rUl7UZfaGic8ailhA0ay8I= 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=Hkpc2g2X; arc=none smtp.client-ip=209.85.214.178 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 Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ee5235f5c9so45048765ad.2; Tue, 14 May 2024 09:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715705049; x=1716309849; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=Ybj1VVny4pX1Hop1gzKlQUO6BxWECSsxknSFeM7x8Fk=; b=Hkpc2g2XcZD+nS42lVWQNHgnAtupZ9trRsK+dN1kM2xEBROpNPjEo/IB4PL84W8Hs8 Acq6GbunUovX5mKfoGTi6rOFSk5nKPKm2+t/49/UP9KzAMVxwmBGFnMAsmujdYJnkOOq Taz5apSgH6eVyFXJIZpQPR2T8Ww1jL+aGPwfR56TQJm+LDk/IsPow7QpwXjNmCHh4NeM CF1ocxx/5UuZYk5e8oj3Zl/EnfUiNKEdwdVj4U5iAaPMaOAzt7eKtJ92uOZagkcGoRd3 ZRfbrS8snAQ+omP6TWZJJf6/ArZm6puNJKMhKHjWu8jh8aiv+4L/PV8r0wAx8YW7cMiM 1UHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715705049; x=1716309849; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Ybj1VVny4pX1Hop1gzKlQUO6BxWECSsxknSFeM7x8Fk=; b=dQb28QpPJPoKG+BOCEkaJbb2lJMPLcf/COU5yDkBnfwfFxB9Xp5LLcLVny+aka3IRO c2FqsYTsyyv2hoVZfza5S7woLQLunrtAR04jS7DWg6KqbEQUYwbv0RUOAzgbRp1cbYFi qi/ZFf7AEyOS9QRy2Obq2d27Hyj0KGhANyKqGy1OgzQai1cHYzzASlRSF9gCimX50RhG eFVmbg1UlYSslyVj/9IQ2BIpbyyFMH7YShLzGikR6/45aeL3FK8XA9hoChfrcLBbUIAM T2sHLbY6DkhzumljvevYWiNpYB8b6oW+evFX5EC67uYkdQFKksQ3FKG0/MEPH/s/+o6u aoGg== X-Forwarded-Encrypted: i=1; AJvYcCUFJjdyHP7lCc8N0/7ktEBNZpwvex/ULNNF5RuEhl0E1RvyOKfg897o9/I1dRmWeGp6lV8fGMFv8G0Bujp+XZFTnniQRNtcu3NTexhMXJKetmft8WEOTpSruQUVdHsaLch4JEzpW847HTc= X-Gm-Message-State: AOJu0YyFvC1iOfz8iGsNQ5H4QK3hZoVwTDIWMe4joOD3+xyJbVu2nGcZ 5cSgo/CTMmoJOrC7mrY8xQne/tyoh7aPydsmoQPMORKaqhLoGBdUh8PVjA== X-Received: by 2002:a17:903:228f:b0:1eb:152a:5a6e with SMTP id d9443c01a7336-1ef43c0c9b5mr178366915ad.3.1715705048765; Tue, 14 May 2024 09:44:08 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0badcae8sm99628805ad.103.2024.05.14.09.44.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 May 2024 09:44:07 -0700 (PDT) Sender: Guenter Roeck Message-ID: <183b8b2a-625e-495d-a443-c57e68ae758f@roeck-us.net> Date: Tue, 14 May 2024 09:44:06 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] hwmon: Add support for ina233 To: Delphine CC Chiu , patrick@stwcx.xyz Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240514092242.2739662-1-Delphine_CC_Chiu@wiwynn.com> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY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C8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <20240514092242.2739662-1-Delphine_CC_Chiu@wiwynn.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/14/24 02:22, Delphine CC Chiu wrote: > Support ina233 with vshunt > > Signed-off-by: Delphine CC Chiu > --- I don't understand what you are doing here. The patch introducing ina233 support was not accepted, still waiting for you to apply the changes I asked for. This is v2, which doesn't really add support for ina233 but adds a non-standard attribute on top of the not accepted patch. As for reporting the shunt voltage, I don't mind, but it should be reported as standard attribute. The pmbus core supports reporting a "VMON" voltage (PMBUS_VIRT_READ_VMON) which you should use. I am not going to accept a non-standard attribute to report a voltage. Thanks, Guenter > drivers/hwmon/pmbus/ina233.c | 37 +++++++++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/pmbus/ina233.c b/drivers/hwmon/pmbus/ina233.c > index d5c7d7408ac3..33736e5049a9 100644 > --- a/drivers/hwmon/pmbus/ina233.c > +++ b/drivers/hwmon/pmbus/ina233.c > @@ -11,9 +11,43 @@ > #include > #include > #include > +#include > #include "pmbus.h" > > #define MFR_CALIBRATION 0xd4 > +#define MFR_READ_VSHUNT 0xd1 > + > +#define HIGHEST_BIT 15 > + > +static ssize_t ina233_vshunt_show(struct device *dev, > + struct device_attribute *devattr, char *buf) > +{ > + int shunt_volt; > + struct i2c_client *client = to_i2c_client(dev->parent); > + > + shunt_volt = i2c_smbus_read_word_data(client, MFR_READ_VSHUNT); > + if (shunt_volt < 0) > + return shunt_volt; > + > + // Is negative > + if (shunt_volt & (1 << HIGHEST_BIT)) > + shunt_volt = ~(shunt_volt & ~(1 << HIGHEST_BIT)) + 1; > + > + // This unit is mV. > + // LSB 2.5 μV is reference from spec 7.6.3.2 MFR_READ_VSHUNT > + int val = DIV_ROUND_UP(shunt_volt * 25, 10000); > + > + return sysfs_emit(buf, "%d\n", val); > +} > + > +static SENSOR_DEVICE_ATTR_RO(vshunt, ina233_vshunt, 1); > + > +static struct attribute *ina233_attrs[] = { > + &sensor_dev_attr_vshunt.dev_attr.attr, > + NULL, > +}; > + > +ATTRIBUTE_GROUPS(ina233); > > struct pmbus_driver_info ina233_info = { > .pages = 1, > @@ -29,6 +63,7 @@ struct pmbus_driver_info ina233_info = { > .m[PSC_VOLTAGE_OUT] = 8, > .R[PSC_VOLTAGE_IN] = 2, > .R[PSC_VOLTAGE_OUT] = 2, > + .groups = ina233_groups, > }; > > static int ina233_probe(struct i2c_client *client) > @@ -82,7 +117,7 @@ static struct i2c_driver ina233_driver = { > > module_i2c_driver(ina233_driver); > > -MODULE_AUTHOR("Eli Huang "); > +MODULE_AUTHOR("Delphine_CC_Chiu "); > MODULE_DESCRIPTION("PMBus driver for Texas Instruments INA233 and compatible chips"); > MODULE_LICENSE("GPL"); > MODULE_IMPORT_NS(PMBUS);