From nobody Thu Apr 2 05:56:53 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.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 A059735B125 for ; Mon, 30 Mar 2026 10:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774866257; cv=none; b=du3xVaBVgwKK+8snVFsuKKr/IAYwNk650yFqwZI8znOzUyCEk5UZ1w477hsY7zo01lyk9fU/NGAXx06FuCDfQD2RciMD/SLkvFtzXXSR9G5a8VOudMn4qUTn0VF2UyPU1TdnJgfsl0QkDf38QYaFmSasL5SL3PIJFyoLj9cQ4Io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774866257; c=relaxed/simple; bh=WIm6RubI/tLAJHS5ewOY+I8EBIbSNInquvgffjL+6y0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=j67bhMsn0LMdkniiEXLIv+9+I2aO1JHvAeL2Ut1YFYeSuFSJn0nmwJro2C9tgY1mIiIwljwgyhWUoxdu3GfWfByagN7w2n1+Zm1s9nklTHlwTPNcnWH4IZpCqbcxgdO19YXZF1egyg4OOYIii3OvluDKmfQWhAablELNIiU8xIo= 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=Z7yMvNwI; arc=none smtp.client-ip=209.85.216.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="Z7yMvNwI" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-35d932cc948so1196829a91.2 for ; Mon, 30 Mar 2026 03:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774866256; x=1775471056; 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=CMUKD+43+H0oR5S99IJHORhT0x6zEEBwVqT64sGew7c=; b=Z7yMvNwIj9ZZR6Q1eCXleC13Ad5Dn+ncnOAM68ke5c5pvUXMyAz8f3Rjo5jJ+INtKt 7MSyMYhOs8WZ2mNgncSOw1TkpOs2Ie76kchs9MYCc5CDkTTGBx89S9eZFc38aoflGGOQ K7PEJy1Bi/CEDKCh46Sea3g64/ZLBiTZhkixghbn4vmneKuGKLgu1IH0pY3tHgRQK6a9 JAV4VI/yKlAMVtN49Aw/IOncktTy31saoUyDQ1ZFK6zrTQB/VnQgVkqlp9jQH28kOKaI G4NrvOOn5zmSpkOowWAezj+FwuWVnxrzDSvgBGzTRVpzmGm4hqPWD5McZ4X5marYKLrk iFUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774866256; x=1775471056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CMUKD+43+H0oR5S99IJHORhT0x6zEEBwVqT64sGew7c=; b=me+VRskE0aiEW3RuupUoCBOMwHCXkQIbzQ+6/z8x4J2IHjF0/n4j/zJie9hD5IyEFF tfOv3RtaUnWlmpyQPurTrhrtxstVD8n9+tv57nCMuvMQZJ6WVOYoHO1Mhq/546x6vE6h USl6/Wg6ZfwGWYlr90sjKg7PfRrpbvLncC6nVtG7GUfpQA3ia1IdCp1hH95aQNreg9f/ 3QfWEnCxa/lz+tgltwi3qhwbfRnFpVaKVdrohFRPORjpwmtTKPxhZx6RHsZfSxTr2UXL 2rB92OKUEaf6kQLvwUyPvbLtffVZwIguje6ZFm+gyWL4ItKgWgwcf9waczsqSqOVYnlw mmMQ== X-Forwarded-Encrypted: i=1; AJvYcCUuc7EMvjNKOw/6HgwwXM9ZgPBkXr0/8UUx2ylbHQeN0G015Y0C2HiMapFAZTa+FlDysBqetYCVaBlNO6E=@vger.kernel.org X-Gm-Message-State: AOJu0YxvPllRHatnR0rdQyotSsokaKPT8+qVSDNe46qDOZVY16C0E/+2 MTazd4hURDz2Yew/h/Q7LWQEdHzfbOfU+q96E/O6fG+gnP9oOJJdhykF X-Gm-Gg: ATEYQzwNnCJC6wdD1jPZoG87cUTfDt7sgK4NzzvN3Q17geB/6gkc1hzvwhnmViQRXIC 8UcRGF91gewO1K6Xa9HhCZ8KUPCTrF/Kcj8XAibooAkPikHKX1JBOyYP5aarUfts0V8pBR1AieT Xh261KLicPbFoZCpEAZoQPnRc+XmMWBlWaidGf2N9b3wp+Be+1aVaFcKjmoXyY+dm94L38Wj5AA j+IkosWa9lJNGNPnewmYXtEixJFjeX5gPi3EI5JHfPPqaJdWgXf3GzNMUV916JR7p9ABYvebg+X tLTvwoU2OcS3tWs65S32SrckR/ucToJzJJf4mZ3fHv4i7YrI+wwjdftUIFGshIOTp53ykL5W1hd tJeKLUUweb42CLSN73CYQkviMAA0Z6O+BAQYeaoiGFfbGrwlW5qIq45/Hzp+9C2eRQLJZlH/dPE R79bDmR/qgrGzcvWvazVVva1rg6dnBSTTUL6WhG9WRMYAudg== X-Received: by 2002:a17:90b:39cc:b0:353:356c:6821 with SMTP id 98e67ed59e1d1-35c2ffd0ec7mr11801460a91.8.1774866255957; Mon, 30 Mar 2026 03:24:15 -0700 (PDT) Received: from localhost.localdomain ([2401:4900:93c7:f319:97ce:1434:43e8:eab7]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35da9ef1b70sm2487452a91.16.2026.03.30.03.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 03:24:15 -0700 (PDT) From: ASHISH YADAV X-Google-Original-From: ASHISH YADAV To: Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ashish Yadav Subject: [PATCH 1/2] dt-bindings: hwmon/pmbus: Add Infineon XDP720 Date: Mon, 30 Mar 2026 15:53:44 +0530 Message-Id: <20260330102345.37065-2-Ashish.Yadav@infineon.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260330102345.37065-1-Ashish.Yadav@infineon.com> References: <20260330102345.37065-1-Ashish.Yadav@infineon.com> 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 From: Ashish Yadav Add documentation for the device tree binding of the XDP720 eFuse. Signed-off-by: Ashish Yadav --- This patch introduces a YAML schema describing the required and optional properties for the XDP720 eFuse device node. It includes details on the compatible string, register mapping, and rimon-micro-ohms(RIMON). The RIMON resistance is installed between the Imon pin and the ground reference. --- .../bindings/hwmon/pmbus/infineon,xdp720.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/infineon,= xdp720.yaml diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.= yaml b/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml new file mode 100644 index 000000000000..09249a326eee --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/pmbus/infineon,xdp720.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- + +$id: http://devicetree.org/schemas/hwmon/pmbus/infineon,xdp720.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Infineon XDP720 Digital eFuse Controller + +maintainers: + - Ashish Yadav + +description: | + The XDP720 is an eFuse with integrated current sensor and digital + controller. It provides accurate system telemetry (V, I, P, T) and + reports analog current at the IMON pin for post-processing. + + Datasheet: + https://www.infineon.com/assets/row/public/documents/24/49/infineon-x= dp720-001-datasheet-en.pdf + +properties: + compatible: + enum: + - infineon,xdp720 + + reg: + maxItems: 1 + + infineon,rimon-micro-ohms: + description: | + The value of the RIMON resistor, in micro=E2=80=91ohms, required to = enable + the system=E2=80=99s over=E2=80=91current protection. + $ref: /schemas/types.yaml#/definitions/uint32 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + hwmon@11 { + compatible =3D "infineon,xdp720"; + reg =3D <0x11>; + infineon,rimon-micro-ohms =3D <1098000000>; /* 1.098k ohm */ + }; + }; --=20 2.39.5 From nobody Thu Apr 2 05:56:53 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.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 5A5543B52E0 for ; Mon, 30 Mar 2026 10:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774866265; cv=none; b=CypoXZVMTzX1JS6NDYRFNQdshR5N3Oinz4PuTqx5s1y+UFugXutk3FgRqisJYH8rO8Fg3CGGpO5dPEH8gEgoyticza3M/6TodbGcvgt5c+7szbh8e7PKuhAmHW6SYAQ9ia5HOXDufzFdv1UJKRHDpUSC+9Nvj7yNEYR2MU7x4NU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774866265; c=relaxed/simple; bh=VMluzEO+vXScleCPbSoiPiWKvNB37BOBgsT+f6Aumbg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rudAO0RRbyNNhAWMagxtktuwfDX7uNbOSV64NFsItDLRuBHMzAdrOufniBqPBaW0kAYLpEAVVm8FpgNKgSSV4fDygzWLZtPPKvGqVAQ4F3utKcTdjCmNsT1drO7cRNnH0NHenaxfHUNSF0QtCuOOsD/m1QISdLVD4aQJ43ZEKAQ= 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=QUwbvQ8O; arc=none smtp.client-ip=209.85.216.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="QUwbvQ8O" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-35d932cc948so1196916a91.2 for ; Mon, 30 Mar 2026 03:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774866264; x=1775471064; 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=FuV6S8ARQhcEDtqDMV4JUy18vQg5CHRAe10eKnzkrUw=; b=QUwbvQ8O2WijVRF1EWUCh+QGPcsjNOG8Qm7uJN0UfISVHDtseEaHjj/duJzqxjLwBJ IhKjXuMvBpcQ2vCPWI36sp7z/uBec1GjAC1O6im6Slcm/mN5xx+JkeJ5aRRPr1D0WIrh HANPoT8LTIvxtBabmVKj0qsoUQ0kTCabe64X950pdkE5izsAF3QAtFvY05fZVH2QXBsq QNJdgvNg9Gfnli8ZG4utYcIhkjiWFGJK/DAD4P5mGj/hN+68YTrZIYSL0eI+BUp81+SW qIIPXHwzQwmLa3MldlFpRO4OJVhjkxJJdbfIOeilhDKjDB3ixy1f7BiyABA627WfvQYu j8Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774866264; x=1775471064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FuV6S8ARQhcEDtqDMV4JUy18vQg5CHRAe10eKnzkrUw=; b=am4V90xSu5d3pEPnCAp7rlkAKjhXQOZgpjGqQtqLg21zLZfxeNtw1yRWw45m171D3g 2GvGKKhOIMNjai27+bJOCKSCW4WKdUniWoyRUA6i/PW2DA0CCoSZGqleXf1DlRLyFe+j 46L7s163ENGkahMr0kicaJOfO9+wEw6NJJI03tPd4J3FwWNCLrlv2ESEfa821qpZhNZz KOlwdXDaqtI9jBTMWWT85u6KLnNQAYo/tybVZppkE4qB0d2/K0A2iErTDxK/ZBBRClcb ktW139DOeQXIuZE9PJVB5M9VLGex4PbcOI7kJbCZGiTNTf2LyzJj184cWk4UCB+/JYW9 1HmQ== X-Forwarded-Encrypted: i=1; AJvYcCW8woKBA0mmlVygV82fK4RgZGuG0xD1FqHPznPg9kG5FCbrnvLnPdBYr12Lh5gk1c6A0DFqwIWeUoewGYc=@vger.kernel.org X-Gm-Message-State: AOJu0YziyUq2ScPEUD2Sh+rU2OTlIZMGa0wR0OJXWOlMAaYR1XnJkdR3 AZZZfraLeWCc4XcZTfdMnjCTJ+YWdTMKKNgKpzptjDnGlJMCDg30Oit1 X-Gm-Gg: ATEYQzysRAzxyP723/76mpFki2jtOflKgdazeyO/yJW0AfNop0zECXXeC73H0VpSfdr Am1PlCWjfGbuK8tCJwzEbbTlk2WslwMxnxSYNA2I4EZBK+uRl/2YJKmgtuTIucbm9CimsZoubL0 ol3JIHDUYaSO82Ga70X5yaeOwGu3dYmZJlibDGoJLUJ/As1fRRDHei2Mw/aGMLX0OzzbGQn5h8n pKnyXfsauJzMHG/Up2O/4yivJtCyA0tZOPBaZdBV+GNKOy14dRK2IirDYn8kDaxKRarghfyv6e9 MKgf6b47tF9gY/1mUlm/TwLRAwf8c9reP2pDdHzLxMZyezBM/kqDin8k9iKHHfw7lbUf/E/iQlh pPN2539yZgDs1nqAjKAiVrn33qErF/JS9X8M+rGKHrc4chXsJZGYTOT3UBRjzgEiQbeWznEgYC5 ytqslcvSSLIJZCcPSkxFFFWDgvmS4wa9WuegK/AJsRrtONrw== X-Received: by 2002:a17:90b:4b0d:b0:35b:e5ba:c0c8 with SMTP id 98e67ed59e1d1-35c3010dc26mr10692038a91.28.1774866263357; Mon, 30 Mar 2026 03:24:23 -0700 (PDT) Received: from localhost.localdomain ([2401:4900:93c7:f319:97ce:1434:43e8:eab7]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35da9ef1b70sm2487452a91.16.2026.03.30.03.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 03:24:22 -0700 (PDT) From: ASHISH YADAV X-Google-Original-From: ASHISH YADAV To: Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ashish Yadav Subject: [PATCH 2/2] hwmon:(pmbus/xdp720) Add support for efuse xdp720 Date: Mon, 30 Mar 2026 15:53:45 +0530 Message-Id: <20260330102345.37065-3-Ashish.Yadav@infineon.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260330102345.37065-1-Ashish.Yadav@infineon.com> References: <20260330102345.37065-1-Ashish.Yadav@infineon.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" From: Ashish Yadav Add the pmbus driver for Infineon XDP720 Digital eFuse Controller. Signed-off-by: Ashish Yadav --- XDP720 Digital eFuse Controller provides accurate system telemetry (V, I, P, T) and reports analog current at the IMON pin for post-processing. The Current and Power measurement depends on the RIMON and GIMON values. Please look into data sheet sections 5.4.2 and 5.4.4 for more details: https://www.infineon.com/assets/row/public/documents/24/49/infineon-xdp720-= 001-datasheet-en.pdf The GIMON (microA/A) depends on the 10th bit of TELEMETRY_AVG PMBUS Registe= r. The value of RIMON (kohm) can be provided by the user through device tree u= sing infineon,rimon-micro-ohms property. --- drivers/hwmon/pmbus/Kconfig | 9 +++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/xdp720.c | 122 +++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 drivers/hwmon/pmbus/xdp720.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index fc1273abe357..c8e53852d0c3 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -702,6 +702,15 @@ config SENSORS_XDP710 This driver can also be built as a module. If so, the module will be called xdp710. =20 +config SENSORS_XDP720 + tristate "Infineon XDP720 family" + help + If you say yes here you get hardware monitoring support for Infi= neon + XDP720. + + This driver can also be built as a module. If so, the module will + be called xdp720. + config SENSORS_XDPE152 tristate "Infineon XDPE152 family" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index d6c86924f887..bb0a7526d5b3 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -68,6 +68,7 @@ obj-$(CONFIG_SENSORS_TPS546D24) +=3D tps546d24.o obj-$(CONFIG_SENSORS_UCD9000) +=3D ucd9000.o obj-$(CONFIG_SENSORS_UCD9200) +=3D ucd9200.o obj-$(CONFIG_SENSORS_XDP710) +=3D xdp710.o +obj-$(CONFIG_SENSORS_XDP720) +=3D xdp720.o obj-$(CONFIG_SENSORS_XDPE122) +=3D xdpe12284.o obj-$(CONFIG_SENSORS_XDPE152) +=3D xdpe152c4.o obj-$(CONFIG_SENSORS_ZL6100) +=3D zl6100.o diff --git a/drivers/hwmon/pmbus/xdp720.c b/drivers/hwmon/pmbus/xdp720.c new file mode 100644 index 000000000000..862de828198d --- /dev/null +++ b/drivers/hwmon/pmbus/xdp720.c @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Hardware monitoring driver for Infineon XDP720 Digital eFuse Controller + * + * Copyright (c) 2026 Infineon Technologies. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + +/* + * The IMON resistor required to generate the system overcurrent protectio= n. + * Arbitrary default Rimon value: 2k Ohm + */ +#define XDP720_DEFAULT_RIMON 2000000000 /* 2k ohm */ +#define XDP720_TELEMETRY_AVG 0xE9 + +static struct pmbus_driver_info xdp720_info =3D { + .pages =3D 1, + .format[PSC_VOLTAGE_IN] =3D direct, + .format[PSC_VOLTAGE_OUT] =3D direct, + .format[PSC_CURRENT_OUT] =3D direct, + .format[PSC_POWER] =3D direct, + .format[PSC_TEMPERATURE] =3D direct, + + .m[PSC_VOLTAGE_IN] =3D 4653, + .b[PSC_VOLTAGE_IN] =3D 0, + .R[PSC_VOLTAGE_IN] =3D -2, + .m[PSC_VOLTAGE_OUT] =3D 4653, + .b[PSC_VOLTAGE_OUT] =3D 0, + .R[PSC_VOLTAGE_OUT] =3D -2, + /* + * Current and Power measurement depends on the RIMON (kOhm) and + * GIMON(microA/A) values. + */ + .m[PSC_CURRENT_OUT] =3D 24668, + .b[PSC_CURRENT_OUT] =3D 0, + .R[PSC_CURRENT_OUT] =3D -4, + .m[PSC_POWER] =3D 4486, + .b[PSC_POWER] =3D 0, + .R[PSC_POWER] =3D -1, + .m[PSC_TEMPERATURE] =3D 54, + .b[PSC_TEMPERATURE] =3D 22521, + .R[PSC_TEMPERATURE] =3D -1, + + .func[0] =3D PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_PIN | + PMBUS_HAVE_TEMP | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_INPUT | + PMBUS_HAVE_STATUS_TEMP, +}; + +static int xdp720_probe(struct i2c_client *client) +{ + struct pmbus_driver_info *info; + int ret; + u32 rimon; + int gimon; + + info =3D devm_kmemdup(&client->dev, &xdp720_info, sizeof(*info), + GFP_KERNEL); + if (!info) + return -ENOMEM; + + ret =3D i2c_smbus_read_word_data(client, XDP720_TELEMETRY_AVG); + if (ret < 0) { + dev_err(&client->dev, "Can't get TELEMETRY_AVG\n"); + return ret; + } + + ret >>=3D 10; /* 10th bit of TELEMETRY_AVG REG for GIMON Value */ + ret &=3D GENMASK(0, 0); + if (ret =3D=3D 1) + gimon =3D 18200; /* output gain 18.2 microA/A */ + else + gimon =3D 9100; /* output gain 9.1 microA/A */ + + if (of_property_read_u32(client->dev.of_node, + "infineon,rimon-micro-ohms", &rimon)) + rimon =3D XDP720_DEFAULT_RIMON; /* Default if not set via DT */ + if (rimon =3D=3D 0) + return -EINVAL; + + /* Adapt the current and power scale for each instance */ + info->m[PSC_CURRENT_OUT] =3D DIV_ROUND_CLOSEST_ULL((u64) + info->m[PSC_CURRENT_OUT] * rimon * gimon, 1000000000000); + info->m[PSC_POWER] =3D DIV_ROUND_CLOSEST_ULL((u64) + info->m[PSC_POWER] * rimon * gimon, 1000000000000); + + return pmbus_do_probe(client, info); +} + +static const struct of_device_id xdp720_of_match[] =3D { + { .compatible =3D "infineon,xdp720" }, + {} +}; + +static const struct i2c_device_id xdp720_id[] =3D { + { "xdp720" }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, xdp720_id); + +static struct i2c_driver xdp720_driver =3D { + .driver =3D { + .name =3D "xdp720", + .of_match_table =3D xdp720_of_match, + }, + .probe =3D xdp720_probe, + .id_table =3D xdp720_id, +}; + +module_i2c_driver(xdp720_driver); + +MODULE_AUTHOR("Ashish Yadav "); +MODULE_DESCRIPTION("PMBus driver for Infineon Digital eFuse Controller"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("PMBUS"); --=20 2.39.5