From nobody Fri Sep 25 23:12:16 2026 Received: from mail-oo2-f8.google.com (mail-oo2-f8.google.com [74.125.231.136]) (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 B75293D5C07 for ; Sun, 20 Sep 2026 05:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.136 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882326; cv=none; b=SgTT7hVU8WL1Fou5ZuDM2U18gfhXw3U7mdqQPf353kUhd4Ock6gDwH9qf6cGO8jSn+oupmF2lldBp0bLtAgFRITbczhqFRDjeXJvJmRFpryXbrsxkFOVGcUJ8+TRJhR/DYHzUTHZsnhPl+irRdS+Jc/z90anoATK2uUKMYhDca8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882326; c=relaxed/simple; bh=fwlPkqstrQlpYtzSAbjI/xkIKHHpjI1afmv6T7fC7po=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p2PcLhYQVx90g1WK5tycwk0BrrhImLvmyeo+4DjiCbCdnqqHKp6+4AG25NuEe298UdYM6GcZyhCG/mkT1tpiewKPi74TtaE/exUtqXrfjKf3wvz1Jq90zTvYm/vpENYVOaejdtZyia+M9TISfLXMgFtZ5xvAab9VhoIbPlzKAJc= 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=n2OxweBi; arc=none smtp.client-ip=74.125.231.136 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="n2OxweBi" Received: by mail-oo2-f8.google.com with SMTP id 006d021491bc7-6b1bf394d3bso346715eaf.0 for ; Sat, 19 Sep 2026 22:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789882321; x=1790487121; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SqP4V2+10gRQA7yGYe82IeB5bWtXD1MRgeLzqXm0MrQ=; b=n2OxweBimzodcV9kpyfGfSjjlRiIknR7qOhHuila2d3TDcvB5dv+ChEW7y4BpshfHs NJVtHmifhQzvOD4YdTiiQifW5pLf4lB6qA2G+BVpvMND2t1/lAYh9f5og187T+9xSGm4 hSeWTf/YBPu4Cdvp00gJl2kbRa9tnB/Rg4IjghbnvCovo/EbnzWuGZo5bW98eDsD7b8P NIs3kLb71TAITRb4Yt1GL6jkWu67dKkty92YQw+LNtedqJWhRH0P8BFA+BKOSjWi2p0h XznFV16k1gX7kXxvU3iuPqNAunvwZdT2o8/791dGue0HF7akc/6zdQg698N70SP13hp2 +4gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789882321; x=1790487121; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SqP4V2+10gRQA7yGYe82IeB5bWtXD1MRgeLzqXm0MrQ=; b=vyXebEu75U24C/nWTtgmNTmQaOdVjYKjCWkWs9XORIxl5/yPILyQ+AXqdnbqgLWoDW gXjQyO8tuAYwbXAnWVHYQ70AY4g6SKK2IvMyU3o3xpek24E/fO8HvmchyeXcorw5egJA zeDOwDf1nai0kvWlpxMr6C4svTPG/j8WVR2DyYGjOdeFWca1DC5Bb+hFHH0YGSf6jlHj N/NEda2RN5feZD6qf7Ij6p+TujRXo3YW5sDbkGlKxTIZlq+LkWWqwasb7VaYAouWXocB vO/8sbEQmx5tOh4oIbvV4NGiBXPFg8ImA7apCtoQbiGHiFgxasHIjBkLx5LNtnHCD+Lt BTeA== X-Forwarded-Encrypted: i=1; AKwUvBzDX2BHDbb16xMN7a/tJT/SXmggQHgL5CpVFO+z6EAnFE3sNlhiloHJPNECr3/R7UOK7u7kWpLkgfk7zkE=@vger.kernel.org X-Gm-Message-State: AFuF++koKJ2tmWCpq4eQFH4g8d1tvoNkeHWLF/RYLzWE3OywpX85qbbJ W7WxyUsuUec32dpbAujWHSqxCca1B4ZQgbW2zOMVwRAqie1UMd2hcClN4l2orHacvyQ= X-Gm-Gg: AYBFou2hI9HE/Tt/xiKfcLpGCiMDj/NRJjDhbkjaOgTA6UjLO1XUWsCDp+MfdktjuXf /nkLN2tSAtkjYYJZGpqT6WcuBjc84NqJXduoccujbsRUE+sWu6ZVJJ7XYAxNCds+i1BfgrV1hxV rh0UKVHJGK3Hn/GRPyc3KEirkvzR380OpQShEXiE7aNIGLe+7GOxIqgm32uyrcQXBT7CDTnNsLM FcYJwAbIisczYn4BjDmQ4KnmT0qAj4FhC7d13vfK4oUKLv/pvU+rmzcnqqHU62FCJTT+lFDB/YY FiFnXSIxteQ0A17Nb3nv8ux0qLKrb54sBkryk/nh9ji+SdR+NhhcWB5eibLVzXmVRVIVDJEKeg2 Ei06cUBJyb6PJ5qxwBVOslHEHaMSlP7gVB6TnECZ+B1Fa1QBD78gfwsF4ZbPIDMKVPYHkVbYhZa SPD+5gRe7gWr6rlQ19U32fV/39znFhzIcMdwvLKQksari4QFHxgGQY8wLzoZ9xegUGiSI= X-Received: by 2002:a05:6820:c0cf:10b0:6cd:3fdc:6009 with SMTP id 006d021491bc7-6cd3fdc6073mr2569288eaf.90.1789882321459; Sat, 19 Sep 2026 22:32:01 -0700 (PDT) Received: from [192.168.18.164] ([2600:8804:5716:d800::2620]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6cd3541f07fsm5007319eaf.10.2026.09.19.22.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2026 22:32:00 -0700 (PDT) From: Ryan Brue Date: Sun, 20 Sep 2026 00:31:51 -0500 Subject: [PATCH v3 1/3] dt-bindings: iio: adc: mediatek,mt6359-auxadc: add mt6397 PMIC AUXADC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-1-c00edacbee64@gmail.com> References: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> In-Reply-To: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Lee Jones Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, mfd@lists.linux.dev, Roman Vivchar , Luca Leonardo Scorcia , Andy Shevchenko , Ryan Brue X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789882316; l=2681; i=ryanbrue.dev@gmail.com; s=20260906; h=from:subject:message-id; bh=fwlPkqstrQlpYtzSAbjI/xkIKHHpjI1afmv6T7fC7po=; b=Opl97KH8MrqT3zIoiO069ry22IpQqYaPkHHieyAt0MVeeRXmAV1cUFOzXcG3h4gqUISqz8ECP zcigdUcPK5ID5aT4XknZj1qigND/X/OZwurcQvc1nDaYdP5H9wRI4Y3 X-Developer-Key: i=ryanbrue.dev@gmail.com; a=ed25519; pk=KsUvVaP//v/2q+ZBuacc7cLbsyEYn+AD71Sn28oZWKo= The MediaTek mt6397 PMIC includes a 10-bit AUXADC used for battery voltage and battery temperature measurements. It is not register compatible with mt6359: a conversion is requested by writing a channel number to a select field and pulsing an edge triggered start bit rather than by setting the channel's bit in a request register, and the results live elsewhere. It therefore gets its own compatible rather than a fallback. Add the binding and the header naming the channels a consumer puts in io-channels. The battery channel is named for the input it measures, ISENSE, which is what mt6323-auxadc calls the same input. Assisted-by: LLM Signed-off-by: Ryan Brue Acked-by: Krzysztof Kozlowski Reviewed-by: AngeloGioacchino Del Regno --- .../devicetree/bindings/iio/adc/mediatek,mt6359-auxadc.yaml | 1 + MAINTAINERS | 6 ++++++ include/dt-bindings/iio/adc/mediatek,mt6397-auxadc.h | 9 +++++= ++++ 3 files changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/mediatek,mt6359-auxa= dc.yaml b/Documentation/devicetree/bindings/iio/adc/mediatek,mt6359-auxadc.= yaml index c2f7387e4bfc..2847bd5d5bc4 100644 --- a/Documentation/devicetree/bindings/iio/adc/mediatek,mt6359-auxadc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/mediatek,mt6359-auxadc.yaml @@ -26,6 +26,7 @@ properties: - mediatek,mt6359-auxadc - mediatek,mt6363-auxadc - mediatek,mt6373-auxadc + - mediatek,mt6397-auxadc - items: - enum: - mediatek,mt6365-auxadc diff --git a/MAINTAINERS b/MAINTAINERS index c2414447892c..41d7b3a67415 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16713,6 +16713,12 @@ S: Maintained F: drivers/iio/adc/mt6323-auxadc.c F: include/dt-bindings/iio/adc/mediatek,mt6323-auxadc.h =20 +MEDIATEK MT6397 PMIC AUXADC DRIVER +M: Ryan Brue +L: linux-iio@vger.kernel.org +S: Maintained +F: include/dt-bindings/iio/adc/mediatek,mt6397-auxadc.h + MEDIATEK MT6735 CLOCK & RESET DRIVERS M: Yassine Oudjana L: linux-clk@vger.kernel.org diff --git a/include/dt-bindings/iio/adc/mediatek,mt6397-auxadc.h b/include= /dt-bindings/iio/adc/mediatek,mt6397-auxadc.h new file mode 100644 index 000000000000..b696c1cb5ebe --- /dev/null +++ b/include/dt-bindings/iio/adc/mediatek,mt6397-auxadc.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef _DT_BINDINGS_MEDIATEK_MT6397_AUXADC_H +#define _DT_BINDINGS_MEDIATEK_MT6397_AUXADC_H + +#define MT6397_AUXADC_ISENSE 0 +#define MT6397_AUXADC_BAT_TEMP 1 + +#endif --=20 2.55.0 From nobody Fri Sep 25 23:12:16 2026 Received: from mail-oa2-f10.google.com (mail-oa2-f10.google.com [74.125.231.74]) (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 BFD853D5647 for ; Sun, 20 Sep 2026 05:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882329; cv=none; b=Et0MLTvPEuMMdqjZw0g9HCCoJDcO8NFPtpLGt+XIZhrI9pn8V8JD0IBBQsL4g2QHbdMD96voLbD28TYNWi+oscVnQtJP93LQr11cvDO9MVvlGPX+eDvJ5aFGz53cLo1QXo3vYuzvTnUNsI0MiyYL1MeGwZks+ZH6VCRekqsBdx4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882329; c=relaxed/simple; bh=2/09mwmCWHAmQRczFfkj/6sO+pEFVwrBXzlkK6Y4DMY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r/xfkndTieEA1nJ+Q+ClSlfdsgSdXaRwQIdhFWmcE0krTcbt2AWod5GAgY8pAf8SeftcZWgGcV5DSzwWyJCdfMw5FEkHwEwtk+ZUDl11/eSqZ6mZ6RajIYefCSWp1GlOcsgqwOqPq+A/1Ghmb7RMbpVFU1EUxkNuEudXGfi1NGw= 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=U25VE7dd; arc=none smtp.client-ip=74.125.231.74 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="U25VE7dd" Received: by mail-oa2-f10.google.com with SMTP id 586e51a60fabf-47bbb846425so1021852fac.0 for ; Sat, 19 Sep 2026 22:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789882324; x=1790487124; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=N1Hvg2JMi4nrnD6ulr7LYBIUqOQmteayVujpA8jQF9Y=; b=U25VE7ddcgnSCpbG1qolMZIri7E8KU+fyYVQBM7lS/o6CihHhi16y0TO+3cYdjvHBt P8XDddZK50eC2rTgGldDWuqA7Rc2dEFRTjlQ7SEGxTbxBbvt4CoMpp/BIkQk1lCLC1Fc RJK8dJ12YH2mInTigO+/0QFaoDF31HVQsZGAPZbJq0Sg7HAVp5CYO1+WHrZCbPCEYkbE 5fUsgg/P8E2rVyrYPpS+R9E3cE048CmlqgQexZ8RIcM0UtVkCfmOQz0CLRRec/djGJQN kPF81CJc8QqrV9+0SSNkulSKpOoRbrr0sYGsZKmM7FjqmF6u59UlOwZG96QVJYwmmTy8 /6JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789882324; x=1790487124; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=N1Hvg2JMi4nrnD6ulr7LYBIUqOQmteayVujpA8jQF9Y=; b=JnZ9Ah8Sh9lJ8ODVsTOsuxQ32rX5Qn0gKGXGtyiEAeopcDYk6PPAp/y4JN/F8L3sbE 4Ya3QcYiYgZFgME4VwQeQDobm26c8ZGJi2pO2EbdmqBwWiuPbtN2R28JmqiQrfgPT4jW Y0vxjWJpmWYyWWe7WlIaqu/iiyUyqGEvNNxQwL6Vt87K6DotRIZyIumMGLuBh5Y38hSE Jgl7j6tej1/0p0084IvRYel6T5SzneyD9MRBl4DgADCXDBy3HB6PBKDMZTgHgwJMapfB Ugxr3HEv8SvnsYaB41itpQreCqvpK2d3BUCt5ZORfYms8wwHuNPmlHiDVDcxJ1aUWF53 FpwA== X-Forwarded-Encrypted: i=1; AKwUvBwJSTbS7GnG2SPemAcoytUyLWfPZ7OSyNKWlwYa+JGmJC2kPjAABEaERyOhu/YRK2k2tOSyXMF0MF7b9wg=@vger.kernel.org X-Gm-Message-State: AFuF++kkQVm4iQVGOl3jXqHb75cV/xwt+IFyxmHF9drOswcEr8Wksn2U InulodBdAwUh8U+MZgumKDTWIHqN8idPFBvtbsE9h2E5gr8GANekFr/dyTpdNZ4tOx4= X-Gm-Gg: AYBFou0QpbjGIvK6J7sPC+5NvFuq5z3Z0+265x1KvzRi9cF+Ib+VEh24pouAq0RKAdW REBzwk12dx7kZErL5JFTrPKTcqJqCSmEKIQ/v9u+WUtFWcMdLT6UjQ9ndP0ZILCoJNqkJYoiCf7 T4XHSosTcEni/yY7fS1uN7rXAsPls1giK8nQ+vIv+rST7TXYT5NxJBa+D0kTaU86ew+qCrkCstU fyLqS9AiwnQRRhSm9VQgfo2bgsVgzWEGeM/n2dMZlXWRQZW5MYS8+DDvOi6LIEsbVHBT7JDpbOn tmiAkMP70JUJ9QnD+BHJyckVRzvgdNTiuwC8w//Kesr7WWJ7x9JKwvmq7fEsGpf/bPXTZOV0sbJ tJDJ/aRf+U5if5f47AS0JW731rzoQQoRA+mQyLD1sOdhqINm00JvrSmsDCU7OEvSJrvL1jvCTqk 8oGyd+8Fgh5tTCjLQ8oYKdK1zmPGQL+MAwaf5bkh7voMO9OeAJ78ZlaZMq2dHoq6Zd0w== X-Received: by 2002:a05:6820:a515:10b0:6cd:3ffc:ad0a with SMTP id 006d021491bc7-6cd3ffcb664mr2483465eaf.90.1789882324562; Sat, 19 Sep 2026 22:32:04 -0700 (PDT) Received: from [192.168.18.164] ([2600:8804:5716:d800::2620]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6cd3541f07fsm5007319eaf.10.2026.09.19.22.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2026 22:32:03 -0700 (PDT) From: Ryan Brue Date: Sun, 20 Sep 2026 00:31:52 -0500 Subject: [PATCH v3 2/3] iio: adc: mt6397-auxadc: add mt6397 PMIC AUXADC driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-2-c00edacbee64@gmail.com> References: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> In-Reply-To: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Lee Jones Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, mfd@lists.linux.dev, Roman Vivchar , Luca Leonardo Scorcia , Andy Shevchenko , Ryan Brue X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789882316; l=16778; i=ryanbrue.dev@gmail.com; s=20260906; h=from:subject:message-id; bh=2/09mwmCWHAmQRczFfkj/6sO+pEFVwrBXzlkK6Y4DMY=; b=nD3z2Iubwzgrgho2o2g8EpigyswjyQjo9Ur/pCVbdBWfjgQ24X5gGVbYk6XRVy+2tJLILTuAu xzedVNGAhkMCp2V7sHZXSqPjxZkxO4thqr6c+7GcWLUZPedj1uxZ7fS X-Developer-Key: i=ryanbrue.dev@gmail.com; a=ed25519; pk=KsUvVaP//v/2q+ZBuacc7cLbsyEYn+AD71Sn28oZWKo= The mt6397 AUXADC is a 10-bit ADC behind the SoC's PMIC wrapper. On boards built around this PMIC it is the only way to read the battery: the SoC's AUXADC is wired to board thermistors and the charger ICs these boards use have no ADC of their own. Add a driver exposing the battery voltage and battery temperature channels. Only those two are described, so a channel ID in the device tree indexes the driver's channel array rather than the PMIC's channel number, as mt6323-auxadc does. The ready bit lives in a channel's raw result register, but the value comes from the chip's factory-calibrated copy. The battery voltage is measured through ISENSE, because a board with a switching charger in the power path leaves BATSNS on the charger's system rail instead of on the pack. The thermistor only reads correctly with the PMIC's battery-detect bias and input buffer enabled, which take 20 ms to settle. Both are switched back off afterwards. Reads average sixteen conversions in software; the chip's sample accumulator makes no measurable difference at any setting, so it is left at one sample per conversion. Assisted-by: LLM Signed-off-by: Ryan Brue --- A new driver was created here, instead of modifying an existing driver such as mt6323-auxadc or mt6359-auxadc, for the following reasons: - Both mt6323-auxadc and mt6359-auxadc select channels through a request register (1 bit per channel), while mt6397 uses a 4-bit numeric field CHSEL in CON1 (10:7), and then pulses a START bit (CON1 bit 0). - For mt6323-auxadc, which is the closest I could find to the mt6397 (CON0..CON27), it has 13 more registers than the mt6397 (CON0..CON14). It uses CON22 for its request register, and reads the result value from the same register as the ready bit. We don't do that - the mt6397 has a factory-calibrated value for each channel at 0x16 higher than the raw value. mt6323 also has a 1800 mV / 15 bit scale / resolution while we have 1200 mV / 10 bits. We also have some per-channel preparation that we have to do before the burst, that the mt6323 doesn't have to do. - For mt6359-auxadc, it has a more generic framework for describing the AUXADC, but it assumes requests are channel-per-bit, and so we would have to basically ignore req_idx, req_mask, rdy_idx, and rdy_mask. - We also have our own software sampling, which the vendor does too (Amazon Fire OS based on Linux 3.18). We'd have to have our own sampling callback to do it. --- MAINTAINERS | 1 + drivers/iio/adc/Kconfig | 11 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mt6397-auxadc.c | 391 ++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 404 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 41d7b3a67415..9b254f98b5d7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16717,6 +16717,7 @@ MEDIATEK MT6397 PMIC AUXADC DRIVER M: Ryan Brue L: linux-iio@vger.kernel.org S: Maintained +F: drivers/iio/adc/mt6397-auxadc.c F: include/dt-bindings/iio/adc/mediatek,mt6397-auxadc.h =20 MEDIATEK MT6735 CLOCK & RESET DRIVERS diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 415e519ad4eb..9a1d36ed53cb 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -1233,6 +1233,17 @@ config MEDIATEK_MT6370_ADC This driver can also be built as a module. If so, the module will be called "mt6370-adc". =20 +config MEDIATEK_MT6397_AUXADC + tristate "MediaTek MT6397 PMIC AUXADC driver" + depends on MFD_MT6397 + help + Say yes here to enable support for MediaTek MT6397 PMIC Auxiliary ADC. + This driver provides the battery voltage and battery temperature + channels used by the fuel gauge on boards built around this PMIC. + + This driver can also be built as a module. If so, the module will be + called mt6397-auxadc. + config MEDIATEK_MT6577_AUXADC tristate "MediaTek AUXADC driver" depends on ARCH_MEDIATEK || COMPILE_TEST diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index dcec0abb03b7..13cb4206bdb7 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -105,6 +105,7 @@ obj-$(CONFIG_MEDIATEK_MT6323_AUXADC) +=3D mt6323-auxadc= .o obj-$(CONFIG_MEDIATEK_MT6359_AUXADC) +=3D mt6359-auxadc.o obj-$(CONFIG_MEDIATEK_MT6360_ADC) +=3D mt6360-adc.o obj-$(CONFIG_MEDIATEK_MT6370_ADC) +=3D mt6370-adc.o +obj-$(CONFIG_MEDIATEK_MT6397_AUXADC) +=3D mt6397-auxadc.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) +=3D mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) +=3D men_z188_adc.o obj-$(CONFIG_MESON_SARADC) +=3D meson_saradc.o diff --git a/drivers/iio/adc/mt6397-auxadc.c b/drivers/iio/adc/mt6397-auxad= c.c new file mode 100644 index 000000000000..d860cd3a8922 --- /dev/null +++ b/drivers/iio/adc/mt6397-auxadc.c @@ -0,0 +1,391 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * MediaTek MT6397 PMIC AUXADC IIO driver + * + * Copyright (c) 2026 Ryan Brue + * + * Based on drivers/iio/adc/mt6323-auxadc.c + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +/* The ready bit is in the raw result register, the value in the trimmed o= ne. */ +#define MT6397_AUXADC_ADC(n) (0x0514 + 2 * (n)) +#define MT6397_AUXADC_ADC_RDY BIT(15) +#define MT6397_AUXADC_ADC_VAL GENMASK(9, 0) +/* The trimmed copy of ADC(n), which is ADC11 + n. */ +#define MT6397_AUXADC_ADC_TRIM(n) (0x052a + 2 * (n)) + +/* The thermistor needs the battery-detect bias and the input buffer on. */ +#define MT6397_AUXADC_CON0 0x0542 +#define MT6397_AUXADC_CON0_BUF_PWD_B BIT(1) +#define MT6397_AUXADC_CON0_BUF_PWD_ON BIT(3) +/* Samples accumulated per conversion; the chip's accumulator is left at o= ne. */ +#define MT6397_AUXADC_CON0_SPL_NUM GENMASK(11, 7) +#define MT6397_CHR_CON7 0x000e +#define MT6397_CHR_CON7_BATON_TDET_EN BIT(2) + +#define MT6397_AUXADC_BATTEMP_SETTLE_US (20 * USEC_PER_MSEC) + +#define MT6397_AUXADC_CON1 0x0544 +#define MT6397_AUXADC_CON1_CHSEL GENMASK(10, 7) +#define MT6397_AUXADC_CON1_START BIT(0) + +/* + * CHR_CON16 and the two SOURCE_CH0 selects route either BATSNS or ISENSE = onto + * the battery channel. Only ISENSE is used: with a switching charger in t= he + * power path BATSNS sits on the system rail rather than on the pack. All = five + * ADCIN bits are written out because they are one enable per analog input + * and not a select field; the driver touches only the two it needs. + */ +#define MT6397_CHR_CON16 0x0020 +#define MT6397_CHR_CON16_ADCIN_VCHR_EN BIT(12) +#define MT6397_CHR_CON16_ADCIN_VSEN_EN BIT(11) +#define MT6397_CHR_CON16_ADCIN_VBAT_EN BIT(10) +#define MT6397_CHR_CON16_ADCIN_VSEN_EXT_BATON_EN BIT(9) +#define MT6397_CHR_CON16_ADCIN_VSEN_MUX_EN BIT(8) +#define MT6397_AUXADC_CON14 0x055e +#define MT6397_AUXADC_CON14_CH0_NORM_SEL BIT(2) +#define MT6397_AUXADC_CON14_CH0_LBAT_SEL BIT(0) + +#define MT6397_AUXADC_ISENSE_SETTLE_US (1 * USEC_PER_MSEC) + +/* Conversions averaged in software per read. */ +#define MT6397_AUXADC_SAMPLES 16 + +/* Hardware limitation: the result is not ready for this long after START.= */ +#define MT6397_AUXADC_START_US 30 + +/* The battery channel is divided down by 4; the thermistor is not divided= . */ +#define MT6397_AUXADC_ISENSE_DIVIDER 4 + +/* The PMIC's channel numbers, as the CON1 select field takes them. */ +#define MT6397_AUXADC_HWCHAN_BATSNS 0 +#define MT6397_AUXADC_HWCHAN_BAT_TEMP 3 + +struct mt6397_auxadc { + struct regmap *regmap; + /* + * A read is a multi-register sequence: analog setup, then a channel + * select and an edge-triggered start per conversion. Interleaving two + * of them steals the select and tears down the setup, so a read holds + * this for its whole burst. + */ + struct mutex lock; +}; + +/* + * A device tree channel ID indexes this array; .address holds the PMIC ch= annel + * number. The thermistor reports as a voltage because that is all the PMIC + * measures: the divider across an NTC whose curve belongs to the board. + */ +static const struct iio_chan_spec mt6397_auxadc_channels[] =3D { + { + .type =3D IIO_VOLTAGE, + .indexed =3D 1, + .channel =3D MT6397_AUXADC_ISENSE, + .address =3D MT6397_AUXADC_HWCHAN_BATSNS, + .datasheet_name =3D "isense", + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, { + .type =3D IIO_VOLTAGE, + .indexed =3D 1, + .channel =3D MT6397_AUXADC_BAT_TEMP, + .address =3D MT6397_AUXADC_HWCHAN_BAT_TEMP, + .datasheet_name =3D "bat_temp", + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE), + }, +}; + +static int mt6397_auxadc_read_once(struct mt6397_auxadc *adc, + const struct iio_chan_spec *chan, int *val) +{ + struct regmap *map =3D adc->regmap; + unsigned int reg; + int ret; + + ret =3D regmap_update_bits(map, MT6397_AUXADC_CON1, MT6397_AUXADC_CON1_CH= SEL, + FIELD_PREP(MT6397_AUXADC_CON1_CHSEL, chan->address)); + if (ret) + return ret; + + /* + * START is edge triggered: lower it before raising it again. No delay + * is needed in between -- the ready bit survives the fall and is + * cleared by the rise, before the next transaction on this bus can + * observe it, so a ready bit seen by the poll can only be this + * conversion's. + */ + ret =3D regmap_clear_bits(map, MT6397_AUXADC_CON1, MT6397_AUXADC_CON1_STA= RT); + if (ret) + return ret; + + ret =3D regmap_set_bits(map, MT6397_AUXADC_CON1, MT6397_AUXADC_CON1_START= ); + if (ret) + return ret; + + fsleep(MT6397_AUXADC_START_US); + + ret =3D regmap_read_poll_timeout(map, MT6397_AUXADC_ADC(chan->address), + reg, reg & MT6397_AUXADC_ADC_RDY, + 100, 100 * USEC_PER_MSEC); + if (ret) + return ret; + + ret =3D regmap_read(map, MT6397_AUXADC_ADC_TRIM(chan->address), ®); + if (ret) + return ret; + + *val =3D FIELD_GET(MT6397_AUXADC_ADC_VAL, reg); + + return 0; +} + +static int mt6397_auxadc_battemp_bias_on(struct mt6397_auxadc *adc) +{ + struct regmap *map =3D adc->regmap; + int ret; + + ret =3D regmap_set_bits(map, MT6397_AUXADC_CON0, + MT6397_AUXADC_CON0_BUF_PWD_ON); + if (ret) + return ret; + + ret =3D regmap_set_bits(map, MT6397_AUXADC_CON0, + MT6397_AUXADC_CON0_BUF_PWD_B); + if (ret) + return ret; + + return regmap_set_bits(map, MT6397_CHR_CON7, + MT6397_CHR_CON7_BATON_TDET_EN); +} + +static int mt6397_auxadc_battemp_bias_off(struct mt6397_auxadc *adc) +{ + struct regmap *map =3D adc->regmap; + int ret; + + ret =3D regmap_clear_bits(map, MT6397_CHR_CON7, MT6397_CHR_CON7_BATON_TDE= T_EN); + if (ret) + return ret; + + ret =3D regmap_clear_bits(map, MT6397_AUXADC_CON0, MT6397_AUXADC_CON0_BUF= _PWD_B); + if (ret) + return ret; + + return regmap_clear_bits(map, MT6397_AUXADC_CON0, + MT6397_AUXADC_CON0_BUF_PWD_ON); +} + +static int mt6397_auxadc_isense_enable(struct mt6397_auxadc *adc) +{ + struct regmap *map =3D adc->regmap; + int ret; + + /* + * Two of the five independent input enables, not a select field: + * BATSNS is cleared first so that the two inputs are never enabled + * onto the battery channel at the same time. + */ + ret =3D regmap_clear_bits(map, MT6397_CHR_CON16, MT6397_CHR_CON16_ADCIN_V= BAT_EN); + if (ret) + return ret; + + ret =3D regmap_set_bits(map, MT6397_CHR_CON16, MT6397_CHR_CON16_ADCIN_VSE= N_EN); + if (ret) + return ret; + + return regmap_set_bits(map, MT6397_AUXADC_CON14, + MT6397_AUXADC_CON14_CH0_NORM_SEL | + MT6397_AUXADC_CON14_CH0_LBAT_SEL); +} + +static int mt6397_auxadc_isense_disable(struct mt6397_auxadc *adc) +{ + struct regmap *map =3D adc->regmap; + int ret; + + ret =3D regmap_clear_bits(map, MT6397_AUXADC_CON14, + MT6397_AUXADC_CON14_CH0_NORM_SEL | + MT6397_AUXADC_CON14_CH0_LBAT_SEL); + if (ret) + return ret; + + return regmap_clear_bits(map, MT6397_CHR_CON16, + MT6397_CHR_CON16_ADCIN_VSEN_EN | + MT6397_CHR_CON16_ADCIN_VBAT_EN); +} + +/* + * One burst on a channel that is already prepared: the caller owns the lo= ck, + * the analog setup and the teardown. + */ +static int mt6397_auxadc_read_burst(struct mt6397_auxadc *adc, + const struct iio_chan_spec *chan, int *val) +{ + unsigned int sum =3D 0; + int sample; + int ret; + + for (unsigned int i =3D 0; i < MT6397_AUXADC_SAMPLES; i++) { + ret =3D mt6397_auxadc_read_once(adc, chan, &sample); + if (ret) + return ret; + + sum +=3D sample; + } + + *val =3D DIV_ROUND_CLOSEST(sum, MT6397_AUXADC_SAMPLES); + + return 0; +} + +static int mt6397_auxadc_read_channel(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + int *val) +{ + struct mt6397_auxadc *adc =3D iio_priv(indio_dev); + bool isense =3D chan->channel =3D=3D MT6397_AUXADC_ISENSE; + int ret, stop_err, release_err; + + guard(mutex)(&adc->lock); + + if (isense) { + ret =3D mt6397_auxadc_isense_enable(adc); + if (!ret) + fsleep(MT6397_AUXADC_ISENSE_SETTLE_US); + } else { + ret =3D mt6397_auxadc_battemp_bias_on(adc); + if (!ret) + fsleep(MT6397_AUXADC_BATTEMP_SETTLE_US); + } + + if (!ret) + ret =3D mt6397_auxadc_read_burst(adc, chan, val); + + /* + * The teardown is unconditional: once any part of the setup has been + * written it has to run, even if the setup itself failed part-way. + * Lowering START also leaves the converter unarmed between reads. + * A caller has nothing to do with a teardown error, so it is logged + * rather than returned. + */ + stop_err =3D regmap_clear_bits(adc->regmap, MT6397_AUXADC_CON1, + MT6397_AUXADC_CON1_START); + + if (isense) + release_err =3D mt6397_auxadc_isense_disable(adc); + else + release_err =3D mt6397_auxadc_battemp_bias_off(adc); + + if (stop_err || release_err) + dev_err(&indio_dev->dev, "failed to release channel %d\n", + chan->channel); + + return ret; +} + +static int mt6397_auxadc_read_raw(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + int *val, int *val2, long mask) +{ + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret =3D mt6397_auxadc_read_channel(indio_dev, chan, val); + if (ret) + return ret; + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + /* 1200 mV full range with 10-bit resolution. */ + if (chan->channel =3D=3D MT6397_AUXADC_ISENSE) + *val =3D 1200 * MT6397_AUXADC_ISENSE_DIVIDER; + else + *val =3D 1200; + + *val2 =3D 10; + + return IIO_VAL_FRACTIONAL_LOG2; + + default: + return -EINVAL; + } +} + +static const struct iio_info mt6397_auxadc_info =3D { + .read_raw =3D mt6397_auxadc_read_raw, +}; + +static int mt6397_auxadc_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct mt6397_chip *chip =3D dev_get_drvdata(dev->parent); + struct mt6397_auxadc *adc; + struct iio_dev *indio_dev; + int ret; + + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*adc)); + if (!indio_dev) + return -ENOMEM; + + adc =3D iio_priv(indio_dev); + adc->regmap =3D chip->regmap; + + ret =3D devm_mutex_init(dev, &adc->lock); + if (ret) + return ret; + + ret =3D regmap_update_bits(adc->regmap, MT6397_AUXADC_CON0, + MT6397_AUXADC_CON0_SPL_NUM, + FIELD_PREP(MT6397_AUXADC_CON0_SPL_NUM, 1)); + if (ret) + return dev_err_probe(dev, ret, "failed to initialize auxadc\n"); + + indio_dev->name =3D "mt6397-auxadc"; + indio_dev->info =3D &mt6397_auxadc_info; + indio_dev->modes =3D INDIO_DIRECT_MODE; + indio_dev->channels =3D mt6397_auxadc_channels; + indio_dev->num_channels =3D ARRAY_SIZE(mt6397_auxadc_channels); + + return devm_iio_device_register(dev, indio_dev); +} + +static const struct of_device_id mt6397_auxadc_of_match[] =3D { + { .compatible =3D "mediatek,mt6397-auxadc" }, + { } +}; +MODULE_DEVICE_TABLE(of, mt6397_auxadc_of_match); + +static struct platform_driver mt6397_auxadc_driver =3D { + .driver =3D { + .name =3D "mt6397-auxadc", + .of_match_table =3D mt6397_auxadc_of_match, + }, + .probe =3D mt6397_auxadc_probe, +}; +module_platform_driver(mt6397_auxadc_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Ryan Brue "); +MODULE_DESCRIPTION("MediaTek MT6397 PMIC AUXADC Driver"); --=20 2.55.0 From nobody Fri Sep 25 23:12:16 2026 Received: from mail-oa2-f0.google.com (mail-oa2-f0.google.com [74.125.231.64]) (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 D98443D6CD8 for ; Sun, 20 Sep 2026 05:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882330; cv=none; b=dq1K2gmOE7xvD29BvM9QTxUsbZmtFUT5TVsjY3PzAaWWLzbXdnwvC5hGpb4jeGdkV0P+uZJ8drwWnr44frX0CGs4enVtsGRoXddJoeuW636dvsmno3XYCIpNvFw3pqNPvoNcyDDbL4ekNuXewVPraSOurQEoZHE9XmdA3XMa4YY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789882330; c=relaxed/simple; bh=1otP8UYV9viBZZ+f8NwjITACufQDeLB/kdjE9I9R9IM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k/6B7bINE6ljfdvEXLI8MXa+F42OPfNnFLIB8G2+afK0OQ//hMV5JMwgJTAvFZY3vqTZgpox/ZbAU/z3h80Utg8Jd2WY+uvmrmNP6PQbs5Irl40vALn2mcJufEVJWSDGNHQNPc8yvpAKVD9u/WURC5wnSeRAxmM1VQwIc6vMQvo= 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=cEchglrN; arc=none smtp.client-ip=74.125.231.64 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="cEchglrN" Received: by mail-oa2-f0.google.com with SMTP id 586e51a60fabf-4511f6a63edso297087fac.1 for ; Sat, 19 Sep 2026 22:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789882328; x=1790487128; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=54xUl28tB3oyyAr/XFRTTgMHGsQTvwV3/5B41pgtCxk=; b=cEchglrNuJlLC45J60P4tJ6kTKISj+g7r23WamFMMTF/k9fbbVFvGI0e57s5YzuAAk Aeoge6jiTvuBjdAZYLL2LIE53huRy1BteP0fdAuD8CH1oRS0xqvzh5UKrTD5ZIoBFw82 HVtodRMIIimS5nnmf1DvfikNl9WQxLcVsZBkWvRrdVEPu+WdVww73ygeZKyoNeQrHo1P GihHDvUOMtJpIPhLJhasaL4rrC8QUVbVyOLnI7QuRN43fD4A/XrM5inMtJeBtY4BpxUp raa4pJatHTqzo5/nRJ0Cp1u0cYuGxQu6Afv7IY/aG8QbP1CYmRFUFSce+/4aB2MYihZU 5raA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789882328; x=1790487128; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=54xUl28tB3oyyAr/XFRTTgMHGsQTvwV3/5B41pgtCxk=; b=OHKa7o3lTnKwUit2Q/Ex84LgAPyZvweuX2uR7whOfXDB/XI0RGXOb2oXvF3dcc2tGt 360lymuBnZiUbrEG3YI3OcTMpwZ8HXcIZ3LyDV750ANCWBZaXhCgUF8fL8sCZZ/uYEVh tqQg1040syZ5GPG/WQ240//EfgLzbLcBzAgilcvG6dGSzJpad1YbhTDJtDj9Q+fr6WcF WTwJ/0dGNYaHF/hWLcjAT7S3RIOFYEJxZCeAVW81NF01ovzkF3xigTcNdNwfqTQHcOzY oqPENmO+6dTOXuCvKEO6Kblz4T0LBLf8SmMK7aUJxjTAFapvt5x2Fx3SfWAnpjw+vNlU Y9IQ== X-Forwarded-Encrypted: i=1; AKwUvBxs4gxByM0kmxEU4jMUF832kTzWJ3mXI900E5zqXP26uR0kZfartbjAhyupDQ99dgyBZYiQ5uCQxQ/6M1c=@vger.kernel.org X-Gm-Message-State: AFuF++nFOR1dvYq7JT5jB5ogkFL7uu9cQFGcA9jOY5E+fBAnn5xZ9usJ b1Ongj/TKuE79Ul6rfL2dTNC2ZRKPMJ/1NlfUtpe7dxO3AqbyTzNRsEbqFs/h/4YQCc= X-Gm-Gg: AYBFou0cv2TDRqKcsyFj50YjAqIH5ThI+r6w3iYJEmKm9Vc44p/yIm2nv7bDNGk6HDS m6Nwahto2Cu0Loh9SNRpf/B5Gb58q2mb1Il4Em2Sg+upRDclGqxr9kWf/L87/DKtseYrPnZGSMs BUYVzKgT1UdnI1pd1MEnYDx6DgRdKHHdwlExs5kaduo+yXTEZColRxf1OGsNFkQ5PSnp98pd82n fvhcYJmaFM1y3JUnKbfn+MiYqW1p0ERtK1noFL0BfiyiPw7QR3cWf3fAnDAcrEQrfg7wQZFrGSm kLmXQY171q4Smd4PjOlYqgDL599koFy4BpMP/l1lsbtk03X0SzI2IIzKn8T67JJQCAVCkIyOzmz 3QWuu6GNXW1zZp49aw2G/vp2VvfyBUxPNdchlVbtkCrCR7BDYF6Te5lvoKPxF+m2yJQHO6tIn9g R9LssQhRx4YvgzGw/9WG58jUYS/0ufJqQjiYjSS1uhkaAv4+GV+2dKJNGHtWgInW30KA== X-Received: by 2002:a05:6820:818a:b0:6b7:8396:f3d6 with SMTP id 006d021491bc7-6ca9ce4cfcdmr7217118eaf.56.1789882327657; Sat, 19 Sep 2026 22:32:07 -0700 (PDT) Received: from [192.168.18.164] ([2600:8804:5716:d800::2620]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6cd3541f07fsm5007319eaf.10.2026.09.19.22.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2026 22:32:06 -0700 (PDT) From: Ryan Brue Date: Sun, 20 Sep 2026 00:31:53 -0500 Subject: [PATCH v3 3/3] mfd: mt6397-core: Add mt6397 AUXADC support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-3-c00edacbee64@gmail.com> References: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> In-Reply-To: <20260920-rbrue-suez-upstreaming-mt6397-auxadc-v3-0-c00edacbee64@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Lee Jones Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, mfd@lists.linux.dev, Roman Vivchar , Luca Leonardo Scorcia , Andy Shevchenko , Ryan Brue X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789882316; l=822; i=ryanbrue.dev@gmail.com; s=20260906; h=from:subject:message-id; bh=1otP8UYV9viBZZ+f8NwjITACufQDeLB/kdjE9I9R9IM=; b=9u9PT8EgMhT2CU7ynGTjZXDCJlhMILqp7KosTLFKUyKBrbzaMyv7T6YSoFBmQnoUOssaMtNEq wq0GEJz7dXDAC/rXFbTt3HuxJH3iGRrtfTsh2kyNLr/fEKdyaxtfq/X X-Developer-Key: i=ryanbrue.dev@gmail.com; a=ed25519; pk=KsUvVaP//v/2q+ZBuacc7cLbsyEYn+AD71Sn28oZWKo= The mt6397 PMIC includes an AUXADC. Register the AUXADC in the mt6397 devices array to allow the corresponding driver to probe using compatible string. Assisted-by: LLM Signed-off-by: Ryan Brue Reviewed-by: AngeloGioacchino Del Regno --- drivers/mfd/mt6397-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c index 9ec951996588..5d5f816492aa 100644 --- a/drivers/mfd/mt6397-core.c +++ b/drivers/mfd/mt6397-core.c @@ -261,6 +261,9 @@ static const struct mfd_cell mt6359_devs[] =3D { =20 static const struct mfd_cell mt6397_devs[] =3D { { + .name =3D "mt6397-auxadc", + .of_compatible =3D "mediatek,mt6397-auxadc", + }, { .name =3D "mt6397-rtc", .num_resources =3D ARRAY_SIZE(mt6397_rtc_resources), .resources =3D mt6397_rtc_resources, --=20 2.55.0