From nobody Wed Dec 17 08:54:46 2025 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CF9B1EDA3D; Thu, 20 Mar 2025 03:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742443001; cv=none; b=R/EiOk2yqZkc+ez0CHLMs1rKhv2HLC4WcUOPh8by6YUb/hNKBwjHIY9S8+sPsvhaZUx5dxHbuVhNc+9c5as3IIyExGdzzbn45ijUsmr6bgFgFF5mGqN0Fr5+BWxt35bPsf8iw4Uf034pz9lZ9Ht4iJ2HLTqDJ/UxLGpIAqFNpFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742443001; c=relaxed/simple; bh=fmCT0v90oyzA0aTZ1Tgr9IqU4H0CNGKyD8bu5XayWpA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=FS602a4Ajw7dFQwzZHsG67pt0w8Dl458gOatMxG+j7hRY3Hw00WyNrs1oYXYyijmLufxy9vC39LHBQ1UuKGrTdhxZloyHoEX5dXFBVNYj6Xq+MX1DIYs4HgNpACm5vNpnCvdKMiDHTObk2lMP4mqT1cuPVi7EcceNhI6Ja8w7Ok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=NITwdWqf; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="NITwdWqf" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52K3Y40E024288; Wed, 19 Mar 2025 23:56:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=DVJBb wTtnbTkbd8lrroOGNiPdsk7fe9QMtgaYRzi35I=; b=NITwdWqfZXX3aWw9FvRO3 MceJMS7K751kxkOHK6p6dg2lMxH2B8j8mn0jODIitfYEJRebK+IIlfW+Jg9UPmq6 mnCz8AzS+mhCJFLs1M5zzGqLkfKTnXmYwC+qA4nA7AFGcGSKN3K/TYsicY/+lBkJ J1b7eXjXxWC+VsGNSae6j552nKedtqBkJQiO2R+llIxfFUbv4XhEahnctSXkOYmh C5muqhqkbfUbbGCapJie4aoJYo4dcZFJ/0tQ2POUaXxCxMbAF9GzaN3J4Ifz66Xp LS3Yuh/INN/yQhau4lda1NxorL2QsQ+3Dmu1Frv9vZW0kIaJ8fuaA+7dlTDyLf+F A== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 45gb7sr2kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Mar 2025 23:56:19 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 52K3uIMW044216 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Mar 2025 23:56:18 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 19 Mar 2025 23:56:18 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 19 Mar 2025 23:56:18 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Wed, 19 Mar 2025 23:56:18 -0400 Received: from ATORRENO-L02.ad.analog.com (ATORRENO-L02.ad.analog.com [10.117.223.3]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52K3tvie030363; Wed, 19 Mar 2025 23:56:08 -0400 From: Alexis Czezar Torreno Date: Thu, 20 Mar 2025 11:55:47 +0800 Subject: [PATCH 1/2] hwmon: (pmbus/max34440): Fix support for max34451 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250320-dev_adpm12160-v1-1-8f7b975eac75@analog.com> References: <20250320-dev_adpm12160-v1-0-8f7b975eac75@analog.com> In-Reply-To: <20250320-dev_adpm12160-v1-0-8f7b975eac75@analog.com> To: Jean Delvare , Guenter Roeck , Jonathan Corbet , Delphine CC Chiu CC: , , , , "Alexis Czezar Torreno" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742442957; l=8613; i=alexisczezar.torreno@analog.com; s=20250213; h=from:subject:message-id; bh=fmCT0v90oyzA0aTZ1Tgr9IqU4H0CNGKyD8bu5XayWpA=; b=UzP9X2aAwDs+RMAFYkUYqNjqAtLWSGkNE0+EK97Z/A0DEfJyk0wwajXYpD8yAxxPSMnfoozBl iXojP7H8Z67A4OcXrvyynDj+XCPz7mKdHI6dFwkgzK78JmxVhJUiGcp X-Developer-Key: i=alexisczezar.torreno@analog.com; a=ed25519; pk=XpXmJnRjnsKdDil6YpOlj9+44S+XYXVFnxvkbmaZ+10= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=SuiQ6OO0 c=1 sm=1 tr=0 ts=67db91e4 cx=c_pps a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=pZbETZ21HzVX83SInWEA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: dtXnBP5vau4yLjNSqgCTIX1q3RDjDIuN X-Proofpoint-ORIG-GUID: dtXnBP5vau4yLjNSqgCTIX1q3RDjDIuN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-20_01,2025-03-19_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 adultscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 clxscore=1011 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503200023 The max344** family has an issue with some PMBUS address being switched. This includes max34451 however version MAX34451-NA6 and later has this issue fixed and this commit supports that update. Signed-off-by: Alexis Czezar Torreno --- Documentation/hwmon/max34440.rst | 8 ++- drivers/hwmon/pmbus/max34440.c | 102 ++++++++++++++++++++++++++---------= ---- 2 files changed, 74 insertions(+), 36 deletions(-) diff --git a/Documentation/hwmon/max34440.rst b/Documentation/hwmon/max3444= 0.rst index 162d289f08140341e8e76ab7033834ba07a8b935..b1f3f75091bb8e233e766c24913= 194dd62b0cd90 100644 --- a/Documentation/hwmon/max34440.rst +++ b/Documentation/hwmon/max34440.rst @@ -35,7 +35,7 @@ Supported chips: =20 PMBus 16-Channel V/I Monitor and 12-Channel Sequencer/Marginer =20 - Prefixes: 'max34451' + Prefixes: 'max34451', 'max34451_na6' =20 Addresses scanned: - =20 @@ -93,6 +93,10 @@ attribute is set to a positive value. Power measurement = is only enabled if channel 1 (3) is configured for voltage measurement, and channel 2 (4) is configured for current measurement. =20 +For MAX34451, version MAX34451ETNA6+ and later are denoted with prefix +'max34451_na6'. The previous versions contains some errors on the PMBUS +addresses and these are fixed on the later versions. + =20 Platform data support --------------------- @@ -192,4 +196,4 @@ temp[1-8]_reset_history Write any value to reset histor= y. - MAX34451 supports attribute groups in[1-16] (or curr[1-16] based on input pins) and temp[1-5]. - MAX34460 supports attribute groups in[1-12] and temp[1-5]. - - MAX34461 supports attribute groups in[1-16] and temp[1-5]. + - MAX34461 supports attribute groups in[1-16] and temp[1-5]. \ No newline at end of file diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c index c9dda33831ff24e7b5e2fd1956a65e6bd2bfcbb9..d483c01f256c96f048c9da5981f= 10f52402d981c 100644 --- a/drivers/hwmon/pmbus/max34440.c +++ b/drivers/hwmon/pmbus/max34440.c @@ -14,7 +14,15 @@ #include #include "pmbus.h" =20 -enum chips { max34440, max34441, max34446, max34451, max34460, max34461 }; +enum chips { + max34440, + max34441, + max34446, + max34451, + max34451_na6, + max34460, + max34461, +}; =20 #define MAX34440_MFR_VOUT_PEAK 0xd4 #define MAX34440_MFR_IOUT_PEAK 0xd5 @@ -34,6 +42,7 @@ enum chips { max34440, max34441, max34446, max34451, max3= 4460, max34461 }; /* * The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT * swapped from the standard pmbus spec addresses. + * For max34451, version MAX34451ETNA6+ and later has this issue fixed. */ #define MAX34440_IOUT_OC_WARN_LIMIT 0x46 #define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A @@ -59,12 +68,20 @@ static int max34440_read_word_data(struct i2c_client *c= lient, int page, =20 switch (reg) { case PMBUS_IOUT_OC_FAULT_LIMIT: - ret =3D pmbus_read_word_data(client, page, phase, - MAX34440_IOUT_OC_FAULT_LIMIT); + if (data->id =3D=3D max34451_na6) + ret =3D pmbus_read_word_data(client, page, phase, + PMBUS_IOUT_OC_FAULT_LIMIT); + else + ret =3D pmbus_read_word_data(client, page, phase, + MAX34440_IOUT_OC_FAULT_LIMIT); break; case PMBUS_IOUT_OC_WARN_LIMIT: - ret =3D pmbus_read_word_data(client, page, phase, - MAX34440_IOUT_OC_WARN_LIMIT); + if (data->id =3D=3D max34451_na6) + ret =3D pmbus_read_word_data(client, page, phase, + PMBUS_IOUT_OC_WARN_LIMIT); + else + ret =3D pmbus_read_word_data(client, page, phase, + MAX34440_IOUT_OC_WARN_LIMIT); break; case PMBUS_VIRT_READ_VOUT_MIN: ret =3D pmbus_read_word_data(client, page, phase, @@ -75,7 +92,8 @@ static int max34440_read_word_data(struct i2c_client *cli= ent, int page, MAX34440_MFR_VOUT_PEAK); break; case PMBUS_VIRT_READ_IOUT_AVG: - if (data->id !=3D max34446 && data->id !=3D max34451) + if (data->id !=3D max34446 && data->id !=3D max34451 && + data->id !=3D max34451_na6) return -ENXIO; ret =3D pmbus_read_word_data(client, page, phase, MAX34446_MFR_IOUT_AVG); @@ -133,12 +151,20 @@ static int max34440_write_word_data(struct i2c_client= *client, int page, =20 switch (reg) { case PMBUS_IOUT_OC_FAULT_LIMIT: - ret =3D pmbus_write_word_data(client, page, MAX34440_IOUT_OC_FAULT_LIMIT, - word); + if (data->id =3D=3D max34451_na6) + ret =3D pmbus_write_word_data(client, page, PMBUS_IOUT_OC_FAULT_LIMIT, + word); + else + ret =3D pmbus_write_word_data(client, page, MAX34440_IOUT_OC_FAULT_LIMI= T, + word); break; case PMBUS_IOUT_OC_WARN_LIMIT: - ret =3D pmbus_write_word_data(client, page, MAX34440_IOUT_OC_WARN_LIMIT, - word); + if (data->id =3D=3D max34451_na6) + ret =3D pmbus_write_word_data(client, page, PMBUS_IOUT_OC_WARN_LIMIT, + word); + else + ret =3D pmbus_write_word_data(client, page, MAX34440_IOUT_OC_WARN_LIMIT, + word); break; case PMBUS_VIRT_RESET_POUT_HISTORY: ret =3D pmbus_write_word_data(client, page, @@ -159,7 +185,8 @@ static int max34440_write_word_data(struct i2c_client *= client, int page, case PMBUS_VIRT_RESET_IOUT_HISTORY: ret =3D pmbus_write_word_data(client, page, MAX34440_MFR_IOUT_PEAK, 0); - if (!ret && (data->id =3D=3D max34446 || data->id =3D=3D max34451)) + if (!ret && (data->id =3D=3D max34446 || data->id =3D=3D max34451 || + data->id =3D=3D max34451_na6)) ret =3D pmbus_write_word_data(client, page, MAX34446_MFR_IOUT_AVG, 0); =20 @@ -270,6 +297,29 @@ static int max34451_set_supported_funcs(struct i2c_cli= ent *client, return 0; } =20 +#define MAX34451_COMMON_INFO \ + .pages =3D 21, \ + .format[PSC_VOLTAGE_OUT] =3D direct, \ + .format[PSC_TEMPERATURE] =3D direct, \ + .format[PSC_CURRENT_OUT] =3D direct, \ + .m[PSC_VOLTAGE_OUT] =3D 1, \ + .b[PSC_VOLTAGE_OUT] =3D 0, \ + .R[PSC_VOLTAGE_OUT] =3D 3, \ + .m[PSC_CURRENT_OUT] =3D 1, \ + .b[PSC_CURRENT_OUT] =3D 0, \ + .R[PSC_CURRENT_OUT] =3D 2, \ + .m[PSC_TEMPERATURE] =3D 1, \ + .b[PSC_TEMPERATURE] =3D 0, \ + .R[PSC_TEMPERATURE] =3D 2, \ + /* func 0-15 is set dynamically before probing */ \ + .func[16] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[17] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[18] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[19] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .func[20] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, \ + .read_word_data =3D max34440_read_word_data, \ + .write_word_data =3D max34440_write_word_data, + static struct pmbus_driver_info max34440_info[] =3D { [max34440] =3D { .pages =3D 14, @@ -394,27 +444,10 @@ static struct pmbus_driver_info max34440_info[] =3D { .write_word_data =3D max34440_write_word_data, }, [max34451] =3D { - .pages =3D 21, - .format[PSC_VOLTAGE_OUT] =3D direct, - .format[PSC_TEMPERATURE] =3D direct, - .format[PSC_CURRENT_OUT] =3D direct, - .m[PSC_VOLTAGE_OUT] =3D 1, - .b[PSC_VOLTAGE_OUT] =3D 0, - .R[PSC_VOLTAGE_OUT] =3D 3, - .m[PSC_CURRENT_OUT] =3D 1, - .b[PSC_CURRENT_OUT] =3D 0, - .R[PSC_CURRENT_OUT] =3D 2, - .m[PSC_TEMPERATURE] =3D 1, - .b[PSC_TEMPERATURE] =3D 0, - .R[PSC_TEMPERATURE] =3D 2, - /* func 0-15 is set dynamically before probing */ - .func[16] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[17] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[18] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[19] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .func[20] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .read_word_data =3D max34440_read_word_data, - .write_word_data =3D max34440_write_word_data, + MAX34451_COMMON_INFO, + }, + [max34451_na6] =3D { + MAX34451_COMMON_INFO, }, [max34460] =3D { .pages =3D 18, @@ -495,7 +528,7 @@ static int max34440_probe(struct i2c_client *client) data->id =3D i2c_match_id(max34440_id, client)->driver_data; data->info =3D max34440_info[data->id]; =20 - if (data->id =3D=3D max34451) { + if (data->id =3D=3D max34451 || data->id =3D=3D max34451_na6) { rv =3D max34451_set_supported_funcs(client, data); if (rv) return rv; @@ -509,6 +542,7 @@ static const struct i2c_device_id max34440_id[] =3D { {"max34441", max34441}, {"max34446", max34446}, {"max34451", max34451}, + {"max34451_na6", max34451_na6}, {"max34460", max34460}, {"max34461", max34461}, {} @@ -529,4 +563,4 @@ module_i2c_driver(max34440_driver); MODULE_AUTHOR("Guenter Roeck"); MODULE_DESCRIPTION("PMBus driver for Maxim MAX34440/MAX34441"); MODULE_LICENSE("GPL"); -MODULE_IMPORT_NS("PMBUS"); +MODULE_IMPORT_NS(PMBUS); --=20 2.34.1 From nobody Wed Dec 17 08:54:46 2025 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DEFA1EDA3B; Thu, 20 Mar 2025 03:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742443001; cv=none; b=XvzgHzMgNJ4c3kFkT8VlU6jfyepXtgFkjRSwxvbL+vOlyY11rjkyTZ5YSWobL+B6MLNr7ZxQ1OHW7n8092+laXBKjUbXifWJkr54pB+6MPsL4hG1sW0yH+qer9YDvqBtvSvMSPB460rj250NiUpEod9oJNvBJmkm0iw3EcO4Atw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742443001; c=relaxed/simple; bh=CXV04TlxekKR/bTBoGcWZhfgq3TJzR9cfIhLGbDNdsg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nz7K6ELYSG6NWYL/CWFMNrQa41j7as/A/IKzqP5v04EVd70GwMHihtK3o6zkA3DlDIZdIEAtXwAnKCLSuK6UY/h/sinbzJbWVtg6b4kpdiA2Fm0iac74cSj4gpY6Cuhdfk6x2IhScv7DKN9VLoebBd+0Fd9q/Rg7mCAvV6iaS2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=rKZTisgn; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="rKZTisgn" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52K3Y40G024288; Wed, 19 Mar 2025 23:56:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=faItO toLkHyW2FMW/OhFXyD/aqnxepV8oYjEmgATTEU=; b=rKZTisgnnZvFizHRmMJ6C WgjS1jJlROJ0Z9TIDrs5k6/GlRHkDOtgLlStzqTY5cuT6+U2unKRc1BozF1O6CI9 Y56Bq5YU6TxfSJzCV2zn0qFNq0NlYyGMzeANYBm+6yz0AbmJ+zM82aCSyOZA6zIy xGdo0YKIa968UzQ8NTqCfUag2QIGP0L4adp3+CjVywAoOrt091jLzBca3ndzQt5I hcpq+66GQNHW0QSry/e/e9cmMXDrNsl3HDwEcEFvNekKP2VOf4/Xyu5JP7JtmA3y vvL/JVoJ/UOFUMZKIM5Tg2Ozijm3Hw1QPMROUG51a2q/44vccBtKbvqRU7OOwnFv g== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 45gb7sr2kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Mar 2025 23:56:24 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 52K3uLJA044224 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Mar 2025 23:56:21 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 19 Mar 2025 23:56:21 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 19 Mar 2025 23:56:21 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Wed, 19 Mar 2025 23:56:21 -0400 Received: from ATORRENO-L02.ad.analog.com (ATORRENO-L02.ad.analog.com [10.117.223.3]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 52K3tvif030363; Wed, 19 Mar 2025 23:56:12 -0400 From: Alexis Czezar Torreno Date: Thu, 20 Mar 2025 11:55:48 +0800 Subject: [PATCH 2/2] hwmon: (pmbus/max3440): add support adpm12160 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250320-dev_adpm12160-v1-2-8f7b975eac75@analog.com> References: <20250320-dev_adpm12160-v1-0-8f7b975eac75@analog.com> In-Reply-To: <20250320-dev_adpm12160-v1-0-8f7b975eac75@analog.com> To: Jean Delvare , Guenter Roeck , Jonathan Corbet , Delphine CC Chiu CC: , , , , "Alexis Czezar Torreno" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742442957; l=8633; i=alexisczezar.torreno@analog.com; s=20250213; h=from:subject:message-id; bh=CXV04TlxekKR/bTBoGcWZhfgq3TJzR9cfIhLGbDNdsg=; b=i7a31jhbqMoSNcbaTmgNwVCfqtubkD38YORHCvPXFPMv2cI9cBhusAlQB/oI6nOatX0k19EHV ZmUGLBKeiNbBfBvsgoD6cbi/TZxN2zr1GAebg+mppflNwOenPGZhUhy X-Developer-Key: i=alexisczezar.torreno@analog.com; a=ed25519; pk=XpXmJnRjnsKdDil6YpOlj9+44S+XYXVFnxvkbmaZ+10= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=SuiQ6OO0 c=1 sm=1 tr=0 ts=67db91e9 cx=c_pps a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=gAnH3GRIAAAA:8 a=_jlGtV7tAAAA:8 a=vkGcfZK4uBsIXNnpU_sA:9 a=QEXdDO2ut3YA:10 a=nlm17XC03S6CtCLSeiRr:22 X-Proofpoint-GUID: 6wkUh4D5ynwylyreFizCociTIzcC2IoP X-Proofpoint-ORIG-GUID: 6wkUh4D5ynwylyreFizCociTIzcC2IoP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-20_01,2025-03-19_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 adultscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 clxscore=1011 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503200023 ASPM12160 is a quarter brick DC/DC Power Module. It is a high power non-isolated converter capable of delivering a fully regulated 12V, with continuous power level of 1600W with peak power at 2400W for a limited time. Uses PMBus Configuration. Signed-off-by: Alexis Czezar Torreno --- Documentation/hwmon/max34440.rst | 31 +++++++++++++++++-------- drivers/hwmon/pmbus/Kconfig | 1 + drivers/hwmon/pmbus/max34440.c | 49 +++++++++++++++++++++++++++++++++++-= ---- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/Documentation/hwmon/max34440.rst b/Documentation/hwmon/max3444= 0.rst index b1f3f75091bb8e233e766c24913194dd62b0cd90..65522efa57563389fce54b51829= 964d62f970c27 100644 --- a/Documentation/hwmon/max34440.rst +++ b/Documentation/hwmon/max34440.rst @@ -3,6 +3,14 @@ Kernel driver max34440 =20 Supported chips: =20 + * ADI ADPM12160 + + Prefixes: 'adpm12160' + + Addresses scanned: - + + Datasheet: - + * Maxim MAX34440 =20 Prefixes: 'max34440' @@ -67,13 +75,14 @@ Author: Guenter Roeck Description ----------- =20 -This driver supports hardware monitoring for Maxim MAX34440 PMBus 6-Channel -Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply Manager -and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Data Logge= r. -It also supports the MAX34451, MAX34460, and MAX34461 PMBus Voltage Monito= r & -Sequencers. The MAX34451 supports monitoring voltage or current of 12 chan= nels -based on GIN pins. The MAX34460 supports 12 voltage channels, and the MAX3= 4461 -supports 16 voltage channels. +This driver supports multiple devices: hardware monitoring for Maxim MAX34= 440 +PMBus 6-Channel Power-Supply Manager, MAX34441 PMBus 5-Channel Power-Supply +Manager and Intelligent Fan Controller, and MAX34446 PMBus Power-Supply Da= ta +Logger; PMBus Voltage Monitor and Sequencers for MAX34451, MAX34460, and +MAX34461; PMBus DC/DC Power Module ADPM12160. The MAX34451 supports monito= ring +voltage or current of 12 channels based on GIN pins. The MAX34460 supports= 12 +voltage channels, and the MAX34461 supports 16 voltage channels. The ADPM1= 260 +also monitors both input and output of voltage and current. =20 The driver is a client driver to the core PMBus driver. Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers. @@ -97,7 +106,6 @@ For MAX34451, version MAX34451ETNA6+ and later are denot= ed with prefix 'max34451_na6'. The previous versions contains some errors on the PMBUS addresses and these are fixed on the later versions. =20 - Platform data support --------------------- =20 @@ -132,7 +140,10 @@ in[1-6]_highest Historical maximum voltage. in[1-6]_reset_history Write any value to reset history. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D =20 -.. note:: MAX34446 only supports in[1-4]. +.. note:: + + - MAX34446 only supports in[1-4]. + - ADPM12160 only supports in[1-2]. Label is "vin1" and "vout1" respect= ively. =20 Curr ~~~~ @@ -154,6 +165,7 @@ curr[1-6]_reset_history Write any value to reset histor= y. =20 - in6 and curr6 attributes only exist for MAX34440. - MAX34446 only supports curr[1-4]. + - For ADPM12160, curr[1] is "iin1" and curr[2-6] are "iout[1-5]. =20 Power ~~~~~ @@ -189,6 +201,7 @@ temp[1-8]_reset_history Write any value to reset histor= y. .. note:: - temp7 and temp8 attributes only exist for MAX34440. - MAX34446 only supports temp[1-3]. + - ADPM12160 only supports temp[1]. =20 =20 .. note:: diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index c9b3c314998234e639db1770c18c6f75fa037d25..b50bb6eceaa1419a928ff5b2153= 260738978f9a8 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -324,6 +324,7 @@ config SENSORS_MAX34440 help If you say yes here you get hardware monitoring support for Maxim MAX34440, MAX34441, MAX34446, MAX34451, MAX34460, and MAX34461. + Other compatible includes ADPM12160. =20 This driver can also be built as a module. If so, the module will be called max34440. diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c index d483c01f256c96f048c9da5981f10f52402d981c..48e459252391048c90f373b3b73= de6871392880c 100644 --- a/drivers/hwmon/pmbus/max34440.c +++ b/drivers/hwmon/pmbus/max34440.c @@ -15,6 +15,7 @@ #include "pmbus.h" =20 enum chips { + adpm12160, max34440, max34441, max34446, @@ -68,7 +69,7 @@ static int max34440_read_word_data(struct i2c_client *cli= ent, int page, =20 switch (reg) { case PMBUS_IOUT_OC_FAULT_LIMIT: - if (data->id =3D=3D max34451_na6) + if (data->id =3D=3D max34451_na6 || data->id =3D=3D adpm12160) ret =3D pmbus_read_word_data(client, page, phase, PMBUS_IOUT_OC_FAULT_LIMIT); else @@ -76,7 +77,7 @@ static int max34440_read_word_data(struct i2c_client *cli= ent, int page, MAX34440_IOUT_OC_FAULT_LIMIT); break; case PMBUS_IOUT_OC_WARN_LIMIT: - if (data->id =3D=3D max34451_na6) + if (data->id =3D=3D max34451_na6 || data->id =3D=3D adpm12160) ret =3D pmbus_read_word_data(client, page, phase, PMBUS_IOUT_OC_WARN_LIMIT); else @@ -93,7 +94,7 @@ static int max34440_read_word_data(struct i2c_client *cli= ent, int page, break; case PMBUS_VIRT_READ_IOUT_AVG: if (data->id !=3D max34446 && data->id !=3D max34451 && - data->id !=3D max34451_na6) + data->id !=3D max34451_na6 && data->id !=3D adpm12160)) return -ENXIO; ret =3D pmbus_read_word_data(client, page, phase, MAX34446_MFR_IOUT_AVG); @@ -151,7 +152,7 @@ static int max34440_write_word_data(struct i2c_client *= client, int page, =20 switch (reg) { case PMBUS_IOUT_OC_FAULT_LIMIT: - if (data->id =3D=3D max34451_na6) + if (data->id =3D=3D max34451_na6 || data->id =3D=3D adpm12160) ret =3D pmbus_write_word_data(client, page, PMBUS_IOUT_OC_FAULT_LIMIT, word); else @@ -159,7 +160,7 @@ static int max34440_write_word_data(struct i2c_client *= client, int page, word); break; case PMBUS_IOUT_OC_WARN_LIMIT: - if (data->id =3D=3D max34451_na6) + if (data->id =3D=3D max34451_na6 || data->id =3D=3D adpm12160) ret =3D pmbus_write_word_data(client, page, PMBUS_IOUT_OC_WARN_LIMIT, word); else @@ -186,7 +187,7 @@ static int max34440_write_word_data(struct i2c_client *= client, int page, ret =3D pmbus_write_word_data(client, page, MAX34440_MFR_IOUT_PEAK, 0); if (!ret && (data->id =3D=3D max34446 || data->id =3D=3D max34451 || - data->id =3D=3D max34451_na6)) + data->id =3D=3D max34451_na6 || data->id =3D=3D adpm12160)) ret =3D pmbus_write_word_data(client, page, MAX34446_MFR_IOUT_AVG, 0); =20 @@ -321,6 +322,41 @@ static int max34451_set_supported_funcs(struct i2c_cli= ent *client, .write_word_data =3D max34440_write_word_data, =20 static struct pmbus_driver_info max34440_info[] =3D { + [adpm12160] =3D { + .pages =3D 19, + .format[PSC_VOLTAGE_IN] =3D direct, + .format[PSC_VOLTAGE_OUT] =3D direct, + .format[PSC_CURRENT_IN] =3D direct, + .format[PSC_CURRENT_OUT] =3D direct, + .format[PSC_TEMPERATURE] =3D direct, + .m[PSC_VOLTAGE_IN] =3D 1, + .b[PSC_VOLTAGE_IN] =3D 0, + .R[PSC_VOLTAGE_IN] =3D 0, + .m[PSC_VOLTAGE_OUT] =3D 1, + .b[PSC_VOLTAGE_OUT] =3D 0, + .R[PSC_VOLTAGE_OUT] =3D 0, + .m[PSC_CURRENT_IN] =3D 1, + .b[PSC_CURRENT_IN] =3D 0, + .R[PSC_CURRENT_IN] =3D 2, + .m[PSC_CURRENT_OUT] =3D 1, + .b[PSC_CURRENT_OUT] =3D 0, + .R[PSC_CURRENT_OUT] =3D 2, + .m[PSC_TEMPERATURE] =3D 1, + .b[PSC_TEMPERATURE] =3D 0, + .R[PSC_TEMPERATURE] =3D 2, + /* absent func below [18] are not for monitoring */ + .func[2] =3D PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, + .func[4] =3D PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[5] =3D PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[6] =3D PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[7] =3D PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[8] =3D PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, + .func[9] =3D PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT, + .func[10] =3D PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT, + .func[18] =3D PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, + .read_word_data =3D max34440_read_word_data, + .write_word_data =3D max34440_write_word_data, + }, [max34440] =3D { .pages =3D 14, .format[PSC_VOLTAGE_IN] =3D direct, @@ -538,6 +574,7 @@ static int max34440_probe(struct i2c_client *client) } =20 static const struct i2c_device_id max34440_id[] =3D { + {"adpm12160", adpm12160}, {"max34440", max34440}, {"max34441", max34441}, {"max34446", max34446}, --=20 2.34.1