Pillgram::Audio: Difference between revisions

From Amar
Jump to navigationJump to search
→‎Schematics: File with copyright
→‎Device Tree: Correct device tree
Line 4: Line 4:


== Device Tree ==
== Device Tree ==
<syntaxhighlight>/dts-v1/;
<syntaxhighlight/dts-v1/;
/plugin/;  
/plugin/;
 
/ {  
/ {
     compatible = "brcm,bcm2712", "brcm,bcm2711", "brcm,bcm2835";
     compatible = "brcm,bcm2712", "brcm,bcm2711", "brcm,bcm2835";
    // compatible = "brcm,bcm2835";
 
     fragment@0 {
     fragment@0 {
         target = <&i2s>; // For RPi4
         target = <&i2s_clk_consumer>;
         __overlay__ {
         __overlay__ {
             status = "okay";
             status = "okay";
             #sound-dai-cells = <0>;
             #sound-dai-cells = <0>;
             brcm,tx-channels = <2>;
             brcm,tx-channels = <2>;
             brcm,rx-channels = <2>;
             brcm,rx-channels = <1>;
        };
    };
 
    fragment@1 {
        target-path = "/";
        __overlay__ {
            status = "okay";
 
            codec_1v8_reg: codec-1v8-reg {
                compatible = "regulator-fixed";
                regulator-name = "tlv320aic3104_1v8";
                regulator-min-microvolt = <1800000>;
                regulator-max-microvolt = <1800000>;
                regulator-always-on;
                status = "okay";
            };
         };
         };
     };
     };
   
   
     fragment@2 {
     fragment@2 {
            target-path = "/";
            __overlay__ {
                    codec_1v8_reg: codec-1v8-reg {
                        compatible = "regulator-fixed";
                        regulator-name = "tlv320aic3104_1v8";
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <1800000>;
                        regulator-always-on;
                    };
            };
    };
 
    fragment@3 {
         target = <&i2c1>;
         target = <&i2c1>;
         __overlay__ {
         __overlay__ {
Line 39: Line 43:
             #size-cells = <0>;    /* No size cells for I2C devices */
             #size-cells = <0>;    /* No size cells for I2C devices */
             status = "okay";
             status = "okay";
 
             tlv320aic3110: tlv320aic3110@18 {
             tlv320aic3110: tlv320aic3110@18 {
                 compatible = "ti,tlv320aic3110", "ti,tlv320aic311x";  
                 compatible = "ti-pg,tlv320aic3110", "ti,tlv320aic3110", "ti,tlv320aic311x";  
                 reg = <0x18>;
                 reg = <0x18>;
                 #sound-dai-cells = <0>;
                 #sound-dai-cells = <0>;
Line 47: Line 51:
                 // system-clock-direction-out;          // Codec as master
                 // system-clock-direction-out;          // Codec as master
                 status = "okay";
                 status = "okay";
 
                 HPVDD-supply = <&vdd_3v3_reg>;
                 HPVDD-supply = <&vdd_3v3_reg>;
                 SPRVDD-supply = <&vdd_5v0_reg>;
                 SPRVDD-supply = <&vdd_5v0_reg>;
Line 54: Line 58:
                 IOVDD-supply = <&vdd_3v3_reg>;
                 IOVDD-supply = <&vdd_3v3_reg>;
                 DVDD-supply = <&codec_1v8_reg>;
                 DVDD-supply = <&codec_1v8_reg>;
 
                 clocks = <&mclk_external>;
                 clocks = <&mclk_external>;
                 clock-names = "mclk";
                 clock-names = "mclk";
Line 60: Line 64:
                 mclk-frequency = <12288000>;
                 mclk-frequency = <12288000>;
                 // gpio-controller;
                 // gpio-controller;
 
                /* PLL configuration for 48kHz with 12.288MHz MCLK */
                 reset-gpios = <&gpio 13 1>; // GPIO 13 as active low reset
                pll-p = <1>;
                pll-r = <1>;
                pll-j = <7>;
                pll-d = <1680>;
                 reset-gpios = <&gpio 13 0>; // GPIO 13 as active high
                 reset-delay-us = <10000>;    /* 10ms delay */
                 reset-delay-us = <10000>;    /* 10ms delay */
 
                 // Debug properties
                 // Debug properties (must precede subnodes)
                 debug;
                 debug;
                 linux,debug;
                 linux,debug;
             };
             };
         };
         };
     };
     };
 
     fragment@5 {
     fragment@3 {
         target = <&sound>;
         target = <&sound>;
         __overlay__ {
         __overlay__ {
             compatible = "simple-audio-card";
             compatible = "simple-audio-card";
            i2s-controller = <&i2s_clk_consumer>;
             simple-audio-card,name = "TLV320AIC3110";
             simple-audio-card,name = "TLV320AIC3110";
             simple-audio-card,format = "i2s";
             simple-audio-card,format = "i2s";
             // simple-audio-card,bitclock-master = <&dailink0_master>;
             simple-audio-card,convert-rate = <48000>;
             // simple-audio-card,frame-master = <&dailink0_master>;
            simple-audio-card,mclk-fs = <256>;
 
            simple-audio-card,bitclock-master = <&snd_codec>;
             simple-audio-card,frame-master = <&snd_codec>;
 
             simple-audio-card,widgets =
             simple-audio-card,widgets =
                 "Microphone", "Mic Jack",
                 "Microphone", "Mic Jack",
                 "Speaker", "Speaker Left",
                 "Speaker", "External Speaker";
                "Speaker", "Speaker Right";
             simple-audio-card,routing =
             simple-audio-card,routing =
                 "Speaker Left", "SPL",
                 "External Speaker", "SPL",
                 "Speaker Right", "SPR",
                 "External Speaker", "SPR",
                 "MIC1LP", "Mic Jack",
                 "MIC1LP", "Mic Jack",
                 "MIC1LM", "Mic Jack";
                 "MIC1LM", "Mic Jack";
             status = "okay";
             status = "okay";
 
             simple-audio-card,cpu {
             dailink0_master: simple-audio-card,cpu {
                 sound-dai = <&i2s>;
                 sound-dai = <&i2s_clk_consumer>;
                dai-tdm-slot-num = <2>;
                dai-tdm-slot-width = <32>;
             };
             };
 
             dailink0_master: simple-audio-card,codec {
             snd_codec: simple-audio-card,codec {
                 sound-dai = <&tlv320aic3110>;
                 sound-dai = <&tlv320aic3110>;
                 clocks = <&mclk_external>;
                 clocks = <&mclk_external>;
                system-clock-direction-out = "out";
                 system-clock-frequency = <12288000>; //*** added LAX
                 system-clock-frequency = <12288000>; //*** added LAX
                 mclk-fs = <256>; //*** added LAX
                 mclk-fs = <256>; //*** added LAX
Line 109: Line 115:
         };
         };
     };
     };
 
     fragment@6 {
     fragment@4 {
         target-path = "/";
         target-path = "/";
         __overlay__ {
         __overlay__ {

Revision as of 20:38, 20 January 2025

TLV320AIC3110

Schematics

Device Tree

<syntaxhighlight/dts-v1/; /plugin/;

/ {

   compatible = "brcm,bcm2712", "brcm,bcm2711", "brcm,bcm2835";
   // compatible = "brcm,bcm2835";
   fragment@0 {
       target = <&i2s_clk_consumer>;
       __overlay__ {
           status = "okay";
           #sound-dai-cells = <0>;
           brcm,tx-channels = <2>;
           brcm,rx-channels = <1>;
       };
   };
   fragment@1 {
       target-path = "/";
       __overlay__ {
           status = "okay";
           codec_1v8_reg: codec-1v8-reg {
               compatible = "regulator-fixed";
               regulator-name = "tlv320aic3104_1v8";
               regulator-min-microvolt = <1800000>;
               regulator-max-microvolt = <1800000>;
               regulator-always-on;
               status = "okay";
           };
       };
   };

   fragment@2 {
       target = <&i2c1>;
       __overlay__ {
           #address-cells = <1>; /* Single cell for I2C address */
           #size-cells = <0>;    /* No size cells for I2C devices */
           status = "okay";
           tlv320aic3110: tlv320aic3110@18 {
               compatible = "ti-pg,tlv320aic3110", "ti,tlv320aic3110", "ti,tlv320aic311x"; 
               reg = <0x18>;
               #sound-dai-cells = <0>;
               // system-clock-frequency = <12288000>;  // Codec clock config
               // system-clock-direction-out;           // Codec as master
               status = "okay";
               HPVDD-supply = <&vdd_3v3_reg>;
               SPRVDD-supply = <&vdd_5v0_reg>;
               SPLVDD-supply = <&vdd_5v0_reg>;
               AVDD-supply = <&vdd_3v3_reg>;
               IOVDD-supply = <&vdd_3v3_reg>;
               DVDD-supply = <&codec_1v8_reg>;
               clocks = <&mclk_external>;
               clock-names = "mclk";
               // system-clk-frequency = <12288000>;
               mclk-frequency = <12288000>;
               // gpio-controller;
               reset-gpios = <&gpio 13 1>; // GPIO 13 as active low reset
               reset-delay-us = <10000>;     /* 10ms delay */
               // Debug properties (must precede subnodes)
               debug;
               linux,debug;
           };
       };
   };
   fragment@3 {
       target = <&sound>;
       __overlay__ {
           compatible = "simple-audio-card";
           i2s-controller = <&i2s_clk_consumer>;
           simple-audio-card,name = "TLV320AIC3110";
           simple-audio-card,format = "i2s";
           simple-audio-card,convert-rate = <48000>;
           simple-audio-card,mclk-fs = <256>;
           simple-audio-card,bitclock-master = <&snd_codec>;
           simple-audio-card,frame-master = <&snd_codec>;
           simple-audio-card,widgets =
               "Microphone", "Mic Jack",
               "Speaker", "External Speaker";
           simple-audio-card,routing =
               "External Speaker", "SPL",
               "External Speaker", "SPR",
               "MIC1LP", "Mic Jack",
               "MIC1LM", "Mic Jack";
           status = "okay";
           dailink0_master: simple-audio-card,cpu {
               sound-dai = <&i2s_clk_consumer>;
               dai-tdm-slot-num = <2>;
               dai-tdm-slot-width = <32>;
           };
           snd_codec: simple-audio-card,codec {
               sound-dai = <&tlv320aic3110>;
               clocks = <&mclk_external>;
               system-clock-direction-out = "out";
               system-clock-frequency = <12288000>; //*** added LAX
               mclk-fs = <256>; //*** added LAX
           };
       };
   };
   fragment@4 {
       target-path = "/";
       __overlay__ {
           mclk_external: mclk_external {
               compatible = "fixed-clock";
               #clock-cells = <0>;
               clock-frequency = <12288000>; // 12.288 MHz
               clock-output-names = "mclk";
           };
       };
   };

}; </syntaxhighlight>