Skip to content

Add Google Pixel 5a (barbet / SM7250) - #31

Open
Gibbz wants to merge 98 commits into
denialwm:perpetua/v7.3from
bit-shift-io:devices/barbet-pr
Open

Gibbz wants to merge 98 commits into
denialwm:perpetua/v7.3from
bit-shift-io:devices/barbet-pr

Conversation

@Gibbz

@Gibbz Gibbz commented Nov 17, 2026 •

Copy link
Copy Markdown

Add Google Pixel 5a (barbet / SM7250)

Ready for review. Two contract questions are listed at the end; the kernel
is hardware-validated and the remaining items are submission scope and
cross-device validation, not known defects in this device.

Device

  • Google Pixel 5a, codename barbet, Qualcomm SM7250 (Snapdragon 765G).
  • Stock firmware AP2A.240805.005.S4 (Android 14), build fingerprint
    google/barbet/barbet:14/AP2A.240805.005.S4/12281092:user/release-keys.
    Taken from the archived stock provenance files, not a fresh on-device read.
  • The stock /sys/firmware/fdt capture is archived. It is not attached yet
    because it must first be checked for calibration data and unit addresses;
    say how you would like it provided.

Scope

SM7250 SoC support, the board tree, the component drivers this device needs,
and the device registration. Userspace, boot-image packing and Droidloom are
out of scope unless the maintainers want the in-tree boot adapter for the
checker (see below). The branch used for this pull request drops the internal
design/planning documents that the earlier development branch carried.

Validation

