From nobody Thu Sep 24 15:10:56 2026 Received: from mail-oo2-f41.google.com (mail-oo2-f41.google.com [74.125.231.169]) (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 9866B5678EA for ; Tue, 22 Sep 2026 16:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790094889; cv=none; b=q+yX09aSMMQpwSdMpJxt2SoKFeiX9myFc+UtvwdamLSs8oLBY9XGymZJxXAjne1ul3iAugoaPPVzxiPcrbF0bwECMTzG8ROQKF4boN/yb29QSdmajKaxF559KzCGE2PO0Chpc2ZlgaSiOuPbK2EOgMrGWO+6MXRd0j8Pxwj+VFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790094889; c=relaxed/simple; bh=LUDT1kHiXHBCnePbIaYBUJQHAxuAaQl4Sg3kYNxuzRM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DErOOUG036B2lRkUQJKz0ujRvnGea0TZvwTxdzmYQX2l8rcNmhH4nGm0Fr9CaEsksnljYX00MDneX2JS5raGcVG4WfZOU2O/uJbEGmJZUxljONPKLjURCsk4QjzrmM6vWuUSq4Wy2DSwmEDg/myfvIi8Gss+klT3asQcqv0MQ1M= 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=L3VDAaPw; arc=none smtp.client-ip=74.125.231.169 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="L3VDAaPw" Received: by mail-oo2-f41.google.com with SMTP id 006d021491bc7-6b1ae6b1b26so11278eaf.2 for ; Tue, 22 Sep 2026 09:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790094885; x=1790699685; 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=eTa0efMcyPx+a3sRs/5/R1BWxQ19AFGAD7UOiV7rwak=; b=L3VDAaPwigTL0Yqzv2WXjuLyTxsVHgB/GB2iaqNiyYWP3dOBMlIjQ0hibDALLLqv6U rzKykCmBm5OXf8+AoZ+FHXIfc4m2EKaVrI6HU+NscIEwH0x6F4Yw/IHYDqNr60sweLYX ZiEW8vKzi1KGbtRmM1KdAnI6VsU1Pzo5UiKgL0PK2VbQ7aNSIjVZ/k7fIDaDPv4tceP6 eejJylM6Sj1AyadIbLXfHnThwbXxMuPx24M4hkyATgI7WxKKCNQmxNZxIZRoParuefS2 YQwcF0YikmEK8BirtyuzA0hmWYy0oQ8K8uNMQXC60+jvyuKxHW4wMMhhxo9bJcXcgYlY c9tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790094885; x=1790699685; 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=eTa0efMcyPx+a3sRs/5/R1BWxQ19AFGAD7UOiV7rwak=; b=Xvga6poxShO6PWxnVPZ3QR8YAq1NjvI+xRK4gCk/34Odb8hkyexHC0TNY21etPUOA2 4aySo/z3J/zmyef4ZGmUotXjB16tJM1txMQ1w4lIoPhWlda5eWD754KgrpciUAbVb67t 7iTpzxivL+tJqRpaVyiHABy78S7lu/qjgszD7aFoHyfYHKYnb1ikZOA9sHFALVILbGYl A8rELP+/qzen/5WjvX6wmQhnA3Mbk0nMv0LrYwsP8Nv0tY5CvdscLhWivRwYcxPYzSSM 6KFTYKy/Hdj7LLVfi9LiU84PQe7L/UgMWbx2FQA7drbWhXGCPhEqaf50Z5l32HY1b+sZ jxkg== X-Forwarded-Encrypted: i=1; AKwUvBzNt5q1zksZlNjAxynE4cchY9taATpMiac0sapJ1jc0tUpSnF8UQPTPDxb0BeuZHn8hN3TT45kcueDuMiY=@vger.kernel.org X-Gm-Message-State: AFuF++kfsi2TTjyr3au5NiYt5W0OKeHR1VgwJodHd2cXpx+ocoSoQrsT Te/teDLConGbK2Z1ItrHYdo35Jie+LvRRVpbzEo433PY+2R6R/KuPJmA X-Gm-Gg: AYBFou01cEVbAi854D4J8wBdoV6l17dZgSvKxOwTDlwXsegW7N9yMtWuRvbwnSzUlwm BtWHC3frfnCu70j7eQ5BIJQKtp1dFXcaGi5AEaK/TG+2mse7S8APLRxch6BZn+QHy+mXasWiiie uIyL4yhwjIlCX+cZT9PHDt9IdS5cpoDUMHHXNachsUInSGiITMc2fNCKQ7q2L4H8Qo63ayasGus okZAXdiUwZJrr296dhx3rG87VoyFeRcr5zXOnG4B+unGVfvtDxaOHoTWkOkXPd+X+EglPtUmkOH yaONliaS+G4sX6G7bmwTg6/OXCzlaLMnO8NTnRjdQrcLTpzQgieOT2kNymTmXPqP6SlZCj1wLlo 6W/hO/QXr2BdEz07BWgtbJmpVrmdXpbsiTwGPxbiqyaXmb/b76aA8pNnCFonKC5q8dNnYRgA6oQ zHgAHfOqt4zzdc4OGWBiMNfpW/5gT8j8TORyG0e91nvC9+FgioHFthwj/WxXpKlvmPQmMb4o2Eh fFXaCS3X7rrxKRZd0qaXjYTVOkvzW2KrE8C/nefDof/gKmcqDWOFvAsu7zo4dvmJZVuLvLq0WkW 2I14chojAzZGJOlqr0MZWmgYuFia65o/X85LP4K9TrWCJCpskNff8DD7pW/rA5/aSFxgecgO+ru P3i7TRP7JGbi0muPHIi+JCQ== X-Received: by 2002:a05:6820:4c15:b0:6c3:68bb:ec42 with SMTP id 006d021491bc7-6ca9be4ff88mr13199753eaf.35.1790094884804; Tue, 22 Sep 2026 09:34:44 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-814e0a13a73sm2679320a34.0.2026.09.22.09.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:34:44 -0700 (PDT) From: James Hilliard Date: Tue, 22 Sep 2026 10:34:34 -0600 Subject: [PATCH v13 1/2] dt-bindings: mfd: x-powers: Add AC200 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: <20260922-submit-ac200-mfd-v13-1-8832afd2481c@gmail.com> References: <20260922-submit-ac200-mfd-v13-0-8832afd2481c@gmail.com> In-Reply-To: <20260922-submit-ac200-mfd-v13-0-8832afd2481c@gmail.com> To: Jernej Skrabec , James Hilliard , Lee Jones , Arnd Bergmann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Andrew Lunn , "Jagielski, Jedrzej" , Andre Przywara , Chen-Yu Tsai , linux-sunxi@lists.linux.dev, mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley X-Mailer: b4 0.15.2 The AC200 is an I2C-controlled mixed-signal companion IC containing audio, video, RTC and Fast Ethernet PHY functions. Describe the shared input clock, audio DAI, TV encoder display graph and optional bandgap calibration in one parent node. The codec and TV encoder do not need separate firmware nodes. AC_LDOIN and TV_VCC are distinct 3.3 V supply inputs. Describe them separately without requiring different external regulators. Require the audio supply when the DAI is described and the video supply when the display graph is present, while allowing PHY-only configurations. Describe the optional shared INTB connection without an internal interrupt domain. Cable detection status remains readable over I2C when INTB is not connected. Include wired and unwired examples. The Ethernet PHY is represented by a PHY package on its MDIO bus, with a phandle back to this device for access to the package control registers. It therefore does not require an MFD child node. The input clock must run at 24 or 27 MHz when the Ethernet PHY is used, matching the rates encoded by its documented clock selector. Co-developed-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Signed-off-by: James Hilliard Reviewed-by: Conor Dooley --- .../devicetree/bindings/mfd/x-powers,ac200.yaml | 168 +++++++++++++++++= ++++ MAINTAINERS | 7 + 2 files changed, 175 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Do= cumentation/devicetree/bindings/mfd/x-powers,ac200.yaml new file mode 100644 index 000000000000..75dafa7c1071 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml @@ -0,0 +1,168 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/x-powers,ac200.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: X-Powers AC200 mixed-signal IC + +maintainers: + - James Hilliard + - Jernej Skrabec + +description: + The AC200 is a mixed-signal companion IC containing audio, video, RTC and + Fast Ethernet PHY functions. Its control registers are accessed over I2C. + The audio codec and TV encoder are described by properties of this node. + The Ethernet PHY is described separately on its MDIO bus. + +allOf: + - $ref: /schemas/sound/dai-common.yaml# + +properties: + compatible: + const: x-powers,ac200 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + description: + AC200 input clock. When using the Ethernet PHY, its configured rate = must + be 24 or 27 MHz, matching the rates encoded by the documented EPHY c= lock + selector. + + interrupts: + maxItems: 1 + description: + The shared, level-triggered, open-drain INTB output for the TV encod= er, + Ethernet PHY and RTC interrupts. Omit when INTB is not connected. TV + encoder cable detection status can also be read over I2C without an + interrupt. + + '#sound-dai-cells': + const: 0 + + ac-ldoin-supply: + description: + The 3.3 V supply connected to the AC_LDOIN pin for the audio codec L= DO + input. This may be the same regulator as tv-vcc-supply. + + tv-vcc-supply: + description: + The 3.3 V supply connected to the TV_VCC pin for the composite-video + DAC. This may be the same regulator as ac-ldoin-supply. + + nvmem-cells: + maxItems: 1 + description: TV encoder bandgap calibration. + + nvmem-cell-names: + items: + - const: bandgap + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Input to the TV encoder, carrying CCIR656. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Output to the composite-video connector. + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - clocks + +dependencies: + '#sound-dai-cells': [ ac-ldoin-supply ] + ports: [ tv-vcc-supply ] + nvmem-cells: [ nvmem-cell-names ] + nvmem-cell-names: [ nvmem-cells ] + +unevaluatedProperties: false + +examples: + - | + #include + + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + mixed-signal@10 { + compatible =3D "x-powers,ac200"; + reg =3D <0x10>; + clocks =3D <&pwm 5>; + interrupt-parent =3D <&pio>; + interrupts =3D <1 20 IRQ_TYPE_LEVEL_LOW>; + #sound-dai-cells =3D <0>; + ac-ldoin-supply =3D <®_aldo2>; + tv-vcc-supply =3D <®_aldo2>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + tve_in: endpoint { + remote-endpoint =3D <&tcon_out_tve>; + }; + }; + + port@1 { + reg =3D <1>; + + tve_out: endpoint { + remote-endpoint =3D <&composite_in>; + }; + }; + }; + }; + }; + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + mixed-signal@10 { + compatible =3D "x-powers,ac200"; + reg =3D <0x10>; + clocks =3D <&pwm 5>; + /* INTB is not connected. */ + tv-vcc-supply =3D <®_aldo2>; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + + port@0 { + reg =3D <0>; + + endpoint { + remote-endpoint =3D <&tcon_out_tve>; + }; + }; + + port@1 { + reg =3D <1>; + + endpoint { + remote-endpoint =3D <&composite_in>; + }; + }; + }; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c..419340093c9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -29504,6 +29504,13 @@ F: drivers/net/wwan/ F: include/linux/wwan.h F: include/uapi/linux/wwan.h =20 +X-POWERS AC200 DRIVERS +M: Jernej Skrabec +M: James Hilliard +L: linux-sunxi@lists.linux.dev +S: Maintained +F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml + X-POWERS AXP288 PMIC DRIVERS M: Hans de Goede S: Maintained --=20 2.53.0 From nobody Thu Sep 24 15:10:56 2026 Received: from mail-oi2-f43.google.com (mail-oi2-f43.google.com [74.125.231.235]) (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 1C266568FD2 for ; Tue, 22 Sep 2026 16:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790094891; cv=none; b=AobgH2baeGZnLvc1MYOGNTpxxzE+upsGPMqYz1pQUrzA+0tpnpdU4RiuLTOyw7h3jISiT2L7lkUbqlwyq28lZNRBG5z9qpmEvNtEqDQ9O3apWXjP1tT0cP7bGrZngwX78cOsJL6F5RkvtBLD+OQxjp1jR/0YuQXTmVPDhz9gfMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790094891; c=relaxed/simple; bh=sQ3EwTgn0EUt9L8CXBhCZb8lf3xC0w0ejiBjOSV8Pco=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FVtsrvcTuMAWo6MNCH3MXg8WTSgA4fAV3f+anTjkyRxYXIOgBs119l9v/nKT3zsBl8l3QAub7aTSARVmXS6X+Aws1B8uALXw3w6QKuDVYsZ72H06GjZ8tQZrknWqZbsaIpyT9ka7/9mbHuGEti05KfBX/01nLO0euR9isBPZ5ZQ= 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=A2HP7tWd; arc=none smtp.client-ip=74.125.231.235 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="A2HP7tWd" Received: by mail-oi2-f43.google.com with SMTP id 46e09a7af769-7fccd4c3f36so127956a34.3 for ; Tue, 22 Sep 2026 09:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790094886; x=1790699686; 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=660IpMR0mIr/dOv4xwWcEolN+/t1yP+V7wW0zQGaZaQ=; b=A2HP7tWdVWWx/fd6vQL7k8rcYgHq+41hUkWddMzJJ9e/hEipAC5II4HiICpdl/K1/s 29J5rvf226MH4uTnLOyTn/YjghhiVoVP0sc9CoGrv7zIET8JT4QdaFY9JlIkrTiTlKx4 ggCo7XEkDcXib1ToOOR4RGIFhtAHRtWyYa9fqlHBlJ0dDLdrD3FSe+gdARIUIeynueJM 7eNtGTotGAhppvyL86ceF82Y/G4fSDOVXcuuqUDy6c4McfOuz5TMb6kfTRp1aAKPPQGm EaxPwh/qav5ovkq0exybMDh3cfrSO6HsCQYjak7K4QaKIUy6nN/oQJ3VnkJ+IkByinUt dHGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790094886; x=1790699686; 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=660IpMR0mIr/dOv4xwWcEolN+/t1yP+V7wW0zQGaZaQ=; b=fFnERFaFn4tL39uBFopmpofndk1hQwJ+41g8GqmSf3NzDE44onZOGXdf4PYjVp9xvs 5ww3A3lLciFA0rX5fOzLxt4hsUsLrGfpgPk1IP5GSFgFdgjj2lzm+qtWS0m6Yg2WyWoj RNuXZDalYY1BUBc10nabsvzAG1ubmjoVPrxyh+mUd/zNrvh6cxjfNkx8YmStt3JehJz6 /BkgN60jfFl14GUmGFwqf3c2ner41eCoYLPNJvb1r1PSI0NLE0BqjMN2A6HteFWMSF2z M+pIFaEQxR6PCRf5s8QPsFRpiLH+Cfras8bjVL/He4PUoU3N9FFdspZkrDqv8STzWgut DM2A== X-Forwarded-Encrypted: i=1; AKwUvBxj+3xVgV3D5abneXNYZte64qxK64NtH5/xRMDFqeHmucvj4J4a8YRCKWAQqMacXHiy2cA0VyT0C0o6y/A=@vger.kernel.org X-Gm-Message-State: AFuF++kPczBz/PWcvo8icuMsLH/TCQDYLQs1oNh+AjJMoLe57KRD3oYa vLxZfjEA+TOR4E3G0G6mxA2be2LVR+/yjIASdO5P8BWEZJl7AaZsYVmB X-Gm-Gg: AYBFou26S8BS/D7uEUbpb3wM1xWaPXViE+smykx7/GKVjKq+UMRTZXQYnsTWtOxYdty J1le3IsLAz4vVnG26/aagGOsCjJmIv8TuD2RNXlpDtWjlF/WhF5uaZyT8YYI4bcAlYX6JyG9QV2 YYgksk2JoZKPKqxw1soXTLVsOMAntl/0pp+Apwahbwwo2ns3UnN4FgJ7RDBCjcXqb/HVuvXED6m DC+jw8L/MkGeYC4UmQCR/MnJ3kSCq67pwZT6yrVYIq3Ht+VROXaeYSItXwoYRL4yRzxJXJlwt8l W0RXkHn6ICBY+Yz81Zz2E3tSI5XyQIQ1BJ5L80NbnXmohaDuIOOzrowWKkRrkYBP92cXGRf9CQQ Fh+qC5PhxtTHhFw5jAjJixgxwVWuLxFRZOch7sbMtFaJa3PilAOA0wnnxVJk/k2setd5npguxcS KG65NUcTbysmso4v3PqOvcu4z3Au+ioSHJolWwKuoS4yBAOMBsJIg1gSOaiYQJgWEtwmLtEjNSm 3JZzcnh0Tl0dwu+jfGLI27op7m0jVz1rYmS4lsYIU0s9ouQ0H2XMtRjdByX50/oAl/r9pS1UV2G 9kQK0PrK0dEK6shSFvtt3dvXLpjMf4nzAUitl7snfl2jBvFMLk63LCBCpTrGqG35uGWEOYKW+SF UiCuvgkqOK1H/WnS/x2hsijo= X-Received: by 2002:a05:6830:44ab:b0:7f8:4ebe:2854 with SMTP id 46e09a7af769-815ef49c682mr197798a34.4.1790094886387; Tue, 22 Sep 2026 09:34:46 -0700 (PDT) Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-814e0a13a73sm2679320a34.0.2026.09.22.09.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 09:34:45 -0700 (PDT) From: James Hilliard Date: Tue, 22 Sep 2026 10:34:35 -0600 Subject: [PATCH v13 2/2] mfd: ac200: Add X-Powers AC200 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: <20260922-submit-ac200-mfd-v13-2-8832afd2481c@gmail.com> References: <20260922-submit-ac200-mfd-v13-0-8832afd2481c@gmail.com> In-Reply-To: <20260922-submit-ac200-mfd-v13-0-8832afd2481c@gmail.com> To: Jernej Skrabec , James Hilliard , Lee Jones , Arnd Bergmann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Andrew Lunn , "Jagielski, Jedrzej" , Andre Przywara , Chen-Yu Tsai , linux-sunxi@lists.linux.dev, mfd@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15.2 The X-Powers AC200 is a mixed-signal companion IC with a paged register map accessed over I2C. Enable and rate-lock the shared input clock, retain the vendor resume path's 40 ms wait before creating the regmap and accessing registers, and deassert the common reset. No minimum delay is documented. Set only the deassert bit instead of forcing a reset cycle, avoiding a chip-wide reset of unrelated function registers. Leave the common reset deasserted during driver removal and system shutdown; function drivers own their block resets. Supplier unbind still tears down linked consumers and releases the provider's clock references. Cache only the common page selector. Individual functions can reset independently and invalidate their other registers, so leave all functional registers volatile. Register the audio codec and TV encoder using static MFD cells and automatically assigned platform device IDs. Their firmware properties belong to the parent node. Map their supply lookups to the parent with MFD supply aliases, without assigning separate OF nodes to the cells. When INTB is connected, pass its physical IRQ to the TV encoder cell. Select a cell array without IRQ resources when INTB is absent. No regmap IRQ controller or private IRQ domain is needed. Configure the level-triggered INTB output, defaulting to level-low when the upstream IRQ has no trigger type. Mask all sources before enabling INTB. Function drivers request shared threaded IRQs before enabling their own source, check and clear their own status, and mask their source before freeing the IRQ. Disable INTB after removing the children on failure or removal, while the regmap and clock are still available. The Ethernet PHY is enumerated on its MDIO bus rather than as an MFD child. It follows the x-powers,ac200 phandle and uses this regmap for ancillary package-control access. Co-developed-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Signed-off-by: James Hilliard --- MAINTAINERS | 1 + drivers/mfd/Kconfig | 14 ++++ drivers/mfd/Makefile | 1 + drivers/mfd/ac200.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 238 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 419340093c9b..1d03b0060bda 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -29510,6 +29510,7 @@ M: James Hilliard L: linux-sunxi@lists.linux.dev S: Maintained F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml +F: drivers/mfd/ac200.c =20 X-POWERS AXP288 PMIC DRIVERS M: Hans de Goede diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 857ca3bb0d5b..071cba7c775b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -205,6 +205,20 @@ config MFD_AC100 This driver include only the core APIs. You have to select individual components like codecs or RTC under the corresponding menus. =20 +config MFD_AC200 + tristate "X-Powers AC200" + depends on COMMON_CLK + depends on I2C + depends on OF + select MFD_CORE + select REGMAP_I2C + help + Support for the X-Powers AC200 mixed-signal companion IC. The AC200 + contains audio, video, RTC and Fast Ethernet PHY functions and is + co-packaged with some Allwinner H6 and H616 SoCs. This driver provides + the shared register access and instantiates the individual function + devices. + config MFD_AXP20X tristate select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 72d3944b0ad8..f8101d2a9ce9 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -150,6 +150,7 @@ obj-$(CONFIG_MFD_DA9052_SPI) +=3D da9052-spi.o obj-$(CONFIG_MFD_DA9052_I2C) +=3D da9052-i2c.o =20 obj-$(CONFIG_MFD_AC100) +=3D ac100.o +obj-$(CONFIG_MFD_AC200) +=3D ac200.o obj-$(CONFIG_MFD_AXP20X) +=3D axp20x.o obj-$(CONFIG_MFD_AXP20X_I2C) +=3D axp20x-i2c.o obj-$(CONFIG_MFD_AXP20X_RSB) +=3D axp20x-rsb.o diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c new file mode 100644 index 000000000000..3c6543a1688c --- /dev/null +++ b/drivers/mfd/ac200.c @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * X-Powers AC200 Core driver + * + * Copyright (C) 2019 Jernej Skrabec + * Copyright (C) 2026 James Hilliard + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define AC200_SYS_CONTROL_REG 0x0002 +#define AC200_SYS_CONTROL_CHIP_RESET_DEASSERT BIT(0) +#define AC200_SYS_IRQ_ENABLE_REG 0x0004 +#define AC200_SYS_IRQ_INTB_ENABLE BIT(15) +#define AC200_SYS_IRQ_INTB_ACTIVE_HIGH BIT(14) +#define AC200_SYS_IRQ_RTC BIT(12) +#define AC200_SYS_IRQ_EPHY BIT(8) +#define AC200_SYS_IRQ_TVE BIT(4) + +/* Interface register accessible from every register page. */ +#define AC200_TWI_REG_ADDR_H 0x00fe +#define AC200_MAX_REG 0xa1f2 + +static const struct regmap_range_cfg ac200_range_cfg[] =3D { + { + .range_max =3D AC200_MAX_REG, + .selector_reg =3D AC200_TWI_REG_ADDR_H, + .selector_mask =3D 0xff, + .window_len =3D 256, + }, +}; + +/* + * Each AC200 sub-block can reset independently, invalidating its register + * contents without regmap's knowledge. Cache only the common page selecto= r; + * this avoids a selector read-modify-write for every access on the same p= age + * without ever returning stale functional-register values. + */ +static bool ac200_volatile_reg(struct device *dev, unsigned int reg) +{ + return reg !=3D AC200_TWI_REG_ADDR_H; +} + +static const struct regmap_config ac200_regmap_config =3D { + .name =3D "ac200", + .reg_bits =3D 8, + .reg_stride =3D 2, + .val_bits =3D 16, + .ranges =3D ac200_range_cfg, + .num_ranges =3D ARRAY_SIZE(ac200_range_cfg), + .max_register =3D AC200_MAX_REG, + .volatile_reg =3D ac200_volatile_reg, + .cache_type =3D REGCACHE_MAPLE, +}; + +static const char * const ac200_codec_supplies[] =3D { + "ac-ldoin", +}; + +static const char * const ac200_tve_supplies[] =3D { + "tv-vcc", +}; + +static const struct resource ac200_tve_resources[] =3D { + DEFINE_RES_IRQ_NAMED(0, "intb"), +}; + +#define AC200_CELL(_name, _supplies, _resources) \ + { \ + .name =3D (_name), \ + .parent_supplies =3D (_supplies), \ + .num_parent_supplies =3D ARRAY_SIZE(_supplies), \ + .resources =3D (_resources), \ + .num_resources =3D MFD_RES_SIZE(_resources), \ + } + +static const struct mfd_cell ac200_cells[] =3D { + AC200_CELL("ac200-codec", ac200_codec_supplies, NULL), + AC200_CELL("ac200-tve", ac200_tve_supplies, ac200_tve_resources), +}; + +static const struct mfd_cell ac200_noirq_cells[] =3D { + AC200_CELL("ac200-codec", ac200_codec_supplies, NULL), + AC200_CELL("ac200-tve", ac200_tve_supplies, NULL), +}; + +static void ac200_disable_intb(void *data) +{ + struct regmap *regmap =3D data; + int ret; + + ret =3D regmap_clear_bits(regmap, AC200_SYS_IRQ_ENABLE_REG, AC200_SYS_IRQ= _INTB_ENABLE); + if (ret) + dev_err(regmap_get_device(regmap), "failed to disable INTB: %d\n", ret); +} + +static int ac200_init_irq(struct device *dev, struct regmap *regmap, int i= rq) +{ + unsigned int trigger; + u16 value =3D 0; + int ret; + + trigger =3D irq_get_trigger_type(irq); + switch (trigger) { + case IRQ_TYPE_LEVEL_HIGH: + value |=3D AC200_SYS_IRQ_INTB_ACTIVE_HIGH; + break; + case IRQ_TYPE_NONE: + case IRQ_TYPE_LEVEL_LOW: + break; + default: + return dev_err_probe(dev, -EINVAL, + "INTB is level triggered, not type %u\n", trigger); + } + + /* Mask every source before enabling the shared output. */ + ret =3D regmap_update_bits(regmap, AC200_SYS_IRQ_ENABLE_REG, + AC200_SYS_IRQ_INTB_ENABLE | AC200_SYS_IRQ_INTB_ACTIVE_HIGH | + AC200_SYS_IRQ_RTC | AC200_SYS_IRQ_EPHY | AC200_SYS_IRQ_TVE, value); + if (ret) + return ret; + + /* Children are removed before INTB is disabled and the regmap released. = */ + ret =3D devm_add_action_or_reset(dev, ac200_disable_intb, regmap); + if (ret) + return ret; + + if (trigger =3D=3D IRQ_TYPE_NONE) { + ret =3D irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW); + if (ret) + return dev_err_probe(dev, ret, "failed to set INTB trigger\n"); + } + + /* + * Function drivers request INTB with IRQF_SHARED | IRQF_ONESHOT before + * enabling their own source. They check and clear their own status and + * mask their source before freeing the IRQ. No IRQ domain is needed. + */ + return regmap_set_bits(regmap, AC200_SYS_IRQ_ENABLE_REG, AC200_SYS_IRQ_IN= TB_ENABLE); +} + +static int ac200_probe(struct i2c_client *client) +{ + const struct mfd_cell *cells =3D ac200_noirq_cells; + unsigned int num_cells =3D ARRAY_SIZE(ac200_noirq_cells); + struct device *dev =3D &client->dev; + struct regmap *regmap; + struct clk *clk; + int ret; + + clk =3D devm_clk_get_enabled(dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(dev, PTR_ERR(clk), "failed to enable input clock\n"= ); + + ret =3D devm_clk_rate_exclusive_get(dev, clk); + if (ret) + return dev_err_probe(dev, ret, "failed to lock clock rate\n"); + + /* + * No minimum delay is documented. Retain the vendor resume path's 40 ms + * wait after enabling the input clock and before register access. + */ + msleep(40); + + regmap =3D devm_regmap_init_i2c(client, &ac200_regmap_config); + if (IS_ERR(regmap)) + return dev_err_probe(dev, PTR_ERR(regmap), "failed to initialize regmap\= n"); + + ret =3D regmap_set_bits(regmap, AC200_SYS_CONTROL_REG, AC200_SYS_CONTROL_= CHIP_RESET_DEASSERT); + if (ret) + return ret; + + if (client->irq > 0) { + ret =3D ac200_init_irq(dev, regmap, client->irq); + if (ret) + return ret; + cells =3D ac200_cells; + num_cells =3D ARRAY_SIZE(ac200_cells); + } + + /* Function drivers read their firmware properties from the parent. */ + ret =3D devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, cells, num_cells, + NULL, client->irq, NULL); + if (ret) + return dev_err_probe(dev, ret, "failed to add function devices\n"); + + return 0; +} + +static const struct of_device_id ac200_of_match[] =3D { + { .compatible =3D "x-powers,ac200" }, + { } +}; +MODULE_DEVICE_TABLE(of, ac200_of_match); + +static const struct i2c_device_id ac200_i2c_ids[] =3D { + { .name =3D "ac200" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ac200_i2c_ids); + +static struct i2c_driver ac200_driver =3D { + .driver =3D { + .name =3D "ac200", + .of_match_table =3D ac200_of_match, + }, + .probe =3D ac200_probe, + .id_table =3D ac200_i2c_ids, +}; +module_i2c_driver(ac200_driver); + +MODULE_AUTHOR("Jernej Skrabec "); +MODULE_AUTHOR("James Hilliard "); +MODULE_DESCRIPTION("X-Powers AC200 Core driver"); +MODULE_LICENSE("GPL"); --=20 2.53.0