From patchwork Wed Nov 20 03:58:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Encarnacion X-Patchwork-Id: 13880686 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FDE243179; Wed, 20 Nov 2024 03:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732075177; cv=none; b=I2UhmcZSHNSUO5Mdh3yL6hgE9fXLdcgUUGjPRRObB+BK59W2aW426CDs7KvpCjhuGCuIuRB+GKJERGcIVdnx7jEGra0y6ba3NrGESznrkvXF12nYWrMYXlVIa2ftg2soRgJHoDOAeK7/PdqOwgadv1vob8ZZmtHVAOJKMAFwJwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732075177; c=relaxed/simple; bh=dwQD5PiPjmvNB4xBLjwVEgDTENZ1YHqqS7aXgbXU1Sc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WBvIBC3cLn34Iea9ZqPre1MZ5E25OwneKVgc9a9N5yHIyDa8I86CYbb5OsNaHwOpG+VYoLhyy3zgAFurHRVzXpx6CBUP12QC1li9f9tK2aExl3OuYF3DKFHH5a3hDdJJ2AcwF+iGKs6lbErezLQZzbkdSYXvf7BpRV3C/Ekz61E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=U2r/mlmj; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="U2r/mlmj" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AK2RDx5015516; Tue, 19 Nov 2024 22:59:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=G1cAy /USucuQvgQhGsPIV7Nf+joe8pU5htvjOJTf24U=; b=U2r/mlmjTPWvSLjtvCbKV XltF+d7fgnsxSWOWZqHPIbQAL0CqOHFxH56TDxNso6va1QsViTcbJ3jDFC0PQ40T 5OCxdP52MtvqmgmhUCndhE/r/D0iRnM/ERbpRm5FvkmWobvR1wYmkYYHdiqMaffB jqt+SQ8+jV+HnP1QQX555ILya/aK7Mj86UH9z1pqZQir7/GPrz8oxeyreVsCuTtV cwCj/shm+zfFoUB6dhQ3/66rGks+lyrf13BAerm2AzQzvXOVbTbp1dFtgH9dU3Ig ZdwO1zKexgBM2JBX76KH02PEuIWra1aq12idHROWpRoOvioCHc8+l3XP03MXzowy w== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 43170framh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 22:59:06 -0500 (EST) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 4AK3x5L3029651 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 Nov 2024 22:59:05 -0500 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 19 Nov 2024 22:59:05 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 19 Nov 2024 22:59:05 -0500 Received: from CENCARNA-L02.ad.analog.com (CENCARNA-L02.ad.analog.com [10.116.39.203]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 4AK3wWZk027365; Tue, 19 Nov 2024 22:58:53 -0500 From: Cedric Encarnacion To: , , , , CC: Guenter Roeck , Jean Delvare , Jonathan Corbet , Delphine CC Chiu , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Radu Sabau , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Alexis Czezar Torreno , Cedric Encarnacion , Andy Shevchenko Subject: [PATCH 1/2] dt-bindings: hwmon: (pmbus/adp1050): Add bindings for adp1051, adp1055 and ltp8800 Date: Wed, 20 Nov 2024 11:58:25 +0800 Message-ID: <20241120035826.3920-2-cedricjustine.encarnacion@analog.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241120035826.3920-1-cedricjustine.encarnacion@analog.com> References: <20241120035826.3920-1-cedricjustine.encarnacion@analog.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: rm8orIlgiTXAtLX57RSmLljpxBPU-A4O X-Proofpoint-ORIG-GUID: rm8orIlgiTXAtLX57RSmLljpxBPU-A4O X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411200028 add dt-bindings for adp1051, adp1055, and ltp8800 pmbus. ADP1051: 6 PWM for I/O Voltage, I/O Current, Temperature ADP1055: 6 PWM for I/O Voltage, I/O Current, Power, Temperature LTP8800-1A/-2/-4A: 150A/135A/200A DC/DC µModule Regulator Co-developed-by: Alexis Czezar Torreno Signed-off-by: Alexis Czezar Torreno Signed-off-by: Cedric Encarnacion --- .../bindings/hwmon/pmbus/adi,adp1050.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml index 10c2204bc3df..af7530093942 100644 --- a/Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml @@ -10,16 +10,27 @@ maintainers: - Radu Sabau description: | - The ADP1050 is used to monitor system voltages, currents and temperatures. + The ADP1050 and similar devices are used to monitor system voltages, + currents, power, and temperatures. + Through the PMBus interface, the ADP1050 targets isolated power supplies and has four individual monitors for input/output voltage, input current and temperature. Datasheet: https://www.analog.com/en/products/adp1050.html + https://www.analog.com/en/products/adp1051.html + https://www.analog.com/en/products/adp1055.html + https://www.analog.com/en/products/ltp8800-1a.html + https://www.analog.com/en/products/ltp8800-2.html + https://www.analog.com/en/products/ltp8800-4a.html properties: compatible: - const: adi,adp1050 + enum: + - adi,adp1050 + - adi,adp1051 + - adi,adp1055 + - adi,ltp8800 reg: maxItems: 1 From patchwork Wed Nov 20 03:58:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Encarnacion X-Patchwork-Id: 13880688 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D97728EC; Wed, 20 Nov 2024 03:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732075177; cv=none; b=GjH02s3yKrqazn+9Vs7w/RVSIrvBU8jIcNUN2duXN4j5PfCARB/LeanHQCsoPYz/fP6gDOTK0s2MQsDOUupcu+NQq951uEaLolzrxAy3ZeHm7UgBSsYKmFdAJtBVzH8972c9MXUplF14eOIuQ9xKLNbP4iVkxcvjc5X9x3Soei8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732075177; c=relaxed/simple; bh=L4BQOlXzuhvBlV5KoHAUaNDGvnI3BSXwS4K7465biDo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ds1O8zeUOwMvSwxRyA11vk0NtCKny+ia2CehcaDrkOPqu2VC5oysJs7KJNKQIAI8NWnV4oeVk9N8GGCUCIWO6MkbzZ4ypNDpLcLvgsabc0rG2ARStuqJTHXW9nS6cKM4YrR+McWZZMiJm+B/IsDxZZuG2zB8mToZ7MDpmJMvfx8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=m0+L+/wt; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="m0+L+/wt" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AK2RDe3015514; Tue, 19 Nov 2024 22:59:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=51j9P F4GSrv8m/Vt1BlPJYx3NPN6VSLCHBiJOrzh6hY=; b=m0+L+/wtmQ/nCP6IhtNZc qGIF2+GHHsewA6YDjLei+U+NpbHLaxmZKyNoPB57ccKr2FphD1yMGCO/OJGREnln FU/v/cQXgdRUswcVtW1w9Doc2fSByru76ROf1vU0Ab7A29/T6gOx/XrUCmiJGbJS 29GyfacxwurnQyBIyyhsP6zsdxBGg4HqE0NKdC40TWOBeMhZPiz6uOW3vGFe2ClS VaA8GH2OFjprAuvJ9CQ0gMxl7DknGKvUT5lkBUYdr9KF4mTrFFBykheZIXcX9Aml /CWiGIwNUzzb5tTfH7tTMVVn7TaWKQQV4nEXN6NxkgwbMAj4SvMLmsh3xf8uN+U/ g== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 43170framm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 22:59:10 -0500 (EST) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 4AK3x9jQ029657 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 Nov 2024 22:59:09 -0500 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 19 Nov 2024 22:59:09 -0500 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 19 Nov 2024 22:59:09 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 19 Nov 2024 22:59:09 -0500 Received: from CENCARNA-L02.ad.analog.com (CENCARNA-L02.ad.analog.com [10.116.39.203]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 4AK3wWZl027365; Tue, 19 Nov 2024 22:58:59 -0500 From: Cedric Encarnacion To: , , , , CC: Guenter Roeck , Jean Delvare , Jonathan Corbet , Delphine CC Chiu , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Radu Sabau" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Alexis Czezar Torreno , Cedric Encarnacion , Andy Shevchenko Subject: [PATCH 2/2] hwmon: (pmbus/adp1050): add support for adp1051, adp1055 and ltp8800 Date: Wed, 20 Nov 2024 11:58:26 +0800 Message-ID: <20241120035826.3920-3-cedricjustine.encarnacion@analog.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241120035826.3920-1-cedricjustine.encarnacion@analog.com> References: <20241120035826.3920-1-cedricjustine.encarnacion@analog.com> Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: lcKxszCKuCocugpeOefSo9PcNzemEhXb X-Proofpoint-ORIG-GUID: lcKxszCKuCocugpeOefSo9PcNzemEhXb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411200028 ADP1051: 6 PWM for I/O Voltage, I/O Current, Temperature ADP1055: 6 PWM for I/O Voltage, I/O Current, Power, Temperature LTP8800-1A/-2/-4A: 150A/135A/200A DC/DC µModule Regulator The LTP8800 is a family of step-down μModule regulators that provides microprocessor core voltage from 54V power distribution architecture. LTP8800 features telemetry monitoring of input/output voltage, input current, output power, and temperature over PMBus. Co-developed-by: Alexis Czezar Torreno Signed-off-by: Alexis Czezar Torreno Signed-off-by: Cedric Encarnacion --- Documentation/hwmon/adp1050.rst | 63 +++++++++++++++++++++++++++-- drivers/hwmon/pmbus/Kconfig | 9 +++++ drivers/hwmon/pmbus/adp1050.c | 72 +++++++++++++++++++++++++++++++-- 3 files changed, 137 insertions(+), 7 deletions(-) diff --git a/Documentation/hwmon/adp1050.rst b/Documentation/hwmon/adp1050.rst index 8fa937064886..1692373ee5af 100644 --- a/Documentation/hwmon/adp1050.rst +++ b/Documentation/hwmon/adp1050.rst @@ -13,18 +13,43 @@ Supported chips: Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1050.pdf + * Analog Devices ADP1051 + + Prefix: 'adp1051' + + Addresses scanned: I2C 0x70 - 0x77 + + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1051.pdf + + * Analog Devices ADP1055 + + Prefix: 'adp1055' + + Addresses scanned: I2C 0x4B - 0x77 + + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1055.pdf + + * Analog Devices LTP8800-1A/-2/-4A + + Prefix: 'ltp8800' + + Addresses scanned: - + + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-1A.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-2.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-4A.pdf + Authors: - Radu Sabau - Description ----------- -This driver supprts hardware monitoring for Analog Devices ADP1050 Digital -Controller for Isolated Power Supply with PMBus interface. +This driver supports hardware monitoring for Analog Devices ADP1050, ADP1051, and +ADP1055 Digital Controller for Isolated Power Supply with PMBus interface. -The ADP1050 is an advanced digital controller with a PMBus™ +The ADP105X is an advanced digital controller with a PMBus™ interface targeting high density, high efficiency dc-to-dc power conversion used to monitor system temperatures, voltages and currents. Through the PMBus interface, the device can monitor input/output voltages, @@ -49,16 +74,46 @@ Sysfs Attributes in1_label "vin" in1_input Measured input voltage in1_alarm Input voltage alarm +in1_crit Critical maximum input voltage +in1_crit_alarm Input voltage high alarm +in1_lcrit Critical minimum input voltage +in1_lcrit_alarm Input voltage critical low alarm in2_label "vout1" in2_input Measured output voltage in2_crit Critical maximum output voltage in2_crit_alarm Output voltage high alarm in2_lcrit Critical minimum output voltage in2_lcrit_alarm Output voltage critical low alarm +in2_max Critical maximum output voltage +in2_max_alarm Output voltage critical max alarm +in2_min Critical minimum output voltage +in2_min_alarm Output voltage critical min alarm curr1_label "iin" curr1_input Measured input current. curr1_alarm Input current alarm +curr1_crit Critical maximum input current +curr1_crit_alarm Input current high alarm +curr2_label "iout1" +curr2_input Measured output current +curr2_alarm Output current alarm +curr2_crit Critical maximum output current +curr2_crit_alarm Output current high alarm +curr2_lcrit Critical minimum output current +curr2_lcrit_alarm Output current critical low alarm +curr2_max Critical maximum output current +curr2_max_alarm Output current critical max alarm +power1_label "pout1" +power1_input Measured output power +power1_crit Critical maximum output power +power1_crit_alarm Output power high alarm temp1_input Measured temperature temp1_crit Critical high temperature temp1_crit_alarm Chip temperature critical high alarm +temp1_max Critical maximum temperature +temp1_max_alarm Temperature critical max alarm +temp2_input Measured temperature +temp2_crit Critical high temperature +temp2_crit_alarm Chip temperature critical high alarm +temp2_max Critical maximum temperature +temp2_max_alarm Temperature critical max alarm ================= ======================================== diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index f6d352841953..5d03a307824e 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -67,6 +67,15 @@ config SENSORS_ADP1050 This driver can also be built as a module. If so, the module will be called adp1050. +config SENSORS_ADP1050_REGULATOR + bool "Regulator support for ADP1050 and compatibles" + depends on SENSORS_ADP1050 && REGULATOR + help + If you say yes here you get regulator support for Analog Devices + LTP8800-1A, LTP8800-4A, and LTP8800-2. LTP8800 is a family of DC/DC + µModule regulators that can provide microprocessor power from 54V + power distribution architecture. + config SENSORS_BEL_PFE tristate "Bel PFE Compatible Power Supplies" help diff --git a/drivers/hwmon/pmbus/adp1050.c b/drivers/hwmon/pmbus/adp1050.c index 20f22730fc01..46f2dda8adbb 100644 --- a/drivers/hwmon/pmbus/adp1050.c +++ b/drivers/hwmon/pmbus/adp1050.c @@ -11,6 +11,12 @@ #include "pmbus.h" +#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR) +static const struct regulator_desc adp1050_reg_desc[] = { + PMBUS_REGULATOR_ONE("vout"), +}; +#endif /* CONFIG_SENSORS_ADP1050_REGULATOR */ + static struct pmbus_driver_info adp1050_info = { .pages = 1, .format[PSC_VOLTAGE_IN] = linear, @@ -23,19 +29,79 @@ static struct pmbus_driver_info adp1050_info = { | PMBUS_HAVE_STATUS_TEMP, }; +static struct pmbus_driver_info adp1051_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = linear, + .format[PSC_CURRENT_IN] = linear, + .format[PSC_TEMPERATURE] = linear, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT + | PMBUS_HAVE_TEMP + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT + | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_STATUS_TEMP, +}; + +static struct pmbus_driver_info adp1055_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = linear, + .format[PSC_CURRENT_IN] = linear, + .format[PSC_TEMPERATURE] = linear, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT + | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 + | PMBUS_HAVE_POUT + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT + | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_STATUS_TEMP, +}; + +static struct pmbus_driver_info ltp8800_info = { + .pages = 1, + .format[PSC_VOLTAGE_IN] = linear, + .format[PSC_VOLTAGE_OUT] = linear, + .format[PSC_CURRENT_IN] = linear, + .format[PSC_TEMPERATURE] = linear, + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT + | PMBUS_HAVE_TEMP + | PMBUS_HAVE_POUT + | PMBUS_HAVE_STATUS_VOUT + | PMBUS_HAVE_STATUS_INPUT + | PMBUS_HAVE_STATUS_TEMP, +#if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR) + .num_regulators = 1, + .reg_desc = adp1050_reg_desc, +#endif +}; + static int adp1050_probe(struct i2c_client *client) { - return pmbus_do_probe(client, &adp1050_info); + const struct pmbus_driver_info *info; + + info = device_get_match_data(&client->dev); + if (!info) + return -ENODEV; + + return pmbus_do_probe(client, info); } static const struct i2c_device_id adp1050_id[] = { - {"adp1050"}, + { .name = "adp1050", .driver_data = (kernel_ulong_t)&adp1050_info}, + { .name = "adp1051", .driver_data = (kernel_ulong_t)&adp1051_info}, + { .name = "adp1055", .driver_data = (kernel_ulong_t)&adp1055_info}, + { .name = "ltp8800", .driver_data = (kernel_ulong_t)<p8800_info}, {} }; MODULE_DEVICE_TABLE(i2c, adp1050_id); static const struct of_device_id adp1050_of_match[] = { - { .compatible = "adi,adp1050"}, + { .compatible = "adi,adp1050", .data = &adp1050_info}, + { .compatible = "adi,adp1051", .data = &adp1051_info}, + { .compatible = "adi,adp1055", .data = &adp1055_info}, + { .compatible = "adi,ltp8800", .data = <p8800_info}, {} }; MODULE_DEVICE_TABLE(of, adp1050_of_match);