Base 0b3815eca32568b28eb308c59edb4ad2651bbbfa (perpetua/v7.3).
Tested tree 3edf4121f0a4; Image SHA-256
db9aa6a433d6c3aaf6f460ae16565079717823fbd7913c1183522cda0e97146a
over DTB 0ddd7dc2cf3bc65da5da461cb32f97be5fe33496829497fba98ed88c5185b268.
The hardware run used exactly this Image and DTB (confirmed in the packed
image's evidence).

  • ARCH=arm64 LLVM=1 devices/config barbet OBJDIR: exit 0, every fragment
    value survives.
  • make ARCH=arm64 LLVM=1 O=OBJDIR Image modules dtbs: exit 0, no warnings.
  • devices/check barbet OBJDIR 0b3815e: exit 0, including the built-in tree
    and the added-code hygiene rules.
  • devices/handoff/test with the built tree and the archived stock FDT:
    exit 0 (the kernel boots its built-in tree; 10 memory ranges,
    29 reservations, initrd 0xafe00000-0xb1d2359a). The same built tree
    against each of the six other built device trees exits 2, and each of
    those trees against the Barbet stock tree exits 2. The reverse library
    direction with the peer stock captures is not available: those captures
    are not archived, so that part of the requested matrix is missing.

Hardware results (fragment build, 7.3.0+ #10)

Feature Result Notes
Boot to userspace works UFS root, systemd running, no failed units
Display / GPU works DSI connected; GMU firmware loads; the panel lights on a power-button wake and the Denial GUI appears (user-confirmed)
Touch works stfts_spi input device; touch validated on the reference build
Storage / USB works UFS root; USB NCM networking
Wi-Fi works modem + WCN3990; wlan0 DHCP and SSH
Bluetooth works controller 39:98:00:00:5A:AD, QCA setup completes, powered
Speaker works TDM port starts; the 440 Hz test tone is audible (user-confirmed)
Microphone partly works 32 kHz mono capture produces samples; the known loud/DC-offset signal remains
Battery works voltage-derived gauge, 4.43 V
Charging works / full USB powered, battery reports Full, 100 %, charge current 0 because full
Thermal works CPU/GPU zones around 30.6–30.9 °C
Suspend / resume works s2idle, one successful cycle, RTC wake; power savings unmeasured
Rotation / sensors does not work sensor DSP path not brought up
GNSS / modem data does not work not registered/brought up
Camera / fingerprint / NFC does not work not brought up

The panel is dark after the 30 s idle DPMS timeout and lights on the power
button, which is the configured behaviour.

The earlier "device configuration does not build DRM/GPU" regression is
fixed in the fragment, as are the missing built-in drivers that the module-less
rootfs needs (refgen, LPASS pinctrl, SoundWire/LPASS macros, FastRPC, MSS,
QRTR SMD, GENI SPI, zram/LZ4). They were found by comparing the running
kernel's /proc/config.gz with the fragment build.

Open questions for the maintainers

  1. TDM clock attribute. The Barbet audio port changes the Q6AFE TDM
    clock attribute from INVERT_COUPLE_NO to COUPLE_NO for every clock in
    the TDM range, because that is what this DSP accepts for the speaker
    route. The working Barbet kernel uses COUPLE_NO; other SM8250-style
    users of the same DAI may need the old value. Please advise between a
    per-port DT property, an SoC/board-gated selection, or a generic
    correction with broader validation. I did not want to invent hardware
    semantics or silently change the generic default.
  2. Boot adapter placement. devices/check requires
    devices/boot/<boot> to exist and be executable, and the branch adds
    devices/boot/android-v2. CONTRIBUTING.md says boot-image packing
    belongs outside the kernel, and checkpatch.pl flags the executable
    source file. This pull request keeps the adapter so the device can be
    registered; tell me if you would rather have the packing live only in
    Phonewave and adjust the checker or the registration contract.

The userspace companion is denialwm/phonewave#4;
this pull request stays kernel-only.

Checkpatch is clean on the follow-up fixes. The imported port series still
carries its Luma cherry-pick provenance, whose abbreviated commit IDs
checkpatch reports; those are import history, not new code. I can reword or
drop them if you prefer.

Commits

The branch is ordered as the contribution guide asks: SoC/DT bindings,
drivers, board DTS and per-feature changes, then the configuration fragments.

sreeshankark and others added 30 commits November 17, 2026 20:15
Add device tree bindings for the global clock controller on SM7250.

[Adapt the schema to Perpetua's SM6375-only binding; keep the posted
clock, reset and power-domain identifiers unchanged.]

Link: https://lore.kernel.org/linux-arm-msm/20261015051926.13752-2-sreeshankar0910@gmail.com/
Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Add support for the global clock controller found on SM7250 devices.

[Extend Kconfig help and remove a repeated blank line for checkpatch.]

Link: https://lore.kernel.org/linux-arm-msm/20261015051926.13752-3-sreeshankar0910@gmail.com/
Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Document the Network-On-Chip interconnect providers of the Qualcomm
SM7250 SoC (Snapdragon 765/765G/768G), which are controlled through RPMh
Bus Clock Managers, and add the header with the node and slave IDs.

Signed-off-by: Ishu Brar <patches@brar.si>
Message-ID: <010601a17d6212dc-ed028a84-ea72-48e7-a4d8-fea315dc42cc-000000@ap-northeast-1.amazonses.com>
Add a driver for the Network-On-Chip interconnect providers of the
Qualcomm SM7250 SoC (Snapdragon 765/765G/768G). It follows the layout of
the other RPMh based providers: the nodes and the Bus Clock Managers
come from the downstream interconnect description of the platform.

Tested on a OnePlus Nord: all providers probe, and the UFS, USB,
display, I2C, serial and camera ISP devices get their paths without
errors.

Signed-off-by: Ishu Brar <patches@brar.si>
Message-ID: <010601a17d62222c-befdb9b3-ce1d-469d-a6d3-00511529579f-000000@ap-northeast-1.amazonses.com>
Describe the Top Level Mode Multiplexer pin controller in the Qualcomm
SM7250 SoC, including its three register tiles and reserved GPIO ranges.

This binding has not been posted upstream. It is taken from the
avicii-mainline pinctrl work as retained in the Luma reference tree, with
the corrected tile addresses from its follow-up fix.

Link: https://github.com/lazybrar/avicii-mainline
Signed-off-by: Bronson <bronsonmathews@gmail.com>
Add the pinctrl, pinmux, pinconf and gpiolib driver for the Top Level
Mode Multiplexer block in the Qualcomm SM7250 SoC. It provides the GPIO
and function data for the east, south and west tiles, including the UFS
reset pin.

This driver has not been posted upstream. It is taken from the
avicii-mainline combined patch, with the driver's register macros
parenthesised and the Kconfig help completed for checkpatch.

Link: https://github.com/lazybrar/avicii-mainline
Signed-off-by: Bronson <bronsonmathews@gmail.com>
Add the ID for the Qualcomm SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260824150156.1310-2-sreeshankar0910@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
(cherry picked from commit b6fe0b2)
Add SoC ID for Qualcomm SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260824150156.1310-3-sreeshankar0910@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
(cherry picked from commit 4f7b5ac)
Document RPMHCC bindings for clock rpmh driver on Qualcomm SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/linux-arm-msm/20260821154030.2514-1-sreeshankar0910@gmail.com
Link: https://patch.msgid.link/20260816131646.10551-3-sreeshankar0910@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
(cherry picked from commit 5bea070)
Add the RPMH clocks present in SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260816131646.10551-2-sreeshankar0910@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
(cherry picked from commit 84a40df)
Document the RPMh power domain for SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
(cherry picked from commit e1d70a0)
Add RPMh power domains for SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
(cherry picked from commit 26b9ea4)
Document Kryo 475 CPUs found in Qualcomm SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260824150156.1310-10-sreeshankar0910@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
(cherry picked from commit 1c8fe88)
Document the PDC block on the SM7250 SoC.

Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20261015051926.13752-5-sreeshankar0910@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
(cherry picked from commit e8b2cbf)
Document the SCM compatible for Qualcomm SM7250 SoC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Sreeshankar K <sreeshankar0910@gmail.com>
Add the base devicetree for SM7250: the CPUs and their PSCI idle
states, the interrupt controllers, RPMh, GCC, TLMM, SPMI, the timer and
the memory map.

Based on the v14 posting by Sreeshankar K. TLMM and the QUPv3 wrapper
that carries the debug UART are added here; cpufreq and LMH are left
out until their dependencies are in the tree.
Document the Google Pixel 5a, an SM7250 board.
Add the board tree for the Google Pixel 5a (barbet), an SM7250 device.
It describes the debug UART on QUPv3 wrapper 0, the firmware carveouts
the stock tree reserves and the GPIOs the secure world owns.

Storage, USB, regulators and the PMICs are not described yet.
The bootloader starts the kernel with Google's own Barbet tree. Name
that tree by its root compatible and model so the kernel boots the
built-in one instead, and keep the initramfs it loaded.

Its command line points at its own installation, so name the console
and the initramfs entry point in the built-in tree.
…ntrollers

The debug UART needs the global clock controller and its pins before the
root filesystem is mounted, so build both in. The interconnect driver is
built in as well, for the peripherals that follow.
Register the device, its built-in tree and the SM7250 fragment. The boot
field stays empty: the bootloader uses a version 2 image with the ramdisk
in the kernel partition and no in-tree chain writes that layout.
Document the SM7250 UFS PHY. It uses the version 4 register layout with
SM7250-specific TX, RX and PCS calibration.

Link: https://github.com/lazybrar/avicii-mainline
Document the SM7250 UFS host controller. Its compatible is
"qcom,sm7250-ufshc", "qcom,ufshc", "jedec,ufs-2.0".

Link: https://github.com/lazybrar/avicii-mainline
The SM7250 UFS PHY uses the version 4 register layout, two lanes and
HS-G3. Its serdes and HS-B tables are the SM8150 ones; TX, RX and PCS
come from the downstream lito calibration. That calibration places the
TX PWM gear dividers 0x10 below the version 5 layout, so those four
registers are written as raw offsets.

Link: https://github.com/lazybrar/avicii-mainline
The SM7250 UFS PHY votes for "qphy.lvl". Nothing else votes for it once
the modem is up, so the PHY holds it and the PLL stays locked.

Link: https://github.com/lazybrar/avicii-mainline
Some SoCs route the UFS device reset to a dedicated TLMM pin that is
only described as pinctrl states, with no GPIO. Look up the optional
"dev-reset-assert" and "dev-reset-deassert" states and select them when
the device is reset.

Link: https://github.com/lazybrar/avicii-mainline
The SM7250 UFS node has no IOMMU stream, so its descriptors carry raw
physical addresses. Above 4 GiB the controller never writes back the OCS
or the response UPIU and raises no completion interrupt. Limit this
variant to 32-bit DMA.

Link: https://github.com/lazybrar/avicii-mainline
Describe ufshc@1d84000 and phy@1d87000 with the GCC clocks, resets and
GDSC, the QPHY power domain, the two downstream OPPs and the TLMM device
reset states. Their interconnect paths wait for the NoC nodes; those are
performance votes, not a probe dependency.
…d USB

Describe the PM8150 and PM8150L RPMh regulators that feed the UFS host
and PHY and the USB HS PHY. They stay on as the bootloader leaves them.
Power the host from the PM8150L 2.95 V rail and the 1.8 V SMPS, and the
PHY from the 0.88 V and 1.2 V rails. Both nodes were checked against the
reference board wiring.
Gibbz added 22 commits November 17, 2026 20:15
The thermal core, TSENS and RTC class were all off, so the SoC's 27
thermal zones and the PMIC RTC did not exist. The DRV2624 driver was also
never built, leaving the haptics device unbound.

Verified on barbet: 27 zones report 33-35 C, rtc0 is the pm8xxx RTC with
an alarm, and drv2624:haptics registers on i2c-1.
The PM8150L flash controller was disabled and the LED driver was a module
the image does not carry. Enable the controller with its two white LED
sources and build the driver in, so the torch is usable from
/sys/class/leds/white:flash.

Verified on barbet: brightness 128 lights the torch and 0 turns it off.
Add the adapter for Android header version 2 images, which carry the
kernel, ramdisk and one DTB in the boot partition. It keeps the stock
template's header, addresses, command line and unsigned AVB properties,
and compresses the kernel as an LZ4 frame with the template's settings
and text_offset. The packed image is unpacked and its kernel, ramdisk
and DTB compared byte for byte, and avbtool verifies the result.
The Pixel bootloader uses a version 2 image with the kernel, ramdisk and
DTB, which devices/boot/android-v2 writes.
e390ae5 dropped /chosen/bootargs while adopting the full description, so
the built-in tree no longer described the console and panic settings.
Restore them. The bootloader appends its own command line to these, so
the installed root arguments still reach the kernel.
The audio and Wi-Fi fragment asked for codecs, machine and remoteproc
drivers built in but not for their parents, which the base config leaves
as modules, so devices/config demoted them and the machine driver was
never built. Set the sound core, SoundWire, remoteproc, RFKILL and the
wireless stack to built-in, and drop the unused QDSP6 USB offload helper
that capped the machine driver at module.
The imported capture path left the handshake helpers without prototypes
and two enum declarations with a duplicate const, and declared three
internal callbacks global. Publish the two helpers in rt5514.h, use that
header from the SPI side, and keep the callbacks local.
The controller appears only after Wi-Fi has powered the combo chip and
barbet-bt.service rebinds the serdev then, so the stack cannot depend on a
root-filesystem module.
With qcom,disable-ibs the controller stays awake and keeps its wake line
asserted, so the serial controller's wake IRQ ends s2idle a few seconds
after it starts. Disable the wakeup on the serdev and every wakeup-capable
ancestor of its controller at probe and again at suspend, and stop
advertising a controller wake callback.
Droidloom's cell brings up its own veth pair, nftables NAT and tc-BPF
accounting, and runs Android's binder and alarm timers. Build those in
so the cell works without a root-filesystem module, and expose the
kernel config through /proc/config.gz for field debugging.
A stream can prepare its AFE port more than once before the port is
freed. Both slot-map formats allocated a fresh payload on every prepare,
losing the previous allocation.

Allocate each map only once and refresh its contents on subsequent
prepares. Preserve allocation-failure retries and the existing port-
release cleanup.
Keep slot-map selection based on the reported AFE API version instead of
exposing a global module parameter for firmware experiments.

Remove the default-off primary TDM group-device experiment and its
parameter. The working Barbet configuration never enables it; shipping
it would retain an unvalidated hardware setup path and violate the
device contribution rules.
Remove the global TDM module parameters used for bring-up experiments.
Read the existing per-port device-tree configuration directly instead.

The working configuration overrides every TDM sync mode with 1. Update
Barbet's three TDM nodes to that effective value before removing the
override, preserving its current frame sync configuration. Keep the
existing clock attribute unchanged.
Keep the verified slot layout, clock rates and RT5514 BCLK PLL setup
in the machine driver rather than exposing global hardware overrides.

Drop the unused capture controls and the alternative MCLK and speaker
clock paths that were only reachable through experimental parameters.
This preserves the effective settings of the tested Barbet kernel.
Manage each successful TDM clock enable with a disable/unprepare action
so failed card probe, deferred probe and driver removal release it.
The managed clock reference alone does not balance prepare/enable.

Propagate deferred TDM clock lookup instead of registering the card
without its provider. Keep tolerating clock enable requests rejected by
the DSP, as the working configuration does.
The serial hardware controller owns the dedicated UART wake IRQ. Do
not disable wake on every ancestor, or on the Bluetooth serdev device.

Borrow only the host's originally enabled system-wake policy and hold
a device reference until managed cleanup restores it. Leave initially
disabled hosts unchanged, and stop overriding policy at every suspend.
The no-IBS suspend path still skips its unavailable sleep handshake.
Document the Google Pixel 5a sound-card compatible and its LPASS vote
and primary/quinary TDM clocks.
Select Barbet's TDM layout, RT5514 setup, backend formats and front-end
capture constraint using its sound-card compatible, not DAI IDs or the
user-visible card name alone.

Limit the vote/TDM clock setup to this card as well. Leave other cards
on their original stereo/S16 format-mask path, avoiding the imported
Barbet configuration being applied to unrelated codecs.
Use the board-specific sound-card compatible to select the verified
Barbet audio configuration without changing unrelated SM8250 cards.
The built-in sound card uses the SM8250 LPASS LPI pad controller, but
the fragment build leaves that driver and its common core as modules.
The known-working deployment builds both in.

Build the controller and its common dependency in so audio does not
wait for a root-filesystem pinctrl module.
Wait for an unready LPASS dcodec vote clock instead of registering the
card without it. Keep tolerating the other optional-clock errors that the
working Barbet boot accepts.
The device rootfs carries no modules, so every driver the boot and the
Phonewave services need must be built in. The fragment left several as
modules: refgen (the DSI PHY supply), the GENI SPI controller, the LPASS
pinctrl, SoundWire and the LPASS macro codecs, FastRPC, the modem
remoteproc, QRTR over SMD, and zram with its LZ4/LZO compressors.

Compare against the working kernel's /proc/config.gz: without these the
panel never probes, the WCN3990 never registers a QRTR service, the ADSP
route never comes up, and zram-swap fails. All were built in by the
reference configuration.
@Gibbz
Gibbz marked this pull request as ready for review November 17, 2026 11:23
@Gibbz

Gibbz commented Nov 17, 2026

Copy link
Copy Markdown
Author

@doctorlogix this is ready for review. Two contract questions are called out in the description: (1) how you want the Q6AFE TDM clock attribute scoped for Barbet without silently changing other SM8250-style users, and (2) the in-tree devices/boot/android-v2 adapter that devices/check requires while CONTRIBUTING.md says boot packing belongs outside the kernel. The full peer stock-FDT handoff matrix is also missing because those captures are not archived; the Barbet stock FDT here still needs a private-data check before attaching.

The v2 boot image carries no module tail, so a driver built as a module
never reaches userspace.  vold mounts Android's emulated storage as FUSE
and fails with "Failed to open /dev/fuse: No such device";
/storage/emulated never appears, and Play Store reports "not enough
space" for an install.

Build FUSE in.  With the rebuilt Image vold mounts /storage/emulated and
Play Store installs apps.
@Gibbz

Gibbz commented Nov 17, 2026

Copy link
Copy Markdown
Author

Follow-up for the Play Store install failure found while validating the
Android cell.

devices/barbet/kernel.config already builds the Android cell's drivers in
except FUSE, which stayed at CONFIG_FUSE_FS=m. The v2 boot image has no
module tail (devices/boot/android-v2 writes kernel, ramdisk and DTB only,
and the root's /usr/lib/modules is empty), so fuse.ko is never
available. vold then cannot mount emulated storage:

vold: Failed to open /dev/fuse: No such device
vold: Failed to mount emulated fuse volume: No such device

/storage/emulated never appears and Play Store reports "not enough
space" for any install, although /data has 96 GB free.

997286ddac66 builds FUSE in. Hardware test with the rebuilt Image:

  • Image d125e7df0490b0f0f1e0c0832010187d0d9d899cd7fcde3e2c7cf17070066a9e
    over DTB 0ddd7dc2cf3bc65da5da461cb32f97be5fe33496829497fba98ed88c5185b268
    (the PR's earlier db9aa6a4 Image plus this config change)
  • CONFIG_FUSE_FS=y; vold mounts /dev/fuse on /storage/emulated
  • Play Store installs apps; the first third-party package in the fresh cell
    is org.mozilla.firefox

This stays in the barbet fragment because it is a consequence of the
module-less v2 boot image, like the rest of the Android-cell block. The
android-gki devices use --tail, which carries the kernel's modules, so
FUSE_FS=m works there.

The previously reported validation remains otherwise unchanged. On
997286ddac66, ARCH=arm64 LLVM=1 devices/config barbet exits 0;
make ARCH=arm64 LLVM=1 O=OBJDIR Image modules dtbs exits 0 with no
warnings; devices/check barbet OBJDIR 0b3815eca325 exits 0; checkpatch
is clean with --no-signoff.

@synthia-si synthia-si Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this port, and for the careful hardware table. Display, GPU, Wi-Fi, Bluetooth, the speaker and charging working on a Pixel 5a is a lot of ground. Review of 997286d. We applied every fix below to the PR head and compiled the changed files with W=1 (no warnings), plus the barbet device tree. Nothing was run on a device, and the binding changes were not checked with dt-schema.

The main problem is that bring-up code landed in drivers other phones share. Every inline suggestion is exact code. The full set is also attached at the end as one patch, if git apply is easier than clicking.

Must fix

  1. Collision with #37 (Galaxy Tab S7 FE). Both pull requests add devices/boot/android-v2, with different arguments (TEMPLATE IMAGE DTB RAMDISK OUTPUT here, TEMPLATE IMAGE RAMDISK OUTPUT there). Both also add the same Bluetooth switch to hci_qca.c under two names: qcom,disable-ibs here, qcom,no-inband-sleep there. Whichever merges first sets the tool and the property name, and the other rebases onto it. Please keep that in mind while you rework: the boot tool should take the DTB as an argument only when the header asks for one, so it covers both devices.

  2. Every Pixel 5a would get the same Bluetooth address (inline on qcom,use-firmware-bdaddr). 39:98:00:00:5A:AD from your test table is the placeholder in the firmware's NVM file. qca_check_bdaddr() sets HCI_QUIRK_USE_BDADDR_PROPERTY exactly when the controller reports that NVM address, and the new property clears the quirk again. Please drop the property, the binding commit (1e84c9e) and the driver commit (c10af53). Without it the controller comes up unconfigured, and Phonewave's radio-addr-bluetooth.service, already in the shared image, gives it the phone's own address. If the Pixel bootloader passes an address in its tree or bootargs, the handoff can carry it instead, as roadstr does with its bluetooth-address node.

  3. Debug logging left in shared audio code (inline). q6afe, q6afe-dai, q6asm-dai, the SM8250 machine driver and tas2562 print at dev_info on every stream open, every trigger and every port start, on every board that uses them. q6afe.c also keeps two unused structs from the experiments and a "v130 path" comment. The suggestions remove them.

  4. The TDM clock attribute is changed for every board (your open question 1; inline on q6afe_mi2s_set_sysclk). The answer is a per-port DT switch, with the default left as it is. The suggestion reads qcom,tdm-clk-no-invert from the port and sets it on barbet's QUINARY_TDM_RX_0. Three pieces sit outside the diff, so here they are. In struct q6afe_dai_priv_data:

	uint32_t data_align;
	bool tdm_clk_no_invert;
};

In of_q6afe_parse_dai_data():

		case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7:
			priv = &data->priv[id];
			priv->tdm_clk_no_invert = of_property_read_bool(node,
						"qcom,tdm-clk-no-invert");

In Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml, after qcom,tdm-data-align:

      qcom,tdm-clk-no-invert:
        type: boolean
        description:
          Request the TDM bit clocks of this port without the inverted
          clock attribute, for DSPs that refuse it on this port.
  1. tas2562 never shuts the amplifier down any more (inline on tas2562_update_pwr_ctrl). With the DAC off, the amp now goes to MUTE instead of SHUTDOWN. On every board with this amp it stays powered while nothing plays, which costs battery. The forced ACTIVE write in tas2562_mute() changes nothing either: tas2562_update_pwr_ctrl() overwrites it right after. The suggestions restore both. If the speaker stays silent after this, please send the dmesg order of the DAC event and the mute calls (the dev_dbg lines you added show it). The cause is then in that order, not in the shutdown.

  2. The barbet card ignores every clock and slot call it makes (inline on sm8250_snd_startup). The return values were only printed. The suggestions return the error instead, so a refused setting fails the stream rather than playing silence. Please retest the speaker and the microphone after this, and tell us if any of these calls returns an error.

Should fix

  1. UFS reset through pin states (inline). Upstream exposes the UFS_RESET pad as the GPIO right after the last real one. SM8250 has it at 180 with .ngpios = 181, and aston uses reset-gpios = <&tlmm 210 GPIO_ACTIVE_LOW> on SM8550. The suggestions do the same here: UFS_RESET becomes pin 146, the SDC pads move up by one, .ngpios = 147, and barbet gets reset-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>. That removes the new pin-state path from ufs-qcom.c, which every Qualcomm phone runs. Please check UFS still comes up after a cold boot.

  2. Code nothing uses. The TFA9874 driver (fe0f8c3, 461 lines) is built in, but no node in the device tree uses it. Please drop the commit and the config line (inline). The rt5514 commits rewrite an upstream driver by about 2,300 lines. Which parts does the microphone path actually need? We would rather take the smallest change that makes capture work.

  3. Kernel-doc (outside the diff). q6afe_slot_map_v2() sits between q6afe_tdm_port_prepare() and its comment, so the doc now describes the wrong function (W=1 warns). Move the helper above the comment and make its comment a plain one:

/*
 * AFE service API v3 and later reject the legacy 8-channel slot map, so pick
 * the payload from the version the DSP reported.
 */
static bool q6afe_slot_map_v2(struct q6afe *afe)
{
	return afe->ainfo.api_version >= AFE_API_VERSION_V3;
}

/**
 * q6afe_tdm_port_prepare() - Prepare tdm afe port.
 *
 * @port: Instance of afe port
 * @cfg: TDM configuration for the afe port
 *
 */
void q6afe_tdm_port_prepare(struct q6afe_port *port,
  1. Commit history. Several commits add code that a later commit in the same series replaces or removes:

    Please fold each fix into the commit it fixes, the review fixes here included. The result should read as the final code, one commit per driver or device tree. Where folding changes a commit by Sreeshankar K or Ishu Brar, say in its message what you changed, with the [...] note you already use in 8b44174.

Questions

  • The UFS host is limited to 32-bit DMA because the node has no iommus. Did you try routing it through the apps SMMU, with the stream ID downstream's SMMU tables give UFS? If that works, the 32-bit limit is not needed.
  • kernel.config says "the bring-up service rebinds the serdev" for Bluetooth. What does that service do, and why is a rebind needed? The kernel should bring the controller up on its own.
  • With qcom,disable-ibs, the UART wake is turned off while the driver is bound, so Bluetooth can no longer wake the phone from suspend. That is fine for now, but please say so in the commit message.

Smaller

  • The built-in bootargs carry earlycon and keep_bootcon and print to the serial port. The suggestion uses the line the other phones use.
  • The battery percentage is a straight line from 3.2 V to 4.35 V, but a full battery reads 4.43 V. That is fine as a start, but please say "estimate" in FEATURES.md rather than "works".

Your question 2 (boot tool): keep it in devices/boot/, beside the other boot tools. devices/check is right to require it. It only has to become the same tool #37 uses (point 1).

All fixes as one patch, against 997286d (git apply)
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sm7250-tlmm.yaml b/Documentation/devicetree/bindings/pinctrl/qcom,sm7250-tlmm.yaml
index c95774d82692..574821aa8177 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,sm7250-tlmm.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,sm7250-tlmm.yaml
@@ -33,10 +33,10 @@ properties:
 
   gpio-reserved-ranges:
     minItems: 1
-    maxItems: 73
+    maxItems: 74
 
   gpio-line-names:
-    maxItems: 146
+    maxItems: 147
 
 patternProperties:
   "-state$":
diff --git a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
index 3b03e2acd67e..0f90f09ba799 100644
--- a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
@@ -100,6 +100,12 @@ patternProperties:
             0 = MSB
             1 = LSB
 
+      qcom,tdm-clk-no-invert:
+        type: boolean
+        description:
+          Request the TDM bit clocks of this port without the inverted
+          clock attribute, for DSPs that refuse it on this port.
+
     required:
       - reg
 
diff --git a/arch/arm64/boot/dts/qcom/sm7250-google-barbet.dts b/arch/arm64/boot/dts/qcom/sm7250-google-barbet.dts
index fc58a61bc534..00a35abf3b18 100644
--- a/arch/arm64/boot/dts/qcom/sm7250-google-barbet.dts
+++ b/arch/arm64/boot/dts/qcom/sm7250-google-barbet.dts
@@ -46,7 +46,7 @@ aliases {
 	};
 
 	chosen {
-		bootargs = "earlycon=qcom_geni,0x888000 keep_bootcon console=ttyMSM0,115200n8 loglevel=7 rdinit=/init panic=15 bootconfig";
+		bootargs = "rdinit=/init console=tty0 panic=0 loglevel=7 log_buf_len=2M bootconfig";
 		stdout-path = "serial0:115200n8";
 
 		/*
@@ -356,6 +356,8 @@ &mdss_dsi0_phy {
 };
 
 &ufs_mem_hc {
+	reset-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>;
+
 	vcc-supply = <&vreg_l7c_2p95>;
 	vcc-max-microamp = <800000>;
 	vccq2-supply = <&vreg_s4a_1p8>;
@@ -797,8 +799,6 @@ bluetooth {
 		 * setup leaves the QCA in-band-sleep handshake enabled.
 		 */
 		qcom,disable-ibs;
-		/* The firmware reports a usable public address. */
-		qcom,use-firmware-bdaddr;
 	};
 };
 
@@ -821,6 +821,7 @@ dai@58 {
 		qcom,tdm-invert-sync = <1>;
 		qcom,tdm-data-delay = <1>;
 		qcom,tdm-data-align = <0>;
+		qcom,tdm-clk-no-invert;
 	};
 
 	dai@59 {
diff --git a/arch/arm64/boot/dts/qcom/sm7250.dtsi b/arch/arm64/boot/dts/qcom/sm7250.dtsi
index e2279ea4abd9..3b2c06589b76 100644
--- a/arch/arm64/boot/dts/qcom/sm7250.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm7250.dtsi
@@ -1859,13 +1859,6 @@ ufs_mem_hc: ufshc@1d84000 {
 			 * stream is left untranslated.
 			 */
 
-			pinctrl-names = "default",
-					"dev-reset-assert",
-					"dev-reset-deassert";
-			pinctrl-0 = <&ufs_dev_reset_deassert>;
-			pinctrl-1 = <&ufs_dev_reset_assert>;
-			pinctrl-2 = <&ufs_dev_reset_deassert>;
-
 			clock-names = "core_clk",
 				      "bus_aggr_clk",
 				      "iface_clk",
@@ -1966,7 +1959,7 @@ tlmm: pinctrl@f100000 {
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
-			gpio-ranges = <&tlmm 0 0 146>;
+			gpio-ranges = <&tlmm 0 0 147>;
 			wakeup-parent = <&pdc>;
 
 			qup_uart2_default: qup-uart2-default-state {
@@ -2125,21 +2118,6 @@ cam_mclk4_sleep: cam-mclk4-sleep-state {
 				drive-strength = <2>;
 				bias-pull-down;
 			};
-
-			/* UFS_RESET is a dedicated pad (not a GPIO); states as downstream */
-			ufs_dev_reset_assert: ufs-dev-reset-assert-state {
-				pins = "ufs_reset";
-				bias-pull-down;
-				drive-strength = <8>;
-				output-low;
-			};
-
-			ufs_dev_reset_deassert: ufs-dev-reset-deassert-state {
-				pins = "ufs_reset";
-				bias-pull-down;
-				drive-strength = <8>;
-				output-high;
-			};
 		};
 
 		/*
diff --git a/devices/barbet/kernel.config b/devices/barbet/kernel.config
index 0447b635fd30..850c22639f6b 100644
--- a/devices/barbet/kernel.config
+++ b/devices/barbet/kernel.config
@@ -52,7 +52,6 @@ CONFIG_QCOM_Q6V5_ADSP=y
 CONFIG_QCOM_APR=y
 CONFIG_SND_SOC_RT5514=y
 CONFIG_SND_SOC_RT5514_SPI=y
-CONFIG_SND_SOC_TFA9874=y
 CONFIG_SND_SOC_TAS2562=y
 CONFIG_PINCTRL_LPASS_LPI=y
 CONFIG_PINCTRL_SM8250_LPASS_LPI=y
diff --git a/drivers/pinctrl/qcom/pinctrl-sm7250.c b/drivers/pinctrl/qcom/pinctrl-sm7250.c
index 2e176f6f0d04..25f931cd8b13 100644
--- a/drivers/pinctrl/qcom/pinctrl-sm7250.c
+++ b/drivers/pinctrl/qcom/pinctrl-sm7250.c
@@ -260,14 +260,14 @@ static const struct pinctrl_pin_desc sm7250_pins[] = {
 	PINCTRL_PIN(143, "GPIO_143"),
 	PINCTRL_PIN(144, "GPIO_144"),
 	PINCTRL_PIN(145, "GPIO_145"),
-	PINCTRL_PIN(146, "SDC1_RCLK"),
-	PINCTRL_PIN(147, "SDC1_CLK"),
-	PINCTRL_PIN(148, "SDC1_CMD"),
-	PINCTRL_PIN(149, "SDC1_DATA"),
-	PINCTRL_PIN(150, "SDC2_CLK"),
-	PINCTRL_PIN(151, "SDC2_CMD"),
-	PINCTRL_PIN(152, "SDC2_DATA"),
-	PINCTRL_PIN(153, "UFS_RESET"),
+	PINCTRL_PIN(146, "UFS_RESET"),
+	PINCTRL_PIN(147, "SDC1_RCLK"),
+	PINCTRL_PIN(148, "SDC1_CLK"),
+	PINCTRL_PIN(149, "SDC1_CMD"),
+	PINCTRL_PIN(150, "SDC1_DATA"),
+	PINCTRL_PIN(151, "SDC2_CLK"),
+	PINCTRL_PIN(152, "SDC2_CMD"),
+	PINCTRL_PIN(153, "SDC2_DATA"),
 };
 
 #define DECLARE_MSM_GPIO_PINS(pin) \
@@ -419,14 +419,14 @@ DECLARE_MSM_GPIO_PINS(143);
 DECLARE_MSM_GPIO_PINS(144);
 DECLARE_MSM_GPIO_PINS(145);
 
-static const unsigned int sdc1_rclk_pins[] = { 146 };
-static const unsigned int sdc1_clk_pins[] = { 147 };
-static const unsigned int sdc1_cmd_pins[] = { 148 };
-static const unsigned int sdc1_data_pins[] = { 149 };
-static const unsigned int sdc2_clk_pins[] = { 150 };
-static const unsigned int sdc2_cmd_pins[] = { 151 };
-static const unsigned int sdc2_data_pins[] = { 152 };
-static const unsigned int ufs_reset_pins[] = { 153 };
+static const unsigned int ufs_reset_pins[] = { 146 };
+static const unsigned int sdc1_rclk_pins[] = { 147 };
+static const unsigned int sdc1_clk_pins[] = { 148 };
+static const unsigned int sdc1_cmd_pins[] = { 149 };
+static const unsigned int sdc1_data_pins[] = { 150 };
+static const unsigned int sdc2_clk_pins[] = { 151 };
+static const unsigned int sdc2_cmd_pins[] = { 152 };
+static const unsigned int sdc2_data_pins[] = { 153 };
 
 enum sm7250_functions {
 	msm_mux_gpio,
@@ -1649,14 +1649,14 @@ static const struct msm_pingroup sm7250_groups[] = {
 	[143] = PINGROUP(143, WEST, _, _, _, _, _, _, _, _, _),
 	[144] = PINGROUP(144, WEST, _, _, _, _, _, _, _, _, _),
 	[145] = PINGROUP(145, WEST, _, _, _, _, _, _, _, _, _),
-	[146] = SDC_QDSD_PINGROUP(sdc1_rclk, WEST, 0xb8000, 15, 0),
-	[147] = SDC_QDSD_PINGROUP(sdc1_clk, WEST, 0xb8000, 13, 6),
-	[148] = SDC_QDSD_PINGROUP(sdc1_cmd, WEST, 0xb8000, 11, 3),
-	[149] = SDC_QDSD_PINGROUP(sdc1_data, WEST, 0xb8000, 9, 0),
-	[150] = SDC_QDSD_PINGROUP(sdc2_clk, SOUTH, 0xb7000, 14, 6),
-	[151] = SDC_QDSD_PINGROUP(sdc2_cmd, SOUTH, 0xb7000, 11, 3),
-	[152] = SDC_QDSD_PINGROUP(sdc2_data, SOUTH, 0xb7000, 9, 0),
-	[153] = UFS_RESET(ufs_reset, 0xbc000),
+	[146] = UFS_RESET(ufs_reset, 0xbc000),
+	[147] = SDC_QDSD_PINGROUP(sdc1_rclk, WEST, 0xb8000, 15, 0),
+	[148] = SDC_QDSD_PINGROUP(sdc1_clk, WEST, 0xb8000, 13, 6),
+	[149] = SDC_QDSD_PINGROUP(sdc1_cmd, WEST, 0xb8000, 11, 3),
+	[150] = SDC_QDSD_PINGROUP(sdc1_data, WEST, 0xb8000, 9, 0),
+	[151] = SDC_QDSD_PINGROUP(sdc2_clk, SOUTH, 0xb7000, 14, 6),
+	[152] = SDC_QDSD_PINGROUP(sdc2_cmd, SOUTH, 0xb7000, 11, 3),
+	[153] = SDC_QDSD_PINGROUP(sdc2_data, SOUTH, 0xb7000, 9, 0),
 };
 
 static const struct msm_gpio_wakeirq_map sm7250_pdc_map[] = {
@@ -1687,7 +1687,7 @@ static const struct msm_pinctrl_soc_data sm7250_tlmm = {
 	.nfunctions = ARRAY_SIZE(sm7250_functions),
 	.groups = sm7250_groups,
 	.ngroups = ARRAY_SIZE(sm7250_groups),
-	.ngpios = 146,
+	.ngpios = 147,
 	.tiles = sm7250_tiles,
 	.ntiles = ARRAY_SIZE(sm7250_tiles),
 	.wakeirq_map = sm7250_pdc_map,
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index cebc025590ad..3c5d4c560f0e 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -14,7 +14,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/phy/phy.h>
-#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/reset-controller.h>
@@ -794,16 +793,11 @@ static void ufs_qcom_device_reset_ctrl(struct ufs_hba *hba, bool asserted)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
-	if (host->device_reset) {
-		gpiod_set_value_cansleep(host->device_reset, asserted);
+	/* reset gpio is optional */
+	if (!host->device_reset)
 		return;
-	}
 
-	/* Some SoCs only expose the reset line as a dedicated TLMM pin */
-	if (host->pins_reset_assert && host->pins_reset_deassert)
-		pinctrl_select_state(host->pinctrl, asserted ?
-				     host->pins_reset_assert :
-				     host->pins_reset_deassert);
+	gpiod_set_value_cansleep(host->device_reset, asserted);
 }
 
 static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
@@ -1660,22 +1654,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 		goto out_variant_clear;
 	}
 
-	if (!host->device_reset) {
-		/* optional "dev-reset-assert"/"dev-reset-deassert" pin states */
-		host->pinctrl = devm_pinctrl_get(dev);
-		if (!IS_ERR(host->pinctrl)) {
-			host->pins_reset_assert = pinctrl_lookup_state(host->pinctrl,
-								       "dev-reset-assert");
-			host->pins_reset_deassert = pinctrl_lookup_state(host->pinctrl,
-									 "dev-reset-deassert");
-			if (IS_ERR(host->pins_reset_assert) ||
-			    IS_ERR(host->pins_reset_deassert)) {
-				host->pins_reset_assert = NULL;
-				host->pins_reset_deassert = NULL;
-			}
-		}
-	}
-
 	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
 		&host->hw_ver.minor, &host->hw_ver.step);
 
@@ -2290,9 +2268,8 @@ static int ufs_qcom_device_reset(struct ufs_hba *hba)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
-	/* reset gpio (or pinctrl states) is optional */
-	if (!host->device_reset &&
-	    !(host->pins_reset_assert && host->pins_reset_deassert))
+	/* reset gpio is optional */
+	if (!host->device_reset)
 		return -EOPNOTSUPP;
 
 	/*
diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h
index dc77c4554cf1..55e66412b8f9 100644
--- a/drivers/ufs/host/ufs-qcom.h
+++ b/drivers/ufs/host/ufs-qcom.h
@@ -355,9 +355,6 @@ struct ufs_qcom_host {
 	struct reset_controller_dev rcdev;
 
 	struct gpio_desc *device_reset;
-	struct pinctrl *pinctrl;
-	struct pinctrl_state *pins_reset_assert;
-	struct pinctrl_state *pins_reset_deassert;
 
 	struct ufs_host_params host_params;
 	u32 phy_gear;
diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index b9fa5696381e..01fa598bff72 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -196,10 +196,6 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
 
 	tas2562->tx_mask = tx_mask;
 
-	dev_info(component->dev,
-		 "set_tdm_slot: tx_mask=0x%x rx_mask=0x%x slots=%d width=%d\n",
-		 tx_mask, rx_mask, slots, slot_width);
-
 	if (!tx_mask) {
 		dev_err(component->dev, "tx masks must not be 0\n");
 		return -EINVAL;
@@ -433,7 +429,7 @@ static int tas2562_update_pwr_ctrl(struct tas2562_data *tas2562)
 		val = tas2562->unmuted ?
 			TAS2562_ACTIVE : TAS2562_MUTE;
 	else
-		val = TAS2562_MUTE;
+		val = TAS2562_SHUTDOWN;
 
 	dev_dbg(tas2562->dev, "pwr: dac=%d unmuted=%d val=%u\n",
 		tas2562->dac_powered, tas2562->unmuted, val);
@@ -451,22 +447,8 @@ static int tas2562_update_pwr_ctrl(struct tas2562_data *tas2562)
 static int tas2562_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(dai->component);
-	int ret;
 
-	dev_dbg(tas2562->dev, "mute: mute=%d dac=%d\n", mute,
-		tas2562->dac_powered);
 	tas2562->unmuted = !mute;
-	if (mute)
-		return tas2562_update_pwr_ctrl(tas2562);
-
-	/* DAPM may already have powered the DAC, so force active explicitly. */
-	ret = snd_soc_component_update_bits(tas2562->component,
-					    TAS2562_PWR_CTRL,
-					    TAS2562_MODE_MASK,
-					    TAS2562_ACTIVE);
-	if (ret < 0)
-		return ret;
-
 	return tas2562_update_pwr_ctrl(tas2562);
 }
 
diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c
index 48a8e47e93b5..e442a92ba588 100644
--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
+++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
@@ -25,6 +25,7 @@ struct q6afe_dai_priv_data {
 	uint32_t invert_sync;
 	uint32_t data_delay;
 	uint32_t data_align;
+	bool tdm_clk_no_invert;
 };
 
 struct q6afe_dai_data {
@@ -275,9 +276,6 @@ static int q6tdm_hw_params(struct snd_pcm_substream *substream,
 	tdm->bit_width = params_width(params);
 	tdm->sample_rate = params_rate(params);
 	tdm->num_channels = params_channels(params);
-	dev_info(dai->dev, "tdm hw_params: id=%d rate=%u ch=%u width=%u\n",
-		 dai->id, params_rate(params), params_channels(params),
-		 params_width(params));
 	tdm->data_align_type = dai_data->priv[dai->id].data_align;
 	tdm->data_out_enable = dai_data->priv[dai->id].data_out_enable;
 	tdm->invert_sync = dai_data->priv[dai->id].invert_sync;
@@ -517,7 +515,9 @@ static int q6afe_mi2s_set_sysclk(struct snd_soc_dai *dai,
 					     freq, dir);
 	case Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT ... Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT:
 		return q6afe_port_set_sysclk(port, clk_id,
-					     Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO,
+					     dai_data->priv[dai->id].tdm_clk_no_invert ?
+					     Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO :
+					     Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO,
 					     Q6AFE_LPASS_CLK_ROOT_DEFAULT,
 					     freq, dir);
 	}
@@ -1117,6 +1117,8 @@ static void of_q6afe_parse_dai_data(struct device *dev,
 			break;
 		case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7:
 			priv = &data->priv[id];
+			priv->tdm_clk_no_invert = of_property_read_bool(node,
+						"qcom,tdm-clk-no-invert");
 			ret = of_property_read_u32(node, "qcom,tdm-sync-mode",
 						   &priv->sync_mode);
 			if (ret) {
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 2cf9348782cc..dff0a305a500 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -1240,32 +1240,9 @@ static int q6afe_port_set_lpass_clock(struct q6afe_port *port,
 				       sizeof(*cfg));
 }
 
-/*
- * AFE API v7 service params use the wide (instance-id) header, while the
- * port SET_PARAM_V2 path still uses afe_port_param_data_v2. Sending the
- * 12-byte v2 header on the service path shifts instance_id/param_id and the
- * DSP answers ADSP_EBADPARAM.
- */
-struct q6afe_param_hdr_v3 {
-	u32 module_id;
-	u16 instance_id;
-	u16 reserved;
-	u32 param_id;
-	u32 param_size;
-} __packed;
-
-/* AFE_SVC_CMD_SET_PARAM_V2: mem_hdr precedes payload_size. */
-struct q6afe_svc_set_param_v2 {
-	u32 payload_address_lsw;
-	u32 payload_address_msw;
-	u32 mem_map_handle;
-	u32 payload_size;
-} __packed;
-
 static int q6afe_set_lpass_clock_v2(struct q6afe_port *port,
 				 struct afe_clk_set *cfg)
 {
-	/* v130 path: per-port SET_PARAM, accepted by this DSP. */
 	return q6afe_port_set_param(port, cfg, AFE_PARAM_ID_CLOCK_SET,
 				    AFE_MODULE_CLOCK_SET, sizeof(*cfg));
 }
@@ -1426,6 +1403,15 @@ void q6afe_slim_port_prepare(struct q6afe_port *port,
 }
 EXPORT_SYMBOL_GPL(q6afe_slim_port_prepare);
 
+/*
+ * AFE service API v3 and later reject the legacy 8-channel slot map, so pick
+ * the payload from the version the DSP reported.
+ */
+static bool q6afe_slot_map_v2(struct q6afe *afe)
+{
+	return afe->ainfo.api_version >= AFE_API_VERSION_V3;
+}
+
 /**
  * q6afe_tdm_port_prepare() - Prepare tdm afe port.
  *
@@ -1433,17 +1419,6 @@ EXPORT_SYMBOL_GPL(q6afe_slim_port_prepare);
  * @cfg: TDM configuration for the afe port
  *
  */
-/**
- * q6afe_slot_map_v2() - Use the wide (32-channel) slot-map payload.
- *
- * AFE service API v3 and later reject the legacy 8-channel payload, so pick
- * the format from the version the DSP reported.
- */
-static bool q6afe_slot_map_v2(struct q6afe *afe)
-{
-	return afe->ainfo.api_version >= AFE_API_VERSION_V3;
-}
-
 void q6afe_tdm_port_prepare(struct q6afe_port *port,
 			     struct q6afe_tdm_cfg *cfg)
 {
@@ -1800,38 +1775,6 @@ int q6afe_port_start(struct q6afe_port *port)
 		return ret;
 	}
 
-	if (param_id == AFE_PARAM_ID_TDM_CONFIG) {
-		struct afe_param_id_tdm_cfg *t = &port->port_cfg.tdm_cfg;
-
-		dev_info(afe->dev,
-			 "tdm start: dai=%d port=0x%x ch=%u rate=%u bw=%u fmt=%u sync_mode=%u sync_src=%u nslots=%u dout=%u inv=%u delay=%u slot_w=%u mask=0x%x\n",
-			 port->id, port_id, t->num_channels, t->sample_rate,
-			 t->bit_width, t->data_format, t->sync_mode,
-			 t->sync_src, t->nslots_per_frame,
-			 t->ctrl_data_out_enable, t->ctrl_invert_sync_pulse,
-			 t->ctrl_sync_data_delay, t->slot_width, t->slot_mask);
-		if (port->scfg_v2)
-			dev_info(afe->dev,
-				 "tdm map v2: ch=%u bw=%u align=%u slots=%u,%u,%u,%u\n",
-				 port->scfg_v2->num_channels,
-				 port->scfg_v2->bitwidth,
-				 port->scfg_v2->data_align_type,
-				 port->scfg_v2->ch_mapping[0],
-				 port->scfg_v2->ch_mapping[1],
-				 port->scfg_v2->ch_mapping[2],
-				 port->scfg_v2->ch_mapping[3]);
-		else if (port->scfg)
-			dev_info(afe->dev,
-				 "tdm map: ch=%u bw=%u align=%u slots=%u,%u,%u,%u\n",
-				 port->scfg->num_channels, port->scfg->bitwidth,
-				 port->scfg->data_align_type,
-				 port->scfg->ch_mapping[0],
-				 port->scfg->ch_mapping[1],
-				 port->scfg->ch_mapping[2],
-				 port->scfg->ch_mapping[3]);
-
-	}
-
 	if (port->scfg_v2) {
 		ret  = q6afe_port_set_param_v2(port, port->scfg_v2,
 					AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG,
@@ -1877,9 +1820,6 @@ int q6afe_port_start(struct q6afe_port *port)
 	if (ret)
 		dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
 			port_id, ret);
-	else
-		dev_info(afe->dev, "port started: id=0x%x param=0x%x\n",
-			 port_id, param_id);
 
 	return ret;
 }
@@ -2092,8 +2032,6 @@ static int q6afe_probe(struct apr_device *adev)
 		return -ENOMEM;
 
 	q6core_get_svc_api_info(adev->svc_id, &afe->ainfo);
-	dev_info(dev, "AFE service API version %u, slot map v%u\n",
-		 afe->ainfo.api_version, q6afe_slot_map_v2(afe) ? 2 : 1);
 	afe->apr = adev;
 	mutex_init(&afe->lock);
 	init_waitqueue_head(&afe->wait);
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index fe3213b8b83a..b416743589e6 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -339,9 +339,6 @@ static int q6asm_dai_trigger(struct snd_soc_component *component,
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct q6asm_dai_rtd *prtd = runtime->private_data;
 
-	dev_info(component->dev, "asm trigger: cmd=%d stream=%d\n",
-		 cmd, prtd->stream_id);
-
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
@@ -362,7 +359,6 @@ static int q6asm_dai_trigger(struct snd_soc_component *component,
 		ret = -EINVAL;
 		break;
 	}
-	dev_info(component->dev, "asm trigger: cmd=%d ret=%d\n", cmd, ret);
 
 	return ret;
 }
@@ -1013,9 +1009,6 @@ static int q6asm_dai_compr_trigger(struct snd_soc_component *component,
 	struct q6asm_dai_rtd *prtd = runtime->private_data;
 	int ret = 0;
 
-	dev_info(component->dev, "asm trigger: cmd=%d stream=%d\n",
-		 cmd, prtd->stream_id);
-
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
index d697e286c4b7..159cf0869712 100644
--- a/sound/soc/qcom/sm8250.c
+++ b/sound/soc/qcom/sm8250.c
@@ -132,11 +132,6 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
 	struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
 
-	dev_info(rtd->card->dev,
-		 "startup: link=%s cpu_dai=%s id=%d slots=%d width=%d rx_mask=0x%x clk_rate=%d\n",
-		 rtd->dai_link->name, cpu_dai->name, cpu_dai->id, tdm_slots,
-		 tdm_slot_width, tdm_rx_mask, tdm_clk_rate);
-
 	switch (cpu_dai->id) {
 	case PRIMARY_MI2S_RX:
 		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S;
@@ -196,53 +191,55 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
 		 * (PCM_A) mode with only slot 0 as its own TX channel.
 		 */
 		unsigned int tx_slots[] = { 0 };
-		int ret_pll, ret_clk, ret_ctdm, ret_cfmt;
-		int ret_cpu_clk, ret_cpu_tdm, ret_cpu_map;
+		int ret;
 
 		if (!data->is_barbet)
 			break;
 
-		ret_cpu_clk = snd_soc_dai_set_sysclk(cpu_dai,
-				       tdm_pri_clk_id,
-				       tdm_clk_rate,
-				       SNDRV_PCM_STREAM_CAPTURE);
-		ret_cpu_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, tdm_rx_mask, 0,
-					 tdm_slots, tdm_slot_width);
-		ret_cpu_map = snd_soc_dai_set_channel_map(cpu_dai, 1, tx_slots,
-							  0, NULL);
-
-		ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, 1, 0,
-						    tdm_slots, tdm_slot_width);
-		ret_cfmt = snd_soc_dai_set_fmt(codec_dai,
-					       SND_SOC_DAIFMT_DSP_A |
-					       SND_SOC_DAIFMT_NB_NF);
+		ret = snd_soc_dai_set_sysclk(cpu_dai, tdm_pri_clk_id, tdm_clk_rate,
+					     SNDRV_PCM_STREAM_CAPTURE);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_tdm_slot(cpu_dai, tdm_rx_mask, 0,
+					       tdm_slots, tdm_slot_width);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 1, tx_slots, 0, NULL);
+		if (ret)
+			return ret;
+
+		ret = snd_soc_dai_set_tdm_slot(codec_dai, 1, 0,
+					       tdm_slots, tdm_slot_width);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_fmt(codec_dai,
+					  SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF);
+		if (ret)
+			return ret;
 
 		/*
 		 * There is no MCLK wire to the RT5514 on barbet: the codec PLL
 		 * runs from the TDM bit clock, and stock programs it with the
 		 * bit clock as both input and output.
 		 */
-		ret_pll = snd_soc_dai_set_pll(codec_dai, 0,
-					    RT5514_PLL_S_BCLK,
-					    cap_bclk_rate, cap_bclk_rate);
-		ret_clk = snd_soc_dai_set_sysclk(codec_dai,
-					       RT5514_SCLK_S_PLL,
-					       cap_bclk_rate, SND_SOC_CLOCK_IN);
-		dev_info(rtd->card->dev,
-			 "cap: cpu(clk=%d tdm=%d map=%d) codec(tdm=%d fmt=%d pll=%d clk=%d) slots=%d width=%d mask=0x%x\n",
-			 ret_cpu_clk, ret_cpu_tdm, ret_cpu_map, ret_ctdm, ret_cfmt,
-			 ret_pll, ret_clk, tdm_slots, tdm_slot_width,
-			 tdm_rx_mask);
+		ret = snd_soc_dai_set_pll(codec_dai, 0, RT5514_PLL_S_BCLK,
+					  cap_bclk_rate, cap_bclk_rate);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_sysclk(codec_dai, RT5514_SCLK_S_PLL,
+					     cap_bclk_rate, SND_SOC_CLOCK_IN);
+		if (ret)
+			return ret;
 		break;
 	}
 
-		case QUINARY_TDM_RX_0: {
+	case QUINARY_TDM_RX_0: {
 		unsigned int rx_slots[] = { 0, tdm_slot_width / 8 };
 		unsigned int quin_slots = quin_tdm_slots;
 		/* Two channels live in slots 0 and 1 (byte offsets 0 and 4). */
 		unsigned int quin_mask = (1U << 2) - 1;
 		unsigned int quin_rate = quin_slots * tdm_slot_width * 48000;
-		int ret_sysclk, ret_tdm, ret_map;
+		int ret;
 		int i;
 
 		if (!data->is_barbet)
@@ -259,31 +256,29 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
 		 * tas2562_hw_params(); the LPASS power-up otherwise wipes the
 		 * LPI pad mux.
 		 */
-		ret_sysclk = snd_soc_dai_set_sysclk(cpu_dai, quin_clk_id,
-						    quin_rate,
-						    SNDRV_PCM_STREAM_PLAYBACK);
-		ret_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, 0, quin_mask,
-						   quin_slots, tdm_slot_width);
-		ret_map = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, 2,
-						      rx_slots);
-		dev_info(rtd->card->dev,
-			 "quin cpu: sysclk=%d tdm_slot=%d chan_map=%d slots=%u mask=0x%x rate=%u\n",
-			 ret_sysclk, ret_tdm, ret_map, quin_slots, quin_mask,
-			 quin_rate);
+		ret = snd_soc_dai_set_sysclk(cpu_dai, quin_clk_id, quin_rate,
+					     SNDRV_PCM_STREAM_PLAYBACK);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, quin_mask,
+					       quin_slots, tdm_slot_width);
+		if (ret)
+			return ret;
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, 2, rx_slots);
+		if (ret)
+			return ret;
 		codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_DSP_A;
 		snd_soc_dai_set_fmt(cpu_dai, fmt);
