From nobody Sun Feb 8 02:56:04 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6D6A218E91 for ; Tue, 6 Jan 2026 16:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767715442; cv=none; b=haQ/qrVuFNvO5PAS8LCnvNEjqI6rS8IAuxJukG9hiAR2/1HJP6/hViZHevt3N2p5kFEhdc1izuJ9s4qoxiKttJmJ++S4p9gAooXnsGiRhO/Z3WVSTJYIcbO+Sw2D7TzE6qM3TgoOAgpbHI/nU1JGndm9LIfDickB6Osy6RJbHVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767715442; c=relaxed/simple; bh=q7ZffHMEJ6S7HH7Vy46Q9bG0ze32HCzvVz8NWmJuFOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XM85tCb8Wffiu4ulZTFW2nBtka9LEWf22/m+XRyz6gwGpc2Rq43iLiH0VSodgrrlJqBaYhQoaEfBt9yrU+C0tV0OJtSpXWFM8q2u57ZQKObBVDVWlFkISklGSwGe8Y9PbozcBscOer7vQDVkhkYryWA/53/bERay87eAVCzMwgI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SA+sYJyg; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SA+sYJyg" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-65089cebdb4so533476a12.0 for ; Tue, 06 Jan 2026 08:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767715438; x=1768320238; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0luukR6GB0vtkreCdXxNdvwtnnCpUjD0tYf9hb5lzG4=; b=SA+sYJygsbjW1ueD7jOvHp3jVNB26Uss/b+NYm5ajaPA1L4XFcWlmPh8NIMIl4npW2 sluo4fCrzvV7o3q7amlveuPA+6hCVbxi+2y6ZKmOe3aAhMk+0dp7wX1ypTP7kV6gUZxD hbQWEq11ll7oJD4e0HQkZHyYiJ/o+6MiHBqdpzKvC1nAjAf1EkK8MZzSJ9bleIUI/pgV aY3QafY7zFzde6V3b+zkgR16Ic2CNDyyY2uq7z5vu03vdFxqM5Neoi944iO/8SMu0FcG 12BqqJKEg5OfJlqdsepHDpbGLT5Z5BuUrEHkbgM5U2bcIpwKZsDYqsEeiShB49aHSrjP hUxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767715438; x=1768320238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0luukR6GB0vtkreCdXxNdvwtnnCpUjD0tYf9hb5lzG4=; b=Oz9zy/1+iiYIB7xBi3FrBbwg6PwKagVQswNJym8QPKViY/zz4yTiRXVFNm5zxbdo+w eInM8shF1OGtBwFHTpj47ZWga9IzBtkmaj2bgU3wkJX/05u/R6mbs/QDXk5lODp7tkhF zKVFfycnELo5CE5vNue8I4pNbGnVd1tVyq5kt+3ZfkQ6BcYm3pdiNG1q9wpvGTpxnmxS Tpj2uKG11cyDyeV2MwS0jBWfnlapZn5fkAZkFOf2asXDT0aJrblB2JhgFGBMiJlShDu8 cW2YoXZfb74mas/sYluahBy3tkVBdz4Bn3beiZzvR2aZjdQtu8fGiSJei4+juH0v4e/H EGuA== X-Forwarded-Encrypted: i=1; AJvYcCWMdQXfWmtBbqHwcTKMNKrjMNevJbV2tk+bTzKo/JCv/W0w5EMlbbte/tegoD8PUc4q9tVJhVXlXpXF238=@vger.kernel.org X-Gm-Message-State: AOJu0YzQc6ZN7ZhfHXaQ1Nxdwn2/TyKddFekOhsABrs6eKVwKEn2xoa0 RpLlV/+e2pw1ZDZNbO5M52krFuXadEKg7uYZ/bHOndlZ5RozXtjBGJJh X-Gm-Gg: AY/fxX5ynrth8n62xLTO6tu+ZhYrgZF9EOGdqgRwTeV37Saj/O0fqE272eIMoNdkuYs +mqRDs1hfTjkymfk+NQdzxBOrRR0t2krE8Wx7VBZe/QuopJyo/3ONW+FU1o6FPOaOez7thtdyi1 QFLH1YjBMRWSz/TS47rxAGS7BUtt7Sw3q9q87wwFevURtfyY+eAQRyIsywy5EEPcgqMAFcLCUqm 4kTOWn9MhyU8ya8SQbuPhSS+C43u127bLLrbk64dFSZeJwnJGsPfn4agTC8/GdMuSY/LJRddn2J 2KaIkMNclcX791SHUE9ApvkZmRaJbyP4UqTuU7J0+28BSjxPlKgb703gy1s3B07uA7pd3DjQgBn il/Fj6WOTlx2GdI8OtxwCZtvWl1wsqqGoh7kgpz8emK6ld1dgvtYArNEOdj5YeMsYOF4Xf0Qy0k zLrpcB7/1hj50+BqV6Plnfdjs= X-Google-Smtp-Source: AGHT+IGR9v3J89GSKErBV2ue+nf1hP2ngLMAfTwsJSEBW82CVZzOXwAEySuFK3GwjV2cHC8Zmar8wQ== X-Received: by 2002:a05:6402:1e91:b0:64d:f39:3fdb with SMTP id 4fb4d7f45d1cf-6507932220dmr3241052a12.13.1767715437804; Tue, 06 Jan 2026 08:03:57 -0800 (PST) Received: from vamoirid-laptop.. ([2a04:ee41:82:7577:80f9:d6dd:93b5:e2ef]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-6507bf65ca0sm2474912a12.24.2026.01.06.08.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:03:56 -0800 (PST) From: Vasileios Amoiridis To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux@roeck-us.net Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Vasileios Amoiridis Subject: [PATCH v1 1/2] dt-bindings: trivial-devices: Add hitron,hac300s Date: Tue, 6 Jan 2026 17:03:52 +0100 Message-ID: <20260106160353.14023-2-vassilisamir@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106160353.14023-1-vassilisamir@gmail.com> References: <20260106160353.14023-1-vassilisamir@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vasileios Amoiridis Add HiTRON HAC300S PSU to trivial devices since it is simple PMBUS capable device. Since this is the first supported device from this vendor, document its name to the vendor-prefixes.yaml file as well. Signed-off-by: Vasileios Amoiridis Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Docum= entation/devicetree/bindings/trivial-devices.yaml index d0f7dbf15d6f..4864ef9bed7c 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -123,6 +123,8 @@ properties: - fsl,mma8450 # MPR121: Proximity Capacitive Touch Sensor Controller - fsl,mpr121 + # HiTRON AC/DC CompatcPCI Power Supply + - hitron,hac300s # Honeywell Humidicon HIH-6130 humidity/temperature sensor - honeywell,hi6130 # IBM Common Form Factor Power Supply Versions (all versions) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Docum= entation/devicetree/bindings/vendor-prefixes.yaml index c7591b2aec2a..fdb11141e597 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -701,6 +701,8 @@ patternProperties: description: Hitachi Ltd. "^hitex,.*": description: Hitex Development Tools + "^hitron,.*": + description: HiTRON Electronics Corporation "^holt,.*": description: Holt Integrated Circuits, Inc. "^holtek,.*": --=20 2.47.3 From nobody Sun Feb 8 02:56:05 2026 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E942EEA8 for ; Tue, 6 Jan 2026 16:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767715443; cv=none; b=DlclPmXvu50J/dwyiRxkiRFiPa64gBms4H04dNfPTGAiHPCJEKOLvZgsxl2NyJIrDBmezd2SsWpEkhDGj4zJcnZWlZCuCzKZ5GHbWiLp9YxKS2F5PdR7C0Y3qlnCQSeXJQjcBUFpJVyG/Z+MbTksZIxqWb0ngAxaUFirHe77aqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767715443; c=relaxed/simple; bh=sfTXdIgusCv835rgmExNC2fi0DAQNO7kS2NnPvpm2Ho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UZkNZHSt0x49lw35Mpem2y/OD3OFdyvGX9c4EzzNghwvXjuksPIIisJw+AEvEfM505jMYg/Cr7TteLKV1dh5K+bp1WbuaJ/KNcKz0XRVQG6sLsilD4gY2tzPhDA96pzBtwYY6eVpT9W19nCvycRFmEfFBYOMUrkZTzhXul+vjhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mLJoUWSs; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mLJoUWSs" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-64ba74e6892so1827699a12.2 for ; Tue, 06 Jan 2026 08:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767715439; x=1768320239; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XUHjIDbkNzTZTLFz7CEqg9gXQzUHt8y3SwqX49Bzobk=; b=mLJoUWSsqd6/W+GcGbbOu7roN+TGBRHOi43+z9wUJ1JvH4PR2Q+pLyBEApRKTFn3wE lXruGsXtXmoKVknAPuScGvK1KLz0jeFo6jzby10dBKwqwnVS04jpXShZ9hECuxbTyWyc VRYBesu00kx0lysSOMvp2r9p7Lc920VlX180A+43DevWkGGosmwisLloRD7g3WxDfeiL SXAvjbe4jHdEn/KjhlpcHWCuOnuUUxoJj4raI9rm04qHZ6Y6DTQIuOydl53VFHUXQC06 +KO/zOQ200jsa+6dYw7Rf2u1B3oFkPhoDlOfQclNH0rTfBqqeRxYgKwo/7E4yYF/m9P3 I/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767715439; x=1768320239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XUHjIDbkNzTZTLFz7CEqg9gXQzUHt8y3SwqX49Bzobk=; b=Ae0oldjrf87QM7yflFY302awlZp9vWYfMclJRjLLalUoAOyfR+2geMYvlVRztvWpzP mxsjJFxrDoNISNLwO2T0OlHlweUfXwJdMA7+z0QlXX4GS8ooPiJwIRWbec9MOcNdjgLA D0MaDDPlM33g6TR9Ayicec6bTFChq/9mxBH+xm+kLpyKUlsQRSJ2S1UBfnkBtVbd55I1 /W9+lNnni5Gq4Klhui79yRiothWxxVNF/lOGHRBoJ81c2cG1gEZc16iKVtWOBb6KXjJv fANOABCL4cv5FLjivzioGp2sLWx/BEw76Boiucd2ZHKE/WAgnlp37zQSaeJWTrz72MMo VcMA== X-Forwarded-Encrypted: i=1; AJvYcCWrlDcWE3AuRuV1+wnJLmuTciviJqVAZrqZ+0S0/I1CHNtCxiVUH3tE1Ccw+jnRX8lZznpBegwOvLHfB/E=@vger.kernel.org X-Gm-Message-State: AOJu0YxjS5NL3pdaVops4N0775RyJC9yFbnSvKfOge6/9AHEzZ7xwZlK ifcDMdqbWVx1CKomCv3rz0QtZjipgCa/+N/pj855JKe5QAsTkA1NrXSf X-Gm-Gg: AY/fxX590lQItetwZWoCeJ9kCwwhFIgJaVthSqy1QBJeF6+kGKsG+2qlzFzSetLiMDZ loQY8d2/pJr941omVzwUJ+HLzq4L8wQmEiswvd0xDh6i9NT12EeLa6b3Ge3biKrMWYkQjstGfwk oHk3aNBdpkVQUsh+geX1wDMmd/SoagdYzKQaHZfZ93/A15yAXqvjOy2efctmyea+imN8VlMQEmo CV7zVOAkVExVK22E731sfij37OCiTL7t9DAGLKf/msY1zTPsnzqFouj0SedFSDi0uw+s+O9xfCG 6f2/uHlxS25MY1Hc2VK2inUzhAdhj6dFsOPWcrywm1vJxTUfxHQ2uP4hlBGfApFs0uxuvvcKYG/ jcsRXtwX9cXx5AFaF+w/+ri5KASBvhvhWBlcQFoWVD/+TIXdCGxM1b1oyvMbRnUqWXOcv6xBsKR EGu33Q4MWYfdWTzu33ExaZMog= X-Google-Smtp-Source: AGHT+IFtUB+Huqd/+RNj0Sg15SrL63cW/rNoqfEijDyjjDi1vClfHTD2UnPl3RO3NGX5v+4hlw8+0Q== X-Received: by 2002:a05:6402:274e:b0:64b:8d7a:71cf with SMTP id 4fb4d7f45d1cf-65079675846mr3023366a12.26.1767715439152; Tue, 06 Jan 2026 08:03:59 -0800 (PST) Received: from vamoirid-laptop.. ([2a04:ee41:82:7577:80f9:d6dd:93b5:e2ef]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-6507bf65ca0sm2474912a12.24.2026.01.06.08.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 08:03:58 -0800 (PST) From: Vasileios Amoiridis To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux@roeck-us.net Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Vasileios Amoiridis Subject: [PATCH v1 2/2] hwmon: Add support for HiTRON HAC300S PSU Date: Tue, 6 Jan 2026 17:03:53 +0100 Message-ID: <20260106160353.14023-3-vassilisamir@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106160353.14023-1-vassilisamir@gmail.com> References: <20260106160353.14023-1-vassilisamir@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vasileios Amoiridis Add Support for HiTRON HAC300S PSU. This is a AC/DC hot-swappable CompactPCI Serial Dual output active current sharing switching power supply with a 312W rating. Signed-off-by: Vasileios Amoiridis --- Documentation/hwmon/hac300s.rst | 37 ++++++++ MAINTAINERS | 7 ++ drivers/hwmon/pmbus/Kconfig | 9 ++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/hac300s.c | 152 ++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+) create mode 100644 Documentation/hwmon/hac300s.rst create mode 100644 drivers/hwmon/pmbus/hac300s.c diff --git a/Documentation/hwmon/hac300s.rst b/Documentation/hwmon/hac300s.= rst new file mode 100644 index 000000000000..573269fc81f8 --- /dev/null +++ b/Documentation/hwmon/hac300s.rst @@ -0,0 +1,37 @@ +.. SPDX-License-Identifier: GPL-2.0 + +Kernel driver hac300s +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Supported chips: + + * HiTRON HAC300S + + Prefix: 'hac300s' + + Datasheet: Publicly available at HiTRON website. + +Author: + + - Vasileios Amoiridis + +Description +----------- + +This driver implements support for the HiTRON HAC300S PSU. It is a Univers= al +AC input harmonic correction AC-DC hot-swappable CompactPCI Serial Dual ou= tput +(with 5V standby) 312 Watts active current sharing switching power supply. + +The device has an input of 90-264VAC and 2 nominal output voltaged at 12V = and +5V which they can supplu up to 25A and 2.5A respectively. + +Sysfs entries +------------- + +=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +curr1 Output current +in1 Output voltage +power1 Output power +temp1 Ambient temperature inside the module +temp2 Internal secondary component's temperature +=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/MAINTAINERS b/MAINTAINERS index a0dd762f5648..feb8ec4d9b17 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11254,6 +11254,13 @@ F: kernel/time/timer_list.c F: kernel/time/timer_migration.* F: tools/testing/selftests/timers/ =20 +HITRON HAC300S PSU DRIVER +M: Vasileios Amoiridis +L: linux-hwmon@vger.kernel.org +S: Maintained +F: Documentation/hwmon/hac300s.rst +F: drivers/hwmon/pmbus/hac300s.c + DELAY, SLEEP, TIMEKEEPING, TIMERS [RUST] M: Andreas Hindborg R: Boqun Feng diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index f3fb94cebf1a..4c2cb51dbe3f 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -124,6 +124,15 @@ config SENSORS_FSP_3Y This driver can also be built as a module. If so, the module will be called fsp-3y. =20 +config SENSORS_HAC300S + tristate "Hitron HAC300S-D120E PSU" + help + If you say yes here you get hardware monitoring support for the + Hitron HAC300S-D120E Power Supply. + + This driver can also be built as a module. If so, the module will + be called hac300s. + config SENSORS_IBM_CFFPS tristate "IBM Common Form Factor Power Supply" depends on LEDS_CLASS diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 349a89b6d92e..b92309019d35 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_SENSORS_BEL_PFE) +=3D bel-pfe.o obj-$(CONFIG_SENSORS_BPA_RS600) +=3D bpa-rs600.o obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) +=3D delta-ahe50dc-fan.o obj-$(CONFIG_SENSORS_FSP_3Y) +=3D fsp-3y.o +obj-$(CONFIG_SENSORS_HAC300S) +=3D hac300s.o obj-$(CONFIG_SENSORS_IBM_CFFPS) +=3D ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB) +=3D dps920ab.o obj-$(CONFIG_SENSORS_INA233) +=3D ina233.o diff --git a/drivers/hwmon/pmbus/hac300s.c b/drivers/hwmon/pmbus/hac300s.c new file mode 100644 index 000000000000..a1640449e5f5 --- /dev/null +++ b/drivers/hwmon/pmbus/hac300s.c @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: 2024 CERN (home.cern) +/* + * Hardware monitoring driver for Hi-Tron HAC300S PSU. + * + * NOTE: The HAC300S device does not support the PMBUS_VOUT_MODE register. + * On top of that, it returns the Voltage output values in Linear11 which = is + * not adhering to the PMBus specifications. (PMBus Specification Part II, + * Section 7.1-7.3). For that reason the PMBUS_VOUT_MODE register is being= faked + * and returns the exponent value of the READ_VOUT register. The exponent = part + * of the VOUT_* registers is being cleared in order to return the mantiss= a to + * the pmbus core. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pmbus.h" + +#define LINEAR11_EXPONENT_MASK GENMASK(15, 11) +#define LINEAR11_MANTISSA_MASK GENMASK(10, 0) + +#define to_hac300s_data(x) container_of(x, struct hac300s_data, info) + +struct hac300s_data { + struct pmbus_driver_info info; + bool vout_linear11; + s8 exponent; +}; + +static int hac300s_read_byte_data(struct i2c_client *client, int page, int= reg) +{ + const struct pmbus_driver_info *info =3D pmbus_get_driver_info(client); + struct hac300s_data *data =3D to_hac300s_data(info); + + if (reg =3D=3D PMBUS_VOUT_MODE && data->vout_linear11) + return data->exponent; + + return pmbus_read_byte_data(client, page, reg); +} + +static int hac300s_read_word_data(struct i2c_client *client, int page, + int phase, int reg) +{ + const struct pmbus_driver_info *info =3D pmbus_get_driver_info(client); + struct hac300s_data *data =3D to_hac300s_data(info); + int rv; + + rv =3D pmbus_read_word_data(client, page, phase, reg); + if (rv < 0) + return rv; + + switch (reg) { + case PMBUS_VIRT_READ_IOUT_AVG: + case PMBUS_VIRT_READ_POUT_AVG: + case PMBUS_VIRT_READ_TEMP_AVG: + return -ENXIO; + case PMBUS_VOUT_OV_WARN_LIMIT: + case PMBUS_VOUT_UV_WARN_LIMIT: + case PMBUS_VOUT_OV_FAULT_LIMIT: + case PMBUS_VOUT_UV_FAULT_LIMIT: + case PMBUS_MFR_VOUT_MAX: + case PMBUS_MFR_VOUT_MIN: + case PMBUS_READ_VOUT: + if (data->vout_linear11) + return FIELD_GET(LINEAR11_MANTISSA_MASK, rv); + fallthrough; + default: + return rv; + } +} + +#define HAC300S_SW_FUNC (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | \ + PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \ + PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \ + PMBUS_HAVE_POUT | PMBUS_HAVE_STATUS_TEMP) + +static struct pmbus_driver_info hac300s_info =3D { + .pages =3D 1, + .func[0] =3D HAC300S_SW_FUNC, + .read_byte_data =3D hac300s_read_byte_data, + .read_word_data =3D hac300s_read_word_data, + .format[PSC_VOLTAGE_OUT] =3D linear, +}; + +static struct pmbus_platform_data hac300s_pdata =3D { + .flags =3D PMBUS_NO_CAPABILITY, +}; + +static int hac300s_probe(struct i2c_client *client) +{ + struct hac300s_data *data; + int rv; + + data =3D devm_kzalloc(&client->dev, sizeof(struct hac300s_data), GFP_KERN= EL); + if (!data) + return -ENOMEM; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA | + I2C_FUNC_SMBUS_READ_WORD_DATA)) + return -ENODEV; + + rv =3D i2c_smbus_read_byte_data(client, PMBUS_VOUT_MODE); + if (rv < 0) { + data->vout_linear11 =3D true; + /* LINEAR11 format, use exponent from READ_VOUT register */ + rv =3D i2c_smbus_read_word_data(client, PMBUS_READ_VOUT); + if (rv < 0) + return dev_err_probe(&client->dev, rv, "Failed to read vout_mode\n"); + + data->exponent =3D FIELD_GET(LINEAR11_EXPONENT_MASK, rv); + } + + data->info =3D hac300s_info; + client->dev.platform_data =3D &hac300s_pdata; + return pmbus_do_probe(client, &data->info); +} + +static const struct of_device_id hac300s_of_match[] =3D { + { .compatible =3D "hitron,hac300s" }, + {} +}; +MODULE_DEVICE_TABLE(of, hac300s_of_match); + +static const struct i2c_device_id hac300s_id[] =3D { + {"hac300s", 0}, + {} +}; +MODULE_DEVICE_TABLE(i2c, hac300s_id); + +static struct i2c_driver hac300s_driver =3D { + .driver =3D { + .name =3D "hac300s", + .of_match_table =3D hac300s_of_match, + }, + .probe =3D hac300s_probe, + .id_table =3D hac300s_id, + +}; +module_i2c_driver(hac300s_driver); + +MODULE_AUTHOR("Vasileios Amoiridis"); +MODULE_DESCRIPTION("PMBus driver for Hi-Tron HAC300S PSU"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("PMBUS"); --=20 2.47.3