arm64: dts: qcom: msm8953-xiaomi-vince: add TAS2557 speaker amplifier - #252
arm64: dts: qcom: msm8953-xiaomi-vince: add TAS2557 speaker amplifier #252M0Rf30 wants to merge 4 commits into
Conversation
|
Nice, need to try if the amp on FP3+ works with this :) |
c28ebec to
e205166
Compare
e205166 to
be97d7a
Compare
|
rebased on latest sdm660-mainline reviews |
be97d7a to
0c40162
Compare
|
Please send it to upstream at least for review, we have too much downstream commit at the moment what were never sent too upstream. |
|
Lets wait 7.1 rebase there will be little changes in pinctrls. |
0c40162 to
638e44a
Compare
| firmware-name = "qcom/msm8953/xiaomi/vince/a506_zap.mdt"; | ||
| }; | ||
|
|
||
| &i2c_2 { |
There was a problem hiding this comment.
| &i2c_2 { | |
| &i2c_2 { | |
| clock-frequency = <400000>; |
Apparently by default i2c runs at 100KHz. Downstream overrides it to 400KHz which would help to speed up firmware upload.
| CONFIG_SND_SOC_MSM8916_WCD_ANALOG=m | ||
| CONFIG_SND_SOC_MSM8916_WCD_DIGITAL=m | ||
| CONFIG_SND_SOC_QDSP6_Q6VOICE=m | ||
| CONFIG_SND_SOC_TAS2557=m |
There was a problem hiding this comment.
Why not in xiaomi-vince.config? This isn't used on many msm8953 devices.
| TAS2557_ASI2_BDIV_CLK_RATIO_REG, 0x81, /* power up BDIV */ | ||
| TAS2557_ASI2_WDIV_CLK_RATIO_REG, 0x40, | ||
| TAS2557_ASI2_WDIV_CLK_RATIO_REG, 0xc0, /* power up WDIV */ | ||
| TAS2557_GPIO7_PIN_REG, 0x15, /* GPIO7 = ASI2 DOUT */ |
There was a problem hiding this comment.
I don't like hard-coding pin configurations like this. Especially setting grounded pin to output mode (on vince all "default" asi2 pins are connected to ground according to schematic). Meanwhile actually connected GPIO3 is not configured (default config seems to be interrupt output).
I think pin connections should be explicitly described in DT, something like this:
ti,i2s-asi1-pins = "gpio1", "gpio2", "gpi1", "gpio3">;
ti,i2s-asi2-pins = "gpio5", "gpio6", "gpio8", "gpio7";
| } | ||
|
|
||
| /* Apply DAC gain */ | ||
| tas2557_dev_update_bits(tas2557, TAS2557_SPK_CTRL_REG, |
There was a problem hiding this comment.
Changing this register here or during playback with control causes volume to keep oscillating with few second period.
| // | ||
| // The TAS2557 requires DSP firmware (tas2557_uCDSP.bin for PG2.x, | ||
| // tas2557_pg1p0_uCDSP.bin for PG1.0) to route audio through its internal | ||
| // DSP and DAC. Without loaded firmware the device produces no audio. |
There was a problem hiding this comment.
This is only because that firmware hides necessary init settings. I could make it produce sound on vince with just 17 writes below instead (based on ROMMODE2 config). This might not configure some features and right tuning tho.
w 4 (82 19 38) d1 50 00 10
w 1 (00 00 2a) 04
w 1 (00 01 73) 0f
w 1 (00 01 74) 00
w 1 (64 00 1b) 01
w 1 (64 00 1c) 20
w 1 (64 00 1d) 00
w 1 (64 00 1e) 00
w 1 (64 00 20) 02
w 1 (64 00 22) 08
w 1 (64 00 02) 10
w 1 (64 00 21) 08
w 1 (64 00 01) 08
w 1 (64 00 2b) 00
w 1 (64 00 2c) 40
w 1 (64 00 1f) 20
w 1 (64 00 2a) 00
| offset = (tas2557->channel == 0) ? 1 : 1 + width * 2; | ||
| tas2557->asi_offset = offset; | ||
|
|
||
| /* Playback runs over ASI2; ASI1 is programmed too (per TI driver) */ |
There was a problem hiding this comment.
Seem like a hack to merge 2 DAIs (ASIs) into one for simplicity.
| } | ||
|
|
||
| /* Hard + soft reset, then baseline register setup */ | ||
| tas2557_hw_reset(tas2557); |
There was a problem hiding this comment.
Is there a need to reset and reload firmware so often? There is no program/config selection anymore. Also driver doesn't enter "hardware shutdown" mode with reset low so device state isn't lost. It takes half a second to enable the just ClassD widget with this (with I2C@400KHz). Also when audio daemon starts (pulse) it triggers 10 startups and shutdowns back-to-back which is even more noticeable.
Document the TAS2557 mono Class-D smart amplifier with an integrated DSP for speaker protection. The device is controlled over I2C and receives audio over I2S/TDM (ASI). It can drive a single mono speaker or, as two devices, a stereo pair; in that case the ti,channel property selects the audio slot each device reproduces and the per-device tuning it applies. The on-chip DSP boots from a firmware image generated per speaker design with the TI PurePath Console tuning tools; the optional firmware-name property selects a board-specific image. Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
The TAS2557 is a mono Class-D smart amplifier with an on-chip DSP for speaker protection. Audio is received over I2S/TDM (ASI) and processed by DSP firmware before reaching the Class-D output stage. The register map is book/page indirected behind an 8-bit regmap; the driver layers composite book/page/register addressing on top of it. The TI "uCDSP" firmware format (PLL, program and configuration blocks) is parsed with bounds checking, and program 0 with a sample-rate matched configuration is applied whenever the amplifier powers up; the device cannot pass audio without this firmware. Firmware images are produced per speaker design with TI's PurePath Console tuning tools, so they are board specific; the default image name is derived from the detected silicon revision and can be overridden with the firmware-name device tree property. Amplifier power is managed through DAPM. A fault interrupt handler recovers the device from clock loss, over-current, brownout and over-temperature events by reloading the firmware configuration. Speaker volume and I/V-sense switches are exposed as ALSA controls. Stereo is supported as two cooperating instances using stereo (device 3) firmware, with per-instance DEV_A/DEV_B tuning selected by the ti,channel property. Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
Build the TAS2557 mono smart amplifier driver as a module, used by the Xiaomi Redmi 5 Plus (vince) for its loudspeaker. Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
Wire up the TAS2557 mono speaker amplifier on the Redmi 5 Plus (vince): - it sits on i2c_2 at 0x4c with reset on GPIO86 and IRQ on GPIO87; its AVDD/DVDD/IOVDD pins are fed by the always-on 1.8 V rail pm8953_l6, and VBAT by the always-on battery rail; - it is the external PA on Quinary MI2S. The Android mixer paths route the speaker through QUIN_MI2S_RX, and the register-compatible Motorola ocean (tfa9874) and Fairphone 3 (aw8898) use Quinary as well. Add a dedicated Quinary MI2S dai-link for the amplifier and register the QUINARY_MI2S_RX AFE DAI (SD0, per the downstream). The internal codec stays on Primary MI2S, so earpiece and headphones are unaffected; - the MI2S pins (gpio88/91/93 plus the gpio92 word-clock, which uses the dedicated pri_mi2s_ws pinmux function) are configured. The LPASS routes Quinary onto these pins through the quin iomux that the apq8016_sbc machine driver already programs in its MI2S_QUINARY path, so no machine-driver change is required. Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
638e44a to
67526b7
Compare
Adds TAS2557 loudspeaker support for the Xiaomi Redmi 5 Plus (vince).
dai-link
The amp is on Quinary MI2S, not Primary — Primary is the internal codec. Matches the stock mixer_paths and
the existing ocean/FP3 setups, so no machine-driver change.
Needs tas2557_uCDSP.bin (device-specific, pull from stock vendor into /lib/firmware) to actually pass audio.
Tested on device, speaker works.