Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp97341pxm; Fri, 25 Feb 2022 04:46:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYiUoIJUue2UiJP9X+R4y/Do+ruX7hRpQwxUVJrEKxIosmLneL3XoIKffnODlC1unxctfN X-Received: by 2002:a17:907:1de9:b0:6b9:e4f:25ec with SMTP id og41-20020a1709071de900b006b90e4f25ecmr5935999ejc.741.1645793176387; Fri, 25 Feb 2022 04:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645793176; cv=none; d=google.com; s=arc-20160816; b=g+wAN4RQqDt23OknUdZDOLTc8JEFG1uE0mdTAHWCD7zq4HUNHAaaYqpn2yJ0ng8R23 GtFgZA9NfU2YVJYYG4yK88bRgyNaF+OuPm8tPy41BHdUACWsF3wKKMQxFjQv6ud+ysgk VfSoI0FK3BEYjS+JRyYk4ZmfBTIAJZJBpyNEVygRkPcADdFrq5YeSjFrfIPuKZlDwVFQ HKAHvc0R0QErE3lHFwaGdVrhrt3r5T0EMU+9GppBfO5l6FqI/ngiBelWVD7pvRyCJf6s pEzZ9nD3qrazm7RSG8gE9oA7imh7mXe2D8kNDnjTFkranTEHR5dIawBJ11Ywe/H0gi1Z W3dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=wYVJphdnC3WyxYFo08m/0+nXWlP/kcAa+yXhJqXCzb4=; b=v8U2WN+fqaQBl6phMDJt5qXAnNlHFw82bY4La5YoNrVeWZiZO93ck9yAIgNTYf/u5l lEz4vmd1v/IXWm5YaA7ZN+CoHyCqZ0s373qMtDnu3UXz5rxgG/Hehi29FrIiXpBJr0I2 2WrjiPzBYveGwWPWDLowzYc2GhuRe913kTEFxAbR1dhQmhGoYaPXqcqbiMUzD7EZl+V2 XVpFdlqlQIUxOaa5jCmzu/teMdtDKF9S8RsS73YvDlWcKwgBNm9HS/8sdNjO+H6FCpyV okM4+Y2+8C/wcrpyredXADcINJaB7h68TkftfDecy6GRZw/NyxsHIZp4+awrVUtZbv22 djeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BP9jkfkK; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ky6-20020a170907778600b006d0038b38e8si1370064ejc.400.2022.02.25.04.45.52; Fri, 25 Feb 2022 04:46:16 -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=@gmail.com header.s=20210112 header.b=BP9jkfkK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233878AbiBXT0Z (ORCPT + 99 others); Thu, 24 Feb 2022 14:26:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbiBXT0X (ORCPT ); Thu, 24 Feb 2022 14:26:23 -0500 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0397B24FB88; Thu, 24 Feb 2022 11:25:53 -0800 (PST) Received: by mail-oi1-x22b.google.com with SMTP id y7so4422125oih.5; Thu, 24 Feb 2022 11:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wYVJphdnC3WyxYFo08m/0+nXWlP/kcAa+yXhJqXCzb4=; b=BP9jkfkKdOF3lr6ne3AVGr49UF2GaGQO+3XzS46vmSPi6v5DO0RFwkfCTc6/haxsnn +YqgyC0nEmy6e7yZSBs8TUimhrxVz2wtiPz+/uAxBuhlbR3+UAR5k0YjGNZfRYzQnpE4 f9/asWaiZMPW6BD345v9ecbBH8WTspjaBrf3oC6n4x08+71at7QkksKbYU+0cdb1gFfA K9zD+355irL13roJIFaIxp783J0jrDPUe+XjhceZ8FyCNU0SHkWNTUZWdVFgsHexxF7V C1wuCDfuqZdsD/7iOjDxAyNG86XOoUw9sJouwzwWMnXEKvGehOxmA9MRIF9Mxf1hV2r4 byPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=wYVJphdnC3WyxYFo08m/0+nXWlP/kcAa+yXhJqXCzb4=; b=HB/Ek3URc+t/QCUVYOE001MfldaZIbN9Nx4NqlZa+icBaMPSNqJz/SJaDD0e8sbAfH edah3i7+LrMHzLAYyDkdMoKx7HrnjWYPkT5OFnqX0gt6amqxVzA3uXSCp/IGd2diQYTp jINzT6KnSEjfxBtqXWo4bDKsW8aKeCdDiTjq3ct2vSd7R47pacbLoOBZnz3WPXK2Ph2l 1aysIFRMTOETJcYBmxg0Nhm3liq7xI6REcRySE6BLzuuyAzE5AGXbDDiSzQy1EhCvTGA wpomZxBmLxQgyXRxLGpvoymvCeaBWAdubmI5t/Mxsm17lXwkpsTgSWJdAnOclY3BKGUY 04MQ== X-Gm-Message-State: AOAM533Bpti7Yc+dMVOgMpjcFkrSuatW9dfIGbttUJIFyrFrNs3Mk2NK GXLsIfuDzaRwXhEQmtmzBpQ= X-Received: by 2002:a05:6870:6017:b0:d3:d393:9680 with SMTP id t23-20020a056870601700b000d3d3939680mr6730560oaa.343.1645730752410; Thu, 24 Feb 2022 11:25:52 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id dy16-20020a056870c79000b000d273fb9e95sm263733oab.7.2022.02.24.11.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 11:25:51 -0800 (PST) Sender: Guenter Roeck Date: Thu, 24 Feb 2022 11:25:50 -0800 From: Guenter Roeck To: Marcello Sylvester Bauer Cc: Jean Delvare , linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph Subject: Re: [PATCH v4 4/4] pmbus (pli1209bc): Add regulator support Message-ID: <20220224192550.GA1942763@roeck-us.net> References: <21b0cdb6dd72654effa451d3b1636ecd07b160e9.1645435888.git.sylv@sylv.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21b0cdb6dd72654effa451d3b1636ecd07b160e9.1645435888.git.sylv@sylv.io> X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, Feb 21, 2022 at 10:42:07AM +0100, Marcello Sylvester Bauer wrote: > Add regulator support for PLI1209BC Digital Supervisor. > > Signed-off-by: Marcello Sylvester Bauer Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/pmbus/Kconfig | 7 +++++++ > drivers/hwmon/pmbus/pli1209bc.c | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 38 insertions(+) > > diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig > index f18f67a94697..6552467c588d 100644 > --- a/drivers/hwmon/pmbus/Kconfig > +++ b/drivers/hwmon/pmbus/Kconfig > @@ -326,6 +326,13 @@ config SENSORS_PLI1209BC > This driver can also be built as a module. If so, the module will > be called pli1209bc. > > +config SENSORS_PLI1209BC_REGULATOR > + bool "Regulator support for PLI1209BC" > + depends on SENSORS_PLI1209BC && REGULATOR > + help > + If you say yes here you get regulator support for Vicor PLI1209BC > + Digital Supervisor. > + > config SENSORS_PM6764TR > tristate "ST PM6764TR" > help > diff --git a/drivers/hwmon/pmbus/pli1209bc.c b/drivers/hwmon/pmbus/pli1209bc.c > index 5f8847307e55..05b4ee35ba27 100644 > --- a/drivers/hwmon/pmbus/pli1209bc.c > +++ b/drivers/hwmon/pmbus/pli1209bc.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include "pmbus.h" > > /* > @@ -33,11 +34,37 @@ static int pli1209bc_read_word_data(struct i2c_client *client, int page, > return data; > data = sign_extend32(data, 15) * 10; > return clamp_val(data, -32768, 32767) & 0xffff; > + /* > + * PMBUS_READ_VOUT and PMBUS_READ_TEMPERATURE_1 return invalid data > + * when the BCM is turned off. Since it is not possible to return > + * ENODATA error, return zero instead. > + */ > + case PMBUS_READ_VOUT: > + case PMBUS_READ_TEMPERATURE_1: > + data = pmbus_read_word_data(client, page, phase, > + PMBUS_STATUS_WORD); > + if (data < 0) > + return data; > + if (data & PB_STATUS_POWER_GOOD_N) > + return 0; > + return pmbus_read_word_data(client, page, phase, reg); > default: > return -ENODATA; > } > } > > +#if IS_ENABLED(CONFIG_SENSORS_PLI1209BC_REGULATOR) > +static const struct regulator_desc pli1209bc_reg_desc = { > + .name = "vout2", > + .id = 1, > + .of_match = of_match_ptr("vout2"), > + .regulators_node = of_match_ptr("regulators"), > + .ops = &pmbus_regulator_ops, > + .type = REGULATOR_VOLTAGE, > + .owner = THIS_MODULE, > +}; > +#endif > + > static struct pmbus_driver_info pli1209bc_info = { > .pages = 2, > .format[PSC_VOLTAGE_IN] = direct, > @@ -75,6 +102,10 @@ static struct pmbus_driver_info pli1209bc_info = { > | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP > | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT, > .read_word_data = pli1209bc_read_word_data, > +#if IS_ENABLED(CONFIG_SENSORS_PLI1209BC_REGULATOR) > + .num_regulators = 1, > + .reg_desc = &pli1209bc_reg_desc, > +#endif > }; > > static int pli1209bc_probe(struct i2c_client *client)