-		i = 0;
 		for_each_rtd_codec_dais(rtd, i, codec_dai) {
 			unsigned int mask = 1U << i;
-			int ret_ctdm, ret_cfmt;
-
-			ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, mask, mask,
-							    quin_slots,
-							    tdm_slot_width);
-			ret_cfmt = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
-			dev_info(rtd->card->dev,
-				 "quin codec %s i=%d mask=0x%x tdm_slot=%d fmt=%d\n",
-				 codec_dai->name, i, mask, ret_ctdm, ret_cfmt);
+
+			ret = snd_soc_dai_set_tdm_slot(codec_dai, mask, mask,
+						       quin_slots, tdm_slot_width);
+			if (ret)
+				return ret;
+			ret = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
+			if (ret)
+				return ret;
 		}
 		break;
 	}
@@ -413,8 +408,6 @@ static int sm8250_enable_tdm_clocks(struct device *dev)
 			continue;
 		clk_set_rate(tdm_clk, tdm_clk_rate);
 		ret = clk_prepare_enable(tdm_clk);
-		dev_info(dev, "%s: rate=%u enable_ret=%d\n", tdm_clk_names[i],
-			 tdm_clk_rate, ret);
 		if (ret)
 			continue;
 		ret = devm_add_action_or_reset(dev, sm8250_disable_tdm_clock,

Comment on lines +36 to +39
maxItems: 73

gpio-line-names:
maxItems: 146

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 7: one more GPIO once UFS_RESET is pin 146.

Suggested change
maxItems: 73
gpio-line-names:
maxItems: 146
maxItems: 74
gpio-line-names:
maxItems: 147

};

