summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt766-sdca.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-08-24 08:46:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-08-24 08:46:03 -0700
commitcf9610f9116d55c5a66ef9f1faecacabd93a9322 (patch)
tree757a3d280760c654767631cab5ad8af2d86d1848 /sound/soc/codecs/rt766-sdca.h
downloadlinux-stable-cf9610f9116d55c5a66ef9f1faecacabd93a9322.tar.gz
linux-stable-cf9610f9116d55c5a66ef9f1faecacabd93a9322.zip
Merge tag 'pinctrl-v7.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrlgrafted
Pull pin control updates from Linus Walleij: "Core changes: - Use the non-blocking mux_state_try_select() in the generic MUX pin control back-end - Free pin maps on pinctrl_generic_to_map() failure in the core helpers New hardware pin control: - Qualcomm Maili TLMM SoC, PMG1110 PMIC, and Eliza LPASS LPI TLMM SoC (this is for the low power audio, LPASS = Low Power Audio SubSystem portions) - Upboard support on top of the Intel pin controller - Apple T6030 and T6031 support (just compatible strings) - Samsung Exynos 8855 SoC - Mediatek MT6858 SoC - Rockchip RK3308B and RV1106 SoCs - Airoha EN7523 and AN7563 SoCs Improvements: - Qualcomm TLMM GPIOs are unconditionally marked as wakeup capable - Qualcomm improvements on top of the Qualcomm PDC (power domain controller) irqchip improvements from tglx:s tree - Qualcomm IPQ806x and IPQ9650 non-urgent pin grop fixups - The NPCM8xx driver has been put into shape fixing many pin and group definitions - Some non-urgent Tegra 264 pin assignments are fixed up - Some non-urgent fixups to Airoha AN7581 and AN7583 registers and pin assignments, missing features etc" * tag 'pinctrl-v7.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (130 commits) dt-bindings: pinctrl: Convert TI DA850 pupd to DT schema pinctrl: meson: sync some modify from A4 pinctrl: meson: a4: Add input enable pin configuration pinctrl: realtek: rtd1625: remove unused group name spdif_sel pinctrl: realtek: rtd1625: fix base_bit for VE4 GPIO 13 dt-bindings: pinctrl: microchip,pic32mzda-pinctrl: Convert to DT schema Revert "Merge branch 'ib-rsk7204' into devel" pinctrl: rockchip: Add RV1106 pinctrl support dt-bindings: pinctrl: rockchip: Add RV1106 compatible pinctrl: rockchip: Decode drive strength in the get function pinctrl: fix PINCTRL_GENERIC_MUX not always being selectable pinctrl: airoha: add support of an7563 SoC dt-bindings: pinctrl: airoha: add support of an7563 pin controller pinctrl: airoha: try to find chip scu node by phandle first pinctrl: airoha: add support of en7523 SoC dt-bindings: pinctrl: airoha: add support of en7523 pin controller pinctrl: airoha: an7583: add support for olt pinmux pinctrl: airoha: an7583: add support for pon_alt pinmux pinctrl: airoha: an7583: add support for npu_uart pinmux dt-bindings: pinctrl: airoha: an7583: add missed features ...
Diffstat (limited to 'sound/soc/codecs/rt766-sdca.h')
-rw-r--r--sound/soc/codecs/rt766-sdca.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt766-sdca.h b/sound/soc/codecs/rt766-sdca.h
new file mode 100644
index 000000000..de4064007
--- /dev/null
+++ b/sound/soc/codecs/rt766-sdca.h
@@ -0,0 +1,140 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * rt766-sdca.h -- RT766 SDCA ALSA SoC audio driver header
+ *
+ * Copyright(c) 2026 Realtek Semiconductor Corp.
+ */
+
+#ifndef __RT766_H__
+#define __RT766_H__
+
+#include <linux/hid.h>
+#include <linux/pm.h>
+#include <linux/regmap.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_type.h>
+#include <sound/soc.h>
+#include <linux/workqueue.h>
+
+struct rt766_sdca_priv {
+ struct regmap *regmap;
+ struct snd_soc_component *component;
+ struct sdw_slave *slave;
+ bool hw_init;
+ bool first_hw_init;
+ struct snd_soc_jack *hs_jack;
+ struct mutex disable_irq_lock; /* SDCA irq lock protection */
+ bool disable_irq;
+ int jack_type;
+ bool fu41_dapm_mute;
+ bool fu41_mixer_l_mute;
+ bool fu41_mixer_r_mute;
+ bool fu113_dapm_mute;
+ bool fu113_mixer_mute[4];
+ bool fu21_dapm_mute;
+ bool fu21_mixer_l_mute;
+ bool fu21_mixer_r_mute;
+ bool fu36_dapm_mute;
+ bool fu36_mixer_l_mute;
+ bool fu36_mixer_r_mute;
+ struct sdca_function_data *uaj_func_data;
+ struct sdca_function_data *sm_func_data;
+ struct sdca_function_data *sa_func_data;
+ struct sdca_function_data *hid_func_data;
+ struct sdca_interrupt_info *irq_info;
+ struct hid_device *hid;
+};
+
+/* vendor registers */
+#define RT766_VERSION_ID 0xc404
+#define RT766_DEV_ID1 0xc405
+#define RT766_DEV_ID0 0xc406
+#define RT766_BOND_LATCH_ID 0xc407
+
+#define RT766_HP_POWER_STATE 0x1000004
+#define RT766_HP_FSM_CTL2_1 0x100000d
+
+/* MCU Patch address */
+#define RT766_MCU_PATCH_ADDR1_START 0x10010000
+#define RT766_MCU_PATCH_ADDR1_END 0x10011fff
+#define RT766_MCU_PATCH_ADDR2_START 0x10020000
+#define RT766_MCU_PATCH_ADDR2_END 0x10023fff
+
+/* Buffer address for HID */
+#define RT766_BUF_ADDR_HID1 0x44030000
+#define RT766_BUF_ADDR_HID2 0x44030020
+
+/* SDCA (Channel) */
+#define RT766_CH_1 0x01
+#define RT766_CH_2 0x02
+#define RT766_CH_3 0x03
+#define RT766_CH_4 0x04
+
+/* RT766 SDCA Control - function number */
+#define RT766_FUNC_NUM_UAJ 0x01
+#define RT766_FUNC_NUM_MIC 0x02
+#define RT766_FUNC_NUM_HID 0x03
+#define RT766_FUNC_NUM_AMP 0x04
+
+/* RT766 SDCA entity */
+#define RT766_SDCA_ENT_0 0x00
+#define RT766_SDCA_ENT_HID101 0x01
+#define RT766_SDCA_ENT_GE49 0x49
+#define RT766_SDCA_ENT_USER_FU41 0x05
+#define RT766_SDCA_ENT_USER_FU36 0x0f
+#define RT766_SDCA_ENT_USER_FU21 0x03
+#define RT766_SDCA_ENT_USER_FU113 0x30
+#define RT766_SDCA_ENT_PDE23 0x33
+#define RT766_SDCA_ENT_PDE47 0x28
+#define RT766_SDCA_ENT_PDE11 0x2a
+#define RT766_SDCA_ENT_PDE34 0x29
+#define RT766_SDCA_ENT_CS41 0x01
+#define RT766_SDCA_ENT_CS36 0x11
+#define RT766_SDCA_ENT_CS113 0x12
+#define RT766_SDCA_ENT_CS21 0x21
+#define RT766_SDCA_ENT_PLATFORM_FU33 0x44
+#define RT766_SDCA_ENT_PPU21 0x04
+
+/* sample frequency index */
+#define RT766_SDCA_RATE_44100HZ 0x08
+#define RT766_SDCA_RATE_48000HZ 0x09
+#define RT766_SDCA_RATE_96000HZ 0x0b
+#define RT766_SDCA_RATE_192000HZ 0x0d
+
+/* SDCA Register macros */
+#define RT766_MUTE_REG(func, fu, ch) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##fu, SDCA_CTL_FU_MUTE, RT766_CH_##ch)
+
+#define RT766_VOLUME_REG(func, fu, ch) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##fu, SDCA_CTL_FU_CHANNEL_VOLUME, RT766_CH_##ch)
+
+#define RT766_GAIN_REG(func, fu, ch) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##fu, SDCA_CTL_FU_GAIN, RT766_CH_##ch)
+
+#define RT766_PDE_REQ_REG(func, pde) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##pde, SDCA_CTL_PDE_REQUESTED_PS, 0)
+
+#define RT766_PDE_ACTUAL_REG(func, pde) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##pde, SDCA_CTL_PDE_ACTUAL_PS, 0)
+
+#define RT766_FUNC_STATUS_REG(func) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_0, SDCA_CTL_ENTITY_0_FUNCTION_STATUS, 0)
+
+#define RT766_SDCA_CTL(func, ent, ctl) \
+ SDW_SDCA_CTL(RT766_FUNC_NUM_##func, RT766_SDCA_ENT_##ent, ctl, 0)
+
+enum {
+ RT766_AIF1,
+ RT766_AIF2,
+ RT766_AIF3,
+};
+
+enum {
+ RT766_DAI_UAJ,
+ RT766_DAI_AMP,
+ RT766_DAI_MIC,
+};
+
+int rt766_sdca_io_init(struct device *dev, struct sdw_slave *slave);
+int rt766_sdca_init(struct device *dev, struct regmap *regmap, struct sdw_slave *slave);
+#endif /* __RT766_H__ */