FILE
rt1320-sdw.h
File preview with syntax highlighting.
linux-6.19.14/sound/soc/codecs/rt1320-sdw.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * rt1320-sdw.h -- RT1320 SDCA ALSA SoC audio driver header 4 * 5 * Copyright(c) 2024 Realtek Semiconductor Corp. 6 */ 7 8#ifndef __RT1320_SDW_H__ 9#define __RT1320_SDW_H__ 10 11#include <linux/regmap.h> 12#include <linux/soundwire/sdw.h> 13#include <linux/soundwire/sdw_type.h> 14#include <linux/soundwire/sdw_registers.h> 15#include <sound/soc.h> 16 17#define RT1320_DEV_ID 0x6981 18#define RT1321_DEV_ID 0x7045 19 20/* imp-defined registers */ 21#define RT1320_DEV_VERSION_ID_1 0xc404 22#define RT1320_DEV_ID_1 0xc405 23#define RT1320_DEV_ID_0 0xc406 24 25#define RT1321_PATCH_MAIN_VER 0x1000cffe 26#define RT1321_PATCH_BETA_VER 0x1000cfff 27 28#define RT1320_KR0_STATUS_CNT 0x1000f008 29#define RT1320_KR0_INT_READY 0x1000f021 30#define RT1320_HIFI_VER_0 0x3fe2e000 31#define RT1320_HIFI_VER_1 0x3fe2e001 32#define RT1320_HIFI_VER_2 0x3fe2e002 33#define RT1320_HIFI_VER_3 0x3fe2e003 34 35/* RT1320 SDCA Control - function number */ 36#define FUNC_NUM_AMP 0x04 37#define FUNC_NUM_MIC 0x02 38 39/* RT1320 SDCA entity */ 40#define RT1320_SDCA_ENT0 0x00 41#define RT1320_SDCA_ENT_PDE11 0x2a 42#define RT1320_SDCA_ENT_PDE23 0x33 43#define RT1320_SDCA_ENT_PDE27 0x27 44#define RT1320_SDCA_ENT_FU14 0x32 45#define RT1320_SDCA_ENT_FU21 0x03 46#define RT1320_SDCA_ENT_FU113 0x30 47#define RT1320_SDCA_ENT_CS14 0x13 48#define RT1320_SDCA_ENT_CS21 0x21 49#define RT1320_SDCA_ENT_CS113 0x12 50#define RT1320_SDCA_ENT_SAPU 0x29 51#define RT1320_SDCA_ENT_PPU21 0x04 52 53/* RT1320 SDCA control */ 54#define RT1320_SDCA_CTL_SAMPLE_FREQ_INDEX 0x10 55#define RT1320_SDCA_CTL_REQ_POWER_STATE 0x01 56#define RT1320_SDCA_CTL_ACTUAL_POWER_STATE 0x10 57#define RT1320_SDCA_CTL_FU_MUTE 0x01 58#define RT1320_SDCA_CTL_FU_VOLUME 0x02 59#define RT1320_SDCA_CTL_SAPU_PROTECTION_MODE 0x10 60#define RT1320_SDCA_CTL_SAPU_PROTECTION_STATUS 0x11 61#define RT1320_SDCA_CTL_POSTURE_NUMBER 0x10 62#define RT1320_SDCA_CTL_FUNC_STATUS 0x10 63 64/* RT1320 SDCA channel */ 65#define CH_01 0x01 66#define CH_02 0x02 67 68/* Function_Status */ 69#define FUNCTION_NEEDS_INITIALIZATION BIT(5) 70 71/* Sample Frequency Index */ 72#define RT1320_SDCA_RATE_16000HZ 0x04 73#define RT1320_SDCA_RATE_32000HZ 0x07 74#define RT1320_SDCA_RATE_44100HZ 0x08 75#define RT1320_SDCA_RATE_48000HZ 0x09 76#define RT1320_SDCA_RATE_96000HZ 0x0b 77#define RT1320_SDCA_RATE_192000HZ 0x0d 78 79enum { 80 RT1320_AIF1, 81 RT1320_AIF2, 82}; 83 84/* 85 * The version id will be useful to distinguish the capability between the different IC versions. 86 * Currently, VA and VB have different DSP FW versions. 87 */ 88enum rt1320_version_id { 89 RT1320_VA, 90 RT1320_VB, 91 RT1320_VC, 92}; 93 94#define RT1320_VER_B_ID 0x07392238 95#define RT1320_VAB_MCU_PATCH "realtek/rt1320/rt1320-patch-code-vab.bin" 96#define RT1320_VC_MCU_PATCH "realtek/rt1320/rt1320-patch-code-vc.bin" 97#define RT1321_VA_MCU_PATCH "realtek/rt1320/rt1321-patch-code-va.bin" 98 99struct rt1320_sdw_priv { 100 struct snd_soc_component *component; 101 struct regmap *regmap; 102 struct regmap *mbq_regmap; 103 struct sdw_slave *sdw_slave; 104 struct sdw_bus_params params; 105 bool hw_init; 106 bool first_hw_init; 107 int version_id; 108 unsigned int dev_id; 109 bool fu_dapm_mute; 110 bool fu_mixer_mute[4]; 111}; 112 113#endif /* __RT1320_SDW_H__ */
~/
Read-only file preview.