chosen {
bootargs = "earlycon=qcom_geni,0x888000 keep_bootcon console=ttyMSM0,115200n8 loglevel=7 rdinit=/init panic=15 bootconfig";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boot line the other phones use, without earlycon, keep_bootcon and the serial console.

Suggested change
bootargs = "earlycon=qcom_geni,0x888000 keep_bootcon console=ttyMSM0,115200n8 loglevel=7 rdinit=/init panic=15 bootconfig";
bootargs = "rdinit=/init console=tty0 panic=0 loglevel=7 log_buf_len=2M bootconfig";

status = "okay";
};

&ufs_mem_hc {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 7: the UFS reset as a GPIO, as on SM8450 and SM8550.

Suggested change
&ufs_mem_hc {
&ufs_mem_hc {
reset-gpios = <&tlmm 146 GPIO_ACTIVE_LOW>;

Comment on lines +800 to +801
/* The firmware reports a usable public address. */
qcom,use-firmware-bdaddr;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 2: this property keeps the NVM placeholder address on every unit. Without it, radio-addr gives the controller the phone's own address.

Suggested change
/* The firmware reports a usable public address. */
qcom,use-firmware-bdaddr;

qcom,tdm-data-out = <0>;
qcom,tdm-invert-sync = <1>;
qcom,tdm-data-delay = <1>;
qcom,tdm-data-align = <0>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 4: the per-port switch, so only this port asks for the non-inverted clock.

Suggested change
qcom,tdm-data-align = <0>;
qcom,tdm-data-align = <0>;
qcom,tdm-clk-no-invert;

Comment on lines +1016 to +1018
dev_info(component->dev, "asm trigger: cmd=%d stream=%d\n",
cmd, prtd->stream_id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 3.

Suggested change
dev_info(component->dev, "asm trigger: cmd=%d stream=%d\n",
cmd, prtd->stream_id);

Comment thread sound/soc/qcom/sm8250.c
Comment on lines +135 to 139
dev_info(rtd->card->dev,
"startup: link=%s cpu_dai=%s id=%d slots=%d width=%d rx_mask=0x%x clk_rate=%d\n",
rtd->dai_link->name, cpu_dai->name, cpu_dai->id, tdm_slots,
tdm_slot_width, tdm_rx_mask, tdm_clk_rate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 3: this runs on every stream of every card this machine driver drives.

Suggested change
dev_info(rtd->card->dev,
"startup: link=%s cpu_dai=%s id=%d slots=%d width=%d rx_mask=0x%x clk_rate=%d\n",
rtd->dai_link->name, cpu_dai->name, cpu_dai->id, tdm_slots,
tdm_slot_width, tdm_rx_mask, tdm_clk_rate);

Comment thread sound/soc/qcom/sm8250.c
Comment on lines +199 to +245
int ret_pll, ret_clk, ret_ctdm, ret_cfmt;
int ret_cpu_clk, ret_cpu_tdm, ret_cpu_map;

if (!data->is_barbet)
break;

ret_cpu_clk = snd_soc_dai_set_sysclk(cpu_dai,
tdm_pri_clk_id,
tdm_clk_rate,
SNDRV_PCM_STREAM_CAPTURE);
ret_cpu_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, tdm_rx_mask, 0,
tdm_slots, tdm_slot_width);
ret_cpu_map = snd_soc_dai_set_channel_map(cpu_dai, 1, tx_slots,
0, NULL);

ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, 1, 0,
tdm_slots, tdm_slot_width);
ret_cfmt = snd_soc_dai_set_fmt(codec_dai,
SND_SOC_DAIFMT_DSP_A |
SND_SOC_DAIFMT_NB_NF);

/*
* There is no MCLK wire to the RT5514 on barbet: the codec PLL
* runs from the TDM bit clock, and stock programs it with the
* bit clock as both input and output.
*/
ret_pll = snd_soc_dai_set_pll(codec_dai, 0,
RT5514_PLL_S_BCLK,
cap_bclk_rate, cap_bclk_rate);
ret_clk = snd_soc_dai_set_sysclk(codec_dai,
RT5514_SCLK_S_PLL,
cap_bclk_rate, SND_SOC_CLOCK_IN);
dev_info(rtd->card->dev,
"cap: cpu(clk=%d tdm=%d map=%d) codec(tdm=%d fmt=%d pll=%d clk=%d) slots=%d width=%d mask=0x%x\n",
ret_cpu_clk, ret_cpu_tdm, ret_cpu_map, ret_ctdm, ret_cfmt,
ret_pll, ret_clk, tdm_slots, tdm_slot_width,
tdm_rx_mask);
break;
}

case QUINARY_TDM_RX_0: {
unsigned int rx_slots[] = { 0, tdm_slot_width / 8 };
unsigned int quin_slots = quin_tdm_slots;
/* Two channels live in slots 0 and 1 (byte offsets 0 and 4). */
unsigned int quin_mask = (1U << 2) - 1;
unsigned int quin_rate = quin_slots * tdm_slot_width * 48000;
int ret_sysclk, ret_tdm, ret_map;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 6: return the error instead of printing it. Also fixes the indentation of case QUINARY_TDM_RX_0.

Suggested change
int ret_pll, ret_clk, ret_ctdm, ret_cfmt;
int ret_cpu_clk, ret_cpu_tdm, ret_cpu_map;
if (!data->is_barbet)
break;
ret_cpu_clk = snd_soc_dai_set_sysclk(cpu_dai,
tdm_pri_clk_id,
tdm_clk_rate,
SNDRV_PCM_STREAM_CAPTURE);
ret_cpu_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, tdm_rx_mask, 0,
tdm_slots, tdm_slot_width);
ret_cpu_map = snd_soc_dai_set_channel_map(cpu_dai, 1, tx_slots,
0, NULL);
ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, 1, 0,
tdm_slots, tdm_slot_width);
ret_cfmt = snd_soc_dai_set_fmt(codec_dai,
SND_SOC_DAIFMT_DSP_A |
SND_SOC_DAIFMT_NB_NF);
/*
* There is no MCLK wire to the RT5514 on barbet: the codec PLL
* runs from the TDM bit clock, and stock programs it with the
* bit clock as both input and output.
*/
ret_pll = snd_soc_dai_set_pll(codec_dai, 0,
RT5514_PLL_S_BCLK,
cap_bclk_rate, cap_bclk_rate);
ret_clk = snd_soc_dai_set_sysclk(codec_dai,
RT5514_SCLK_S_PLL,
cap_bclk_rate, SND_SOC_CLOCK_IN);
dev_info(rtd->card->dev,
"cap: cpu(clk=%d tdm=%d map=%d) codec(tdm=%d fmt=%d pll=%d clk=%d) slots=%d width=%d mask=0x%x\n",
ret_cpu_clk, ret_cpu_tdm, ret_cpu_map, ret_ctdm, ret_cfmt,
ret_pll, ret_clk, tdm_slots, tdm_slot_width,
tdm_rx_mask);
break;
}
case QUINARY_TDM_RX_0: {
unsigned int rx_slots[] = { 0, tdm_slot_width / 8 };
unsigned int quin_slots = quin_tdm_slots;
/* Two channels live in slots 0 and 1 (byte offsets 0 and 4). */
unsigned int quin_mask = (1U << 2) - 1;
unsigned int quin_rate = quin_slots * tdm_slot_width * 48000;
int ret_sysclk, ret_tdm, ret_map;
int ret;
if (!data->is_barbet)
break;
ret = snd_soc_dai_set_sysclk(cpu_dai, tdm_pri_clk_id, tdm_clk_rate,
SNDRV_PCM_STREAM_CAPTURE);
if (ret)
return ret;
ret = snd_soc_dai_set_tdm_slot(cpu_dai, tdm_rx_mask, 0,
tdm_slots, tdm_slot_width);
if (ret)
return ret;
ret = snd_soc_dai_set_channel_map(cpu_dai, 1, tx_slots, 0, NULL);
if (ret)
return ret;
ret = snd_soc_dai_set_tdm_slot(codec_dai, 1, 0,
tdm_slots, tdm_slot_width);
if (ret)
return ret;
ret = snd_soc_dai_set_fmt(codec_dai,
SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF);
if (ret)
return ret;
/*
* There is no MCLK wire to the RT5514 on barbet: the codec PLL
* runs from the TDM bit clock, and stock programs it with the
* bit clock as both input and output.
*/
ret = snd_soc_dai_set_pll(codec_dai, 0, RT5514_PLL_S_BCLK,
cap_bclk_rate, cap_bclk_rate);
if (ret)
return ret;
ret = snd_soc_dai_set_sysclk(codec_dai, RT5514_SCLK_S_PLL,
cap_bclk_rate, SND_SOC_CLOCK_IN);
if (ret)
return ret;
break;
}
case QUINARY_TDM_RX_0: {
unsigned int rx_slots[] = { 0, tdm_slot_width / 8 };
unsigned int quin_slots = quin_tdm_slots;
/* Two channels live in slots 0 and 1 (byte offsets 0 and 4). */
unsigned int quin_mask = (1U << 2) - 1;
unsigned int quin_rate = quin_slots * tdm_slot_width * 48000;
int ret;

Comment thread sound/soc/qcom/sm8250.c
Comment on lines +262 to +286
ret_sysclk = snd_soc_dai_set_sysclk(cpu_dai, quin_clk_id,
quin_rate,
SNDRV_PCM_STREAM_PLAYBACK);
ret_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, 0, quin_mask,
quin_slots, tdm_slot_width);
ret_map = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, 2,
rx_slots);
dev_info(rtd->card->dev,
"quin cpu: sysclk=%d tdm_slot=%d chan_map=%d slots=%u mask=0x%x rate=%u\n",
ret_sysclk, ret_tdm, ret_map, quin_slots, quin_mask,
quin_rate);
codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_DSP_A;
snd_soc_dai_set_fmt(cpu_dai, fmt);
i = 0;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
unsigned int mask = 1U << i;
int ret_ctdm, ret_cfmt;

ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, mask, mask,
quin_slots,
tdm_slot_width);
ret_cfmt = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
dev_info(rtd->card->dev,
"quin codec %s i=%d mask=0x%x tdm_slot=%d fmt=%d\n",
codec_dai->name, i, mask, ret_ctdm, ret_cfmt);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 6.

