Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp4148122pxm; Tue, 1 Mar 2022 12:18:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHlji0FLwitjVEzAqFPtkA17GXOC5/iE+LseGwaZsJuo5/BOWKTM1AkYEOMPehLXwLui4w X-Received: by 2002:a50:cfc5:0:b0:414:83de:22c3 with SMTP id i5-20020a50cfc5000000b0041483de22c3mr4809437edk.241.1646165901523; Tue, 01 Mar 2022 12:18:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646165901; cv=none; d=google.com; s=arc-20160816; b=b3nSByA5eVVDfUkek3lAWALfNMPiZCCq2KBlO/UV40qYHhqnV6zfyNBW2aveeMapcY ElHHs/8rKbcTnlQisHW8Xuqi56yGJkSfYgh76kQRaUQsdxAQiAENXVMwMQd/ZnFSANWM O8F1/3l82p9dub+bYNp12rQy4G/1cMY3r+RnCq968w8ImADjbOaVDrxvdZIDlW2uzz9C tc7oEFBt1mxdPUbjxgOeYgGyQOOG/NY5kcD0KtSfGL2qBkvQwdRGLJbnJPoidS049nMR Hkw2oa4oCcYRR3jNsKwed5sjq8LRoNVyLOtPK/LxtXDmn5A1PFg2rAmmy9C4iLlXNMJO zmiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :from; bh=0gXkkSMWRwsd/tK/1tooWVlC8FpM5vy2KBjzcgp2LuE=; b=M/Qsn0PbC1P82wskLkP2mIj+QkBmKPkLUuX9T2PqGs4rkzYCUvhBpEZQRFNWizTGCl 49W48hEBgS1r/1XR04K46NNy1qwDamqg8JigS3magFewUHMZFXzQGEV9rgB1D4Hl6nuI ARpgCBDRoAkFnjz3ZHbyFzpzQSoqDGKi1g0tHdOu/ShBjUx+Gcheqh66tFeAeXHO4LrW POL2oGp+CEi6Y1sPlpsMdFJ0r75EmtsN0gtTvkj2W/nVuS48UNFgZhOzZQ3KK79oREaz zL53m82UuYyUt7EeUURi6LwmDzbM/SPA7SwuDmOK5ftfD4dKFNKjUnYJJUextDAilSeD 5QAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sylv.io header.s=MBO0001 header.b="iAe/jQEv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sylv.io Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc9-20020a056402204900b00410d5c3f76dsi8916987edb.126.2022.03.01.12.17.56; Tue, 01 Mar 2022 12:18:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sylv.io header.s=MBO0001 header.b="iAe/jQEv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sylv.io Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236802AbiCASC1 (ORCPT + 99 others); Tue, 1 Mar 2022 13:02:27 -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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) -- 2.35.1