From nobody Fri Sep 5 20:21:06 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 0580C2F2E; Sun, 11 May 2025 03:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935840; cv=none; b=m4ngTK/otFEv6t8nqq3qHUIL+P51uhkyDepsMvtPaEBmhhnPqLON/PJKEGi8JQrS++B6euX+JuRjml2gZjlhQacC/ueInsXFBAO9Deu78lhYFXhnrwND42k06U/CZjNMUorbMwQjChyrGs4WXPKCu1ze3zPUXTY6k+T1M9xnW0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935840; c=relaxed/simple; bh=f/UTi+V9OBTgwKw1gQAScv/Z3Q/LzPwLJAcAhilQgdY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H43oad+K4jvxm22Nn1mD6FIjI1Y/nhdd9XQBNhOSbYM4Crf1CZnEH06dVhaD/PQbOHSf6SgMXBd6jz+7ynlb1mDgkvmYfVlmij1K1NsiPIf1nEwfgUZ1l/t5JFt3TABNrbyBgcZlMr8lU7iB1EZKDd9gyymk66/7x6KSVyjAGew= 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=gk8Tqx/i; arc=none smtp.client-ip=209.85.128.46 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="gk8Tqx/i" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43d04dc73b7so36593705e9.3; Sat, 10 May 2025 20:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746935837; x=1747540637; 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=DEhQESYwkokAzogW2qk/KK801wxi9MLakYUcNUui9Ko=; b=gk8Tqx/ihKwcOIW5rP08lKzKethfYHEGzXRG5/uly0qvJZ7KJn5YH3K8qMEGIrqeQq 6BA5BR1xZaLDd3rmku/DGHnZNSDQm+Fif9ycv0CuswOIwO+hpxOVxcahfYz8RwofCvsK jiYbe0vvhh1wmQLXKhD7qvVC/YnNxTQT+ItuBc/+PEtzc2Q/Sz6/TBoga32oaoxLatFx kJYBKBxo0pG6BqKgqI8SfpjBLwqKjQHD0udwTfY4x3OJxIPFQz2x7p5pZEYw6P//UqtQ /g63pdAFUeGO7qb+yr0mvEKCjaqJpGSmOmFxH14aSrba8Nos6VKBF3XiHSp70B4i/keL rj0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746935837; x=1747540637; 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=DEhQESYwkokAzogW2qk/KK801wxi9MLakYUcNUui9Ko=; b=TxH378MSLM6ksJu9Z5F9K3EDEcK2OI2IwYjCB79Y3Nz68qw7T1nfiCTteWtmgwMM/X r1o4vnm/KdHESmOezihIlBbFejBiJ9CbCrWGhqEwPJM+NgQj9oVaRxRZWs8E3qztuqqY ULOxm4V14kdvQErvng7EK1y8pHjmEuiyknbXBv7IpfdFPWP3ab48RAclfDJ0Uamb8N5c KlDYDa48fBIAayR2fIJyr8HKpLoAcGbzt6jWv/VNGQ+WNMjclON9Yt5kgdkvWfHlaE8i n4DAtCdaM63j0AvrDw6nUWW5coOKpxwWQaU4Oje92nhx5lkAlTjI/anAwSXNd6pbJEYL tsqw== X-Forwarded-Encrypted: i=1; AJvYcCU62ppuY7wgRVLxYTIqgxjTXzvdI31B39RoAOXyIsTZUu7zcTQjKzRLK3df21xhpFH5F5bIBuLzMFSR@vger.kernel.org, AJvYcCUIetkcQdJMKi3/kpkn5ptX8L24Kfu8l0Ghqv/z63uuOWz7zH8/Pje/a5zzceD5q8HrloOrBGDV707eRM28@vger.kernel.org, AJvYcCVniFEKuNKOwZDqr+WWHQCnQjpkL+f2OJSqdBpuihfQeSWzP6IvQGlU17yALRedWm04y8T6bAuOoca3@vger.kernel.org X-Gm-Message-State: AOJu0YyqETy6CVDl/zeNa/Loka3XWU7aPVk/0b+lxPhVo/CJez5XJMbS VgqUW2LhrZKooWCAncIoapz1R1UNQ+swSxH3pGAe/kedcvvA5juJeGRcNoWv X-Gm-Gg: ASbGncucoZA0/3rKE1ysO3Fkrs2j6NB2skypfi/qUyhNwccYezGAblhkuRph32P5uvj zsRH/y17i/eT3Sq3Q8EA1T4JrPTUfD8Y5/2n4YI78XozfuHck6TWF2MB0Ei1Ov1aIIKloq3evwq TCDHu8stSL3WnAIW1gBv1BMEY7t8kY/xxocLbF3dA8JOYj9ExlH7wRH0W0bTQjgh5Pqiwl2xn2m EenQF8SPp0W5FLob+Pz65/PT6iPXh5On9nC/3N1hW7lieG4tIc5EyycgQ1/zMM9Zu4XAv2JR7/0 7MR1E4jkiEhlsaTnUBf97A4HgiP7WWCoy6f7b57V+ixBzAMZa3R6G+i4fDmLuEA661Bld4OUK1C b X-Google-Smtp-Source: AGHT+IH8aK1oMDdl3+d+9QndIotL8zgwEtnhri+Fyp0sXJHR+IOaMhBjYpvad+nt5NUr51Gp/yoM5Q== X-Received: by 2002:a5d:4807:0:b0:3a0:a09d:b31e with SMTP id ffacd0b85a97d-3a1f64ba5afmr5322166f8f.59.1746935836706; Sat, 10 May 2025 20:57:16 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f5a4c76dsm8163963f8f.92.2025.05.10.20.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 20:57:15 -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 , Shen Lichuan , Peter Zijlstra , Greg KH , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 1/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Date: Sun, 11 May 2025 05:55:44 +0200 Message-ID: <20250511035701.2607947-2-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250511035701.2607947-1-paweldembicki@gmail.com> References: <20250511035701.2607947-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. Reviewed-by: Krzysztof Kozlowski --- v4: - no changes done 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 20:21:06 2025 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 3F3C52F2E; Sun, 11 May 2025 03:57:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935848; cv=none; b=Y9KiZZpJ7+GEnxpWxoAROtqgufEiuyxxB3s2qDNEY4Lw5we1//9eNzlW2v06F6mev9QuuWiglLfZQLyPObzdfwtzqtZeGNJKHBwFUE6g8ZPq/7Omz4pBY7KSr8DZtm/PgyiMzFjfZJ8V3tsjgic4iQxA6JrLNh92YOySAUBVNQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935848; c=relaxed/simple; bh=f11a/87d/MkxjGBfwqmJZV3iTC4m7JH+7y4sSV73jJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qTSxOWAS6aogAyGWU+aJRzhp4szFcnwkM6jQ6V5I9iHSBdtwgGcwmoOpRD943L7rgDbqTsgWVO9kPRNnn+1o9G6TTaArCfjz0BPbtelbjnoqOFOnZcGUd7NfoFdB4fKlkDFS4KDMrsY9bQwiARW5mFrZV4b9sH/r0dgfiRIDSDA= 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=c/noOkMA; arc=none smtp.client-ip=209.85.221.50 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="c/noOkMA" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3a0b7fbdde7so3055724f8f.2; Sat, 10 May 2025 20:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746935844; x=1747540644; 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=AGnjH1P5I0kLHDjAZ4ysHop1/OwSpLWxJh9YdNqBtVk=; b=c/noOkMASm/wdcWc116SnGgN8aKPZ3gQkLh9jdA1tY1ZeL03lCsn8NAjfbD7Mf6AX+ oyFAjDuxAy4REoXP0ifaOWQwzYejy0StEosxpIVl6wnxRteWGM7MCl/y52/wnhFsyY/p F0PBnm8DaEWlDB1yUYO0Rto+gVjtaf3bfTu5JDjiqSZ8XoqAKBZAqRgk23/VzzNlhV6p cS7t3U1rWY2BmsoAbrkEC66pz+NchC8Ia8jvBqACccnuOSKXjY4JD1iPAuLw2z3bk/hc hdGhwH161tCz65i5N9G5XVfPP07RnR6SaI5JNmQVIA+TCW+ljEeys0gU6H4YXaM+pLti Kv1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746935844; x=1747540644; 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=AGnjH1P5I0kLHDjAZ4ysHop1/OwSpLWxJh9YdNqBtVk=; b=QhJO1uhJyz1uUZgfaiwXpHsbAA+xBA6YERP5Rvr4CXQblviH/EtI6ieRQQLMQvZt1J zZgGleh59xxRM37TFHPzg44nlDy5fWGOlJj5BV6BqnSYn47RZChjAzobFaBX3zbcEUYB aPaoW4iAheNtRThrM+6R9TjWP0hbIuWOaxo9jJLJz965GV3KMoYbK+CBKfT0bqN0RpMM z4JWsU7rvzoCm3iuHjiRKQdsDBMNgk+LbmQThJUUMx4wPNdAMeKJMe7He365t0r7CY9p ZkG+lJgHF3iY1FP+hHw9S5eTbMrdTtS+FoUp21FdX27nxVX8R/DaNK9bFBH+Ue1CGQ3Y F1HQ== X-Forwarded-Encrypted: i=1; AJvYcCVhsPPACsbuKSylR+ktv/UuXZ13W6tsQeS5pyb7IU8PR2baavyjjiKx8XrO22U4NH8IBMmCALkFcv31@vger.kernel.org, AJvYcCXEQrl0gUpSDqlEonvINPqH8xAgO6cuvQWjJmKLVVtyzxNor2eXyCCm2uPMSYs0HIFgrTCXHiIrBjaZTiYL@vger.kernel.org, AJvYcCXkbSmAPmplyEs6BblsfRmna5L0X/fO8Y9InbDnV0pv1M+9UA0lCnEFWoxkQmHxv6wTFh2pTfRZaIgA@vger.kernel.org X-Gm-Message-State: AOJu0YyXhnN+/hc8XDfLcLhRCKa+iWtLzILt+OYaI8XwBxPb+8+HQH4C 2BPeUrkXtp+mLl9N1V2XFfYYKmKFi/waRBA1wKgSqQTzp6jg2fhi75nUtZLC X-Gm-Gg: ASbGncvpesPSqJsP3Za9OeZqRVozHQtXu0N/YAUQFGUXPMz3PVKzsCDe8kfaRMO/+Jg VyKEtFeQqdrn7yYkujY8IDbUb2DYf7cx4xuZc6eO/wUyXb+8IiUxuGZVYAQ+YHjU/yVkEmDRT40 s+PJyRQhScLE6D3r5i6twH7/xbbfZcSimz4+ktpG49KsLkUBH4bip0xbspLPD98nHGzghvBP5xG GgHkYtY9zi4rSrTLhWjMTM4723ESnJbc3Y8zlW4vGL3ucTZiCblsCBx4iVtPuLFGDYrz5mfXzhE OsmUJ0rEkNLP60y7CqgVcLjkMR2hlXv9LRWu/aV7KT6l2DyX4THXJ5hqhIWnEPm5LhgwRQkDJ0k / X-Google-Smtp-Source: AGHT+IEAa8DunPvrHQ8yJJ8v4GjnsSw6eFmxwkbwHnHoEfsD2xzSNIHeco505OqaSmbYjeyfZGe/AQ== X-Received: by 2002:a05:6000:2088:b0:39e:e557:7fa with SMTP id ffacd0b85a97d-3a1f648865amr5940049f8f.44.1746935844226; Sat, 10 May 2025 20:57:24 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f5a4c76dsm8163963f8f.92.2025.05.10.20.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 20:57:23 -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 v4 2/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Date: Sun, 11 May 2025 05:55:45 +0200 Message-ID: <20250511035701.2607947-3-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250511035701.2607947-1-paweldembicki@gmail.com> References: <20250511035701.2607947-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 --- v4: - no changes done 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 20:21:06 2025 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 DE28B18A6A8; Sun, 11 May 2025 03:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935855; cv=none; b=NqKlNTlCSr/0JJ7hTE7SmMoztPxZFFPsg1QNbSAazBXf29snAXFbgttQNfRqw6xplSTJVBdAYsWvdX2yP2dPWucD5tXuG0c9RkFX4b1ajx+XLj6TtbIzTpWIMyZG7uqgUYRPIaumuFKolc+RTpsJDfcAkDFahXNos180LnWFRsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935855; c=relaxed/simple; bh=P6wOfebkpU3WfvRqXOJRrv3NX2AzFgNF0qCkMWB0+XA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jC4yKo9P+yaEUpzhWA8H5cvG8Qipl7y2TZWlExZLlVVsEogpJy9lkn8tbrwM5SVr+9Rppiv2bCqimJfXCOltprYu1phfvIUucOZ48UtDtzDuCQX2zlRz3Is9wbxbRCVtluo3b0Eqe6zmx/dknAVRRZspZPeUYttrLbq6v9xRrUg= 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=A04HV5l4; arc=none smtp.client-ip=209.85.221.42 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="A04HV5l4" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3a1f9791a4dso1021863f8f.0; Sat, 10 May 2025 20:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746935852; x=1747540652; 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=VcQ/7TEjuuT9DaFpB0BjkKvroqqAuAAo+U2kbtALpnk=; b=A04HV5l4aYLCfA8Xi/9ugvQOgLizgHKW3WDnPACQKE21D4+W8X9f/fxSUPlXUmk2x6 trupYpNSQP3Ht09RPV2YFdXWua1tVw/jaOWVnewYuKXYsYKOdHHLfJsvszYSGAGqNjau O+AsCRUTAQQAZayZ5Q0sBxN2w+qSyVsBsWwRpu1V+tIDoKDuaISTT5npdgtIsUu2I0J/ zeJWRFLFcLWIxVpHxM82d3FgSbSKsVTuF5+rgQG2ZsjZIzwYm1hn/uegTu86nT21GB0o PdLzZlCgPpsyTjiPPvKejWB0Qd+eQGHruuxcLYJCW25Dq8ZDoNXDp9UiU9EWpXcdtMx+ sXeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746935852; x=1747540652; 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=VcQ/7TEjuuT9DaFpB0BjkKvroqqAuAAo+U2kbtALpnk=; b=prtBDihse5hQRAwzDwlEDxrlybPFVQYNGpZIRY7JoUTMEU97EdNCTxzg1+O3/strVM ibOlYPQMz0PYS1dbG4fiZrKrwJSjbhIFuTYkYuFlf9h9DP4Iih7lVNelxe5axLI2PuHa s+L/m0+ZMZnMo0zydjzgdyiBFRqcVrq9j6EE03f6vyt3Vvqzi7joat+/DIlSma9WlST5 +7cThPuO/KAvRqkQE3TDKttG9HjRmt1Teuu7U4FE8NRDR/vO8FgapIcCjDIzAlX2kxsb cbGrS4nop6eTZbJkFoXVRjcBydmdLrOeJclXB2zgch4jf85EXAIel6KYByXxmDgQR6ST pyHw== X-Forwarded-Encrypted: i=1; AJvYcCU6Goerm4Jy8K/VqDlhAEfdsW1rLRJtobhakHEqjCEpQxM0g8JzQ2exRRFg+74EiMwwOqSZvDaQVKum4rq7@vger.kernel.org, AJvYcCUVwNqbMpMzocihqadkO50w8WdBQELTAovj9nBX6FNjDK5DK0z8hDOwHtjy1JBxlrtxTJFXrsvnbIMA@vger.kernel.org, AJvYcCWmEU8umTA0GMdDu8wYh5PM4sjSj0Ss5iOLTIRtLeSE/J+GghNMusY78u1kSFEZnFbJ+qB+ydJjGNwS@vger.kernel.org X-Gm-Message-State: AOJu0Yx3cR4k/HUv/5pH/7vX6HGI+2OiqtD92ztl6fFPod9f3gDo+FZH 6OFnvs7OnrDw4qCWX7w8OtuEP440PA2/fBa7PiIZvELkwkAqV+oQ6c1i1q/f X-Gm-Gg: ASbGncsHKkNGLhAAR1G15neDrLJ6Ifgb8+0/QkXXhnf7HDn3P5qY2CbzrF1rB0C0x6p wRI+VFfb6SY9mMIkpOwvsqeKWHAO3RPezD9+2HheHbEJ8q4rerdHnskWiCKOa0EQXaB0ooIApF5 yoCk3Fjl7jVyoMhuNHPh7viE5zdSbC1QLQ13+LTXfOz5JLEbADRCnxh7HZijBlgwPm9cjLAIhwv RvKZy8Qpw7hey7bT9jwjMEl9afJiDlrx4WsduryaYcsaPhwcXGstCoV/ndJ7bzUgjO5g9CbxTeR nDkg/twP80skBJlPes/eg4hs5nS1RPizP6swN3s/XqQLRzdCsYGLmqyN9pFyGC4fAihAOF+Nzia O X-Google-Smtp-Source: AGHT+IE868N5mJ1Tijjg3CP0NNfqWMVpdiXblDnz+XlIh9ilb4gA/tpDrjv9Brdu9dYYIYRr+kYVbg== X-Received: by 2002:a5d:59ab:0:b0:3a0:9705:eb13 with SMTP id ffacd0b85a97d-3a1f64a493fmr6270141f8f.43.1746935851682; Sat, 10 May 2025 20:57:31 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f5a4c76dsm8163963f8f.92.2025.05.10.20.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 20:57:31 -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 , Michal Simek , Naresh Solanki , Fabio Estevam , Grant Peltier , Laurent Pinchart , Shen Lichuan , Peter Zijlstra , Greg KH , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 3/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Date: Sun, 11 May 2025 05:55:46 +0200 Message-ID: <20250511035701.2607947-4-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250511035701.2607947-1-paweldembicki@gmail.com> References: <20250511035701.2607947-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 --- v4: - no changes done 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 20:21:06 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 11AC518A6A8; Sun, 11 May 2025 03:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935864; cv=none; b=Gs6O90Fqsejwxa6aN/HnCvsAmCvE2J5jGNJhFVbvYF/zzveDvA3VH6ZXGmmAbzRgWibMFYIZyB2JOuBqX9RXGaOg+33neTDgqi8bCQ2+gX6jLSdv70g/DSFZEzWAMgHNUGAjCeTyK2eJBErc5j3p4qemRQcQBccn3xWiYhi+YrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935864; c=relaxed/simple; bh=GQuN8y6ggGwA8hmdtSJ1FPl8vpx4Ppxc28x8OC7841s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q6BvS1HyMS82W/ynCTKd+JbbjmS2zFeyNIx6QY6vuxGYfqoDtkL8nJyqinPtYaWCUxHwKtgrdHqi3k81XiqgNbm1+xjHlg5J3LrRhqqv0yGyS3+rRQmHsXTwelELGCzHuBxt4EWPRwsvBggX0ib1TRzpxqZdyCrvyHgXCIPAxRY= 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=GSbTrtGP; arc=none smtp.client-ip=209.85.221.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="GSbTrtGP" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3a0ebf39427so2482780f8f.3; Sat, 10 May 2025 20:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746935860; x=1747540660; 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=fcX2FzfNWS4ZbAVrn7bw1wbI1siUi20/FPsyq5QKJUw=; b=GSbTrtGP6CzOgcoCmDoOOmSrNYJl1ixlblrLZ0hA7nO7L1AMXU0IkFyvb8tmLu/xew B/Ieh89vXsztZuZAM7yg6T3owP/vX5d21fFxZha9YEmJSKCXV38Lqqi/XmM2gs+cYSTl 3NPGxxGVl1KcOLs0F+hwgmu+CDqRD0tvtP3+r8dutq+nZQ9S25fVf0MY/SzZZyuJ8k0q zgQDrvPDb8Bx5S386aiqVAuzJ2B+QLDsKAPW94uKOyOiXAfwoi4YD4qi2oWwxScXH6z9 jqiBe7E8jOiMOQnJG74MNLJM/Wu5csuKJ7BOcB904a9v8q7zoaQ5DS4CCO/8uAulHny2 Uqhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746935860; x=1747540660; 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=fcX2FzfNWS4ZbAVrn7bw1wbI1siUi20/FPsyq5QKJUw=; b=q7UHcPj3/jhKv4IiTctJM/NDMjUDVjOkfayWpIGhaM9o55D+gEvIrULr6heGF6CLvF 8tkLcW+NwCeaHc+JHB8gf/9JkPbcAMR8izCfh6N6l8H2z2keipjoW3YhfXEm402gmRdu NO6UeYb8MlbQVkw7zU8JfBFQUgDepujiUuE7UBZWAl/sKgCdsMe6FA1mHkYssobYyXvX rtxmquGPSmUkwFN5aOHdxYs9FPyrCs8nf4mk8yeCbbJHm8ijO6dVSyXxJBYbyIyFRnCH bOR4wanQNTpl0Gk8Re2+4q/K9LRyOd8PunhFKd0aJpxBrhiaPChCP8U86PZGdx2iXAUm Cojw== X-Forwarded-Encrypted: i=1; AJvYcCUHZ0+G7O7t3mzMfs8rp8p+JEynH+pxNs8I1YBGWJbzQ91+nUNz4oqeRSwE5eYJY/WH88zvw89Fm8vj9RoC@vger.kernel.org, AJvYcCUgRirSOTH2mkVP6jYXZxPs43yOh2B8sUFm1sEcUoD+XwkZW08U7y0LJT5RXhCAueErtANzJBgLPEJJ@vger.kernel.org, AJvYcCWWlU+soCQYwVjQd3sVbGbauE8RCR9iSRuUIHGF6X96vqLv3KqudqAxOS/7l7Fla0IpsE160rowInCw@vger.kernel.org X-Gm-Message-State: AOJu0YwB5f1TWNV3MoeWIetlqCD15FAsjY8kUSNNXSEkDyc77FQLc5ok WBzKZLbD+poWQkpqGKlQKA9f3vfkYHkqRqIFPbJ6EhV3idsCVg3wacQVrbvy X-Gm-Gg: ASbGncvYa+ZwtZIuWbY3uyw8+XcrifCuJqMUHIQfKl2OToND7wqB8gP9N96g3rOrq58 TffkIqCuN6UFzKQVHxPq93oWUzztKqU4BW2jODlyU+q9lrletmrT7JascBBJsgabIXz96TcnMNp bRRIv3XOpp4SVtYQ7L3l08/Uuf7V8KbPKPAuQu8ueozSkFos0c5H1SbeCLaPZEqqr5webjWDxli 6roARzaWgA4zBXSA3XVxpz7w/BJ0VKrNy7WCkUhWv6G/ZNZi9gqKBcja7DC7VcaOZv+qKxUoHqX mfuNyxAnderBP52V9k9rjeTYkn5AeXDnNG6J56gCyxH7dXes7tIJt4/lBlH+yfNoKQefvhiD2xD K X-Google-Smtp-Source: AGHT+IEieMPNdSxvs2kn8h2BgpqCFNWZ+axLbCMjw70PhgV0KIdRFdLNYeDWS8GJ7ydM8RDtVTTw5A== X-Received: by 2002:a05:6000:a91:b0:3a1:f5c6:2bd with SMTP id ffacd0b85a97d-3a1f645f228mr6481258f8f.31.1746935859929; Sat, 10 May 2025 20:57:39 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f5a4c76dsm8163963f8f.92.2025.05.10.20.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 20:57:38 -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 v4 4/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Date: Sun, 11 May 2025 05:55:47 +0200 Message-ID: <20250511035701.2607947-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250511035701.2607947-1-paweldembicki@gmail.com> References: <20250511035701.2607947-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 --- v4: - do sign_extend32() without check the MPM82504_READ_TEMPERATURE_1_SIGN 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 | 29 ++++++++++++++++++++++++++++- 2 files changed, 43 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..8827d5a57310 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -4,14 +4,18 @@ */ =20 #include +#include #include #include #include #include "pmbus.h" =20 -enum chips { mpq8785 }; +#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 +45,20 @@ 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 */ + return sign_extend32(ret, MPM82504_READ_TEMPERATURE_1_SIGN_POS) & 0xffff; +} + static struct pmbus_driver_info mpq8785_info =3D { .pages =3D 1, .format[PSC_VOLTAGE_IN] =3D direct, @@ -63,12 +81,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 +112,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 20:21:06 2025 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 36F2E189912; Sun, 11 May 2025 03:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935872; cv=none; b=G1TXtYOT8YRtFnJZwOBS2ZWWiLdABSu6IwpTag2ydxsxpCwboyQP2BNwP8NU/6kGby3hSR4n1wwkilVZM2bD6kd1TqMmTZlwIptsT5+tYf4zRB+vNE5CfIKPp3Mdq1Q6wIskKEswB3uC8jjUxa8DCZLhhyG7KRtS6xs6GkojMaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746935872; c=relaxed/simple; bh=HLK6PiDnz7E2MMqNzDx5rVqMDXwXP+M194AWuImHFJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bLk/gQNF3Ka5WUVTgaHh9ZNYtZm7RVAymjrASCBwPVu1IQwgUmvK2abZzwbR4x7xfnWopMx7zKPMGGe/84E8RC3KJyZrfvU4elNLY2/RHWVzer4LRxYpn8kEKlUJxUiLZ2VJfGnaV1v0V2BfQyrIq59bTKJwZZsjmRFWhRPUvy0= 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=lBtpeFoZ; arc=none smtp.client-ip=209.85.221.50 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="lBtpeFoZ" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3a1f5d2d91eso1562283f8f.1; Sat, 10 May 2025 20:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746935868; x=1747540668; 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=pk8Os/KQV8g3d7fEWFNmmi62uW1E+WMBGyh6BXQrDnY=; b=lBtpeFoZOEPid9WkomPgn8EAyx80AVyNDBDfE2vjHTzyPTUKYJKT5e/YN0eY3NAjUG gIJVhPzfONIO9J6wfOJBvvIxBdKpDTbMM9BUkcCQ/401zsEXn3ttetgcUGV8mua+OIwR FF5kFr7fIV0HOh8E9z87S4ssBjD4U7+68q7F6YqD4ruaneF4J/RCj0H49zmRGBXmKBoy pJfGr8QwzaaJfM2WsmsDJW1ED7zmDcSrJuCNTF3JX+dwKUnat+jRo+AjDICpLyAt0Vmx 6zWzenNtbk0X2ivq3T7U7kmEP/jCryYPJGvvBVQxUYh19G1MFnpGy1pnauV5u9nYydKH q4Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746935868; x=1747540668; 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=pk8Os/KQV8g3d7fEWFNmmi62uW1E+WMBGyh6BXQrDnY=; b=Yv3zosIzoODVHPhO604GeEzpfxrpDTxWQVGTh4AvEddVKvTnb9bDNGa2ub6jCQ7UHp 9EVj92CXTtOsbmoHKajoQUleZ9N3p3KGI8Kr8WMCZrpBzJy870w+nOCx+qAMhEvlTtqy vziyQoKAvTXYXp93/cVO1uSoLNF6lF9CK6+DiZ0amc0nVZep0dZb8DQNnA9XbZK9hsRE BleJ2SgxC4u7nsR2omx9WkfVb6c8nYPATjCSq5kDt5bAyh12L7EA7FhNzxgyJ5zFPg6z A9fJFxhUjrz9rTJPgi8L1XQUBb1C7Mmze0f5tyJ5S/yGFjHJC7BjHtpUz5T4vVfeHBFB qKgw== X-Forwarded-Encrypted: i=1; AJvYcCWWVSx08vXCFd+CWYd2XbkWlNfaS5kG3jNwUk4Zi0jQph/24YhKyK+Ct/lOOnuhzcqO5as2trKEQWLXdguK@vger.kernel.org, AJvYcCX9rRT51qhy2Y0Hu3MpblCHAJdMGAL50jeQr/KTmBjjy6vmzX3plkLoG/peVhcaSHaW7dEPCkLgE/Jz@vger.kernel.org, AJvYcCXuJtNrA3fbLp0dPoHfs9KuY0VL0x3gjZ+eMht0Vd06xlq1Z8xEeSgYjRAC//8zx39xEf7T6jO1P1ya@vger.kernel.org X-Gm-Message-State: AOJu0YyQDgkWWmmuhS2Y4qqH/DYhd6fX3w01enrza0q3kAaTzJYLcqVt qC2f5d6bDZ9SIfxPwSNPwUDtSB3m7DepekDidW4wMWW9qaIX0/cyYF0Hur7e X-Gm-Gg: ASbGncufoWeAEIJe1pQ+/BrzQKhYUe3O8t+FWAxc0gdwM3ezK6ZB7dfpf6lmAWt+pNl 0Y81o3XKtqyWkG/Gfyc1Z+djS6Vid4pa7eJWMR4yuBPUIZv5WB3sXIDS252Y6jntNr414i+IeRc u2vo2Scm0TMSHiERKgtQvqGKWtg46gA4/z2eHMv570VpNcGvirsRNg3yG0vKbli+xVLNbmZq09D MlVOD0kBThdfynzoPImLrOw25CL8PSr5FQORDIC0DUDsELGRdCyD7bSd1x22TRkrc9pqmh0iZg4 YMenXmDaddGpUi/IupEANOPxkrlcuSRUbnSfbUgvhY6V3Szv8F5f6enCuAvHPwErPqqOKVluCVQ +1DiC2qwhofo= X-Google-Smtp-Source: AGHT+IHgD1DbRvr6b/N7zrlgQm2zrrzBhf+EbCUtMPcWsg4I47d7yiKsvb4JKwQGNpEesyBMQIUUyw== X-Received: by 2002:a05:6000:1a87:b0:3a2:6b2:e558 with SMTP id ffacd0b85a97d-3a206b2e7cbmr189612f8f.28.1746935868044; Sat, 10 May 2025 20:57:48 -0700 (PDT) Received: from tempest2.110.lan (xt27dd.stansat.pl. [83.243.39.221]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a1f5a4c76dsm8163963f8f.92.2025.05.10.20.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 May 2025 20:57:47 -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 , Shen Lichuan , Peter Zijlstra , Greg KH , Charles Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 5/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Date: Sun, 11 May 2025 05:55:48 +0200 Message-ID: <20250511035701.2607947-6-paweldembicki@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250511035701.2607947-1-paweldembicki@gmail.com> References: <20250511035701.2607947-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 --- v4: - no changes done 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 8827d5a57310..1f56aaf4dde8 100644 --- a/drivers/hwmon/pmbus/mpq8785.c +++ b/drivers/hwmon/pmbus/mpq8785.c @@ -12,9 +12,11 @@ =20 #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), }; @@ -81,6 +83,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 }, { }, @@ -88,6 +92,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 }, {} @@ -112,6 +118,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