From patchwork Tue Mar 1 18:01:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcello Sylvester Bauer X-Patchwork-Id: 12764986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7CA3C433F5 for ; Tue, 1 Mar 2022 18:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232072AbiCASCV (ORCPT ); Tue, 1 Mar 2022 13:02:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236771AbiCASCU (ORCPT ); Tue, 1 Mar 2022 13:02:20 -0500 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79E1C3F336; Tue, 1 Mar 2022 10:01:39 -0800 (PST) Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4K7Q6n6nJqz9sV3; Tue, 1 Mar 2022 19:01:37 +0100 (CET) From: Marcello Sylvester Bauer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sylv.io; s=MBO0001; t=1646157696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p97zePmp9d+cmIP2kHmhFQpvfjnvmtO8AdQThs+dFK8=; b=d4r/5BHJSFvayCukRPPSEHOCvNQOh70bHqFz7Lqh0cNdl08zR2gZjgdKhofzZhwjJfrSQD UvT8TkO9R1jmGB27jGObWOFTKLEu3JBipdrF5Sau8uCaCf76pz+j3v+F+NXeeBjIs7rDru ExCs7POuUUeZ3/X/EbQBAeiNoIixVV+FR7ddpmfrocfDid6evuHJ64NgfeIxu2KN06bEN9 w9VOyUsmxqwdqB+riv0/VG/1tbiCd97oxY91nJcduuubyscFIvoKJ+DQCQ3+pc+Ehgi0Ai Fuj/GRcc4fUByfmw11FXlkeMiKxZZZ6sMkGAnOfEt5+HUpBLXXYwDYgUYa3VPg== To: Guenter Roeck , Jean Delvare , Rob Herring Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Marcello Sylvester Bauer , Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v3 1/3] dt-bindings: trivial-devices: Add xdpe11280 Date: Tue, 1 Mar 2022 19:01:11 +0100 Message-Id: <81c0523ba790965a371d267bb1944652d80f5f72.1646157237.git.sylv@sylv.io> In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add Infineon Multi-phase Digital Controller XDPE11280. Signed-off-by: Marcello Sylvester Bauer Acked-by: Rob Herring --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 1c49bbc654ee..da929cb08463 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -137,6 +137,8 @@ properties: - infineon,slb9645tt # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor - infineon,tlv493d-a1b6 + # Infineon Multi-phase Digital VR Controller xdpe11280 + - infineon,xdpe11280 # Infineon Multi-phase Digital VR Controller xdpe12254 - infineon,xdpe12254 # Infineon Multi-phase Digital VR Controller xdpe12284 From patchwork Tue Mar 1 18:01:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcello Sylvester Bauer X-Patchwork-Id: 12764988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B838C433EF for ; Tue, 1 Mar 2022 18:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236791AbiCASCX (ORCPT ); Tue, 1 Mar 2022 13:02:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236785AbiCASCX (ORCPT ); Tue, 1 Mar 2022 13:02:23 -0500 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC123F336; Tue, 1 Mar 2022 10:01:41 -0800 (PST) Received: from smtp202.mailbox.org (smtp202.mailbox.org [80.241.60.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4K7Q6q4LcMz9sTM; Tue, 1 Mar 2022 19:01:39 +0100 (CET) From: Marcello Sylvester Bauer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sylv.io; s=MBO0001; t=1646157697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gd09qvc3Z6SaSzk9E+3whnDKKoWn8INGP5nwCpQZBzc=; b=bbXmRNKtow7THbBZJ9jfYyKdAauLCgEs2w2wPE8J5bo047Totoh42oZvmq7DwdXIZ/KRMu w6YRKnkr8kuOrA4bVJXxBL3An4fcNJ36iHsZcXTv9gS/2VJdeXPxD1cSkFQz4reF6aKuCu rW19d4klWcXG8MQx8QLXq91XxEDPKR/5Rrq6Rglfln5wKK+SdlmMSX3GJbIcVdYSJ+Dc5Q FO7fjt4iULPBLZoFRE3UOop5jtFP4Uvp8+KZ7H/ky1IKS3yIuhl4oAl7SNY6WZg5mE0PSm HK2knAiDOrsNgujMtWOitL9oe6OxxpXpOyud/WCE47iI9fmLZDHJwBNX8HmLMQ== To: Guenter Roeck , Jean Delvare , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Marcello Sylvester Bauer , linux-doc@vger.kernel.org Subject: [PATCH v3 2/3] hwmon (xdpe12284): Add support for xdpe11280 Date: Tue, 1 Mar 2022 19:01:12 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during probing and set the xdpe122 related pointers in case it uses vid. Signed-off-by: Marcello Sylvester Bauer --- Documentation/hwmon/xdpe12284.rst | 12 ++++++++---- drivers/hwmon/pmbus/xdpe12284.c | 22 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Documentation/hwmon/xdpe12284.rst b/Documentation/hwmon/xdpe12284.rst index 67d1f87808e5..a224dc74ad35 100644 --- a/Documentation/hwmon/xdpe12284.rst +++ b/Documentation/hwmon/xdpe12284.rst @@ -5,6 +5,10 @@ Kernel driver xdpe122 Supported chips: + * Infineon XDPE11280 + + Prefix: 'xdpe11280' + * Infineon XDPE12254 Prefix: 'xdpe12254' @@ -20,10 +24,10 @@ Authors: Description ----------- -This driver implements support for Infineon Multi-phase XDPE122 family -dual loop voltage regulators. -The family includes XDPE12284 and XDPE12254 devices. -The devices from this family complaint with: +This driver implements support for Infineon Multi-phase XDPE112 and XDPE122 +family dual loop voltage regulators. +These families include XDPE11280, XDPE12284 and XDPE12254 devices. +The devices from this family compliant with: - Intel VR13 and VR13HC rev 1.3, IMVP8 rev 1.2 and IMPVP9 rev 1.3 DC-DC converter specification. diff --git a/drivers/hwmon/pmbus/xdpe12284.c b/drivers/hwmon/pmbus/xdpe12284.c index b07da06a40c9..3413aba9d5be 100644 --- a/drivers/hwmon/pmbus/xdpe12284.c +++ b/drivers/hwmon/pmbus/xdpe12284.c @@ -110,7 +110,6 @@ static int xdpe122_identify(struct i2c_client *client, static struct pmbus_driver_info xdpe122_info = { .pages = XDPE122_PAGE_NUM, .format[PSC_VOLTAGE_IN] = linear, - .format[PSC_VOLTAGE_OUT] = vid, .format[PSC_TEMPERATURE] = linear, .format[PSC_CURRENT_IN] = linear, .format[PSC_CURRENT_OUT] = linear, @@ -123,23 +122,39 @@ static struct pmbus_driver_info xdpe122_info = { PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT, - .identify = xdpe122_identify, - .read_word_data = xdpe122_read_word_data, }; static int xdpe122_probe(struct i2c_client *client) { struct pmbus_driver_info *info; + int vout_mode; info = devm_kmemdup(&client->dev, &xdpe122_info, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; + vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE); + if (vout_mode >= 0 && vout_mode != 0xff) { + switch (vout_mode >> 5) { + case 0: + info->format[PSC_VOLTAGE_OUT] = linear; + break; + case 1: + info->format[PSC_VOLTAGE_OUT] = vid; + info->identify = xdpe122_identify; + info->read_word_data = xdpe122_read_word_data; + break; + default: + return -ENODEV; + } + } + return pmbus_do_probe(client, info); } static const struct i2c_device_id xdpe122_id[] = { + {"xdpe11280", 0}, {"xdpe12254", 0}, {"xdpe12284", 0}, {} @@ -148,6 +163,7 @@ static const struct i2c_device_id xdpe122_id[] = { MODULE_DEVICE_TABLE(i2c, xdpe122_id); static const struct of_device_id __maybe_unused xdpe122_of_match[] = { + {.compatible = "infineon,xdpe11280"}, {.compatible = "infineon,xdpe12254"}, {.compatible = "infineon,xdpe12284"}, {} From patchwork Tue Mar 1 18:01:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcello Sylvester Bauer X-Patchwork-Id: 12764989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBE6C43219 for ; Tue, 1 Mar 2022 18:01:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236794AbiCASCY (ORCPT ); Tue, 1 Mar 2022 13:02:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236786AbiCASCX (ORCPT ); Tue, 1 Mar 2022 13:02:23 -0500 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1596C3FD8F; Tue, 1 Mar 2022 10:01:42 -0800 (PST) Received: from smtp202.mailbox.org (smtp202.mailbox.org [80.241.60.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4K7Q6r4FqXz9sTd; Tue, 1 Mar 2022 19:01:40 +0100 (CET) From: Marcello Sylvester Bauer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sylv.io; s=MBO0001; t=1646157698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0gXkkSMWRwsd/tK/1tooWVlC8FpM5vy2KBjzcgp2LuE=; b=iAe/jQEv/SOKEvJJxcCaOC9cqlf7zBIUnz89K/4vNVb+P5N3wkxIDYNcOq/UhMzcWLhnQ8 TSIE8eqxkO/6hINImIbSLxACJ4/Gnj7nDroOJms5/iRanIbiF8L5G50wnWublWX8cX9YrH +0rWWGb2r5W8pdezQyUP8fdOeb7tGNsd+aSpZI/QQWLbG6lOjdfWV+v0n47vwK9HXw5lNr qKHdQgnyFvE6CHyoXdg/NRvVKpywZxT1yqYU4x9wc8HBsoyx+NG4Qit4eo09tE2mXLwrd4 c6XbXuMP+wV2OLd9COXQ4jILyYpioVIcBYL2TWxTndhVQttY6NjL6VCb6uhl9A== To: Guenter Roeck , Jean Delvare Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph , Marcello Sylvester Bauer Subject: [PATCH v3 3/3] hwmon (xdpe12284): Add regulator support Date: Tue, 1 Mar 2022 19:01:13 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add simple on/off regulator support for xdpe12284 and other pmbus parts supported by the xdpe12284 driver. Signed-off-by: Marcello Sylvester Bauer --- drivers/hwmon/pmbus/Kconfig | 6 ++++++ drivers/hwmon/pmbus/xdpe12284.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 6552467c588d..a2ea1d5a8765 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -417,6 +417,12 @@ config SENSORS_XDPE122 This driver can also be built as a module. If so, the module will be called xdpe12284. +config SENSORS_XDPE122_REGULATOR + bool "Regulator support for XDPE122 and compatibles" + depends on SENSORS_XDPE122 && REGULATOR + help + Uses the xdpe12284 or compatible as regulator. + config SENSORS_ZL6100 tristate "Intersil ZL6100 and compatibles" help diff --git a/drivers/hwmon/pmbus/xdpe12284.c b/drivers/hwmon/pmbus/xdpe12284.c index 3413aba9d5be..495c62005aed 100644 --- a/drivers/hwmon/pmbus/xdpe12284.c +++ b/drivers/hwmon/pmbus/xdpe12284.c @@ -10,6 +10,8 @@ #include #include #include +#include + #include "pmbus.h" #define XDPE122_PROT_VR12_5MV 0x01 /* VR12.0 mode, 5-mV DAC */ @@ -107,6 +109,11 @@ static int xdpe122_identify(struct i2c_client *client, return 0; } +static const struct regulator_desc xdpe122_reg_desc[] = { + PMBUS_REGULATOR("vout", 0), + PMBUS_REGULATOR("vout", 1), +}; + static struct pmbus_driver_info xdpe122_info = { .pages = XDPE122_PAGE_NUM, .format[PSC_VOLTAGE_IN] = linear, @@ -122,6 +129,10 @@ static struct pmbus_driver_info xdpe122_info = { PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT, +#if IS_ENABLED(CONFIG_SENSORS_XDPE122_REGULATOR) + .num_regulators = 2, + .reg_desc = xdpe122_reg_desc, +#endif }; static int xdpe122_probe(struct i2c_client *client)