Commit 6ad73a2b authored by Shuming Fan's avatar Shuming Fan Committed by Mark Brown

ASoC: rt1318: Add RT1318 SDCA vendor-specific driver

This is the initial amplifier driver for rt1318 SDCA version.
Signed-off-by: default avatarShuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20221108092727.13011-1-shumingf@realtek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 66a796c0
......@@ -199,6 +199,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_RT715_SDCA_SDW
imply SND_SOC_RT1308_SDW
imply SND_SOC_RT1316_SDW
imply SND_SOC_RT1318_SDW
imply SND_SOC_RT9120
imply SND_SOC_SDW_MOCKUP
imply SND_SOC_SGTL5000
......@@ -1311,6 +1312,11 @@ config SND_SOC_RT1316_SDW
depends on SOUNDWIRE
select REGMAP_SOUNDWIRE
config SND_SOC_RT1318_SDW
tristate "Realtek RT1318 Codec - SDW"
depends on SOUNDWIRE
select REGMAP_SOUNDWIRE
config SND_SOC_RT5514
tristate
depends on I2C
......
......@@ -196,6 +196,7 @@ snd-soc-rt1305-objs := rt1305.o
snd-soc-rt1308-objs := rt1308.o
snd-soc-rt1308-sdw-objs := rt1308-sdw.o
snd-soc-rt1316-sdw-objs := rt1316-sdw.o
snd-soc-rt1318-sdw-objs := rt1318-sdw.o
snd-soc-rt274-objs := rt274.o
snd-soc-rt286-objs := rt286.o
snd-soc-rt298-objs := rt298.o
......@@ -551,6 +552,7 @@ obj-$(CONFIG_SND_SOC_RT1305) += snd-soc-rt1305.o
obj-$(CONFIG_SND_SOC_RT1308) += snd-soc-rt1308.o
obj-$(CONFIG_SND_SOC_RT1308_SDW) += snd-soc-rt1308-sdw.o
obj-$(CONFIG_SND_SOC_RT1316_SDW) += snd-soc-rt1316-sdw.o
obj-$(CONFIG_SND_SOC_RT1318_SDW) += snd-soc-rt1318-sdw.o
obj-$(CONFIG_SND_SOC_RT274) += snd-soc-rt274.o
obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o
obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* rt1318-sdw.h -- RT1318 SDCA ALSA SoC audio driver header
*
* Copyright(c) 2022 Realtek Semiconductor Corp.
*/
#ifndef __RT1318_SDW_H__
#define __RT1318_SDW_H__
#include <linux/regmap.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_registers.h>
#include <sound/soc.h>
/* imp-defined registers */
#define RT1318_SAPU_SM 0x3203
#define R1318_TCON 0xc203
#define R1318_TCON_RELATED_1 0xc206
#define R1318_SPK_TEMPERATRUE_PROTECTION_0 0xdb00
#define R1318_SPK_TEMPERATRUE_PROTECTION_L_4 0xdb08
#define R1318_SPK_TEMPERATRUE_PROTECTION_R_4 0xdd08
#define R1318_SPK_TEMPERATRUE_PROTECTION_L_6 0xdb12
#define R1318_SPK_TEMPERATRUE_PROTECTION_R_6 0xdd12
#define RT1318_INIT_RECIPROCAL_REG_L_24 0xdbb5
#define RT1318_INIT_RECIPROCAL_REG_L_23_16 0xdbb6
#define RT1318_INIT_RECIPROCAL_REG_L_15_8 0xdbb7
#define RT1318_INIT_RECIPROCAL_REG_L_7_0 0xdbb8
#define RT1318_INIT_RECIPROCAL_REG_R_24 0xddb5
#define RT1318_INIT_RECIPROCAL_REG_R_23_16 0xddb6
#define RT1318_INIT_RECIPROCAL_REG_R_15_8 0xddb7
#define RT1318_INIT_RECIPROCAL_REG_R_7_0 0xddb8
#define RT1318_INIT_R0_RECIPROCAL_SYN_L_24 0xdbc5
#define RT1318_INIT_R0_RECIPROCAL_SYN_L_23_16 0xdbc6
#define RT1318_INIT_R0_RECIPROCAL_SYN_L_15_8 0xdbc7
#define RT1318_INIT_R0_RECIPROCAL_SYN_L_7_0 0xdbc8
#define RT1318_INIT_R0_RECIPROCAL_SYN_R_24 0xddc5
#define RT1318_INIT_R0_RECIPROCAL_SYN_R_23_16 0xddc6
#define RT1318_INIT_R0_RECIPROCAL_SYN_R_15_8 0xddc7
#define RT1318_INIT_R0_RECIPROCAL_SYN_R_7_0 0xddc8
#define RT1318_R0_COMPARE_FLAG_L 0xdb35
#define RT1318_R0_COMPARE_FLAG_R 0xdd35
#define RT1318_STP_INITIAL_RS_TEMP_H 0xdd93
#define RT1318_STP_INITIAL_RS_TEMP_L 0xdd94
/* RT1318 SDCA Control - function number */
#define FUNC_NUM_SMART_AMP 0x04
/* RT1318 SDCA entity */
#define RT1318_SDCA_ENT_PDE23 0x31
#define RT1318_SDCA_ENT_XU24 0x24
#define RT1318_SDCA_ENT_FU21 0x03
#define RT1318_SDCA_ENT_UDMPU21 0x02
#define RT1318_SDCA_ENT_CS21 0x21
#define RT1318_SDCA_ENT_SAPU 0x29
/* RT1318 SDCA control */
#define RT1318_SDCA_CTL_SAMPLE_FREQ_INDEX 0x10
#define RT1318_SDCA_CTL_REQ_POWER_STATE 0x01
#define RT1318_SDCA_CTL_FU_MUTE 0x01
#define RT1318_SDCA_CTL_FU_VOLUME 0x02
#define RT1318_SDCA_CTL_UDMPU_CLUSTER 0x10
#define RT1318_SDCA_CTL_SAPU_PROTECTION_MODE 0x10
#define RT1318_SDCA_CTL_SAPU_PROTECTION_STATUS 0x11
/* RT1318 SDCA channel */
#define CH_L 0x01
#define CH_R 0x02
/* sample frequency index */
#define RT1318_SDCA_RATE_16000HZ 0x04
#define RT1318_SDCA_RATE_32000HZ 0x07
#define RT1318_SDCA_RATE_44100HZ 0x08
#define RT1318_SDCA_RATE_48000HZ 0x09
#define RT1318_SDCA_RATE_96000HZ 0x0b
#define RT1318_SDCA_RATE_192000HZ 0x0d
struct rt1318_sdw_priv {
struct snd_soc_component *component;
struct regmap *regmap;
struct sdw_slave *sdw_slave;
enum sdw_slave_status status;
struct sdw_bus_params params;
bool hw_init;
bool first_hw_init;
};
struct sdw_stream_data {
struct sdw_stream_runtime *sdw_stream;
};
#endif /* __RT1318_SDW_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment