Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3362867pxb; Mon, 17 Jan 2022 18:38:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdPJM08G77NRJebkpqE4W4UKjmZVrZKvU/+QXEpevD6GJJfLRupIL9ne+fXNM4nTRllPLz X-Received: by 2002:a17:90b:4b8f:: with SMTP id lr15mr21881613pjb.213.1642473493770; Mon, 17 Jan 2022 18:38:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642473493; cv=none; d=google.com; s=arc-20160816; b=IxtoAR2tV72Br0cF+stqWhL2E86yvznlz80mFl9P/0JDNj9nHzeNpx2ZqpZ4aZaEsM wIp0EdIyHi5sQjGIn1X0rBf4PT3x9vZLrOsEjD6aEPu98fE2aFwuNLt3+Kkjq5G4PDxE ahNjwWxrmswQCFPfVas3iqejUrURlvGqPanDAGQJ9VnsBYb30/prLgQQ3QkAzF6CFt2O c14koWf3Ypww7oWM507dcXcYwISojL7gDpOo+oMvuTF+G1VaCB6FGta9fD4ViN/xS3eu jLpU51dKVh7UVRF7rHkuXyuLbEIAqm8mOTI37WqHpF3CPuUgoVQ5SU93PYWBlSbWtp3d zU8Q== 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:from :dkim-signature; bh=a1vsx+73yO//LTfnZakZY7L86flI50eX3rHI5DH1Kqg=; b=XkdMdyH7y4LMOz+64nUuUPk2K7vW98ZrUZ1DaJJbUsK8JwtMHmtJ0epe9lamHhxeEt /mQHQ+LmwV25FfD0sPMySs3yREHXTVZf5RGRtPo+lJXFOF9PLP0NLaMP6/KAeBHY4tnp PKTrQtTsa9EeGSAkGPpu2D0uDo2bbuJTo6dbL3oyp730alE23gY4ejQov+EhPSqwZBmS /7x9sCdn14lwnl3N63axQcPnGVx07E1I94h3cB629oLpq9mRK4Gwx/8umTQ9kZw9ftNT KcLALrjkhs8wD/AECD24eTIUAHy8wwn9ZOcNR5YUYrVQoYY3G2+zaodRtW0OpFhyHCVJ J6Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sylv.io header.s=MBO0001 header.b=zU0bgrKj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si3466900pgl.625.2022.01.17.18.38.00; Mon, 17 Jan 2022 18:38:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sylv.io header.s=MBO0001 header.b=zU0bgrKj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241002AbiAQQNr (ORCPT + 99 others); Mon, 17 Jan 2022 11:13:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240936AbiAQQNd (ORCPT ); Mon, 17 Jan 2022 11:13:33 -0500 Received: from mout-y-111.mailbox.org (mout-y-111.mailbox.org [IPv6:2001:67c:2050:1::465:111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC515C06161C; Mon, 17 Jan 2022 08:13:32 -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-y-111.mailbox.org (Postfix) with ESMTPS id 4Jcxlt6Jd8zQkjF; Mon, 17 Jan 2022 17:13:30 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sylv.io; s=MBO0001; t=1642436009; 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=a1vsx+73yO//LTfnZakZY7L86flI50eX3rHI5DH1Kqg=; b=zU0bgrKjJ15VtjFsLqRsEttsN+gpzHYXCoFVgsaCx7h6N76mJkHfVmhXAlxUebVoX5QS0U SpQfF4oDeVR960N0u7lgDlIQOfJuUEEpwuDjYGsNVxPhF6IQsNeRXBoWbGI2etv4Mk2Lki uHaJFK3V8Od5TGao7/9X3/3rOk5mzyg5g4vJI0t07ZXuaORBPUQ6Zu59BRl3d4l4U0jyZ7 oE+aMLNC26bhWy230O84Jg0PvUbISRHJiOq0Uny1a3Q+5mq81WR9pXZN3Fc+tYa7gU7xVy YM1EnDfHQA+deH9zW/Z0uw8DOXKN+65EgOehbXU1R96b8BhTVzN5Wsr6QuA3EA== From: Marcello Sylvester Bauer To: linux-hwmon@vger.kernel.org Cc: Patrick Rudolph , Guenter Roeck , Jean Delvare , linux-kernel@vger.kernel.org, Marcello Sylvester Bauer Subject: [PATCH v1 4/4] pmbus: Add support for bcm6123 Bus Converter Date: Mon, 17 Jan 2022 17:12:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrick Rudolph BCM6123 is an Fixed-Ratio DC-DC Converter. Signed-off-by: Patrick Rudolph Signed-off-by: Marcello Sylvester Bauer --- drivers/hwmon/pmbus/Kconfig | 9 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/bcm6123.c | 90 +++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 drivers/hwmon/pmbus/bcm6123.c diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index c96f7b7338bd..62dac90631c5 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -48,6 +48,15 @@ config SENSORS_ADM1275 This driver can also be built as a module. If so, the module will be called adm1275. +config SENSORS_BCM6123 + tristate "Vicor BCM6123 Compatible Power Supplies" + help + If you say yes here you get hardware monitoring support for Vicor + BCM6123 Power Supplies. + + This driver can also be built as a module. If so, the module will + be called bcm6123. + config SENSORS_BEL_PFE tristate "Bel PFE Compatible Power Supplies" help diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index e5935f70c9e0..2918c2ea7bc5 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_PMBUS) += pmbus_core.o obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o obj-$(CONFIG_SENSORS_ADM1266) += adm1266.o obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o +obj-$(CONFIG_SENSORS_BCM6123) += bcm6123.o obj-$(CONFIG_SENSORS_BEL_PFE) += bel-pfe.o obj-$(CONFIG_SENSORS_BPA_RS600) += bpa-rs600.o obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o diff --git a/drivers/hwmon/pmbus/bcm6123.c b/drivers/hwmon/pmbus/bcm6123.c new file mode 100644 index 000000000000..78fc259bc40f --- /dev/null +++ b/drivers/hwmon/pmbus/bcm6123.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Hardware monitoring driver for Infineon bcm6123 + * + * Copyright (c) 2021 9elements GmbH + * + * VOUT_MODE is not supported by the device. The driver fakes VOUT linear16 + * mode with exponent value -8 as direct mode with m=256/b=0/R=0. + * + * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however + * this driver does not currently support them. + */ + +#include +#include +#include +#include +#include +#include +#include "pmbus.h" + +static struct pmbus_platform_data bcm6123_plat_data = { + .flags = PMBUS_NO_CAPABILITY, +}; + +static struct pmbus_driver_info bcm6123_info = { + .pages = 2, + .format[PSC_VOLTAGE_IN] = direct, + .format[PSC_VOLTAGE_OUT] = direct, + .format[PSC_CURRENT_IN] = direct, + .format[PSC_CURRENT_OUT] = direct, + .format[PSC_POWER] = linear, + .format[PSC_TEMPERATURE] = linear, + .m[PSC_VOLTAGE_IN] = 1, + .b[PSC_VOLTAGE_IN] = 0, + .R[PSC_VOLTAGE_IN] = 1, + .m[PSC_VOLTAGE_OUT] = 1, + .b[PSC_VOLTAGE_OUT] = 0, + .R[PSC_VOLTAGE_OUT] = 1, + .m[PSC_CURRENT_IN] = 1, + .b[PSC_CURRENT_IN] = 0, + .R[PSC_CURRENT_IN] = 3, + .m[PSC_CURRENT_OUT] = 1, + .b[PSC_CURRENT_OUT] = 0, + .R[PSC_CURRENT_OUT] = 2, + .func[0] = 0, /* Summing page without voltage readings */ + .func[1] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP + | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT + | PMBUS_HAVE_IIN | PMBUS_HAVE_POUT, +}; + +static int bcm6123_probe(struct i2c_client *client) +{ + client->dev.platform_data = &bcm6123_plat_data; + + return pmbus_do_probe(client, &bcm6123_info); +} + +static const struct i2c_device_id bcm6123_id[] = { + {"bcm6123", 0}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, bcm6123_id); + +#ifdef CONFIG_OF +static const struct of_device_id bcm6123_of_match[] = { + { .compatible = "vicor,bcm6123" }, + { }, +}; +MODULE_DEVICE_TABLE(of, bcm6123_of_match); +#endif + +/* This is the driver that will be inserted */ +static struct i2c_driver bcm6123_driver = { + .driver = { + .name = "bcm6123", + .of_match_table = of_match_ptr(bcm6123_of_match), + }, + .probe_new = bcm6123_probe, + .id_table = bcm6123_id, +}; + +module_i2c_driver(bcm6123_driver); + +MODULE_AUTHOR("Patrick Rudolph "); +MODULE_DESCRIPTION("PMBus driver for Vicor bcm6123"); +MODULE_LICENSE("GPL"); -- 2.33.1