From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.130.44.152 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796114470; b=m3HAqgxNcd3iX3/IC72ysG12QiS5hX/HKs/rFpmTdsiyaBjwYJhX6XBP+gU8yanzvVoe w1qqKhkJ5hh/9F0FHuF1361t36nYJXaIOn1ImsytxKNyqg+OMR/TmZBhaiVyTieEhUkwt G4P7t/Fnd9a4WNeiswZ2E2je5wHwXI/FweeNn/4mV7NwVlZntSRem6b3WEkC7be6ipEO7 nB4ZgV6K1eYfHJmpdxgDwgO8wp+FHnOfE70HXdggflRtv/h/5n5H5jmn+qQ/kkOfeI310 6SxDEfhVOWAgDt8lEBljlDykt/u46Ne01QPE5yVYMWUcx/GMi3LOzgFBfqZ5d/JutBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796114470; h=DMARC-Filter:X-MailGates:DKIM-Signature:Received:Received:Received: Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=cvgaton33FaIfF53lkIs5P/EszgS1VTVZpkr+7NyGrc=; b=iaWPAZZl5s67FtwRa4RisjVzlduoTPZTwmgQRDKyhdrAwibRMUy5X+iz27QtBfAWY2u1 Fdiqi7PKmNBzEJdvuinkXxAJcmoWdDqijC7NZGQB4noEZMtPcyO95HAN5l4qIPdWEGXXT K7dL3KMjSAALE8NPkf9aAIGHFDqOTPT6syIgQ4VobSG3+lh1+F2kS30B1zwiHVom+4NF+ NcgXVsUtdXOcHxI7dX+NEGSAbUJIhq89f4rBvwH6dK5GUoeXPNGAKuYXbVtwu4ttUsEgj Khzcr1B4nXc2t+xOYhRdNT0szHddg5hfOvAkv7u1yEu2dv2sqGQGrI8e6r4f/Cz1O5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=richtek.com; spf=pass smtp.mailfrom=richtek.com; dkim=pass header.d=richtek.com header.i=@richtek.com header.a=rsa-sha256 header.s=richtek header.b=g7sx6+ui; arc=none smtp.remote-ip=220.130.44.152 Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAE02606A320; Tue, 1 Dec 2026 08:41:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BAE02606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=richtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=richtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=richtek.com header.i=@richtek.com header.a=rsa-sha256 header.s=richtek header.b=g7sx6+ui X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=richtek.com; s=richtek; t=1796114461; bh=cvgaton33FaIfF53lkIs5P/EszgS1VTVZpkr+7NyGrc=; l=3246; h=Date:From:To:Subject:Message-ID:MIME-Version; b=g7sx6+uitFuCEDctgndZh+bfLuPHGCGReUKFMWUQvY5snj+VTBue8cS2522ZCutP7 7KRX11n0+uEpknABZx3DVWuSNkZPqyDiVTwPl6ckpKC/r97xaWkAvT2mkHwhlHws3B 5SY3NffYrpQ+Osh2AHIvtrn26nrILTBiqINp7KIc7iBeRNnoj/N2m05KUuQKLfI6Kq 3YhU/QqesT1Rw7MHk1as9ezMyaX4nWlboeQ0YrX1cfT+l33NCidQQX0a2ijEwnzQpE u4TtjbrtT6N8yJkoxAXYPWA6jSEGQ0YrVPF3nohc0OuX0+5jGQeGGeJFUZ4sM1ErgM 5AhdPWSUoPhww== Received: from 192.168.10.46 by mg.richtek.com with MailGates ESMTPS Server V6.0(2325288:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Tue, 01 Dec 2026 16:40:38 +0800 (CST) Received: from ex6.rt.l (192.168.10.47) by ex5.rt.l (192.168.10.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.53; Tue, 1 Dec 2026 16:40:22 +0800 Received: from git-send.richtek.com (192.168.10.154) by ex6.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.2562.53 via Frontend Transport; Tue, 1 Dec 2026 16:40:22 +0800 Date: Tue, 1 Dec 2026 16:40:22 +0800 From: ChiYuan Huang To: Guenter Roeck CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , "Shuah Khan" , Randy Dunlap , Alexis Czezar Torreno , Sanman Pradhan , Ashish Yadav , "Matti Vaittinen" , Colin Huang , Vincent Jardin , Nuno =?iso-8859-1?Q?S=E1?= , Abdurrahman Hussain , "Ziming Zhu" , Carlos Jones Jr , Wensheng Wang , Charles Hsu , Brian Chiang , , , , , , Subject: Re: [PATCH v2 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B Message-ID: References: <9fb5fb44c4b9e38986ef2fb29d09672b130fe313.1796086906.git.cy_huang@richtek.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: On Mon, Nov 30, 2026 at 10:45:04PM -0800, Guenter Roeck wrote: > Hi, > > On 11/30/26 17:11, cy_huang@richtek.com wrote: > > From: ChiYuan Huang > > [...] > > +static int rtq2886b_read_word_data(struct i2c_client *i2c, int page, int phase, int reg) > > +{ > > + switch (reg) { > > + case PMBUS_MFR_VOUT_MIN: > > + return pmbus_read_word_data(i2c, page, phase, RTQ2886B_PMBUS_VOUT_MIN); > > Is this the configured minimum output voltage, or the rated minimum > output voltage ? Normally 0x2b would be the _configured_ minimum > output voltage, and reporting it as rated minimum output voltage would > be wrong. > For RTQ2886B, PMBUS_MFR_VOUT_MIN/MAX are not implemented. The device provides the minimum and maximum supported output voltage capability through command 0x2b and PMBUS_VOUT_MAX respectively. Both values are fixed device capabilities and are not board-specific configurable limits. The driver maps those values to PMBUS_MFR_VOUT_MIN/MAX so that the rated voltage range can be exposed through the standard hwmon attributes. I'll add comments in the code to clarify this behavior. > > + case PMBUS_MFR_VOUT_MAX: > > + return pmbus_read_word_data(i2c, page, phase, PMBUS_VOUT_MAX); > > PMBUS_MFR_VOUT_MAX is supposed to report the _rated_ maximum output > voltage for a chip. PMBUS_VOUT_MAX is a configurable value that limits > the output voltage that can be set on a given board. Both may be the > same for a chip, but usually that is not the case. The datasheet > is not public, so I can not know what is correct here. If the chip > reports the _rated_ maximum output voltage (read-only) with > PMBUS_VOUT_MAX, the code is ok, but this would require a comment. > Like as the last comment. > > + default: > > + return -ENODATA; > > + } > > +} > > + [...] > > +static int rtq2886b_probe(struct i2c_client *i2c) > > +{ > > + int ret; > > + > > + /* The device requires SMBus PEC for PMBus transactions. */ > > + i2c->flags |= I2C_CLIENT_PEC; > > + > > If this is mandatory, something like > > if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_PEC)) > return -ENODEV; > > is needed above. If it is not mandatory, the PMBus core sets the flag > automatically if supported by the I2C/SMBus controller, and the code above > is not needed. > > It seems likely that it is not mandatory, because pmbus_init_common() > clears the flag before reading PMBUS_CAPABILITY, and does not re-enable > it if reading PMBUS_CAPABILITY (without it) fails. Of course, it might > be that it is only mandatory for I2C writes, but if so that should be > explained with a comment. > > Sorry, but since the datasheet is not public (actually, the chip > does not even exist in public), you'll have to explain such details > in the driver. > The RTQ2886B powers up with PEC enabled by default. As a result, writes to PMBUS_ON_OFF_CONFIG are rejected if PEC is not enabled on the host side. Since the driver needs to switch the device from hardware-controlled mode to PMBus-controlled operation during probe, I2C_CLIENT_PEC is enabled before issuing that write. I'll update the code comment to clarify this requirement. > Thanks, > Guenter >