Suggested change
ret_sysclk = snd_soc_dai_set_sysclk(cpu_dai, quin_clk_id,
quin_rate,
SNDRV_PCM_STREAM_PLAYBACK);
ret_tdm = snd_soc_dai_set_tdm_slot(cpu_dai, 0, quin_mask,
quin_slots, tdm_slot_width);
ret_map = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, 2,
rx_slots);
dev_info(rtd->card->dev,
"quin cpu: sysclk=%d tdm_slot=%d chan_map=%d slots=%u mask=0x%x rate=%u\n",
ret_sysclk, ret_tdm, ret_map, quin_slots, quin_mask,
quin_rate);
codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_DSP_A;
snd_soc_dai_set_fmt(cpu_dai, fmt);
i = 0;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
unsigned int mask = 1U << i;
int ret_ctdm, ret_cfmt;
ret_ctdm = snd_soc_dai_set_tdm_slot(codec_dai, mask, mask,
quin_slots,
tdm_slot_width);
ret_cfmt = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
dev_info(rtd->card->dev,
"quin codec %s i=%d mask=0x%x tdm_slot=%d fmt=%d\n",
codec_dai->name, i, mask, ret_ctdm, ret_cfmt);
ret = snd_soc_dai_set_sysclk(cpu_dai, quin_clk_id, quin_rate,
SNDRV_PCM_STREAM_PLAYBACK);
if (ret)
return ret;
ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, quin_mask,
quin_slots, tdm_slot_width);
if (ret)
return ret;
ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, 2, rx_slots);
if (ret)
return ret;
codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_DSP_A;
snd_soc_dai_set_fmt(cpu_dai, fmt);
for_each_rtd_codec_dais(rtd, i, codec_dai) {
unsigned int mask = 1U << i;
ret = snd_soc_dai_set_tdm_slot(codec_dai, mask, mask,
quin_slots, tdm_slot_width);
if (ret)
return ret;
ret = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
if (ret)
return ret;

Comment thread sound/soc/qcom/sm8250.c
Comment on lines +416 to +417
dev_info(dev, "%s: rate=%u enable_ret=%d\n", tdm_clk_names[i],
tdm_clk_rate, ret);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point 3.

Suggested change
dev_info(dev, "%s: rate=%u enable_ret=%d\n", tdm_clk_names[i],
tdm_clk_rate, ret);

@Gibbz

Gibbz commented Nov 19, 2026

Copy link
Copy Markdown
Author

Superseded by #42, which starts from this branch head and folds the review fixes into the commits they belong to. This branch is left as it is so the original history stays available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants