From nobody Fri Sep 5 18:18:45 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 36EF15477F; Sat, 10 May 2025 09:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868855; cv=none; b=Xk5GXROVbrnaLsLHEUQGAXUhOsb+YUFdH4WgbMzDkUOd2ffRgNm5dYmyaveH4wZvefO1IsRJGFy+9ynJ+GjkFPyczZt+zPy/eqSyOXp7IwXkXqxNbW09uc11b1z34BlHwUcqdPt0RaTmk0t2QLKBYfVZjbudquMqcOANGMkF4PM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868855; c=relaxed/simple; bh=YjSNZ9Mo40M8YA63UVmxnhxy9W5jrVfUJVhs6MQwv8A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=higSvs19t4YEVLSTRkcJRLEe3z1+3nYN4t9qipfXxaDYF9e0l9gj5YxXWSwNvYAjkrSiRgV0UJoXg5pjjeHLK9quKngda7ypKWI24qOEXRAVC6aAAx3CCE/GGotGKmGRuofyKnkWu+WzIHMILRc7axSLoAsRw9okUqpb9Clcx7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BdWmfh7z; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="BdWmfh7z" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43ea40a6e98so28708605e9.1; Sat, 10 May 2025 02:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746868851; x=1747473651; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4lDvfRluNg5GEJWtSISMAA4AYOh8fmZr8HKCT3H4D/o=; b=BdWmfh7z8QtxYiCTruPY1cVbYQdqZz6/pugocYKRk5HTn0JRwp4GckENbLodWW7+5E mPrjt2o2h1mLse8fJMEacs+EugoJUk7VF/WW/5WXX/LCp0TtWM8PIzXIwlZ6g8cvVDSY 04qkx+IAO5Qg58lUiT8AMw/P3uL5A9wVnQq995ZuxBMXZAOpZiBCLXCqLxJQarOJTN79 CtA+i03e8+qlN8yQRL3DtylAaa+s6zYgN6rPHka4OxVc7yIyTNLs5ouFyZddzMkgEIv5 bWV4bcnL1EfCeXD39uWNIri0yRuufNkvmyS0h2lWuFz/f7cqUleZOQ34gzz7iNnujzn/ Oq4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746868851; x=1747473651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4lDvfRluNg5GEJWtSISMAA4AYOh8fmZr8HKCT3H4D/o=; b=ToIPpf3ASW9yTTqNdbD1lhiLhIibyF8WblS0UzK81ifmUnZ9X7luGFgOEnfUieHbYg 2LROU9yQ6EHZNDSvHf3QcEFuX7e542wUOjgHgqgCq1nEsyl+QiqDZQAMpWEoJfcHSWnD reUIewpZmvkpchWfYHaLk2MIfmFAvGwdun8tm9DpxOt3B2CuosaQrt/TQfrhzYRp636R JNPYXbWrjtoq5GPF6kmaoME/9nE1IQtOr6jCLX028WfYBo/OdM1YhWIWQHT6UES32GCI Mcn72pgqA1Se8E+kijLMQZGBdayi04r61PYbYPym8EdXmmZd7pLDakS662mqymVcv2OT CHfw== X-Forwarded-Encrypted: i=1; AJvYcCVwXJvhB9HAFpB7ImnhVlpcCc9M0qYyWA5AYRKSdsEWAA+VAodDBlT0wl77loBSp9Rj9fXek183Ix0o@vger.kernel.org, AJvYcCW/63BRNneFv8cOUuc+vjhKVNDonxsVVWGkRtP759r1cW0qfX3eADKkS3TglGSzLjvkxzFQfGTPd7RqIuTb@vger.kernel.org, AJvYcCXI5aUOC7btftDN6E353lsmp8F4XivHd2n0WsnqPo68gKfr18yyJCj9/tXbUvtalZpJPe99kp0axs4S@vger.kernel.org X-Gm-Message-State: AOJu0YwE15VieGKBpCPSY7KDxFav5oh3YNX5C4RHdVZut/vI3GghoPEe jK/lCKAg6NUQkUg9bgwrs4Dt2m0yGOeBDLMwrE78jKebBJMBzr7/lQtku6S6 X-Gm-Gg: ASbGncu7tU/Qqo6vbZGcOPfFHgIXD67bLBMhMeoKqoy7cCImSh0p9G+aM2TEB8TMQPI l72aW3bhWoN00dsexXZE/qwkxWdJu2bmmw6WxZP5ZjxhpHDMNtkuPxZ8/TL2JFYZ5MI9t5eR/rm IYAJ1xkXF6tEowJ5kuj9q3VKHyki8wc8/dVRfqe9pJoKIJQY7HvA4ztqvAajByBT7vaZYsNg0W3 GNsxOOL/AeY6MdHz9/MatEsUlvCm+x0m3qSXGooAlZS3NFFkJCDL8a/qX8vrYWVlO1NtgEwMA8F UOHcA1P2DJ0eyLEvMnepa3fxBLEM85dbsdKHs9RGwBWXURHyw7oh6PyHsH4OPyj1IGBPCLurC3K m X-Google-Smtp-Source: AGHT+IEHOIKmWCF6V/Banh9eNGsFoLvVIXIIcMHWiH30NteigxCPcpQuOf1X2LM69jEk10Ck5awMZQ== X-Received: by 2002:a05:600c:1c1e:b0:43d:fa59:af98 with SMTP id 5b1f17b1804b1-442d6de5140mr40168985e9.33.1746868850957; Sat, 10 May 2025 02:20:50 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687ae5asm55901985e9.36.2025.05.10.02.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 02:20:50 -0700 (PDT) From: Pawel Dembicki To: linux-hwmon@vger.kernel.org Cc: Pawel Dembicki , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Noah Wang , Naresh Solanki , Michal Simek , Fabio Estevam , Grant Peltier , Laurent Pinchart , Greg KH , Peter Zijlstra , Shen Lichuan , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Date: Sat, 10 May 2025 11:18:44 +0200 Message-ID: <20250510091937.2298256-2-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250510091937.2298256-1-paweldembicki@gmail.com> References: <20250510091937.2298256-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add device tree bindings for Monolithic Power Systems MPQ8785, MPM82504 and MPM3695 PMBus-compliant voltage regulators. These bindings also documents the optional "mps,vout-fb-divider-ratio-permille" property. --- v3: - added maximum and default value to 'mps,vout-fb-divider-ratio-permille' - add enum to compatible check - move 'required' to proper place v2: - remove mps,mpq8785 from trivial-devices.yaml - fix alphabetical order - rename voltage-scale-loop to mps,vout-fb-divider-ratio-permille - add mps,vout-fb-divider-ratio-permille min and max values - rewrite mps,vout-fb-divider-ratio-permille description Signed-off-by: Pawel Dembicki --- .../bindings/hwmon/pmbus/mps,mpq8785.yaml | 74 +++++++++++++++++++ .../devicetree/bindings/trivial-devices.yaml | 2 - 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq87= 85.yaml diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml= b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml new file mode 100644 index 000000000000..90970a0433e9 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/pmbus/mps,mpq8785.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Monolithic Power Systems Multiphase Voltage Regulators with PMBus + +maintainers: + - Charles Hsu + +description: + Monolithic Power Systems digital multiphase voltage regulators with PMBu= s. + +properties: + compatible: + enum: + - mps,mpm3695 + - mps,mpm3695-25 + - mps,mpm82504 + - mps,mpq8785 + + reg: + maxItems: 1 + + mps,vout-fb-divider-ratio-permille: + description: + The feedback resistor divider ratio, expressed in permille + (Vfb / Vout * 1000). This value is written to the PMBUS_VOUT_SCALE_L= OOP + register and is required for correct output voltage presentation. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 4095 + default: 706 + +required: + - compatible + - reg + +allOf: + - if: + properties: + compatible: + enum: + - mps,mpm3695 + - mps,mpm82504 + then: + properties: + mps,vout-fb-divider-ratio-permille: + maximum: 1023 + + - if: + properties: + compatible: + const: mps,mpq8785 + then: + properties: + mps,vout-fb-divider-ratio-permille: + maximum: 2047 + +additionalProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + pmic@30 { + compatible =3D "mps,mpm82504"; + reg =3D <0x30>; + mps,vout-fb-divider-ratio-permille =3D <600>; + }; + }; diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Docum= entation/devicetree/bindings/trivial-devices.yaml index 8da408107e55..7c1c0cc29655 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -293,8 +293,6 @@ properties: - mps,mp5990 # Monolithic Power Systems Inc. digital step-down converter mp= 9941 - mps,mp9941 - # Monolithic Power Systems Inc. synchronous step-down converte= r mpq8785 - - mps,mpq8785 # Temperature sensor with integrated fan control - national,lm63 # Serial Interface ACPI-Compatible Microprocessor System Hardw= are Monitor --=20 2.43.0 From nobody Fri Sep 5 18:18:45 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 B0C2E21B9DA; Sat, 10 May 2025 09:21:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868862; cv=none; b=ZiG+Ps5F7VV2W9CwrUJrol/kM4bbb8qIxCKKGauvY5TTJHpF3KKTBfytoGLF3y5OTPXcfdAS+j2SEokCGZyf/B1kRLsFPbR+qdVUqXpP+E9gex/T3LwYSWFvryEZXY193L7aTnpNb2pF/lVvoycXLMS/j/BXp5NiV/cdZPTJe/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868862; c=relaxed/simple; bh=EkY2Q7cPdq5qkT/nEZqscnQ2gEnaAfbjti072pwy6Ms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PJMBRJA5MgvtnPT5NAWVmiqJdqh3d33pZp+Fnk9TGOgDqZKqC2Pq5nfmP7PKKasAE+X5jTkIHbtpP+OiBQ2CvIiH1wKBsZ2JcLmk0uO9Zx6qvSZEsXimpn05dkcURrtLsjfFfis7RCj3FVcTAJj4yMegUl6oxavL9lheSiCSEoo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k8kOWdLU; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="k8kOWdLU" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-43d0359b1fcso19535595e9.0; Sat, 10 May 2025 02:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746868859; x=1747473659; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2/e1bWjEMfQNvCNIgF1Vv6yPWIAJwsnxqj8b4Nj0U3k=; b=k8kOWdLU+u3Qi5rPop5e765/ltZCKX1CVSSkogQG1O/9w4Zymkp2vovYOP0LuzMi77 CUpXdILv9EqUeQJmVFarofyfNA/D3mI6uRamXo6NuI8ZDa/JY1OUgW3q5s6I7hJglsmL C8JRIcclJhdc0R+2racA6MunaRwAGROheQIPe6d5AZcWvN7Qcs9BrQ82ZmKiTaFKw1pM CtzJNCyqvGVj77swAqG6P7zhMBrqN6RriS6TX/ZVf8wK0+1QkGMCrGSAYLQlUuo6M7Qm tRy+ywxVznRgnH+wwv2xFg0KZl5wtT1cU1OL0PaFWpvpDe/+X7Dt9J+aNNydg3ohEdw4 MB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746868859; x=1747473659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2/e1bWjEMfQNvCNIgF1Vv6yPWIAJwsnxqj8b4Nj0U3k=; b=dCbBADCefvymi2ZtklQCy+b4YcqDG7IyzKJIem4EgHDDRgCBd6jtrYxbOjKgZQCUWT 7lfzg/kcAePz6+Khyxkklpqb8Jr0InUUFjmT8wqBiMF4Gp68sHOUmQt4cUzfTrAXtz46 n3r/sG0ncDgrk+oh5MT1FEEajDAPHaplTftYV7Buqjh+ikDRIcI+sdM87h1TbtCq++iZ nxJE0r+3RJQknTp7evx35dpaxyPl4tGJDmwX7m8FKfvryWsRBzXWsl1CUS0Q2FBgfg1f plCdlb4+Ua+TteftQwQImZC+f65havj4gFGDMPruOc6nd2BZXX5sclrpjfSmM/jPNoao uvWg== X-Forwarded-Encrypted: i=1; AJvYcCWIgJ778NbD5lGcBX27t7G9Qwz4sO4BpSo3blZH1muKfCnWHvTDVPjRdEnTV+mb9aFX1j4n0o8sctIr@vger.kernel.org, AJvYcCXQHbttoIsYHI7KlT2FD2ZruMqmBlJqeTk6v0x9g75RfGXOYbVoi+tK72TG5A/E9W5Y0itnJ9ovxksf@vger.kernel.org, AJvYcCXtmuu9BBgB9+41LZcFbwIbGIj1n3wAwuDR/I+GeqyllygaUYTCc75QR16gTNiTOEr84+KEVC1y6RbpeLOh@vger.kernel.org X-Gm-Message-State: AOJu0YydE+d4Ad7GYLbvDTkmQaCvcUi9gazV+ZNcTMcLdGaHZ6RscgIU wIDxN3RFxrI6dvl6sOa2/Q9h11mk3znQ5nH1LQfZWVlUo45/c0XXuHQlPV0O X-Gm-Gg: ASbGncuTUf+ktdf6EVNzwbI5khqc005xVaeidEnm+4jVLBc+4EeMrli4qy/8QoR2fla Mcsp597rr04pCmBwVP/BrDFmcxoncgkEJ4OP5LYwmGfqDMkqmW8IAJAaUuzxZjscOQ3907gqz44 7xrN6VmwK05f0T8thyJrRo/axrDRhv//sMGLkWNP5v3jcwHV3NzzLLOGEr6IN/p6UQeiK0biudu 4nJBtY3SlSnCHM2X8sAMdPKkxZM4hkf8ud/V4oDJlcDRQIPl/NwxQO4/xEyiWoN+SyHFMsyBpHh D07xktxfZ9fizoYEw8pJ+8MzGNjp4xXlGbIQQb4SQgwaG5K6SgpvjO9fwkbuR3ALuSwhcrWPCKr p X-Google-Smtp-Source: AGHT+IE+98meZZMT5vhF1cqphE751jtmGafTC1805YkfKwMFEEn4CdEeiA16fj/TaOzg0Xanj1g76Q== X-Received: by 2002:a05:600c:3d99:b0:43b:bfa7:c7d with SMTP id 5b1f17b1804b1-442d02b91b8mr92314075e9.2.1746868858544; Sat, 10 May 2025 02:20:58 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687ae5asm55901985e9.36.2025.05.10.02.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 02:20:58 -0700 (PDT) From: Pawel Dembicki To: linux-hwmon@vger.kernel.org Cc: Pawel Dembicki , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Noah Wang , Naresh Solanki , Fabio Estevam , Michal Simek , Grant Peltier , Laurent Pinchart , Shen Lichuan , Greg KH , Peter Zijlstra , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Date: Sat, 10 May 2025 11:18:45 +0200 Message-ID: <20250510091937.2298256-3-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250510091937.2298256-1-paweldembicki@gmail.com> References: <20250510091937.2298256-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor the driver to support multiple Monolithic Power Systems devices. Introduce chip ID handling based on device tree matching. No functional changes intended. Signed-off-by: Pawel Dembicki --- v3: - replaced (uintptr_t) with (kernel_ulong_t) - used i2c_get_match_data() instead i2c_match_id(mpq8785_id, client)->driv= er_data v2: - no changes done --- drivers/hwmon/pmbus/mpq8785.c | 38 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c index 331c274ca892..d0ac294b4bbc 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -8,6 +8,8 @@ #include #include "pmbus.h" =20 +enum chips { mpq8785 }; + static int mpq8785_identify(struct i2c_client *client, struct pmbus_driver_info *info) { @@ -53,26 +55,46 @@ static struct pmbus_driver_info mpq8785_info =3D { PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, - .identify =3D mpq8785_identify, -}; - -static int mpq8785_probe(struct i2c_client *client) -{ - return pmbus_do_probe(client, &mpq8785_info); }; =20 static const struct i2c_device_id mpq8785_id[] =3D { - { "mpq8785" }, + { "mpq8785", mpq8785 }, { }, }; MODULE_DEVICE_TABLE(i2c, mpq8785_id); =20 static const struct of_device_id __maybe_unused mpq8785_of_match[] =3D { - { .compatible =3D "mps,mpq8785" }, + { .compatible =3D "mps,mpq8785", .data =3D (void *)mpq8785 }, {} }; MODULE_DEVICE_TABLE(of, mpq8785_of_match); =20 +static int mpq8785_probe(struct i2c_client *client) +{ + struct device *dev =3D &client->dev; + struct pmbus_driver_info *info; + enum chips chip_id; + + info =3D devm_kmemdup(dev, &mpq8785_info, sizeof(*info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + if (dev->of_node) + chip_id =3D (kernel_ulong_t)of_device_get_match_data(dev); + else + chip_id =3D (kernel_ulong_t)i2c_get_match_data(client); + + switch (chip_id) { + case mpq8785: + info->identify =3D mpq8785_identify; + break; + default: + return -ENODEV; + } + + return pmbus_do_probe(client, info); +}; + static struct i2c_driver mpq8785_driver =3D { .driver =3D { .name =3D "mpq8785", --=20 2.43.0 From nobody Fri Sep 5 18:18:45 2025 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 2BB1521B9DA; Sat, 10 May 2025 09:21:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868869; cv=none; b=g0dNV8N46Yy+57S5eXM+2AhTGhuoT4a+OC1RhLcD2gQka9biP+QH2Yik5nggyO6YhXhBKzL1i+vzBnSiGJYqTsjis7OXbbY3aHlsLXrOQL2UswUzCSXmqnp8fGtkwpklFeO+SiIvfivpm25pOUnMhh1DbsVEYjd1oJqx88+KyFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868869; c=relaxed/simple; bh=SXXrqczKba4FzvxUVUTR/B4Bli6tiLO+krXW3xSylt4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gzjOnJeiGMu/Me6K/Xv1BdZQ1rVx8pE/mXNMUtxP3SAwd9ZjNhvMqwrzORwpLQ9qRwknL6+oht3mY9LCMNyUhZ2b0iWIfuWCqxsms6aFJKb92PDsWvU8nllsdJr3UvpbbooMQdrjXfW5B1sTDuDF6GqKg1Noo9LUSpSzpvnZYlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Wp2ELD92; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="Wp2ELD92" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-441c99459e9so18437535e9.3; Sat, 10 May 2025 02:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746868866; x=1747473666; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rhgUHNaa6z426NTakx70hGZ4J9L2YpDfqhugqEzzdIw=; b=Wp2ELD92x/xL917wNqytQa3uxDsSjdhAwFStCn4BdufQl/gNwRGlCkjRr07QkjeET7 I/f4bLz0WzN35ajtuUr7tv8ZkS4f8LHd/tys9FsE5wYuE6/GSihkuBPH+9OlGBr7Ng1x rkH6r+rI8fN33qK7PBq5m32pOlCV3A2Yh1O3z5G7Ve5GfU9D5DFdRxOfOI1VEgp3PXcc 84Cbz3Of8jj9e4+w61aGmbHRPJT1OCEwQUitH5I+cZFxGJCq5ymBnUzWdcrI8+ld4/GO y8kxeBCtuia3sG+P+mPs4ns8yWmbRo4DKoTHNm7ZSmUjOFe66zCiTsVSKLPFE24jVTS3 VYxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746868866; x=1747473666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rhgUHNaa6z426NTakx70hGZ4J9L2YpDfqhugqEzzdIw=; b=lVXKJ0y96sBWXJNoSVYEkxpVbzexVVxhWhRas5FpM+1fDs5WHttgGqjs8YmZBLAnzA IvbHYlQFwyy7FWcq9k2Bn2zN2zi/LP8wD84JRaARW3kpWfJ7oXijuLjyKouCbpCMSEpP pYMvZ9ah8E3nw7WRR69XmYxvQPs98hhf2jDoXTebS6QITJEB/nC4gWpsf911ruAv7Dnj MCE2dfgMHJ5HCxNSrJ8etpMBleA9Qrx5g8br19f5b1MqthqyKti8uissSrHeyGyfHG1R Hdb6IOZXSTfh4TR00S7MfBO4ttr9N+p2U7xQScrfAD01J+UHygCvfh4Bw/U3FAa33Rbe RmvA== X-Forwarded-Encrypted: i=1; AJvYcCVmdH0n1FBodPcuwPQhyVJHcDJX5oCFVYsY4IUk+wID2jbagfb6Ti8apl2U0h70/Xsk6LUpDDlpHDhRcAWt@vger.kernel.org, AJvYcCWK9/Udsyp9huuVnlwv8/E0hjMG+aSGIAExm0uZO6Eh3GygnpQks3yii6YIBxtz+S+y4tkQ85drxey1@vger.kernel.org, AJvYcCWU6xZ8Sj6ntqH15rtxsqAKlIPHk/x8DyZTuboPnKXME0Y8iUGfc8REquVrtyUam7XGZ7MxyDeuDcWJ@vger.kernel.org X-Gm-Message-State: AOJu0YwBX4e26aguYBJD3lBMBl46UbiR4WC/9ZpVmfY9hYMSr9yR2ZlZ 6BZaSKM/uutv6WPTV4IGDd6Q+7xJU5nhfGk16qpV5fo03deh8nUmeZXIOIwd X-Gm-Gg: ASbGnctEgcXplLLH9HEjCeqV74L43Qap4kL+yts9cofL8xx6tmCaAuajaKRSDDG93OU HKXOAxJbVQ/H9DreTcmUuAldYfyjcTCJA9Xt5M83YZlaehdwcl1jpyNq9IxIStos+3zZGesSXyT EJ8ScaybLx48awHMaas/mSx8pFP9Iki8PnYAWyhrWxkJ/7cv8ZtzLwasSuSzyvPdqYUkpwcKxmN DClx191R98yzoDXnMo41/96v0jZ4i9AzLqb7/ZEs5sr37HpG6gfm2QK3V5DuH0r4teh008C6UZr DJjtJQyTu2/wQodikpmaNPvCAo1EVb2tL/d39tA4JqygCN00FIsJNFVQa/YK2EazxSMo2h992M1 V X-Google-Smtp-Source: AGHT+IGP5xryuMfZF/9LvsLfFzhlUTVvgMq/y3Dmh0nbsJbTjs55410ICSlsHzHyg+wj8SG/5k0mDg== X-Received: by 2002:a05:600c:a089:b0:43c:e9d0:9ee5 with SMTP id 5b1f17b1804b1-442d6d6ad82mr55431285e9.18.1746868866014; Sat, 10 May 2025 02:21:06 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687ae5asm55901985e9.36.2025.05.10.02.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 02:21:05 -0700 (PDT) From: Pawel Dembicki To: linux-hwmon@vger.kernel.org Cc: Pawel Dembicki , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Noah Wang , Fabio Estevam , Naresh Solanki , Michal Simek , Grant Peltier , Laurent Pinchart , Peter Zijlstra , Shen Lichuan , Greg KH , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Date: Sat, 10 May 2025 11:18:46 +0200 Message-ID: <20250510091937.2298256-4-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250510091937.2298256-1-paweldembicki@gmail.com> References: <20250510091937.2298256-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Implement support for setting the VOUT_SCALE_LOOP PMBus register based on an optional device tree property "mps,vout-fb-divider-ratio-permille". This allows the driver to provide the correct VOUT value depending on the feedback voltage divider configuration for chips where the bootloader does not configure the VOUT_SCALE_LOOP register. Signed-off-by: Pawel Dembicki --- v3: - droped comments and indexed the table with enums instead - use device_property_read_u32() instead of_property_read_u32() v2: - renamed property to mps,vout-fb-divider-ratio-permille - added register value range checking --- drivers/hwmon/pmbus/mpq8785.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c index d0ac294b4bbc..2e7c0d0c3f81 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -5,11 +5,16 @@ =20 #include #include +#include #include #include "pmbus.h" =20 enum chips { mpq8785 }; =20 +static u16 voltage_scale_loop_max_val[] =3D { + [mpq8785] =3D GENMASK(10, 0), +}; + static int mpq8785_identify(struct i2c_client *client, struct pmbus_driver_info *info) { @@ -74,6 +79,8 @@ static int mpq8785_probe(struct i2c_client *client) struct device *dev =3D &client->dev; struct pmbus_driver_info *info; enum chips chip_id; + u32 voltage_scale; + int ret; =20 info =3D devm_kmemdup(dev, &mpq8785_info, sizeof(*info), GFP_KERNEL); if (!info) @@ -92,6 +99,17 @@ static int mpq8785_probe(struct i2c_client *client) return -ENODEV; } =20 + if (!device_property_read_u32(dev, "mps,vout-fb-divider-ratio-permille", + &voltage_scale)) { + if (voltage_scale > voltage_scale_loop_max_val[chip_id]) + return -EINVAL; + + ret =3D i2c_smbus_write_word_data(client, PMBUS_VOUT_SCALE_LOOP, + voltage_scale); + if (ret) + return ret; + } + return pmbus_do_probe(client, info); }; =20 --=20 2.43.0 From nobody Fri Sep 5 18:18:45 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 89E8121B9C3; Sat, 10 May 2025 09:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868878; cv=none; b=BypNEjqyxns0jxpd5iv9L9xEfv3FNjC9C8noUQbv9qzeM1X/KXJ0YNd05FUISE6+oiJKmHitW+gNUgirSkU/h8ibxrpWRGac18YV9xxrrHoC27MdG/nvKrwTuj7bHJNeX4E7sjp9lTZElc1tJqyOnqr/B43aUOW26umdYoGw1c8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868878; c=relaxed/simple; bh=qqjG4TLZWzysZi1HRtBlJBJzqF+FJgFf4pYolgJ75xE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rd+Dx2uGeAMqQoY6piYh1TAEbejdOzTi0NEYIM545T9m2uWp6Ubx6YAcnU2Tno0zSYV3zgnC40Jlxe8giU0M3M7VHX9EdiX9eW65duxcvSmllO9zYvHJ6hp584bMvxbVxe6QsGdtWfyJ/CX2XJ3nJ1WEXUUw3NCm0HEtKjeBbwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Gqjyjt7p; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="Gqjyjt7p" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43d0618746bso21783075e9.2; Sat, 10 May 2025 02:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746868874; x=1747473674; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NUKFOmyrkNA7dur3Ib6dvAXhOopAOx/jVKysZ5pKnNs=; b=Gqjyjt7pOdk0VrKqVKOhe6sALyGDTDsA6F1KBPGHNecGnHSGYJQPJWcJPw4Q63XRAH p9TeItEz2TLUADT3+538zzt1ySdqX158lT4YPvVeZr8Yl1IvoSuOhBgtmhCLRM8oUDrX 6mbAcs1mKlWdV7S080DxS6juIN7Urnw2ez2TTDYCgXkxv5DSr1535JUZpi179KWebd5L anemPKx4f0cyXdyPadeAZr2D8q5/LJO/IO4EE/9D7pof1KGXnrzW2MZI+fctNoZHhLqS 3kuziZENqcBJmk0Cu1xGs/FGmL/IouHnVNjpwRQd3h9SWEl30U5N2E9vMzCuDPIqwc/a bzYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746868874; x=1747473674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NUKFOmyrkNA7dur3Ib6dvAXhOopAOx/jVKysZ5pKnNs=; b=qN5+bwr9Fgss6QCFzMeSkJQwKPsiN6VcLnh8LnlmQPsMU5aRl1MO5MGmkybmH/V32W HmDFK5YoiaA/OQhpm//Y/AKLaUGd+VNJ8eeMFjoiJ0DaG4530guztGmBui/sxgPODolK Mb9VYqFoxtRkeq1b2yHVi404rRTpX8zqL1PL3JXsHy/c2xOiX4SlCfUbibxdIzRLLyVy Ev1LGCZ3i8hJk3rMhsVjrY4F/6m12D9G6hHXaFAzSwI7Mp3aBe29DVqjWW+Viyqv1jii 6ZWqV2r9Z3mT984SuaiLBhU8nyN2TW0RMQE65GzYOpx+yMe7N+AWBoqvCOqut/S58RLw 5CnQ== X-Forwarded-Encrypted: i=1; AJvYcCW6voXuPulSqZpO1/LbhSFZFSgKjkBE0yO4Y68Orlnn0OY0AvEEVX0ZJ7sFGdNnOYRCEria9McXIQIr@vger.kernel.org, AJvYcCWj7+MwK56KXwZVBXeyKytdoay4Gu7BboCY9A0z0BU6m9AFZK+o5fr34HSz8wUpRLSidegYfxSvwBPQhr3j@vger.kernel.org, AJvYcCX0ON7fXvxyL91aHr1IXsTQnT6aEyAnKwyWu6l7p2j8cOiwHa7KhifQ3X9G1GJXp6FformkiGqVyaoh@vger.kernel.org X-Gm-Message-State: AOJu0YzetV6jyHe4XL6ITzdNcbrZ5E4BFRm7IMJvGiwCETSP2ieYEmJt aLmI4QK91ZZuQk+JdXLnGAmga08ekI85Gu4eVJ4Au2nslXgaqWAuP92/t474 X-Gm-Gg: ASbGncu9S9KKOBg4KVIX7x3ekJ/NgGbkguTevBfOuInevkz37Uo5vXNee2K1Ieg7bZU fBW2K/oDtvKYhMzKAawJANqhUCx8iLZnAvw8MxOw4pf2LBpEYgwPJEDlPLdA6xvKTm9WwMhdQ+/ doyXgauONtkuApgyDMEetx8yA2oQY41yIhNU3yAXeQoEDh08ObKM14e8qbzog4m4vBknqzPA5x0 AbL+prhEUO+5eHD18bHNfuXbnxUxZRq0F+oDHiprvwANekeX63h72Xk9OUtGn8eOM+TXtkxz62j fljPkqsq8xa9Bkaa/DdIFgIuV87EhywQKERtWcY/M3huJ9xLmpATj2ah4KCg4vxDwTMRs85oDeI 6 X-Google-Smtp-Source: AGHT+IGlEra8PjVc2cBUJrQLHSr6lum+RzZkg5Qz4cmGYCMkFR9xrLOfBpgCy33LdOqth/PAKkqXoQ== X-Received: by 2002:a05:600c:3d8a:b0:43d:94:cfe6 with SMTP id 5b1f17b1804b1-442d6dacbe7mr63034535e9.16.1746868874280; Sat, 10 May 2025 02:21:14 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687ae5asm55901985e9.36.2025.05.10.02.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 02:21:13 -0700 (PDT) From: Pawel Dembicki To: linux-hwmon@vger.kernel.org Cc: Pawel Dembicki , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Noah Wang , Fabio Estevam , Naresh Solanki , Michal Simek , Grant Peltier , Laurent Pinchart , Peter Zijlstra , Greg KH , Shen Lichuan , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Date: Sat, 10 May 2025 11:18:47 +0200 Message-ID: <20250510091937.2298256-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250510091937.2298256-1-paweldembicki@gmail.com> References: <20250510091937.2298256-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the Monolithic Power Systems MPM82504 digital voltage regulator. MPM82504 uses PMBus direct format for voltage output. Tested with device tree based matching. Signed-off-by: Pawel Dembicki --- v3: - fix alphabetical order in multiple places - change PMBUS_READ_TEMPERATURE_1_SIGN macro name to MPM82504_READ_TEMPERATURE_1_SIGN - use sign_extend32() - fix typo in documentation v2: - fixed signedess for temperatures < 0 deg C - removed empty lines --- Documentation/hwmon/mpq8785.rst | 20 +++++++++++++++----- drivers/hwmon/pmbus/mpq8785.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.= rst index bf8176b87086..b91fefb1a84c 100644 --- a/Documentation/hwmon/mpq8785.rst +++ b/Documentation/hwmon/mpq8785.rst @@ -5,6 +5,7 @@ Kernel driver mpq8785 =20 Supported chips: =20 + * MPS MPM82504 * MPS MPQ8785 =20 Prefix: 'mpq8785' @@ -14,6 +15,14 @@ Author: Charles Hsu Description ----------- =20 +The MPM82504 is a quad 25A, scalable, fully integrated power module with a= PMBus +interface. The device offers a complete power solution that achieves up to= 25A +per output channel. The MPM82504 has four output channels that can be para= lleled +to provide 50A, 75A, or 100A of output current for flexible configurations. +The device can also operate in parallel with the MPM3695-100 and additional +MPM82504 devices to provide a higher output current. The MPM82504 operates +at high efficiency across a wide load range. + The MPQ8785 is a fully integrated, PMBus-compatible, high-frequency, synch= ronous buck converter. The MPQ8785 offers a very compact solution that achieves u= p to 40A output current per phase, with excellent load and line regulation over= a @@ -23,18 +32,19 @@ output current load range. The PMBus interface provides converter configurations and key parameters monitoring. =20 -The MPQ8785 adopts MPS's proprietary multi-phase digital constant-on-time = (MCOT) +The devices adopts MPS's proprietary multi-phase digital constant-on-time = (MCOT) control, which provides fast transient response and eases loop stabilizati= on. -The MCOT scheme also allows multiple MPQ8785 devices to be connected in pa= rallel -with excellent current sharing and phase interleaving for high-current +The MCOT scheme also allows multiple devices or channels to be connected in +parallel with excellent current sharing and phase interleaving for high-cu= rrent applications. =20 Fully integrated protection features include over-current protection (OCP), over-voltage protection (OVP), under-voltage protection (UVP), and over-temperature protection (OTP). =20 -The MPQ8785 requires a minimal number of readily available, standard exter= nal -components, and is available in a TLGA (5mmx6mm) package. +All supported modules require a minimal number of readily available, stand= ard +external components. The MPM82504 is available in a BGA (15mmx30mmx5.18mm) +package and the MPQ8785 is available in a TLGA (5mmx6mm) package. =20 Device compliant with: =20 diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c index 2e7c0d0c3f81..1e12e7267a7f 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -4,14 +4,19 @@ */ =20 #include +#include #include #include #include #include "pmbus.h" =20 -enum chips { mpq8785 }; +#define MPM82504_READ_TEMPERATURE_1_SIGN BIT(9) +#define MPM82504_READ_TEMPERATURE_1_SIGN_POS 9 + +enum chips { mpm82504, mpq8785 }; =20 static u16 voltage_scale_loop_max_val[] =3D { + [mpm82504] =3D GENMASK(9, 0), [mpq8785] =3D GENMASK(10, 0), }; =20 @@ -41,6 +46,23 @@ static int mpq8785_identify(struct i2c_client *client, return 0; }; =20 +static int mpm82504_read_word_data(struct i2c_client *client, int page, + int phase, int reg) +{ + int ret; + + ret =3D pmbus_read_word_data(client, page, phase, reg); + + if (ret < 0 || reg !=3D PMBUS_READ_TEMPERATURE_1) + return ret; + + /* Fix PMBUS_READ_TEMPERATURE_1 signedness */ + if (ret & MPM82504_READ_TEMPERATURE_1_SIGN) + ret =3D sign_extend32(ret, MPM82504_READ_TEMPERATURE_1_SIGN_POS) & 0xfff= f; + + return ret; +} + static struct pmbus_driver_info mpq8785_info =3D { .pages =3D 1, .format[PSC_VOLTAGE_IN] =3D direct, @@ -63,12 +85,14 @@ static struct pmbus_driver_info mpq8785_info =3D { }; =20 static const struct i2c_device_id mpq8785_id[] =3D { + { "mpm82504", mpm82504 }, { "mpq8785", mpq8785 }, { }, }; MODULE_DEVICE_TABLE(i2c, mpq8785_id); =20 static const struct of_device_id __maybe_unused mpq8785_of_match[] =3D { + { .compatible =3D "mps,mpm82504", .data =3D (void *)mpm82504 }, { .compatible =3D "mps,mpq8785", .data =3D (void *)mpq8785 }, {} }; @@ -92,6 +116,13 @@ static int mpq8785_probe(struct i2c_client *client) chip_id =3D (kernel_ulong_t)i2c_get_match_data(client); =20 switch (chip_id) { + case mpm82504: + info->format[PSC_VOLTAGE_OUT] =3D direct; + info->m[PSC_VOLTAGE_OUT] =3D 8; + info->b[PSC_VOLTAGE_OUT] =3D 0; + info->R[PSC_VOLTAGE_OUT] =3D 2; + info->read_word_data =3D mpm82504_read_word_data; + break; case mpq8785: info->identify =3D mpq8785_identify; break; --=20 2.43.0 From nobody Fri Sep 5 18:18:45 2025 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 ACB95220F4A; Sat, 10 May 2025 09:21:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868886; cv=none; b=NJqBd8VCXrrlx9W87AWUaHAomhjo7Ec5A8rUt5OkGWFIX5n9a2WpsV+afjIHWupJUinDOmmO8cybzeiAcHSgo4cbpZJhLQ5eOUxnj2P3ZaxDokivwRW5a11aowNMbP3K56OBb2H5dA2FXEhG0/6XSNVxsKdQwBlJwfrnRQMXvP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746868886; c=relaxed/simple; bh=AEZwoEa0kIBgfXAtsj5VukUGw/H0uEfko6HeuAepTa0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ANHJGLGsvFBPNpc327Q7AxuIM64ePmdrZGV5/42pNtSQMr2HRTZw8U6QIctExVeaAa/rBlMpHjBIMjd3zti2VabUyW3TALYh253aBnNd/vm7z1GYPT7+LC46W2Z/ndelqWjk76k406mgJju9pja4VPNwljc21mCtNTK4A4D19mE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W5WgRV4o; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="W5WgRV4o" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-43cec5cd73bso18983005e9.3; Sat, 10 May 2025 02:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746868883; x=1747473683; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bO6Jqt0PFTVJr7LcSorP6iBX8+l4quuhVdfU4Z0JfBo=; b=W5WgRV4o4ar+Q5BCK4N/3Tz1aQySI8W+rbFYmCCuHD5J7OmH27inl4Bt6gE6dtRmxb aBunufVbO9L30FRDZaYDHUErfCoItty03vCwLmu3kutQ7gbtGRvdmKmkkgQLT4odtWfv FK5Ccow7mn4TzEFSefgcbyjoH7+6eInLXIWyCByO/CssZeu1lfmBBCJ7nzvfd5sLUf4/ Zh95Ewi9WLsxKcKO7rzzj13YmCKmeSpniCZr/J9BtBEtTQ9MbUeNix9S0D9R3HbQ8XO8 pApUOqAxgn7ukxzzCN18wzV3W4T7gY27683OYJe5zcRrlY/OELLGSkFuM5hSBGK1EiJq khvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746868883; x=1747473683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bO6Jqt0PFTVJr7LcSorP6iBX8+l4quuhVdfU4Z0JfBo=; b=LjbC+PmwrFoZ5EZxEGnwCOhXcdNVITvRKOLcezsSgXeLHA6IzR4NKhtW0mu8kWZq8k EdcuSZfcrCAVCiSEzEekCquE9gtk6RWNTFAV9Px7Wmr6qBbZ2ueZgIugxFUtEEREaEB/ QXhkHsbalI0hL+QZbK6BWqxqSa1HH1CntYzAsv+bbOIjO+HAGWP+YvRZK7AWLwVq68V8 qYzAztDxgByC1vvE0dpZDOqMi/J4y1xhDwn+g2zwNJPBFD7X8mUhI+LNORMhcM8OTpmp mJyDayR/MtycsA8UJhJqz0g8XKGcPzEOZSl5chFSqyUvPMEqsCe6JgT6Pk4iTJKAWGer C1kA== X-Forwarded-Encrypted: i=1; AJvYcCUrZ6iZPQH2aVR4G0d5wgzCzI7ggDbKwjih4P/e9wFtxNSbYYTJJTrI2NdtLXiBAubmKv4OSsmxUORF@vger.kernel.org, AJvYcCWe9TcpuX9F0WsNfBTQW2stSH2EfSdmQk2zc8jNjgaXM3ob8I3LaSP9Y5hFMTL858Gq6i+CYo07qnkq@vger.kernel.org, AJvYcCXUURcITF9MoUevGlLqZ9x5E2qIP8Tl39SGIUCCYxkYQmMEW5QsVtXKgPgOztwM4pEEazTusNLNis/jEdo9@vger.kernel.org X-Gm-Message-State: AOJu0YwQZ8UHA5cKHE9ihndspA8MSWwmeey7W8yShcGjwKz9CondDAec eF0hicgg9XE4qbfCGBBJbcnoRZ8smwIDViIfl1hciquEVRA6cIna5sBff5WC X-Gm-Gg: ASbGnctgqXxXPjqBNd6EsV+6izS8YFawYOJ5DxtDd3+lv7Gi0bJ3P8CWcn2S6NA04WH wYuQDpJqkGGaaX+fbl1wRws+kllofEg36axV1mgh7wT2IkJI4wtGMOU4KNafUHGIf+NtY5n+bne /3OF57/IAkXU9JtnEQ81aYuBy+5R7g+K0YI1wDkbhdNTqQddx2Jnu85oxADlMShCOts/H0T4SYn i0AQwMlADNBnk0Zti0SfMGMCe6WVgc3Y63YfVRVDExlCTZVozdqsA3adDbeuYsLFQGMD9T1CR1P OVficRTXP7esbuwyypAKI/M7xnUwxhn/9e9665mfhPcDgtDTCQJC+OwY4WEWhsQmqN7AiHLX1Xl 6 X-Google-Smtp-Source: AGHT+IG56s9f07iaGmAkfDoSoclIwgguXa6vIbT+eM6/yZ1j9g/Soz+JIG6toLAVKqzVqMSXTYaRLQ== X-Received: by 2002:a05:600c:3e8e:b0:43d:42b:e186 with SMTP id 5b1f17b1804b1-442d6d37b08mr56223145e9.8.1746868882578; Sat, 10 May 2025 02:21:22 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442d687ae5asm55901985e9.36.2025.05.10.02.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 02:21:22 -0700 (PDT) From: Pawel Dembicki To: linux-hwmon@vger.kernel.org Cc: Pawel Dembicki , Jean Delvare , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Noah Wang , Naresh Solanki , Michal Simek , Fabio Estevam , Grant Peltier , Laurent Pinchart , Peter Zijlstra , Shen Lichuan , Greg KH , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v3 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Date: Sat, 10 May 2025 11:18:48 +0200 Message-ID: <20250510091937.2298256-6-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250510091937.2298256-1-paweldembicki@gmail.com> References: <20250510091937.2298256-1-paweldembicki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the Monolithic Power Systems MPM3695 family. It contains four devices with suffixes: -10, -20, -25 and -100. The device is PMBus compliant and shares characteristics with the MPM82504. MPM3695-25 has different VOLTAGE_SCALE_LOOP register size [11:0] and it needs to be separated because it will be configured in the next commit. Tested with device tree based matching (MPM3695-10). Signed-off-by: Pawel Dembicki --- v3: - fix alphabetical order in couple places - adjust patch after patch order change v2: - Added whole MPM3695 family --- Documentation/hwmon/mpq8785.rst | 13 +++++++++---- drivers/hwmon/pmbus/mpq8785.c | 10 +++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.= rst index b91fefb1a84c..198d5dfd7c30 100644 --- a/Documentation/hwmon/mpq8785.rst +++ b/Documentation/hwmon/mpq8785.rst @@ -5,6 +5,7 @@ Kernel driver mpq8785 =20 Supported chips: =20 + * MPS MPM3695 family * MPS MPM82504 * MPS MPQ8785 =20 @@ -15,6 +16,14 @@ Author: Charles Hsu Description ----------- =20 +The MPM3695 family is a scalable, ultra-thin, fully integrated power modul= e with +a PMBus interface. It offers a complete power solution that achieves up to +10A (-10 variant), 20A (-25 variant), 25A (-20 variant), 100A (-100 varian= t) +of output current with excellent load and line regulation across a wide in= put +voltage range. It operates at high efficiency over a wide load range, and = can +be parallled to deliver higher current. Variants -10,-20 and -100 have dif= ferent +voltage scale configuration register range (10 bits) than -25 version (11 = bits). + The MPM82504 is a quad 25A, scalable, fully integrated power module with a= PMBus interface. The device offers a complete power solution that achieves up to= 25A per output channel. The MPM82504 has four output channels that can be para= lleled @@ -42,10 +51,6 @@ Fully integrated protection features include over-curren= t protection (OCP), over-voltage protection (OVP), under-voltage protection (UVP), and over-temperature protection (OTP). =20 -All supported modules require a minimal number of readily available, stand= ard -external components. The MPM82504 is available in a BGA (15mmx30mmx5.18mm) -package and the MPQ8785 is available in a TLGA (5mmx6mm) package. - Device compliant with: =20 - PMBus rev 1.3 interface. diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c index 1e12e7267a7f..6c9c0970e5d6 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -13,9 +13,11 @@ #define MPM82504_READ_TEMPERATURE_1_SIGN BIT(9) #define MPM82504_READ_TEMPERATURE_1_SIGN_POS 9 =20 -enum chips { mpm82504, mpq8785 }; +enum chips { mpm3695, mpm3695_25, mpm82504, mpq8785 }; =20 static u16 voltage_scale_loop_max_val[] =3D { + [mpm3695] =3D GENMASK(9, 0), + [mpm3695_25] =3D GENMASK(11, 0), [mpm82504] =3D GENMASK(9, 0), [mpq8785] =3D GENMASK(10, 0), }; @@ -85,6 +87,8 @@ static struct pmbus_driver_info mpq8785_info =3D { }; =20 static const struct i2c_device_id mpq8785_id[] =3D { + { "mpm3695", mpm3695 }, + { "mpm3695-25", mpm3695_25 }, { "mpm82504", mpm82504 }, { "mpq8785", mpq8785 }, { }, @@ -92,6 +96,8 @@ static const struct i2c_device_id mpq8785_id[] =3D { MODULE_DEVICE_TABLE(i2c, mpq8785_id); =20 static const struct of_device_id __maybe_unused mpq8785_of_match[] =3D { + { .compatible =3D "mps,mpm3695", .data =3D (void *)mpm3695 }, + { .compatible =3D "mps,mpm3695-25", .data =3D (void *)mpm3695_25 }, { .compatible =3D "mps,mpm82504", .data =3D (void *)mpm82504 }, { .compatible =3D "mps,mpq8785", .data =3D (void *)mpq8785 }, {} @@ -116,6 +122,8 @@ static int mpq8785_probe(struct i2c_client *client) chip_id =3D (kernel_ulong_t)i2c_get_match_data(client); =20 switch (chip_id) { + case mpm3695: + case mpm3695_25: case mpm82504: info->format[PSC_VOLTAGE_OUT] =3D direct; info->m[PSC_VOLTAGE_OUT] =3D 8; --=20 2.43.0