1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * rt1316-sdw.h -- RT1316 SDCA ALSA SoC audio driver header
4 *
5 * Copyright(c) 2021 Realtek Semiconductor Corp.
6 */
7
8#ifndef __RT1316_SDW_H__
9#define __RT1316_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/* RT1316 SDCA Control - function number */
18#define FUNC_NUM_SMART_AMP 0x04
19
20/* RT1316 SDCA entity */
21#define RT1316_SDCA_ENT_PDE23 0x31
22#define RT1316_SDCA_ENT_PDE27 0x32
23#define RT1316_SDCA_ENT_PDE22 0x33
24#define RT1316_SDCA_ENT_PDE24 0x34
25#define RT1316_SDCA_ENT_XU24 0x24
26#define RT1316_SDCA_ENT_FU21 0x03
27#define RT1316_SDCA_ENT_UDMPU21 0x02
28
29/* RT1316 SDCA control */
30#define RT1316_SDCA_CTL_SAMPLE_FREQ_INDEX 0x10
31#define RT1316_SDCA_CTL_REQ_POWER_STATE 0x01
32#define RT1316_SDCA_CTL_BYPASS 0x01
33#define RT1316_SDCA_CTL_FU_MUTE 0x01
34#define RT1316_SDCA_CTL_FU_VOLUME 0x02
35#define RT1316_SDCA_CTL_UDMPU_CLUSTER 0x10
36
37/* RT1316 SDCA channel */
38#define CH_L 0x01
39#define CH_R 0x02
40
41struct rt1316_sdw_priv {
42 struct snd_soc_component *component;
43 struct regmap *regmap;
44 struct sdw_slave *sdw_slave;
45 struct sdw_bus_params params;
46 bool hw_init;
47 bool first_hw_init;
48 unsigned char *bq_params;
49 unsigned int bq_params_cnt;
50};
51
52#endif /* __RT1316_SDW_H__ */
53

source code of linux/sound/soc/codecs/rt1316-sdw.h