69f799168c
GKI (arm64) relevant 137 out of 624 changes, affecting 192 files +1647/-1035a4f865ecdbnvmem: core: fix bit offsets of more than one byte [1 file, +17/-7]4327479e55nvmem: core: verify cell's raw_len [1 file, +12/-0]410f8b72e0nvmem: core: update raw_len if the bit reading is required [1 file, +3/-1]7aea1517fbscsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices [2 files, +35/-0]b730cb1096virtio_ring: Fix data race by tagging event_triggered as racy for KCSAN [1 file, +1/-1]2998813177dma/mapping.c: dev_dbg support for dma_addressing_limited [1 file, +10/-1]3eec42a17adma-mapping: avoid potential unused data compilation warning [1 file, +8/-4]97edaa0ec6cgroup: Fix compilation issue due to cgroup_mutex not being exported [1 file, +1/-1]f93675793bvhost_task: fix vhost_task_create() documentation [1 file, +1/-1]e22034cbeedma-mapping: Fix warning reported for missing prototype [1 file, +8/-8]4f5553a08ffs/buffer: split locking for pagecache lookups [1 file, +25/-16]e138fc2316fs/buffer: introduce sleeping flavors for pagecache lookups [2 files, +17/-0]a49a4a87cefs/buffer: use sleeping version of __find_get_block() [1 file, +9/-2]f1c5aa614bfs/jbd2: use sleeping version of __find_get_block() [1 file, +9/-6]9ece099e95fs/ext4: use sleeping version of sb_find_get_block() [1 file, +2/-1]64f505b08eblock: fix race between set_blocksize and read paths [4 files, +43/-1]218c838d03io_uring: don't duplicate flushing in io_req_post_cqe [1 file, +8/-3]8014d3e56ebpf: fix possible endless loop in BPF map iteration [1 file, +1/-1]d40ca27602fuse: Return EPERM rather than ENOSYS from link() [1 file, +2/-0]bab0bd1389exfat: call bh_read in get_block only when necessary [1 file, +77/-82]01677e7ee1io_uring/msg: initialise msg request opcode [1 file, +1/-0]e506751b7darm64: Add support for HIP09 Spectre-BHB mitigation [2 files, +3/-0]4f427ca9edtracing: Mark binary printing functions with __printf() attribute [4 files, +18/-21]15787ab82amailbox: use error ret code of of_parse_phandle_with_args() [1 file, +4/-3]f48ee562c0Bluetooth: Disable SCO support if READ_VOICE_SETTING is unsupported/broken [1 file, +3/-0]44b79041c4dql: Fix dql->limit value when reset. [1 file, +1/-1]ac30595154lockdep: Fix wait context check on softirq for PREEMPT_RT [1 file, +18/-0]e63b634806PCI: dwc: ep: Ensure proper iteration over outbound map windows [1 file, +1/-1]37ac2434aaext4: on a remount, only log the ro or r/w state when it has changed [1 file, +4/-3]1d1e1efad1libnvdimm/labels: Fix divide error in nd_label_data_init() [1 file, +2/-1]123bcd8f42pidfs: improve multi-threaded exec and premature thread-group leader exit polling [3 files, +9/-9]8f82cf305ecgroup/rstat: avoid disabling irqs for O(num_cpu) [1 file, +5/-7]a5a507fa5fblk-cgroup: improve policy registration error handling [1 file, +12/-10]94c3cbc69aext4: reorder capability check last [1 file, +2/-2]e658f2d94abpf: Return prog btf_id without capable check [1 file, +2/-2]e2520cc19bPCI: dwc: Use resource start as ioremap() input in dw_pcie_pme_turn_off() [1 file, +1/-1]50452704ecjbd2: do not try to recover wiped journal [1 file, +6/-5]dab35f4921tcp: reorganize tcp_in_ack_event() and tcp_count_delivered() [1 file, +32/-24]555c0b713cbpf: Allow pre-ordering for bpf cgroup progs [5 files, +30/-9]572ed3fb99kconfig: do not clear SYMBOL_VALID when reading include/config/auto.conf [1 file, +12/-7]174dedce64dm: restrict dm device size to 2^63-512 bytes [1 file, +4/-0]2f5f326214ext4: reject the 'data_err=abort' option in nojournal mode [1 file, +12/-0]d0dc233fe2posix-timers: Add cond_resched() to posix_timer_add() search loop [1 file, +1/-0]ae22452d15posix-timers: Ensure that timer initialization is fully visible [1 file, +14/-7]3fb9ee05ectimer_list: Don't use %pK through printk() [1 file, +2/-2]21153e0974netfilter: conntrack: Bound nf_conntrack sysctl writes [1 file, +9/-3]236a87e9d2PNP: Expand length of fixup id string [1 file, +1/-1]6215143ad3arm64/mm: Check pmd_table() in pmd_trans_huge() [1 file, +12/-12]8ad58a7ebaarm64/mm: Check PUD_TYPE_TABLE in pud_bad() [1 file, +2/-1]28306c58dammc: sdhci: Disable SD card clock before changing parameters [1 file, +7/-2]3a75fe58a1usb: xhci: Don't change the status of stalled TDs on failed Stop EP [1 file, +11/-1]101a3b9920printk: Check CON_SUSPEND when unblanking a console [1 file, +12/-2]faba68a86awifi: cfg80211: allow IR in 20 MHz configurations [5 files, +46/-25]c1502fc84dipv6: save dontfrag in cork [2 files, +6/-4]75ae2a3553badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0 [1 file, +3/-2]7caad075accrypto: lzo - Fix compression buffer overrun [6 files, +106/-28]73d01bcbf2tcp: bring back NUMA dispersion in inet_ehash_locks_alloc() [1 file, +26/-11]1c17190880usb: xhci: set page size to the xHCI-supported size [2 files, +22/-20]93f581d763drm/gem: Test for imported GEM buffers with helper [2 files, +16/-2]c4525b513dnet: phylink: use pl->link_interface in phylink_expects_phy() [1 file, +1/-1]f29c876d72perf/core: Clean up perf_try_init_event() [1 file, +38/-27]af73c8fd73ublk: enforce ublks_max only for unprivileged devices [1 file, +27/-15]592ba27580perf/hw_breakpoint: Return EOPNOTSUPP for unsupported breakpoint type [1 file, +3/-2]3de322a98bscsi: logging: Fix scsi_logging_level bounds [1 file, +3/-1]f33b310eacipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). [2 files, +16/-24]564f03a797block: mark bounce buffering as incompatible with integrity [2 files, +5/-2]82209faa87ublk: complete command synchronously on error [1 file, +6/-5]b98aad5e5emedia: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map [1 file, +6/-0]2d6231d5cemedia: uvcvideo: Handle uvc menu translation inside uvc_get_le_value [1 file, +32/-45]e359d62886perf: arm_pmuv3: Call kvm_vcpu_pmu_resync_el0() before enabling counters [1 file, +2/-2]673dde8d3cbpf: Search and add kfuncs in struct_ops prologue and epilogue [1 file, +24/-1]083383aba0cpuidle: menu: Avoid discarding useful information [1 file, +12/-1]20a53c3689loop: check in LO_FLAGS_DIRECT_IO in loop_default_blocksize [1 file, +1/-1]b55a97d1bddm: fix unconditional IO throttle caused by REQ_PREFLUSH [1 file, +6/-2]9f27b38771crypto: ahash - Set default reqsize from ahash_alg [2 files, +7/-0]897c98fb32crypto: skcipher - Zap type in crypto_alloc_sync_skcipher [1 file, +1/-0]4d9fa2ebc0net: ipv6: Init tunnel link-netns before registering dev [4 files, +9/-7]53f42776e4genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie [2 files, +25/-36]2b129e89b8bpf: don't do clean_live_states when state->loop_entry->branches > 0 [1 file, +4/-0]46ba5757a7bpf: copy_verifier_state() should copy 'loop_entry' field [1 file, +3/-0]82b54455b6PCI: Fix old_size lower bound in calculate_iosize() too [1 file, +2/-4]dc5f5c9d2bhrtimers: Replace hrtimer_clock_to_base_table with switch-case [1 file, +12/-17]000dd6e344ASoC: ops: Enforce platform maximum on initial value [1 file, +28/-1]c4260bf83bASoC: soc-dai: check return value at snd_soc_dai_set_tdm_slot() [1 file, +5/-3]5b1b4cb46dpinctrl: devicetree: do not goto err when probing hogs in pinctrl_dt_to_map [1 file, +8/-2]69689d1138media: v4l: Memset argument to 0 before calling get_mbus_config pad op [2 files, +5/-1]e6e31b0182sched: Reduce the default slice to avoid tasks getting an extra tick [1 file, +3/-3]ef31dc41cfphy: core: don't require set_mode() callback for phy_get_mode() to work [1 file, +4/-3]06daedb443xfrm: prevent high SEQ input in non-ESN mode [1 file, +12/-0]9f2911868aip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). [2 files, +4/-4]7fea5a9140r8152: add vendor/device ID pair for Dell Alienware AW1022z [2 files, +2/-0]16ddd67bb5pstore: Change kmsg_bytes storage size to u32 [3 files, +9/-8]73733c2fdbext4: don't write back data before punch hole in nojournal mode [1 file, +5/-13]1d15319323f2fs: introduce f2fs_base_attr for global sysfs entries [1 file, +52/-22]ded26f9e4cipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only [1 file, +10/-6]76e56dbe50net: flush_backlog() small changes [1 file, +8/-4]58cdd1ee65bridge: mdb: Allow replace of a host-joined group [2 files, +2/-2]fcabb69674rcu: handle unstable rdp in rcu_read_unlock_strict() [2 files, +11/-2]d402437cdercu: fix header guard for rcu_all_qs() [1 file, +1/-1]887e39ac47perf: Avoid the read if the count is already updated [3 files, +24/-18]c80b2d159cbpf: Use kallsyms to find the function name of a struct_ops's stub function [1 file, +44/-54]46f1c2b508firmware: arm_scmi: Relax duplicate name constraint across protocol ids [1 file, +6/-13]1351052877drm/atomic: clarify the rules around drm_atomic_state->allow_modeset [1 file, +21/-2]9fddd1f154drm: Add valid clones check [1 file, +28/-0]ff214b079dnvme-pci: add quirks for device 126f:1001 [1 file, +3/-0]6d196cae4bnvme-pci: add quirks for WDC Blue SN550 15b7:5009 [1 file, +3/-0]6a09b6bad0ALSA: usb-audio: Fix duplicated name in MIDI substream names [1 file, +12/-4]ad3e83a6c8io_uring/fdinfo: annotate racy sq/cq head/tail reads [1 file, +2/-2]7f7c8c03febtrfs: correct the order of prelim_ref arguments in btrfs__prelim_ref [1 file, +1/-1]8cafd7266f__legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock [1 file, +1/-5]28756f22deespintcp: fix skb leaks [3 files, +9/-3]9cbca30102espintcp: remove encap socket caching to avoid reference leak [4 files, +8/-94]b1a687eb15xfrm: Fix UDP GRO handling for some corner cases [2 files, +20/-16]447c8f0c06kernel/fork: only call untrack_pfn_clear() on VMAs duplicated for fork() [1 file, +5/-4]252f78a931xfrm: Sanitize marks before insert [2 files, +6/-0]7207effe47driver core: Split devres APIs to device/devres.h [2 files, +125/-118]1e8b7e96f7Bluetooth: L2CAP: Fix not checking l2cap_chan security level [1 file, +8/-7]cd7f022296loop: don't require ->write_iter for writable files in loop_configure [1 file, +0/-3]873ebaf3c1io_uring: fix overflow resched cqe reordering [1 file, +1/-0]689a205cd9net/tipc: fix slab-use-after-free Read in tipc_aead_encrypt_done [1 file, +5/-0]adb05149a9can: slcan: allow reception of short error messages [1 file, +20/-6]cc55dd28c2can: bcm: add locking for bcm_op runtime updates [1 file, +45/-21]63567ecd99can: bcm: add missing rcu read protection for procfs content [1 file, +9/-4]bf85e49aafALSA: pcm: Fix race of buffer access at PCM OSS layer [3 files, +14/-2]e78908caf1pmdomain: core: Fix error checking in genpd_dev_pm_attach_by_id() [1 file, +1/-1]dc9bdfb9b0drm/edid: fixed the bug that hdr metadata was not reset [1 file, +1/-0]cb9a1019a6Input: xpad - add more controllers [1 file, +3/-0]9b8263cae6highmem: add folio_test_partial_kmap() [2 files, +12/-5]314bf771cbmemcg: always call cond_resched() after fn() [1 file, +2/-4]9da33ce114mm/page_alloc.c: avoid infinite retries caused by cpuset race [1 file, +8/-0]9f9517f156mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled [1 file, +2/-0]94efb0d656mm: vmalloc: actually use the in-place vrealloc region [1 file, +1/-0]483ac74183mm: vmalloc: only zero-init on vrealloc shrink [1 file, +7/-5]1d45e0170cspi: use container_of_cont() for to_spi_device() [1 file, +1/-4]d28b0305f7err.h: move IOMEM_ERR_PTR() to err.h [2 files, +3/-2]80eb73778dbpf: abort verification if env->cur_state->loop_entry != NULL [1 file, +4/-2]85fb1edd05drm/gem: Internally test import_attach for imported objects [1 file, +1/-2] Changes in 6.12.31 drm/amd/display: Configure DTBCLK_P with OPTC only for dcn401 drm/amd/display: Do not enable replay when vtotal update is pending. drm/amd/display: Correct timing_adjust_pending flag setting. drm/amd/display: Defer BW-optimization-blocked DRR adjustments i2c: designware: Use temporary variable for struct device i2c: designware: Fix an error handling path in i2c_dw_pci_probe() phy: renesas: rcar-gen3-usb2: Move IRQ request in probe phy: renesas: rcar-gen3-usb2: Lock around hardware registers and driver data phy: renesas: rcar-gen3-usb2: Assert PLL reset on PHY power off cpufreq: Add SM8650 to cpufreq-dt-platdev blocklist nvmem: rockchip-otp: Move read-offset into variant-data nvmem: rockchip-otp: add rk3576 variant data nvmem: core: fix bit offsets of more than one byte nvmem: core: verify cell's raw_len nvmem: core: update raw_len if the bit reading is required nvmem: qfprom: switch to 4-byte aligned reads scsi: target: iscsi: Fix timeout on deleted connection scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices virtio_ring: Fix data race by tagging event_triggered as racy for KCSAN dma/mapping.c: dev_dbg support for dma_addressing_limited intel_th: avoid using deprecated page->mapping, index fields mei: vsc: Use struct vsc_tp_packet as vsc-tp tx_buf and rx_buf type dma-mapping: avoid potential unused data compilation warning cgroup: Fix compilation issue due to cgroup_mutex not being exported vhost_task: fix vhost_task_create() documentation vhost-scsi: protect vq->log_used with vq->mutex scsi: mpi3mr: Add level check to control event logging net: enetc: refactor bulk flipping of RX buffers to separate function dma-mapping: Fix warning reported for missing prototype ima: process_measurement() needlessly takes inode_lock() on MAY_READ fs/buffer: split locking for pagecache lookups fs/buffer: introduce sleeping flavors for pagecache lookups fs/buffer: use sleeping version of __find_get_block() fs/ocfs2: use sleeping version of __find_get_block() fs/jbd2: use sleeping version of __find_get_block() fs/ext4: use sleeping version of sb_find_get_block() drm/amd/display: Enable urgent latency adjustment on DCN35 drm/amdgpu: Allow P2P access through XGMI selftests/bpf: Mitigate sockmap_ktls disconnect_after_delete failure block: fix race between set_blocksize and read paths io_uring: don't duplicate flushing in io_req_post_cqe bpf: fix possible endless loop in BPF map iteration samples/bpf: Fix compilation failure for samples/bpf on LoongArch Fedora kconfig: merge_config: use an empty file as initfile x86/fred: Fix system hang during S4 resume with FRED enabled s390/vfio-ap: Fix no AP queue sharing allowed message written to kernel log cifs: Add fallback for SMB2 CREATE without FILE_READ_ATTRIBUTES cifs: Fix querying and creating MF symlinks over SMB1 cifs: Fix negotiate retry functionality smb: client: Store original IO parameters and prevent zero IO sizes fuse: Return EPERM rather than ENOSYS from link() exfat: call bh_read in get_block only when necessary io_uring/msg: initialise msg request opcode NFSv4: Check for delegation validity in nfs_start_delegation_return_locked() NFS: Don't allow waiting for exiting tasks SUNRPC: Don't allow waiting for exiting tasks arm64: Add support for HIP09 Spectre-BHB mitigation iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability tracing: Mark binary printing functions with __printf() attribute ACPI: PNP: Add Intel OC Watchdog IDs to non-PNP device list tpm: Convert warn to dbg in tpm2_start_auth_session() mailbox: pcc: Use acpi_os_ioremap() instead of ioremap() mailbox: use error ret code of of_parse_phandle_with_args() riscv: Allow NOMMU kernels to access all of RAM fbdev: fsl-diu-fb: add missing device_remove_file() fbcon: Use correct erase colour for clearing in fbcon fbdev: core: tileblit: Implement missing margin clearing for tileblit cifs: Set default Netbios RFC1001 server name to hostname in UNC cifs: add validation check for the fields in smb_aces cifs: Fix establishing NetBIOS session for SMB2+ connection NFSv4: Treat ENETUNREACH errors as fatal for state recovery SUNRPC: rpc_clnt_set_transport() must not change the autobind setting SUNRPC: rpcbind should never reset the port to the value '0' spi-rockchip: Fix register out of bounds access ASoC: codecs: wsa884x: Correct VI sense channel mask ASoC: codecs: wsa883x: Correct VI sense channel mask mctp: Fix incorrect tx flow invalidation condition in mctp-i2c net: tn40xx: add pci-id of the aqr105-based Tehuti TN4010 cards net: tn40xx: create swnode for mdio and aqr105 phy and add to mdiobus thermal/drivers/mediatek/lvts: Start sensor interrupts disabled thermal/drivers/qoriq: Power down TMU on system suspend Bluetooth: btmtksdio: Prevent enabling interrupts after IRQ handler removal Bluetooth: Disable SCO support if READ_VOICE_SETTING is unsupported/broken dql: Fix dql->limit value when reset. lockdep: Fix wait context check on softirq for PREEMPT_RT objtool: Properly disable uaccess validation PCI: dwc: ep: Ensure proper iteration over outbound map windows r8169: disable RTL8126 ZRX-DC timeout tools/build: Don't pass test log files to linker pNFS/flexfiles: Report ENETDOWN as a connection error drm/amdgpu/discovery: check ip_discovery fw file available drm/amdkfd: set precise mem ops caps to disabled for gfx 11 and 12 PCI: vmd: Disable MSI remapping bypass under Xen xen/pci: Do not register devices with segments >= 0x10000 ext4: on a remount, only log the ro or r/w state when it has changed libnvdimm/labels: Fix divide error in nd_label_data_init() pidfs: improve multi-threaded exec and premature thread-group leader exit polling staging: vchiq_arm: Create keep-alive thread during probe mmc: host: Wait for Vdd to settle on card power off drm/amdgpu: Skip pcie_replay_count sysfs creation for VF cgroup/rstat: avoid disabling irqs for O(num_cpu) wifi: mt76: only mark tx-status-failed frames as ACKed on mt76x0/2 wifi: mt76: mt7996: fix SER reset trigger on WED reset wifi: mt76: mt7996: revise TXS size wifi: mt76: mt7925: load the appropriate CLC data based on hardware type wifi: mt76: mt7925: fix fails to enter low power mode in suspend state x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers x86/stackprotector/64: Only export __ref_stack_chk_guard on CONFIG_SMP x86/smpboot: Fix INIT delay assignment for extended Intel Families x86/microcode: Update the Intel processor flag scan check x86/mm: Check return value from memblock_phys_alloc_range() i2c: qup: Vote for interconnect bandwidth to DRAM i2c: pxa: fix call balance of i2c->clk handling routines btrfs: make btrfs_discard_workfn() block_group ref explicit btrfs: avoid linker error in btrfs_find_create_tree_block() btrfs: run btrfs_error_commit_super() early btrfs: fix non-empty delayed iputs list on unmount due to async workers btrfs: get zone unusable bytes while holding lock at btrfs_reclaim_bgs_work() btrfs: send: return -ENAMETOOLONG when attempting a path that is too long blk-cgroup: improve policy registration error handling drm/amdgpu: release xcp_mgr on exit drm/amd/display: Guard against setting dispclk low for dcn31x drm/amdgpu: adjust drm_firmware_drivers_only() handling i3c: master: svc: Fix missing STOP for master request s390/tlb: Use mm_has_pgste() instead of mm_alloc_pgste() dlm: make tcp still work in multi-link env clocksource/drivers/timer-riscv: Stop stimecmp when cpu hotplug um: Store full CSGSFS and SS register from mcontext um: Update min_low_pfn to match changes in uml_reserved wifi: mwifiex: Fix HT40 bandwidth issue. bnxt_en: Query FW parameters when the CAPS_CHANGE bit is set riscv: Call secondary mmu notifier when flushing the tlb ext4: reorder capability check last hypfs_create_cpu_files(): add missing check for hypfs_mkdir() failure scsi: st: Tighten the page format heuristics with MODE SELECT scsi: st: ERASE does not change tape location vfio/pci: Handle INTx IRQ_NOTCONNECTED bpf: Return prog btf_id without capable check PCI: dwc: Use resource start as ioremap() input in dw_pcie_pme_turn_off() jbd2: do not try to recover wiped journal tcp: reorganize tcp_in_ack_event() and tcp_count_delivered() rtc: rv3032: fix EERD location objtool: Fix error handling inconsistencies in check() thunderbolt: Do not add non-active NVM if NVM upgrade is disabled for retimer erofs: initialize decompression early spi: spi-mux: Fix coverity issue, unchecked return value ASoC: pcm6240: Drop bogus code handling IRQ as GPIO ASoC: mediatek: mt6359: Add stub for mt6359_accdet_enable_jack_detect bpf: Allow pre-ordering for bpf cgroup progs kbuild: fix argument parsing in scripts/config kconfig: do not clear SYMBOL_VALID when reading include/config/auto.conf crypto: octeontx2 - suppress auth failure screaming due to negative tests dm: restrict dm device size to 2^63-512 bytes net/smc: use the correct ndev to find pnetid by pnetid table xen: Add support for XenServer 6.1 platform device pinctrl-tegra: Restore SFSEL bit when freeing pins mfd: tps65219: Remove TPS65219_REG_TI_DEV_ID check drm/amdgpu/gfx12: don't read registers in mqd init drm/amdgpu/gfx11: don't read registers in mqd init drm/amdgpu: Update SRIOV video codec caps ASoC: sun4i-codec: support hp-det-gpios property clk: qcom: lpassaudiocc-sc7280: Add support for LPASS resets for QCM6490 ext4: reject the 'data_err=abort' option in nojournal mode ext4: do not convert the unwritten extents if data writeback fails RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject() posix-timers: Add cond_resched() to posix_timer_add() search loop posix-timers: Ensure that timer initialization is fully visible net: stmmac: dwmac-rk: Validate GRF and peripheral GRF during probe net: hsr: Fix PRP duplicate detection timer_list: Don't use %pK through printk() wifi: rtw89: set force HE TB mode when connecting to 11ax AP netfilter: conntrack: Bound nf_conntrack sysctl writes PNP: Expand length of fixup id string phy: rockchip: usbdp: Only verify link rates/lanes/voltage when the corresponding set flags are set arm64/mm: Check pmd_table() in pmd_trans_huge() arm64/mm: Check PUD_TYPE_TABLE in pud_bad() mmc: dw_mmc: add exynos7870 DW MMC support mmc: sdhci: Disable SD card clock before changing parameters usb: xhci: Don't change the status of stalled TDs on failed Stop EP wifi: iwlwifi: mvm: fix setting the TK when associated hwmon: (dell-smm) Increment the number of fans iommu: Keep dev->iommu state consistent printk: Check CON_SUSPEND when unblanking a console wifi: iwlwifi: don't warn when if there is a FW error wifi: iwlwifi: w/a FW SMPS mode selection wifi: iwlwifi: fix debug actions order wifi: iwlwifi: mark Br device not integrated wifi: iwlwifi: fix the ECKV UEFI variable name wifi: mac80211: fix warning on disconnect during failed ML reconf wifi: mac80211_hwsim: Fix MLD address translation wifi: cfg80211: allow IR in 20 MHz configurations ipv6: save dontfrag in cork drm/amd/display: remove minimum Dispclk and apply oem panel timing. drm/amd/display: calculate the remain segments for all pipes drm/amd/display: not abort link train when bw is low drm/amd/display: Fix incorrect DPCD configs while Replay/PSR switch gfs2: Check for empty queue in run_queue auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common" ASoC: qcom: sm8250: explicitly set format in sm8250_be_hw_params_fixup() badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0 coresight-etb10: change etb_drvdata spinlock's type to raw_spinlock_t iommu/amd/pgtbl_v2: Improve error handling cpufreq: tegra186: Share policy per cluster watchdog: aspeed: Update bootstatus handling PCI: endpoint: pci-epf-test: Fix double free that causes kernel to oops misc: pci_endpoint_test: Give disabled BARs a distinct error code crypto: lzo - Fix compression buffer overrun crypto: mxs-dcp - Only set OTP_KEY bit for OTP key drm/amdkfd: Set per-process flags only once for gfx9/10/11/12 drm/amdkfd: Set per-process flags only once cik/vi drm/amdgpu: Fix missing drain retry fault the last entry arm64: tegra: p2597: Fix gpio for vdd-1v8-dis regulator arm64: tegra: Resize aperture for the IGX PCIe C5 slot powerpc/prom_init: Fixup missing #size-cells on PowerBook6,7 ALSA: seq: Improve data consistency at polling tcp: bring back NUMA dispersion in inet_ehash_locks_alloc() rtc: ds1307: stop disabling alarms on probe ieee802154: ca8210: Use proper setters and getters for bitwise types drm/xe: Nuke VM's mapping upon close drm/xe: Retry BO allocation soc: samsung: include linux/array_size.h where needed ARM: tegra: Switch DSI-B clock parent to PLLD on Tegra114 media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe() usb: xhci: set page size to the xHCI-supported size dm cache: prevent BUG_ON by blocking retries on failed device resumes soc: mediatek: mtk-mutex: Add DPI1 SOF/EOF to MT8188 mutex tables orangefs: Do not truncate file size drm/gem: Test for imported GEM buffers with helper net: phylink: use pl->link_interface in phylink_expects_phy() blk-throttle: don't take carryover for prioritized processing of metadata remoteproc: qcom_wcnss: Handle platforms with only single power domain drm/amdgpu: Do not program AGP BAR regs under SRIOV in gfxhub_v1_0.c drm/amd/display: Ensure DMCUB idle before reset on DCN31/DCN35 drm/amd/display: Skip checking FRL_MODE bit for PCON BW determination drm/amd/display: Fix DMUB reset sequence for DCN401 drm/amd/display: Fix p-state type when p-state is unsupported drm/amd/display: Request HW cursor on DCN3.2 with SubVP perf/core: Clean up perf_try_init_event() media: cx231xx: set device_caps for 417 pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned" rcu: Fix get_state_synchronize_rcu_full() GP-start detection net: ethernet: ti: cpsw_new: populate netdev of_node net: phy: nxp-c45-tja11xx: add match_phy_device to TJA1103/TJA1104 dpll: Add an assertion to check freq_supported_num ublk: enforce ublks_max only for unprivileged devices iommufd: Disallow allocating nested parent domain with fault ID media: imx335: Set vblank immediately net: pktgen: fix mpls maximum labels list parsing perf/hw_breakpoint: Return EOPNOTSUPP for unsupported breakpoint type ALSA: hda/realtek: Enable PC beep passthrough for HP EliteBook 855 G7 scsi: logging: Fix scsi_logging_level bounds ipv4: fib: Move fib_valid_key_len() to rtm_to_fib_config(). drm/rockchip: vop2: Add uv swap for cluster window block: mark bounce buffering as incompatible with integrity ublk: complete command synchronously on error media: uvcvideo: Add sanity check to uvc_ioctl_xu_ctrl_map media: uvcvideo: Handle uvc menu translation inside uvc_get_le_value clk: imx8mp: inform CCF of maximum frequency of clocks x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2 hwmon: (gpio-fan) Add missing mutex locks ARM: at91: pm: fix at91_suspend_finish for ZQ calibration drm/mediatek: mtk_dpi: Add checks for reg_h_fre_con existence fpga: altera-cvp: Increase credit timeout perf: arm_pmuv3: Call kvm_vcpu_pmu_resync_el0() before enabling counters soc: apple: rtkit: Use high prio work queue soc: apple: rtkit: Implement OSLog buffers properly wifi: ath12k: Report proper tx completion status to mac80211 PCI: brcmstb: Expand inbound window size up to 64GB PCI: brcmstb: Add a softdep to MIP MSI-X driver firmware: arm_ffa: Set dma_mask for ffa devices drm/xe/vf: Retry sending MMIO request to GUC on timeout error drm/xe/pf: Create a link between PF and VF devices net/mlx5: Avoid report two health errors on same syndrome selftests/net: have `gro.sh -t` return a correct exit code pinctrl: sophgo: avoid to modify untouched bit when setting cv1800 pinconf drm/amdkfd: KFD release_work possible circular locking drm/xe: xe_gen_wa_oob: replace program_invocation_short_name leds: pwm-multicolor: Add check for fwnode_property_read_u32 net: ethernet: mtk_ppe_offload: Allow QinQ, double ETH_P_8021Q only net: xgene-v2: remove incorrect ACPI_PTR annotation bonding: report duplicate MAC address in all situations wifi: ath12k: Improve BSS discovery with hidden SSID in 6 GHz band soc: ti: k3-socinfo: Do not use syscon helper to build regmap bpf: Search and add kfuncs in struct_ops prologue and epilogue Octeontx2-af: RPM: Register driver with PCI subsys IDs x86/build: Fix broken copy command in genimage.sh when making isoimage drm/amd/display: handle max_downscale_src_width fail check drm/amd/display: fix dcn4x init failed drm/amd/display: Fix mismatch type comparison ASoC: mediatek: mt8188: Treat DMIC_GAINx_CUR as non-volatile ASoC: mediatek: mt8188: Add reference for dmic clocks x86/nmi: Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus() vhost-scsi: Return queue full for page alloc failures during copy vdpa/mlx5: Fix mlx5_vdpa_get_config() endianness on big-endian machines cpuidle: menu: Avoid discarding useful information media: adv7180: Disable test-pattern control on adv7180 media: tc358746: improve calculation of the D-PHY timing registers net/mlx5e: Add correct match to check IPSec syndromes for switchdev mode scsi: mpi3mr: Update timestamp only for supervisor IOCs loop: check in LO_FLAGS_DIRECT_IO in loop_default_blocksize libbpf: Fix out-of-bound read dm: fix unconditional IO throttle caused by REQ_PREFLUSH scsi: scsi_debug: First fixes for tapes net/mlx5: Change POOL_NEXT_SIZE define value and make it global x86/kaslr: Reduce KASLR entropy on most x86 systems crypto: ahash - Set default reqsize from ahash_alg crypto: skcipher - Zap type in crypto_alloc_sync_skcipher net: ipv6: Init tunnel link-netns before registering dev drm/xe/oa: Ensure that polled read returns latest data MIPS: Use arch specific syscall name match function drm/amdgpu: remove all KFD fences from the BO on release x86/locking: Use ALT_OUTPUT_SP() for percpu_{,try_}cmpxchg{64,128}_op() genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie MIPS: pm-cps: Use per-CPU variables as per-CPU, not per-core clocksource: mips-gic-timer: Enable counter when CPUs start PCI: epf-mhi: Update device ID for SA8775P scsi: mpt3sas: Send a diag reset if target reset fails wifi: rtw88: Fix rtw_init_vht_cap() for RTL8814AU wifi: rtw88: Fix rtw_init_ht_cap() for RTL8814AU wifi: rtw88: Fix rtw_desc_to_mcsrate() to handle MCS16-31 wifi: rtw89: fw: propagate error code from rtw89_h2c_tx() wifi: rtw89: fw: get sb_sel_ver via get_unaligned_le32() wifi: rtw89: fw: add blacklist to avoid obsolete secure firmware wifi: rtw89: 8922a: fix incorrect STA-ID in EHT MU PPDU net: pktgen: fix access outside of user given buffer in pktgen_thread_write() power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree EDAC/ie31200: work around false positive build warning i3c: master: svc: Flush FIFO before sending Dynamic Address Assignment(DAA) mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs eeprom: ee1004: Check chip before probing irqchip/riscv-imsic: Separate next and previous pointers in IMSIC vector drm/amd/pm: Fetch current power limit from PMFW drm/amd/display: Add support for disconnected eDP streams drm/amd/display: Guard against setting dispclk low when active drm/amd/display: Fix BT2020 YCbCr limited/full range input drm/amd/display: Read LTTPR ALPM caps during link cap retrieval Revert "drm/amd/display: Request HW cursor on DCN3.2 with SubVP" drm/amd/display: Don't treat wb connector as physical in create_validate_stream_for_sink serial: mctrl_gpio: split disable_ms into sync and no_sync APIs RDMA/core: Fix best page size finding when it can cross SG entries pmdomain: imx: gpcv2: use proper helper for property detection can: c_can: Use of_property_present() to test existence of DT property bpf: don't do clean_live_states when state->loop_entry->branches > 0 bpf: copy_verifier_state() should copy 'loop_entry' field eth: mlx4: don't try to complete XDP frames in netpoll PCI: Fix old_size lower bound in calculate_iosize() too ACPI: HED: Always initialize before evged vxlan: Join / leave MC group after remote changes hrtimers: Replace hrtimer_clock_to_base_table with switch-case irqchip/riscv-imsic: Set irq_set_affinity() for IMSIC base media: test-drivers: vivid: don't call schedule in loop net/mlx5: Modify LSB bitmask in temperature event to include only the first bit net/mlx5: Apply rate-limiting to high temperature warning firmware: arm_ffa: Reject higher major version as incompatible firmware: arm_ffa: Handle the presence of host partition in the partition info firmware: xilinx: Dont send linux address to get fpga config get status ASoC: ops: Enforce platform maximum on initial value ASoC: tas2764: Add reg defaults for TAS2764_INT_CLK_CFG ASoC: tas2764: Mark SW_RESET as volatile ASoC: tas2764: Power up/down amp on mute ops ASoC: soc-dai: check return value at snd_soc_dai_set_tdm_slot() pinctrl: devicetree: do not goto err when probing hogs in pinctrl_dt_to_map smack: recognize ipv4 CIPSO w/o categories smack: Revert "smackfs: Added check catlen" kunit: tool: Use qboot on QEMU x86_64 media: i2c: imx219: Correct the minimum vblanking value media: v4l: Memset argument to 0 before calling get_mbus_config pad op net/mlx4_core: Avoid impossible mlx4_db_alloc() order value drm/xe: Stop ignoring errors from xe_ttm_stolen_mgr_init() drm/xe: Fix xe_tile_init_noalloc() error propagation clk: qcom: ipq5018: allow it to be bulid on arm32 clk: qcom: clk-alpha-pll: Do not use random stack value for recalc rate drm/xe/debugfs: fixed the return value of wedged_mode_set drm/xe/debugfs: Add missing xe_pm_runtime_put in wedge_mode_set x86/ibt: Handle FineIBT in handle_cfi_failure() x86/traps: Cleanup and robustify decode_bug() sched: Reduce the default slice to avoid tasks getting an extra tick serial: sh-sci: Update the suspend/resume support pinctrl: renesas: rzg2l: Add suspend/resume support for pull up/down phy: phy-rockchip-samsung-hdptx: Swap the definitions of LCPLL_REF and ROPLL_REF phy: core: don't require set_mode() callback for phy_get_mode() to work phy: exynos5-usbdrd: fix EDS distribution tuning (gs101) soundwire: amd: change the soundwire wake enable/disable sequence soundwire: cadence_master: set frame shape and divider based on actual clk freq net: stmmac: dwmac-loongson: Set correct {tx,rx}_fifo_size drm/amdgpu/mes11: fix set_hw_resources_1 calculation drm/amdkfd: fix missing L2 cache info in topology drm/amdgpu: Set snoop bit for SDMA for MI series drm/amd/display: pass calculated dram_speed_mts to dml2 drm/amd/display: Don't try AUX transactions on disconnected link drm/amdgpu: reset psp->cmd to NULL after releasing the buffer drm/amd/pm: Skip P2S load for SMU v13.0.12 drm/amd/display: Support multiple options during psr entry. Revert "drm/amd/display: Exit idle optimizations before attempt to access PHY" drm/amd/display: Update CR AUX RD interval interpretation drm/amd/display: Initial psr_version with correct setting drm/amd/display: Increase block_sequence array size drm/amd/display: Use Nominal vBlank If Provided Instead Of Capping It drm/amd/display: Populate register address for dentist for dcn401 drm/amdgpu: Use active umc info from discovery drm/amdgpu: enlarge the VBIOS binary size limit drm/amd/display/dm: drop hw_support check in amdgpu_dm_i2c_xfer() scsi: target: spc: Fix loop traversal in spc_rsoc_get_descr() net/mlx5: XDP, Enable TX side XDP multi-buffer support net/mlx5: Extend Ethtool loopback selftest to support non-linear SKB net/mlx5e: set the tx_queue_len for pfifo_fast net/mlx5e: reduce rep rxq depth to 256 for ECPF net/mlx5e: reduce the max log mpwrq sz for ECPF and reps drm/v3d: Add clock handling xfrm: prevent high SEQ input in non-ESN mode wifi: ath12k: fix the ampdu id fetch in the HAL_RX_MPDU_START TLV mptcp: pm: userspace: flags: clearer msg if no remote addr wifi: iwlwifi: use correct IMR dump variable wifi: iwlwifi: don't warn during reprobe wifi: mac80211: don't unconditionally call drv_mgd_complete_tx() wifi: mac80211: remove misplaced drv_mgd_complete_tx() call wifi: mac80211: set ieee80211_prep_tx_info::link_id upon Auth Rx net: fec: Refactor MAC reset to function powerpc/pseries/iommu: memory notifier incorrectly adds TCEs for pmemory powerpc/pseries/iommu: create DDW for devices with DMA mask less than 64-bits arch/powerpc/perf: Check the instruction type before creating sample with perf_mem_data_src ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). r8152: add vendor/device ID pair for Dell Alienware AW1022z iio: adc: ad7944: don't use storagebits for sizing pstore: Change kmsg_bytes storage size to u32 leds: trigger: netdev: Configure LED blink interval for HW offload ext4: don't write back data before punch hole in nojournal mode ext4: remove writable userspace mappings before truncating page cache wifi: rtw88: Fix download_firmware_validate() for RTL8814AU wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang wifi: rtw89: fw: validate multi-firmware header before getting its size wifi: rtw89: fw: validate multi-firmware header before accessing wifi: rtw89: call power_on ahead before selecting firmware clk: qcom: camcc-sm8250: Use clk_rcg2_shared_ops for some RCGs net: page_pool: avoid false positive warning if NAPI was never added tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options hwmon: (xgene-hwmon) use appropriate type for the latency value f2fs: introduce f2fs_base_attr for global sysfs entries media: qcom: camss: csid: Only add TPG v4l2 ctrl if TPG hardware is available media: qcom: camss: Add default case in vfe_src_pad_code drm/rockchip: vop2: Improve display modes handling on RK3588 HDMI0 eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs tools: ynl-gen: don't output external constants net/mlx5e: Avoid WARN_ON when configuring MQPRIO with HTB offload enabled cpufreq: amd-pstate: Remove unnecessary driver_lock in set_boost vxlan: Annotate FDB data races ipv4: ip_gre: Fix set but not used warning in ipgre_err() if IPv4-only r8169: don't scan PHY addresses > 0 net: flush_backlog() small changes bridge: mdb: Allow replace of a host-joined group ice: init flow director before RDMA ice: treat dyn_allowed only as suggestion rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y rcu: handle unstable rdp in rcu_read_unlock_strict() rcu: fix header guard for rcu_all_qs() perf: Avoid the read if the count is already updated ice: count combined queues using Rx/Tx count drm/xe/relay: Don't use GFP_KERNEL for new transactions net/mana: fix warning in the writer of client oob scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine scsi: lpfc: Ignore ndlp rport mismatch in dev_loss_tmo callbk scsi: lpfc: Free phba irq in lpfc_sli4_enable_msi() when pci_irq_vector() fails scsi: st: Restore some drive settings after reset wifi: ath12k: Avoid napi_sync() before napi_enable() HID: usbkbd: Fix the bit shift number for LED_KANA arm64: zynqmp: add clock-output-names property in clock nodes ASoC: codecs: pcm3168a: Allow for 24-bit in provider mode ASoC: rt722-sdca: Add some missing readable registers irqchip/riscv-aplic: Add support for hart indexes dm vdo indexer: prevent unterminated string warning dm vdo: use a short static string for thread name prefix drm/ast: Find VBIOS mode from regular display size bpf: Use kallsyms to find the function name of a struct_ops's stub function bpftool: Fix readlink usage in get_fd_type firmware: arm_scmi: Relax duplicate name constraint across protocol ids perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt perf/amd/ibs: Fix ->config to sample period calculation for OP PMU clk: renesas: rzg2l-cpg: Refactor Runtime PM clock validation wifi: rtl8xxxu: retry firmware download on error wifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate wifi: rtw89: add wiphy_lock() to work that isn't held wiphy_lock() yet spi: zynqmp-gqspi: Always acknowledge interrupts regulator: ad5398: Add device tree support wifi: ath12k: fix ath12k_hal_tx_cmd_ext_desc_setup() info1 override accel/qaic: Mask out SR-IOV PCI resources drm/xe/pf: Reset GuC VF config when unprovisioning critical resource wifi: ath9k: return by of_get_mac_address wifi: ath12k: Fetch regdb.bin file from board-2.bin wifi: ath12k: Fix end offset bit definition in monitor ring descriptor drm: bridge: adv7511: fill stream capabilities drm/nouveau: fix the broken marco GSP_MSG_MAX_SIZE wifi: ath11k: Use dma_alloc_noncoherent for rx_tid buffer allocation drm/xe: Move suballocator init to after display init drm/xe: Do not attempt to bootstrap VF in execlists mode wifi: rtw89: coex: Separated Wi-Fi connecting event from Wi-Fi scan event drm/xe/sa: Always call drm_suballoc_manager_fini() drm/xe: Reject BO eviction if BO is bound to current VM drm/atomic: clarify the rules around drm_atomic_state->allow_modeset drm/buddy: fix issue that force_merge cannot free all roots drm/panel-edp: Add Starry 116KHD024006 drm: Add valid clones check ASoC: imx-card: Adjust over allocation of memory in imx_card_parse_of() book3s64/radix: Fix compile errors when CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=n pinctrl: meson: define the pull up/down resistor value as 60 kOhm smb: server: smb2pdu: check return value of xa_store() platform/x86/intel: hid: Add Pantherlake support platform/x86: asus-wmi: Disable OOBE state after resume from hibernation platform/x86: ideapad-laptop: add support for some new buttons ASoC: cs42l43: Disable headphone clamps during type detection ASoC: Intel: bytcr_rt5640: Add DMI quirk for Acer Aspire SW3-013 ALSA: hda/realtek: Add quirk for HP Spectre x360 15-df1xxx nvme-pci: add quirks for device 126f:1001 nvme-pci: add quirks for WDC Blue SN550 15b7:5009 ALSA: usb-audio: Fix duplicated name in MIDI substream names nvmet-tcp: don't restore null sk_state_change io_uring/fdinfo: annotate racy sq/cq head/tail reads cifs: Fix and improve cifs_query_path_info() and cifs_query_file_info() cifs: Fix changing times and read-only attr over SMB1 smb_set_file_info() function ASoC: intel/sdw_utils: Add volume limit to cs42l43 speakers btrfs: compression: adjust cb->compressed_folios allocation type btrfs: correct the order of prelim_ref arguments in btrfs__prelim_ref btrfs: handle empty eb->folios in num_extent_folios() btrfs: avoid NULL pointer dereference if no valid csum tree tools: ynl-gen: validate 0 len strings from kernel block: only update request sector if needed wifi: iwlwifi: add support for Killer on MTL x86/Kconfig: make CFI_AUTO_DEFAULT depend on !RUST or Rust >= 1.88 xenbus: Allow PVH dom0 a non-local xenstore drm/amd/display: Call FP Protect Before Mode Programming/Mode Support __legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock soundwire: bus: Fix race on the creation of the IRQ domain espintcp: fix skb leaks espintcp: remove encap socket caching to avoid reference leak xfrm: Fix UDP GRO handling for some corner cases dmaengine: idxd: Fix allowing write() from different address spaces x86/sev: Fix operator precedence in GHCB_MSR_VMPL_REQ_LEVEL macro kernel/fork: only call untrack_pfn_clear() on VMAs duplicated for fork() remoteproc: qcom_wcnss: Fix on platforms without fallback regulators clk: sunxi-ng: d1: Add missing divider for MMC mod clocks xfrm: Sanitize marks before insert dmaengine: idxd: Fix ->poll() return value dmaengine: fsl-edma: Fix return code for unhandled interrupts driver core: Split devres APIs to device/devres.h devres: Introduce devm_kmemdup_array() ASoC: SOF: Intel: hda: Fix UAF when reloading module irqchip/riscv-imsic: Start local sync timer on correct CPU perf/x86/intel: Fix segfault with PEBS-via-PT with sample_freq Bluetooth: L2CAP: Fix not checking l2cap_chan security level Bluetooth: btusb: use skb_pull to avoid unsafe access in QCA dump handling ptp: ocp: Limit signal/freq counts in summary output functions bridge: netfilter: Fix forwarding of fragmented packets ice: fix vf->num_mac count with port representors ice: Fix LACP bonds without SRIOV environment idpf: fix null-ptr-deref in idpf_features_check loop: don't require ->write_iter for writable files in loop_configure pinctrl: qcom: switch to devm_register_sys_off_handler() net: dwmac-sun8i: Use parsed internal PHY address instead of 1 net: lan743x: Restore SGMII CTRL register on resume io_uring: fix overflow resched cqe reordering idpf: fix idpf_vport_splitq_napi_poll() sch_hfsc: Fix qlen accounting bug when using peek in hfsc_enqueue() octeontx2-pf: Add AF_XDP non-zero copy support net/tipc: fix slab-use-after-free Read in tipc_aead_encrypt_done octeontx2-af: Set LMT_ENA bit for APR table entries octeontx2-af: Fix APR entry mapping based on APR_LMT_CFG clk: s2mps11: initialise clk_hw_onecell_data::num before accessing ::hws[] in probe() crypto: algif_hash - fix double free in hash_accept padata: do not leak refcount in reorder_work can: slcan: allow reception of short error messages can: bcm: add locking for bcm_op runtime updates can: bcm: add missing rcu read protection for procfs content ASoC: SOF: ipc4-control: Use SOF_CTRL_CMD_BINARY as numid for bytes_ext ASoC: SOF: Intel: hda-bus: Use PIO mode on ACE2+ platforms ASoc: SOF: topology: connect DAI to a single DAI link ASoC: SOF: ipc4-pcm: Delay reporting is only supported for playback direction ALSA: pcm: Fix race of buffer access at PCM OSS layer ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14ASP10 llc: fix data loss when reading from a socket in llc_ui_recvmsg() can: kvaser_pciefd: Continue parsing DMA buf after dropped RX can: kvaser_pciefd: Fix echo_skb race net: dsa: microchip: linearize skb for tail-tagging switches vmxnet3: update MTU after device quiesce pmdomain: renesas: rcar: Remove obsolete nullify checks pmdomain: core: Fix error checking in genpd_dev_pm_attach_by_id() platform/x86: dell-wmi-sysman: Avoid buffer overflow in current_password_store() thermal: intel: x86_pkg_temp_thermal: Fix bogus trip temperature drm/edid: fixed the bug that hdr metadata was not reset smb: client: Fix use-after-free in cifs_fill_dirent arm64: dts: marvell: uDPU: define pinctrl state for alarm LEDs smb: client: Reset all search buffer pointers when releasing buffer Revert "drm/amd: Keep display off while going into S4" Input: xpad - add more controllers highmem: add folio_test_partial_kmap() memcg: always call cond_resched() after fn() mm/page_alloc.c: avoid infinite retries caused by cpuset race mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled mm: vmalloc: actually use the in-place vrealloc region mm: vmalloc: only zero-init on vrealloc shrink nilfs2: fix deadlock warnings caused by lock dependency in init_nilfs() Bluetooth: btmtksdio: Check function enabled before doing close Bluetooth: btmtksdio: Do close if SDIO card removed without close Revert "arm64: dts: allwinner: h6: Use RSB for AXP805 PMIC connection" ksmbd: fix stream write failure platform/x86: think-lmi: Fix attribute name usage for non-compliant items spi: use container_of_cont() for to_spi_device() spi: spi-fsl-dspi: restrict register range for regmap access spi: spi-fsl-dspi: Halt the module after a new message transfer spi: spi-fsl-dspi: Reset SR flags before sending a new message err.h: move IOMEM_ERR_PTR() to err.h gcc-15: make 'unterminated string initialization' just a warning gcc-15: disable '-Wunterminated-string-initialization' entirely for now Fix mis-uses of 'cc-option' for warning disablement kbuild: Properly disable -Wunterminated-string-initialization for clang drm/amd/display: Exit idle optimizations before accessing PHY bpf: abort verification if env->cur_state->loop_entry != NULL serial: sh-sci: Save and restore more registers drm/amdkfd: Correct F8_MODE for gfx950 watchdog: aspeed: fix 64-bit division pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group() i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work() x86/mm/init: Handle the special case of device private pages in add_pages(), to not increase max_pfn and trigger dma_addressing_limited() bounce buffers bounce buffers drm/gem: Internally test import_attach for imported objects Linux 6.12.31 Change-Id: I017795966fb764f9320a6a0df1571d19e5e631fe Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
1545 lines
36 KiB
C
1545 lines
36 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) 2019 MediaTek Inc.
|
|
|
|
/*
|
|
* Bluetooth support for MediaTek SDIO devices
|
|
*
|
|
* This file is written based on btsdio.c and btmtkuart.c.
|
|
*
|
|
* Author: Sean Wang <sean.wang@mediatek.com>
|
|
*
|
|
*/
|
|
|
|
#include <linux/unaligned.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/gpio/consumer.h>
|
|
#include <linux/init.h>
|
|
#include <linux/iopoll.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of.h>
|
|
#include <linux/pm_runtime.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/usb.h>
|
|
|
|
#include <linux/mmc/host.h>
|
|
#include <linux/mmc/sdio_ids.h>
|
|
#include <linux/mmc/sdio_func.h>
|
|
|
|
#include <net/bluetooth/bluetooth.h>
|
|
#include <net/bluetooth/hci_core.h>
|
|
|
|
#include "h4_recv.h"
|
|
#include "btmtk.h"
|
|
|
|
#define VERSION "0.1"
|
|
|
|
#define MTKBTSDIO_AUTOSUSPEND_DELAY 1000
|
|
|
|
static bool enable_autosuspend = true;
|
|
|
|
struct btmtksdio_data {
|
|
const char *fwname;
|
|
u16 chipid;
|
|
bool lp_mbox_supported;
|
|
};
|
|
|
|
static const struct btmtksdio_data mt7663_data = {
|
|
.fwname = FIRMWARE_MT7663,
|
|
.chipid = 0x7663,
|
|
.lp_mbox_supported = false,
|
|
};
|
|
|
|
static const struct btmtksdio_data mt7668_data = {
|
|
.fwname = FIRMWARE_MT7668,
|
|
.chipid = 0x7668,
|
|
.lp_mbox_supported = false,
|
|
};
|
|
|
|
static const struct btmtksdio_data mt7921_data = {
|
|
.fwname = FIRMWARE_MT7961,
|
|
.chipid = 0x7921,
|
|
.lp_mbox_supported = true,
|
|
};
|
|
|
|
static const struct sdio_device_id btmtksdio_table[] = {
|
|
{SDIO_DEVICE(SDIO_VENDOR_ID_MEDIATEK, SDIO_DEVICE_ID_MEDIATEK_MT7663),
|
|
.driver_data = (kernel_ulong_t)&mt7663_data },
|
|
{SDIO_DEVICE(SDIO_VENDOR_ID_MEDIATEK, SDIO_DEVICE_ID_MEDIATEK_MT7668),
|
|
.driver_data = (kernel_ulong_t)&mt7668_data },
|
|
{SDIO_DEVICE(SDIO_VENDOR_ID_MEDIATEK, SDIO_DEVICE_ID_MEDIATEK_MT7961),
|
|
.driver_data = (kernel_ulong_t)&mt7921_data },
|
|
{ } /* Terminating entry */
|
|
};
|
|
MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
|
|
|
|
#define MTK_REG_CHLPCR 0x4 /* W1S */
|
|
#define C_INT_EN_SET BIT(0)
|
|
#define C_INT_EN_CLR BIT(1)
|
|
#define C_FW_OWN_REQ_SET BIT(8) /* For write */
|
|
#define C_COM_DRV_OWN BIT(8) /* For read */
|
|
#define C_FW_OWN_REQ_CLR BIT(9)
|
|
|
|
#define MTK_REG_CSDIOCSR 0x8
|
|
#define SDIO_RE_INIT_EN BIT(0)
|
|
#define SDIO_INT_CTL BIT(2)
|
|
|
|
#define MTK_REG_CHCR 0xc
|
|
#define C_INT_CLR_CTRL BIT(1)
|
|
#define BT_RST_DONE BIT(8)
|
|
|
|
/* CHISR have the same bits field definition with CHIER */
|
|
#define MTK_REG_CHISR 0x10
|
|
#define MTK_REG_CHIER 0x14
|
|
#define FW_OWN_BACK_INT BIT(0)
|
|
#define RX_DONE_INT BIT(1)
|
|
#define TX_EMPTY BIT(2)
|
|
#define TX_FIFO_OVERFLOW BIT(8)
|
|
#define FW_MAILBOX_INT BIT(15)
|
|
#define INT_MASK GENMASK(15, 0)
|
|
#define RX_PKT_LEN GENMASK(31, 16)
|
|
|
|
#define MTK_REG_CSICR 0xc0
|
|
#define CSICR_CLR_MBOX_ACK BIT(0)
|
|
#define MTK_REG_PH2DSM0R 0xc4
|
|
#define PH2DSM0R_DRIVER_OWN BIT(0)
|
|
#define MTK_REG_PD2HRM0R 0xdc
|
|
#define PD2HRM0R_DRV_OWN BIT(0)
|
|
|
|
#define MTK_REG_CTDR 0x18
|
|
|
|
#define MTK_REG_CRDR 0x1c
|
|
|
|
#define MTK_REG_CRPLR 0x24
|
|
|
|
#define MTK_SDIO_BLOCK_SIZE 256
|
|
|
|
#define BTMTKSDIO_TX_WAIT_VND_EVT 1
|
|
#define BTMTKSDIO_HW_TX_READY 2
|
|
#define BTMTKSDIO_FUNC_ENABLED 3
|
|
#define BTMTKSDIO_PATCH_ENABLED 4
|
|
#define BTMTKSDIO_HW_RESET_ACTIVE 5
|
|
#define BTMTKSDIO_BT_WAKE_ENABLED 6
|
|
|
|
struct mtkbtsdio_hdr {
|
|
__le16 len;
|
|
__le16 reserved;
|
|
u8 bt_type;
|
|
} __packed;
|
|
|
|
struct btmtksdio_dev {
|
|
struct hci_dev *hdev;
|
|
struct sdio_func *func;
|
|
struct device *dev;
|
|
|
|
struct work_struct txrx_work;
|
|
unsigned long tx_state;
|
|
struct sk_buff_head txq;
|
|
|
|
struct sk_buff *evt_skb;
|
|
|
|
const struct btmtksdio_data *data;
|
|
|
|
struct gpio_desc *reset;
|
|
};
|
|
|
|
static int mtk_hci_wmt_sync(struct hci_dev *hdev,
|
|
struct btmtk_hci_wmt_params *wmt_params)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
struct btmtk_hci_wmt_evt_funcc *wmt_evt_funcc;
|
|
struct btmtk_hci_wmt_evt_reg *wmt_evt_reg;
|
|
u32 hlen, status = BTMTK_WMT_INVALID;
|
|
struct btmtk_hci_wmt_evt *wmt_evt;
|
|
struct btmtk_hci_wmt_cmd *wc;
|
|
struct btmtk_wmt_hdr *hdr;
|
|
int err;
|
|
|
|
/* Send the WMT command and wait until the WMT event returns */
|
|
hlen = sizeof(*hdr) + wmt_params->dlen;
|
|
if (hlen > 255)
|
|
return -EINVAL;
|
|
|
|
wc = kzalloc(hlen, GFP_KERNEL);
|
|
if (!wc)
|
|
return -ENOMEM;
|
|
|
|
hdr = &wc->hdr;
|
|
hdr->dir = 1;
|
|
hdr->op = wmt_params->op;
|
|
hdr->dlen = cpu_to_le16(wmt_params->dlen + 1);
|
|
hdr->flag = wmt_params->flag;
|
|
memcpy(wc->data, wmt_params->data, wmt_params->dlen);
|
|
|
|
set_bit(BTMTKSDIO_TX_WAIT_VND_EVT, &bdev->tx_state);
|
|
|
|
err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc);
|
|
if (err < 0) {
|
|
clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT, &bdev->tx_state);
|
|
goto err_free_wc;
|
|
}
|
|
|
|
/* The vendor specific WMT commands are all answered by a vendor
|
|
* specific event and will not have the Command Status or Command
|
|
* Complete as with usual HCI command flow control.
|
|
*
|
|
* After sending the command, wait for BTMTKSDIO_TX_WAIT_VND_EVT
|
|
* state to be cleared. The driver specific event receive routine
|
|
* will clear that state and with that indicate completion of the
|
|
* WMT command.
|
|
*/
|
|
err = wait_on_bit_timeout(&bdev->tx_state, BTMTKSDIO_TX_WAIT_VND_EVT,
|
|
TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT);
|
|
if (err == -EINTR) {
|
|
bt_dev_err(hdev, "Execution of wmt command interrupted");
|
|
clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT, &bdev->tx_state);
|
|
goto err_free_wc;
|
|
}
|
|
|
|
if (err) {
|
|
bt_dev_err(hdev, "Execution of wmt command timed out");
|
|
clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT, &bdev->tx_state);
|
|
err = -ETIMEDOUT;
|
|
goto err_free_wc;
|
|
}
|
|
|
|
/* Parse and handle the return WMT event */
|
|
wmt_evt = (struct btmtk_hci_wmt_evt *)bdev->evt_skb->data;
|
|
if (wmt_evt->whdr.op != hdr->op) {
|
|
bt_dev_err(hdev, "Wrong op received %d expected %d",
|
|
wmt_evt->whdr.op, hdr->op);
|
|
err = -EIO;
|
|
goto err_free_skb;
|
|
}
|
|
|
|
switch (wmt_evt->whdr.op) {
|
|
case BTMTK_WMT_SEMAPHORE:
|
|
if (wmt_evt->whdr.flag == 2)
|
|
status = BTMTK_WMT_PATCH_UNDONE;
|
|
else
|
|
status = BTMTK_WMT_PATCH_DONE;
|
|
break;
|
|
case BTMTK_WMT_FUNC_CTRL:
|
|
wmt_evt_funcc = (struct btmtk_hci_wmt_evt_funcc *)wmt_evt;
|
|
if (be16_to_cpu(wmt_evt_funcc->status) == 0x404)
|
|
status = BTMTK_WMT_ON_DONE;
|
|
else if (be16_to_cpu(wmt_evt_funcc->status) == 0x420)
|
|
status = BTMTK_WMT_ON_PROGRESS;
|
|
else
|
|
status = BTMTK_WMT_ON_UNDONE;
|
|
break;
|
|
case BTMTK_WMT_PATCH_DWNLD:
|
|
if (wmt_evt->whdr.flag == 2)
|
|
status = BTMTK_WMT_PATCH_DONE;
|
|
else if (wmt_evt->whdr.flag == 1)
|
|
status = BTMTK_WMT_PATCH_PROGRESS;
|
|
else
|
|
status = BTMTK_WMT_PATCH_UNDONE;
|
|
break;
|
|
case BTMTK_WMT_REGISTER:
|
|
wmt_evt_reg = (struct btmtk_hci_wmt_evt_reg *)wmt_evt;
|
|
if (le16_to_cpu(wmt_evt->whdr.dlen) == 12)
|
|
status = le32_to_cpu(wmt_evt_reg->val);
|
|
break;
|
|
}
|
|
|
|
if (wmt_params->status)
|
|
*wmt_params->status = status;
|
|
|
|
err_free_skb:
|
|
kfree_skb(bdev->evt_skb);
|
|
bdev->evt_skb = NULL;
|
|
err_free_wc:
|
|
kfree(wc);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev,
|
|
struct sk_buff *skb)
|
|
{
|
|
struct mtkbtsdio_hdr *sdio_hdr;
|
|
int err;
|
|
|
|
/* Make sure that there are enough rooms for SDIO header */
|
|
if (unlikely(skb_headroom(skb) < sizeof(*sdio_hdr))) {
|
|
err = pskb_expand_head(skb, sizeof(*sdio_hdr), 0,
|
|
GFP_ATOMIC);
|
|
if (err < 0)
|
|
return err;
|
|
}
|
|
|
|
/* Prepend MediaTek SDIO Specific Header */
|
|
skb_push(skb, sizeof(*sdio_hdr));
|
|
|
|
sdio_hdr = (void *)skb->data;
|
|
sdio_hdr->len = cpu_to_le16(skb->len);
|
|
sdio_hdr->reserved = cpu_to_le16(0);
|
|
sdio_hdr->bt_type = hci_skb_pkt_type(skb);
|
|
|
|
clear_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
|
|
err = sdio_writesb(bdev->func, MTK_REG_CTDR, skb->data,
|
|
round_up(skb->len, MTK_SDIO_BLOCK_SIZE));
|
|
if (err < 0)
|
|
goto err_skb_pull;
|
|
|
|
bdev->hdev->stat.byte_tx += skb->len;
|
|
|
|
kfree_skb(skb);
|
|
|
|
return 0;
|
|
|
|
err_skb_pull:
|
|
skb_pull(skb, sizeof(*sdio_hdr));
|
|
|
|
return err;
|
|
}
|
|
|
|
static u32 btmtksdio_drv_own_query(struct btmtksdio_dev *bdev)
|
|
{
|
|
return sdio_readl(bdev->func, MTK_REG_CHLPCR, NULL);
|
|
}
|
|
|
|
static u32 btmtksdio_drv_own_query_79xx(struct btmtksdio_dev *bdev)
|
|
{
|
|
return sdio_readl(bdev->func, MTK_REG_PD2HRM0R, NULL);
|
|
}
|
|
|
|
static u32 btmtksdio_chcr_query(struct btmtksdio_dev *bdev)
|
|
{
|
|
return sdio_readl(bdev->func, MTK_REG_CHCR, NULL);
|
|
}
|
|
|
|
static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev)
|
|
{
|
|
u32 status;
|
|
int err;
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
if (bdev->data->lp_mbox_supported &&
|
|
test_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state)) {
|
|
sdio_writel(bdev->func, CSICR_CLR_MBOX_ACK, MTK_REG_CSICR,
|
|
&err);
|
|
err = readx_poll_timeout(btmtksdio_drv_own_query_79xx, bdev,
|
|
status, !(status & PD2HRM0R_DRV_OWN),
|
|
2000, 1000000);
|
|
if (err < 0) {
|
|
bt_dev_err(bdev->hdev, "mailbox ACK not cleared");
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
/* Return ownership to the device */
|
|
sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err);
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
err = readx_poll_timeout(btmtksdio_drv_own_query, bdev, status,
|
|
!(status & C_COM_DRV_OWN), 2000, 1000000);
|
|
|
|
out:
|
|
sdio_release_host(bdev->func);
|
|
|
|
if (err < 0)
|
|
bt_dev_err(bdev->hdev, "Cannot return ownership to device");
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_drv_pmctrl(struct btmtksdio_dev *bdev)
|
|
{
|
|
u32 status;
|
|
int err;
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
/* Get ownership from the device */
|
|
sdio_writel(bdev->func, C_FW_OWN_REQ_CLR, MTK_REG_CHLPCR, &err);
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
err = readx_poll_timeout(btmtksdio_drv_own_query, bdev, status,
|
|
status & C_COM_DRV_OWN, 2000, 1000000);
|
|
|
|
if (!err && bdev->data->lp_mbox_supported &&
|
|
test_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state))
|
|
err = readx_poll_timeout(btmtksdio_drv_own_query_79xx, bdev,
|
|
status, status & PD2HRM0R_DRV_OWN,
|
|
2000, 1000000);
|
|
|
|
out:
|
|
sdio_release_host(bdev->func);
|
|
|
|
if (err < 0)
|
|
bt_dev_err(bdev->hdev, "Cannot get ownership from device");
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
struct hci_event_hdr *hdr = (void *)skb->data;
|
|
u8 evt = hdr->evt;
|
|
int err;
|
|
|
|
/* When someone waits for the WMT event, the skb is being cloned
|
|
* and being processed the events from there then.
|
|
*/
|
|
if (test_bit(BTMTKSDIO_TX_WAIT_VND_EVT, &bdev->tx_state)) {
|
|
bdev->evt_skb = skb_clone(skb, GFP_KERNEL);
|
|
if (!bdev->evt_skb) {
|
|
err = -ENOMEM;
|
|
goto err_out;
|
|
}
|
|
}
|
|
|
|
err = hci_recv_frame(hdev, skb);
|
|
if (err < 0)
|
|
goto err_free_skb;
|
|
|
|
if (evt == HCI_EV_WMT) {
|
|
if (test_and_clear_bit(BTMTKSDIO_TX_WAIT_VND_EVT,
|
|
&bdev->tx_state)) {
|
|
/* Barrier to sync with other CPUs */
|
|
smp_mb__after_atomic();
|
|
wake_up_bit(&bdev->tx_state, BTMTKSDIO_TX_WAIT_VND_EVT);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
|
|
err_free_skb:
|
|
kfree_skb(bdev->evt_skb);
|
|
bdev->evt_skb = NULL;
|
|
|
|
err_out:
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_recv_acl(struct hci_dev *hdev, struct sk_buff *skb)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
u16 handle = le16_to_cpu(hci_acl_hdr(skb)->handle);
|
|
|
|
switch (handle) {
|
|
case 0xfc6f:
|
|
/* Firmware dump from device: when the firmware hangs, the
|
|
* device can no longer suspend and thus disable auto-suspend.
|
|
*/
|
|
pm_runtime_forbid(bdev->dev);
|
|
fallthrough;
|
|
case 0x05ff:
|
|
case 0x05fe:
|
|
/* Firmware debug logging */
|
|
return hci_recv_diag(hdev, skb);
|
|
}
|
|
|
|
return hci_recv_frame(hdev, skb);
|
|
}
|
|
|
|
static const struct h4_recv_pkt mtk_recv_pkts[] = {
|
|
{ H4_RECV_ACL, .recv = btmtksdio_recv_acl },
|
|
{ H4_RECV_SCO, .recv = hci_recv_frame },
|
|
{ H4_RECV_EVENT, .recv = btmtksdio_recv_event },
|
|
};
|
|
|
|
static int btmtksdio_rx_packet(struct btmtksdio_dev *bdev, u16 rx_size)
|
|
{
|
|
const struct h4_recv_pkt *pkts = mtk_recv_pkts;
|
|
int pkts_count = ARRAY_SIZE(mtk_recv_pkts);
|
|
struct mtkbtsdio_hdr *sdio_hdr;
|
|
int err, i, pad_size;
|
|
struct sk_buff *skb;
|
|
u16 dlen;
|
|
|
|
if (rx_size < sizeof(*sdio_hdr))
|
|
return -EILSEQ;
|
|
|
|
/* A SDIO packet is exactly containing a Bluetooth packet */
|
|
skb = bt_skb_alloc(rx_size, GFP_KERNEL);
|
|
if (!skb)
|
|
return -ENOMEM;
|
|
|
|
skb_put(skb, rx_size);
|
|
|
|
err = sdio_readsb(bdev->func, skb->data, MTK_REG_CRDR, rx_size);
|
|
if (err < 0)
|
|
goto err_kfree_skb;
|
|
|
|
sdio_hdr = (void *)skb->data;
|
|
|
|
/* We assume the default error as -EILSEQ simply to make the error path
|
|
* be cleaner.
|
|
*/
|
|
err = -EILSEQ;
|
|
|
|
if (rx_size != le16_to_cpu(sdio_hdr->len)) {
|
|
bt_dev_err(bdev->hdev, "Rx size in sdio header is mismatched ");
|
|
goto err_kfree_skb;
|
|
}
|
|
|
|
hci_skb_pkt_type(skb) = sdio_hdr->bt_type;
|
|
|
|
/* Remove MediaTek SDIO header */
|
|
skb_pull(skb, sizeof(*sdio_hdr));
|
|
|
|
/* We have to dig into the packet to get payload size and then know how
|
|
* many padding bytes at the tail, these padding bytes should be removed
|
|
* before the packet is indicated to the core layer.
|
|
*/
|
|
for (i = 0; i < pkts_count; i++) {
|
|
if (sdio_hdr->bt_type == (&pkts[i])->type)
|
|
break;
|
|
}
|
|
|
|
if (i >= pkts_count) {
|
|
bt_dev_err(bdev->hdev, "Invalid bt type 0x%02x",
|
|
sdio_hdr->bt_type);
|
|
goto err_kfree_skb;
|
|
}
|
|
|
|
/* Remaining bytes cannot hold a header*/
|
|
if (skb->len < (&pkts[i])->hlen) {
|
|
bt_dev_err(bdev->hdev, "The size of bt header is mismatched");
|
|
goto err_kfree_skb;
|
|
}
|
|
|
|
switch ((&pkts[i])->lsize) {
|
|
case 1:
|
|
dlen = skb->data[(&pkts[i])->loff];
|
|
break;
|
|
case 2:
|
|
dlen = get_unaligned_le16(skb->data +
|
|
(&pkts[i])->loff);
|
|
break;
|
|
default:
|
|
goto err_kfree_skb;
|
|
}
|
|
|
|
pad_size = skb->len - (&pkts[i])->hlen - dlen;
|
|
|
|
/* Remaining bytes cannot hold a payload */
|
|
if (pad_size < 0) {
|
|
bt_dev_err(bdev->hdev, "The size of bt payload is mismatched");
|
|
goto err_kfree_skb;
|
|
}
|
|
|
|
/* Remove padding bytes */
|
|
skb_trim(skb, skb->len - pad_size);
|
|
|
|
/* Complete frame */
|
|
(&pkts[i])->recv(bdev->hdev, skb);
|
|
|
|
bdev->hdev->stat.byte_rx += rx_size;
|
|
|
|
return 0;
|
|
|
|
err_kfree_skb:
|
|
kfree_skb(skb);
|
|
|
|
return err;
|
|
}
|
|
|
|
static void btmtksdio_txrx_work(struct work_struct *work)
|
|
{
|
|
struct btmtksdio_dev *bdev = container_of(work, struct btmtksdio_dev,
|
|
txrx_work);
|
|
unsigned long txrx_timeout;
|
|
u32 int_status, rx_size;
|
|
struct sk_buff *skb;
|
|
int err;
|
|
|
|
pm_runtime_get_sync(bdev->dev);
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
/* Disable interrupt */
|
|
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
|
|
|
|
txrx_timeout = jiffies + 5 * HZ;
|
|
|
|
do {
|
|
int_status = sdio_readl(bdev->func, MTK_REG_CHISR, NULL);
|
|
|
|
/* Ack an interrupt as soon as possible before any operation on
|
|
* hardware.
|
|
*
|
|
* Note that we don't ack any status during operations to avoid race
|
|
* condition between the host and the device such as it's possible to
|
|
* mistakenly ack RX_DONE for the next packet and then cause interrupts
|
|
* not be raised again but there is still pending data in the hardware
|
|
* FIFO.
|
|
*/
|
|
sdio_writel(bdev->func, int_status, MTK_REG_CHISR, NULL);
|
|
int_status &= INT_MASK;
|
|
|
|
if ((int_status & FW_MAILBOX_INT) &&
|
|
bdev->data->chipid == 0x7921) {
|
|
sdio_writel(bdev->func, PH2DSM0R_DRIVER_OWN,
|
|
MTK_REG_PH2DSM0R, NULL);
|
|
}
|
|
|
|
if (int_status & FW_OWN_BACK_INT)
|
|
bt_dev_dbg(bdev->hdev, "Get fw own back");
|
|
|
|
if (int_status & TX_EMPTY)
|
|
set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
|
|
|
|
else if (unlikely(int_status & TX_FIFO_OVERFLOW))
|
|
bt_dev_warn(bdev->hdev, "Tx fifo overflow");
|
|
|
|
if (test_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state)) {
|
|
skb = skb_dequeue(&bdev->txq);
|
|
if (skb) {
|
|
err = btmtksdio_tx_packet(bdev, skb);
|
|
if (err < 0) {
|
|
bdev->hdev->stat.err_tx++;
|
|
skb_queue_head(&bdev->txq, skb);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (int_status & RX_DONE_INT) {
|
|
rx_size = sdio_readl(bdev->func, MTK_REG_CRPLR, NULL);
|
|
rx_size = (rx_size & RX_PKT_LEN) >> 16;
|
|
if (btmtksdio_rx_packet(bdev, rx_size) < 0)
|
|
bdev->hdev->stat.err_rx++;
|
|
}
|
|
} while (int_status || time_is_before_jiffies(txrx_timeout));
|
|
|
|
/* Enable interrupt */
|
|
if (bdev->func->irq_handler)
|
|
sdio_writel(bdev->func, C_INT_EN_SET, MTK_REG_CHLPCR, NULL);
|
|
|
|
sdio_release_host(bdev->func);
|
|
|
|
pm_runtime_mark_last_busy(bdev->dev);
|
|
pm_runtime_put_autosuspend(bdev->dev);
|
|
}
|
|
|
|
static void btmtksdio_interrupt(struct sdio_func *func)
|
|
{
|
|
struct btmtksdio_dev *bdev = sdio_get_drvdata(func);
|
|
|
|
if (test_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state)) {
|
|
if (bdev->hdev->suspended)
|
|
pm_wakeup_event(bdev->dev, 0);
|
|
clear_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state);
|
|
}
|
|
|
|
/* Disable interrupt */
|
|
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
|
|
|
|
schedule_work(&bdev->txrx_work);
|
|
}
|
|
|
|
static int btmtksdio_open(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
u32 val;
|
|
int err;
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
err = sdio_enable_func(bdev->func);
|
|
if (err < 0)
|
|
goto err_release_host;
|
|
|
|
set_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state);
|
|
|
|
err = btmtksdio_drv_pmctrl(bdev);
|
|
if (err < 0)
|
|
goto err_disable_func;
|
|
|
|
/* Disable interrupt & mask out all interrupt sources */
|
|
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, &err);
|
|
if (err < 0)
|
|
goto err_disable_func;
|
|
|
|
sdio_writel(bdev->func, 0, MTK_REG_CHIER, &err);
|
|
if (err < 0)
|
|
goto err_disable_func;
|
|
|
|
err = sdio_claim_irq(bdev->func, btmtksdio_interrupt);
|
|
if (err < 0)
|
|
goto err_disable_func;
|
|
|
|
err = sdio_set_block_size(bdev->func, MTK_SDIO_BLOCK_SIZE);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
/* SDIO CMD 5 allows the SDIO device back to idle state an
|
|
* synchronous interrupt is supported in SDIO 4-bit mode
|
|
*/
|
|
val = sdio_readl(bdev->func, MTK_REG_CSDIOCSR, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
val |= SDIO_INT_CTL;
|
|
sdio_writel(bdev->func, val, MTK_REG_CSDIOCSR, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
/* Explitly set write-1-clear method */
|
|
val = sdio_readl(bdev->func, MTK_REG_CHCR, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
val |= C_INT_CLR_CTRL;
|
|
sdio_writel(bdev->func, val, MTK_REG_CHCR, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
/* Setup interrupt sources */
|
|
sdio_writel(bdev->func, RX_DONE_INT | TX_EMPTY | TX_FIFO_OVERFLOW,
|
|
MTK_REG_CHIER, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
/* Enable interrupt */
|
|
sdio_writel(bdev->func, C_INT_EN_SET, MTK_REG_CHLPCR, &err);
|
|
if (err < 0)
|
|
goto err_release_irq;
|
|
|
|
sdio_release_host(bdev->func);
|
|
|
|
return 0;
|
|
|
|
err_release_irq:
|
|
sdio_release_irq(bdev->func);
|
|
|
|
err_disable_func:
|
|
sdio_disable_func(bdev->func);
|
|
|
|
err_release_host:
|
|
sdio_release_host(bdev->func);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_close(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
|
|
/* Skip btmtksdio_close if BTMTKSDIO_FUNC_ENABLED isn't set */
|
|
if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
|
|
return 0;
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
/* Disable interrupt */
|
|
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
|
|
|
|
sdio_release_irq(bdev->func);
|
|
|
|
cancel_work_sync(&bdev->txrx_work);
|
|
|
|
btmtksdio_fw_pmctrl(bdev);
|
|
|
|
clear_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state);
|
|
sdio_disable_func(bdev->func);
|
|
|
|
sdio_release_host(bdev->func);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int btmtksdio_flush(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
|
|
skb_queue_purge(&bdev->txq);
|
|
|
|
cancel_work_sync(&bdev->txrx_work);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int btmtksdio_func_query(struct hci_dev *hdev)
|
|
{
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
int status, err;
|
|
u8 param = 0;
|
|
|
|
/* Query whether the function is enabled */
|
|
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
|
|
wmt_params.flag = 4;
|
|
wmt_params.dlen = sizeof(param);
|
|
wmt_params.data = ¶m;
|
|
wmt_params.status = &status;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to query function status (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
struct btmtk_tci_sleep tci_sleep;
|
|
struct sk_buff *skb;
|
|
int err, status;
|
|
u8 param = 0x1;
|
|
|
|
/* Query whether the firmware is already download */
|
|
wmt_params.op = BTMTK_WMT_SEMAPHORE;
|
|
wmt_params.flag = 1;
|
|
wmt_params.dlen = 0;
|
|
wmt_params.data = NULL;
|
|
wmt_params.status = &status;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to query firmware status (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
if (status == BTMTK_WMT_PATCH_DONE) {
|
|
bt_dev_info(hdev, "Firmware already downloaded");
|
|
goto ignore_setup_fw;
|
|
}
|
|
|
|
/* Setup a firmware which the device definitely requires */
|
|
err = btmtk_setup_firmware(hdev, fwname, mtk_hci_wmt_sync);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
ignore_setup_fw:
|
|
/* Query whether the device is already enabled */
|
|
err = readx_poll_timeout(btmtksdio_func_query, hdev, status,
|
|
status < 0 || status != BTMTK_WMT_ON_PROGRESS,
|
|
2000, 5000000);
|
|
/* -ETIMEDOUT happens */
|
|
if (err < 0)
|
|
return err;
|
|
|
|
/* The other errors happen in btusb_mtk_func_query */
|
|
if (status < 0)
|
|
return status;
|
|
|
|
if (status == BTMTK_WMT_ON_DONE) {
|
|
bt_dev_info(hdev, "function already on");
|
|
goto ignore_func_on;
|
|
}
|
|
|
|
/* Enable Bluetooth protocol */
|
|
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
|
|
wmt_params.flag = 0;
|
|
wmt_params.dlen = sizeof(param);
|
|
wmt_params.data = ¶m;
|
|
wmt_params.status = NULL;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
set_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
|
|
|
|
ignore_func_on:
|
|
/* Apply the low power environment setup */
|
|
tci_sleep.mode = 0x5;
|
|
tci_sleep.duration = cpu_to_le16(0x640);
|
|
tci_sleep.host_duration = cpu_to_le16(0x640);
|
|
tci_sleep.host_wakeup_pin = 0;
|
|
tci_sleep.time_compensation = 0;
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc7a, sizeof(tci_sleep), &tci_sleep,
|
|
HCI_INIT_TIMEOUT);
|
|
if (IS_ERR(skb)) {
|
|
err = PTR_ERR(skb);
|
|
bt_dev_err(hdev, "Failed to apply low power setting (%d)", err);
|
|
return err;
|
|
}
|
|
kfree_skb(skb);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
u8 param = 0x1;
|
|
int err;
|
|
|
|
err = btmtk_setup_firmware_79xx(hdev, fwname, mtk_hci_wmt_sync);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to setup 79xx firmware (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
err = btmtksdio_fw_pmctrl(bdev);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
err = btmtksdio_drv_pmctrl(bdev);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
/* Enable Bluetooth protocol */
|
|
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
|
|
wmt_params.flag = 0;
|
|
wmt_params.dlen = sizeof(param);
|
|
wmt_params.data = ¶m;
|
|
wmt_params.status = NULL;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
hci_set_msft_opcode(hdev, 0xFD30);
|
|
hci_set_aosp_capable(hdev);
|
|
set_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_mtk_reg_read(struct hci_dev *hdev, u32 reg, u32 *val)
|
|
{
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
struct reg_read_cmd reg_read = {
|
|
.type = 1,
|
|
.num = 1,
|
|
};
|
|
u32 status;
|
|
int err;
|
|
|
|
reg_read.addr = cpu_to_le32(reg);
|
|
wmt_params.op = BTMTK_WMT_REGISTER;
|
|
wmt_params.flag = BTMTK_WMT_REG_READ;
|
|
wmt_params.dlen = sizeof(reg_read);
|
|
wmt_params.data = ®_read;
|
|
wmt_params.status = &status;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to read reg (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
*val = status;
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_mtk_reg_write(struct hci_dev *hdev, u32 reg, u32 val, u32 mask)
|
|
{
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
const struct reg_write_cmd reg_write = {
|
|
.type = 1,
|
|
.num = 1,
|
|
.addr = cpu_to_le32(reg),
|
|
.data = cpu_to_le32(val),
|
|
.mask = cpu_to_le32(mask),
|
|
};
|
|
int err, status;
|
|
|
|
wmt_params.op = BTMTK_WMT_REGISTER;
|
|
wmt_params.flag = BTMTK_WMT_REG_WRITE;
|
|
wmt_params.dlen = sizeof(reg_write);
|
|
wmt_params.data = ®_write;
|
|
wmt_params.status = &status;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0)
|
|
bt_dev_err(hdev, "Failed to write reg (%d)", err);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_get_data_path_id(struct hci_dev *hdev, __u8 *data_path_id)
|
|
{
|
|
/* uses 1 as data path id for all the usecases */
|
|
*data_path_id = 1;
|
|
return 0;
|
|
}
|
|
|
|
static int btmtksdio_get_codec_config_data(struct hci_dev *hdev,
|
|
__u8 link, struct bt_codec *codec,
|
|
__u8 *ven_len, __u8 **ven_data)
|
|
{
|
|
int err = 0;
|
|
|
|
if (!ven_data || !ven_len)
|
|
return -EINVAL;
|
|
|
|
*ven_len = 0;
|
|
*ven_data = NULL;
|
|
|
|
if (link != ESCO_LINK) {
|
|
bt_dev_err(hdev, "Invalid link type(%u)", link);
|
|
return -EINVAL;
|
|
}
|
|
|
|
*ven_data = kmalloc(sizeof(__u8), GFP_KERNEL);
|
|
if (!*ven_data) {
|
|
err = -ENOMEM;
|
|
goto error;
|
|
}
|
|
|
|
/* supports only CVSD and mSBC offload codecs */
|
|
switch (codec->id) {
|
|
case 0x02:
|
|
**ven_data = 0x00;
|
|
break;
|
|
case 0x05:
|
|
**ven_data = 0x01;
|
|
break;
|
|
default:
|
|
err = -EINVAL;
|
|
bt_dev_err(hdev, "Invalid codec id(%u)", codec->id);
|
|
goto error;
|
|
}
|
|
/* codec and its capabilities are pre-defined to ids
|
|
* preset id = 0x00 represents CVSD codec with sampling rate 8K
|
|
* preset id = 0x01 represents mSBC codec with sampling rate 16K
|
|
*/
|
|
*ven_len = sizeof(__u8);
|
|
return err;
|
|
|
|
error:
|
|
kfree(*ven_data);
|
|
*ven_data = NULL;
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_sco_setting(struct hci_dev *hdev)
|
|
{
|
|
const struct btmtk_sco sco_setting = {
|
|
.clock_config = 0x49,
|
|
.channel_format_config = 0x80,
|
|
};
|
|
struct sk_buff *skb;
|
|
u32 val;
|
|
int err;
|
|
|
|
/* Enable SCO over I2S/PCM for MediaTek chipset */
|
|
skb = __hci_cmd_sync(hdev, 0xfc72, sizeof(sco_setting),
|
|
&sco_setting, HCI_CMD_TIMEOUT);
|
|
if (IS_ERR(skb))
|
|
return PTR_ERR(skb);
|
|
|
|
kfree_skb(skb);
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, MT7921_PINMUX_0, &val);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
val |= 0x11000000;
|
|
err = btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_0, val, ~0);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, MT7921_PINMUX_1, &val);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
val |= 0x00000101;
|
|
err = btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
hdev->get_data_path_id = btmtksdio_get_data_path_id;
|
|
hdev->get_codec_config_data = btmtksdio_get_codec_config_data;
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_reset_setting(struct hci_dev *hdev)
|
|
{
|
|
int err;
|
|
u32 val;
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, MT7921_PINMUX_1, &val);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
val |= 0x20; /* set the pin (bit field 11:8) work as GPIO mode */
|
|
err = btmtksdio_mtk_reg_write(hdev, MT7921_PINMUX_1, val, ~0);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, MT7921_BTSYS_RST, &val);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
val |= MT7921_BTSYS_RST_WITH_GPIO;
|
|
return btmtksdio_mtk_reg_write(hdev, MT7921_BTSYS_RST, val, ~0);
|
|
}
|
|
|
|
static int btmtksdio_setup(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
ktime_t calltime, delta, rettime;
|
|
unsigned long long duration;
|
|
char fwname[64];
|
|
int err, dev_id;
|
|
u32 fw_version = 0, val;
|
|
|
|
calltime = ktime_get();
|
|
set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
|
|
|
|
switch (bdev->data->chipid) {
|
|
case 0x7921:
|
|
if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state)) {
|
|
err = btmtksdio_mtk_reg_read(hdev, MT7921_DLSTATUS,
|
|
&val);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
val &= ~BT_DL_STATE;
|
|
err = btmtksdio_mtk_reg_write(hdev, MT7921_DLSTATUS,
|
|
val, ~0);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
btmtksdio_fw_pmctrl(bdev);
|
|
msleep(20);
|
|
btmtksdio_drv_pmctrl(bdev);
|
|
|
|
clear_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state);
|
|
}
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, 0x70010200, &dev_id);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to get device id (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
err = btmtksdio_mtk_reg_read(hdev, 0x80021004, &fw_version);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to get fw version (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
btmtk_fw_get_filename(fwname, sizeof(fwname), dev_id,
|
|
fw_version, 0);
|
|
|
|
snprintf(fwname, sizeof(fwname),
|
|
"mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
|
|
dev_id & 0xffff, (fw_version & 0xff) + 1);
|
|
err = mt79xx_setup(hdev, fwname);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
/* Enable SCO over I2S/PCM */
|
|
err = btmtksdio_sco_setting(hdev);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to enable SCO setting (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
/* Enable WBS with mSBC codec */
|
|
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
|
|
|
|
/* Enable GPIO reset mechanism */
|
|
if (bdev->reset) {
|
|
err = btmtksdio_reset_setting(hdev);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to enable Reset setting (%d)", err);
|
|
devm_gpiod_put(bdev->dev, bdev->reset);
|
|
bdev->reset = NULL;
|
|
}
|
|
}
|
|
|
|
break;
|
|
case 0x7663:
|
|
case 0x7668:
|
|
err = mt76xx_setup(hdev, bdev->data->fwname);
|
|
if (err < 0)
|
|
return err;
|
|
break;
|
|
default:
|
|
return -ENODEV;
|
|
}
|
|
|
|
rettime = ktime_get();
|
|
delta = ktime_sub(rettime, calltime);
|
|
duration = (unsigned long long)ktime_to_ns(delta) >> 10;
|
|
|
|
pm_runtime_set_autosuspend_delay(bdev->dev,
|
|
MTKBTSDIO_AUTOSUSPEND_DELAY);
|
|
pm_runtime_use_autosuspend(bdev->dev);
|
|
|
|
err = pm_runtime_set_active(bdev->dev);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
/* Default forbid runtime auto suspend, that can be allowed by
|
|
* enable_autosuspend flag or the PM runtime entry under sysfs.
|
|
*/
|
|
pm_runtime_forbid(bdev->dev);
|
|
pm_runtime_enable(bdev->dev);
|
|
|
|
if (enable_autosuspend)
|
|
pm_runtime_allow(bdev->dev);
|
|
|
|
bt_dev_info(hdev, "Device setup in %llu usecs", duration);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int btmtksdio_shutdown(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
struct btmtk_hci_wmt_params wmt_params;
|
|
u8 param = 0x0;
|
|
int err;
|
|
|
|
/* Get back the state to be consistent with the state
|
|
* in btmtksdio_setup.
|
|
*/
|
|
pm_runtime_get_sync(bdev->dev);
|
|
|
|
/* wmt command only works until the reset is complete */
|
|
if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
|
|
goto ignore_wmt_cmd;
|
|
|
|
/* Disable the device */
|
|
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
|
|
wmt_params.flag = 0;
|
|
wmt_params.dlen = sizeof(param);
|
|
wmt_params.data = ¶m;
|
|
wmt_params.status = NULL;
|
|
|
|
err = mtk_hci_wmt_sync(hdev, &wmt_params);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
|
|
return err;
|
|
}
|
|
|
|
ignore_wmt_cmd:
|
|
pm_runtime_put_noidle(bdev->dev);
|
|
pm_runtime_disable(bdev->dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int btmtksdio_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
|
|
switch (hci_skb_pkt_type(skb)) {
|
|
case HCI_COMMAND_PKT:
|
|
hdev->stat.cmd_tx++;
|
|
break;
|
|
|
|
case HCI_ACLDATA_PKT:
|
|
hdev->stat.acl_tx++;
|
|
break;
|
|
|
|
case HCI_SCODATA_PKT:
|
|
hdev->stat.sco_tx++;
|
|
break;
|
|
|
|
default:
|
|
return -EILSEQ;
|
|
}
|
|
|
|
skb_queue_tail(&bdev->txq, skb);
|
|
|
|
schedule_work(&bdev->txrx_work);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void btmtksdio_reset(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
u32 status;
|
|
int err;
|
|
|
|
if (!bdev->reset || bdev->data->chipid != 0x7921)
|
|
return;
|
|
|
|
pm_runtime_get_sync(bdev->dev);
|
|
|
|
if (test_and_set_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
|
|
return;
|
|
|
|
sdio_claim_host(bdev->func);
|
|
|
|
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
|
|
skb_queue_purge(&bdev->txq);
|
|
cancel_work_sync(&bdev->txrx_work);
|
|
|
|
gpiod_set_value_cansleep(bdev->reset, 1);
|
|
msleep(100);
|
|
gpiod_set_value_cansleep(bdev->reset, 0);
|
|
|
|
err = readx_poll_timeout(btmtksdio_chcr_query, bdev, status,
|
|
status & BT_RST_DONE, 100000, 2000000);
|
|
if (err < 0) {
|
|
bt_dev_err(hdev, "Failed to reset (%d)", err);
|
|
goto err;
|
|
}
|
|
|
|
clear_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
|
|
err:
|
|
sdio_release_host(bdev->func);
|
|
|
|
pm_runtime_put_noidle(bdev->dev);
|
|
pm_runtime_disable(bdev->dev);
|
|
|
|
hci_reset_dev(hdev);
|
|
}
|
|
|
|
static bool btmtksdio_sdio_inband_wakeup(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
|
|
return device_may_wakeup(bdev->dev);
|
|
}
|
|
|
|
static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev)
|
|
{
|
|
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
|
|
bool may_wakeup = device_may_wakeup(bdev->dev);
|
|
const struct btmtk_wakeon bt_awake = {
|
|
.mode = 0x1,
|
|
.gpo = 0,
|
|
.active_high = 0x1,
|
|
.enable_delay = cpu_to_le16(0xc80),
|
|
.wakeup_delay = cpu_to_le16(0x20),
|
|
};
|
|
|
|
if (may_wakeup && bdev->data->chipid == 0x7921) {
|
|
struct sk_buff *skb;
|
|
|
|
skb = __hci_cmd_sync(hdev, 0xfc27, sizeof(bt_awake),
|
|
&bt_awake, HCI_CMD_TIMEOUT);
|
|
if (IS_ERR(skb))
|
|
may_wakeup = false;
|
|
else
|
|
kfree_skb(skb);
|
|
}
|
|
|
|
return may_wakeup;
|
|
}
|
|
|
|
static int btmtksdio_probe(struct sdio_func *func,
|
|
const struct sdio_device_id *id)
|
|
{
|
|
struct btmtksdio_dev *bdev;
|
|
struct hci_dev *hdev;
|
|
int err;
|
|
|
|
bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL);
|
|
if (!bdev)
|
|
return -ENOMEM;
|
|
|
|
bdev->data = (void *)id->driver_data;
|
|
if (!bdev->data)
|
|
return -ENODEV;
|
|
|
|
bdev->dev = &func->dev;
|
|
bdev->func = func;
|
|
|
|
INIT_WORK(&bdev->txrx_work, btmtksdio_txrx_work);
|
|
skb_queue_head_init(&bdev->txq);
|
|
|
|
/* Initialize and register HCI device */
|
|
hdev = hci_alloc_dev();
|
|
if (!hdev) {
|
|
dev_err(&func->dev, "Can't allocate HCI device\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
bdev->hdev = hdev;
|
|
|
|
hdev->bus = HCI_SDIO;
|
|
hci_set_drvdata(hdev, bdev);
|
|
|
|
hdev->open = btmtksdio_open;
|
|
hdev->close = btmtksdio_close;
|
|
hdev->reset = btmtksdio_reset;
|
|
hdev->flush = btmtksdio_flush;
|
|
hdev->setup = btmtksdio_setup;
|
|
hdev->shutdown = btmtksdio_shutdown;
|
|
hdev->send = btmtksdio_send_frame;
|
|
hdev->wakeup = btmtksdio_sdio_wakeup;
|
|
/*
|
|
* If SDIO controller supports wake on Bluetooth, sending a wakeon
|
|
* command is not necessary.
|
|
*/
|
|
if (device_can_wakeup(func->card->host->parent))
|
|
hdev->wakeup = btmtksdio_sdio_inband_wakeup;
|
|
else
|
|
hdev->wakeup = btmtksdio_sdio_wakeup;
|
|
hdev->set_bdaddr = btmtk_set_bdaddr;
|
|
|
|
SET_HCIDEV_DEV(hdev, &func->dev);
|
|
|
|
hdev->manufacturer = 70;
|
|
set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks);
|
|
|
|
sdio_set_drvdata(func, bdev);
|
|
|
|
err = hci_register_dev(hdev);
|
|
if (err < 0) {
|
|
dev_err(&func->dev, "Can't register HCI device\n");
|
|
hci_free_dev(hdev);
|
|
return err;
|
|
}
|
|
|
|
/* pm_runtime_enable would be done after the firmware is being
|
|
* downloaded because the core layer probably already enables
|
|
* runtime PM for this func such as the case host->caps &
|
|
* MMC_CAP_POWER_OFF_CARD.
|
|
*/
|
|
if (pm_runtime_enabled(bdev->dev))
|
|
pm_runtime_disable(bdev->dev);
|
|
|
|
/* As explaination in drivers/mmc/core/sdio_bus.c tells us:
|
|
* Unbound SDIO functions are always suspended.
|
|
* During probe, the function is set active and the usage count
|
|
* is incremented. If the driver supports runtime PM,
|
|
* it should call pm_runtime_put_noidle() in its probe routine and
|
|
* pm_runtime_get_noresume() in its remove routine.
|
|
*
|
|
* So, put a pm_runtime_put_noidle here !
|
|
*/
|
|
pm_runtime_put_noidle(bdev->dev);
|
|
|
|
err = device_init_wakeup(bdev->dev, true);
|
|
if (err)
|
|
bt_dev_err(hdev, "failed to initialize device wakeup");
|
|
|
|
bdev->dev->of_node = of_find_compatible_node(NULL, NULL,
|
|
"mediatek,mt7921s-bluetooth");
|
|
bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset",
|
|
GPIOD_OUT_LOW);
|
|
if (IS_ERR(bdev->reset))
|
|
err = PTR_ERR(bdev->reset);
|
|
|
|
return err;
|
|
}
|
|
|
|
static void btmtksdio_remove(struct sdio_func *func)
|
|
{
|
|
struct btmtksdio_dev *bdev = sdio_get_drvdata(func);
|
|
struct hci_dev *hdev;
|
|
|
|
if (!bdev)
|
|
return;
|
|
|
|
hdev = bdev->hdev;
|
|
|
|
/* Make sure to call btmtksdio_close before removing sdio card */
|
|
if (test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
|
|
btmtksdio_close(hdev);
|
|
|
|
/* Be consistent the state in btmtksdio_probe */
|
|
pm_runtime_get_noresume(bdev->dev);
|
|
|
|
sdio_set_drvdata(func, NULL);
|
|
hci_unregister_dev(hdev);
|
|
hci_free_dev(hdev);
|
|
}
|
|
|
|
#ifdef CONFIG_PM
|
|
static int btmtksdio_runtime_suspend(struct device *dev)
|
|
{
|
|
struct sdio_func *func = dev_to_sdio_func(dev);
|
|
struct btmtksdio_dev *bdev;
|
|
int err;
|
|
|
|
bdev = sdio_get_drvdata(func);
|
|
if (!bdev)
|
|
return 0;
|
|
|
|
if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
|
|
return 0;
|
|
|
|
sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
|
|
|
|
err = btmtksdio_fw_pmctrl(bdev);
|
|
|
|
bt_dev_dbg(bdev->hdev, "status (%d) return ownership to device", err);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_system_suspend(struct device *dev)
|
|
{
|
|
struct sdio_func *func = dev_to_sdio_func(dev);
|
|
struct btmtksdio_dev *bdev;
|
|
|
|
bdev = sdio_get_drvdata(func);
|
|
if (!bdev)
|
|
return 0;
|
|
|
|
if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
|
|
return 0;
|
|
|
|
set_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state);
|
|
|
|
return btmtksdio_runtime_suspend(dev);
|
|
}
|
|
|
|
static int btmtksdio_runtime_resume(struct device *dev)
|
|
{
|
|
struct sdio_func *func = dev_to_sdio_func(dev);
|
|
struct btmtksdio_dev *bdev;
|
|
int err;
|
|
|
|
bdev = sdio_get_drvdata(func);
|
|
if (!bdev)
|
|
return 0;
|
|
|
|
if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
|
|
return 0;
|
|
|
|
err = btmtksdio_drv_pmctrl(bdev);
|
|
|
|
bt_dev_dbg(bdev->hdev, "status (%d) get ownership from device", err);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int btmtksdio_system_resume(struct device *dev)
|
|
{
|
|
return btmtksdio_runtime_resume(dev);
|
|
}
|
|
|
|
static const struct dev_pm_ops btmtksdio_pm_ops = {
|
|
SYSTEM_SLEEP_PM_OPS(btmtksdio_system_suspend, btmtksdio_system_resume)
|
|
RUNTIME_PM_OPS(btmtksdio_runtime_suspend, btmtksdio_runtime_resume, NULL)
|
|
};
|
|
|
|
#define BTMTKSDIO_PM_OPS (&btmtksdio_pm_ops)
|
|
#else /* CONFIG_PM */
|
|
#define BTMTKSDIO_PM_OPS NULL
|
|
#endif /* CONFIG_PM */
|
|
|
|
static struct sdio_driver btmtksdio_driver = {
|
|
.name = "btmtksdio",
|
|
.probe = btmtksdio_probe,
|
|
.remove = btmtksdio_remove,
|
|
.id_table = btmtksdio_table,
|
|
.drv = {
|
|
.pm = BTMTKSDIO_PM_OPS,
|
|
}
|
|
};
|
|
|
|
module_sdio_driver(btmtksdio_driver);
|
|
|
|
module_param(enable_autosuspend, bool, 0644);
|
|
MODULE_PARM_DESC(enable_autosuspend, "Enable autosuspend by default");
|
|
|
|
MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
|
|
MODULE_DESCRIPTION("MediaTek Bluetooth SDIO driver ver " VERSION);
|
|
MODULE_VERSION(VERSION);
|
|
MODULE_LICENSE("GPL");
|