162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci//
362306a36Sopenharmony_ci// Renesas R-Car Gen1 SRU/SSI support
462306a36Sopenharmony_ci//
562306a36Sopenharmony_ci// Copyright (C) 2013 Renesas Solutions Corp.
662306a36Sopenharmony_ci// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/*
962306a36Sopenharmony_ci * #define DEBUG
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * you can also add below in
1262306a36Sopenharmony_ci * ${LINUX}/drivers/base/regmap/regmap.c
1362306a36Sopenharmony_ci * for regmap debug
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * #define LOG_DEVICE "xxxx.rcar_sound"
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#include "rsnd.h"
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cistruct rsnd_gen {
2162306a36Sopenharmony_ci	struct rsnd_gen_ops *ops;
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	/* RSND_BASE_MAX base */
2462306a36Sopenharmony_ci	void __iomem *base[RSND_BASE_MAX];
2562306a36Sopenharmony_ci	phys_addr_t res[RSND_BASE_MAX];
2662306a36Sopenharmony_ci	struct regmap *regmap[RSND_BASE_MAX];
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	/* RSND_REG_MAX base */
2962306a36Sopenharmony_ci	struct regmap_field *regs[REG_MAX];
3062306a36Sopenharmony_ci	const char *reg_name[REG_MAX];
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define rsnd_priv_to_gen(p)	((struct rsnd_gen *)(p)->gen)
3462306a36Sopenharmony_ci#define rsnd_reg_name(gen, id)	((gen)->reg_name[id])
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cistruct rsnd_regmap_field_conf {
3762306a36Sopenharmony_ci	int idx;
3862306a36Sopenharmony_ci	unsigned int reg_offset;
3962306a36Sopenharmony_ci	unsigned int id_offset;
4062306a36Sopenharmony_ci	const char *reg_name;
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define RSND_REG_SET(id, offset, _id_offset, n)	\
4462306a36Sopenharmony_ci{						\
4562306a36Sopenharmony_ci	.idx = id,				\
4662306a36Sopenharmony_ci	.reg_offset = offset,			\
4762306a36Sopenharmony_ci	.id_offset = _id_offset,		\
4862306a36Sopenharmony_ci	.reg_name = n,				\
4962306a36Sopenharmony_ci}
5062306a36Sopenharmony_ci/* single address mapping */
5162306a36Sopenharmony_ci#define RSND_GEN_S_REG(id, offset)	\
5262306a36Sopenharmony_ci	RSND_REG_SET(id, offset, 0, #id)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* multi address mapping */
5562306a36Sopenharmony_ci#define RSND_GEN_M_REG(id, offset, _id_offset)	\
5662306a36Sopenharmony_ci	RSND_REG_SET(id, offset, _id_offset, #id)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/*
5962306a36Sopenharmony_ci *		basic function
6062306a36Sopenharmony_ci */
6162306a36Sopenharmony_cistatic int rsnd_is_accessible_reg(struct rsnd_priv *priv,
6262306a36Sopenharmony_ci				  struct rsnd_gen *gen, enum rsnd_reg reg)
6362306a36Sopenharmony_ci{
6462306a36Sopenharmony_ci	if (!gen->regs[reg]) {
6562306a36Sopenharmony_ci		struct device *dev = rsnd_priv_to_dev(priv);
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci		dev_err(dev, "unsupported register access %x\n", reg);
6862306a36Sopenharmony_ci		return 0;
6962306a36Sopenharmony_ci	}
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	return 1;
7262306a36Sopenharmony_ci}
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistatic int rsnd_mod_id_cmd(struct rsnd_mod *mod)
7562306a36Sopenharmony_ci{
7662306a36Sopenharmony_ci	if (mod->ops->id_cmd)
7762306a36Sopenharmony_ci		return mod->ops->id_cmd(mod);
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci	return rsnd_mod_id(mod);
8062306a36Sopenharmony_ci}
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ciu32 rsnd_mod_read(struct rsnd_mod *mod, enum rsnd_reg reg)
8362306a36Sopenharmony_ci{
8462306a36Sopenharmony_ci	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
8562306a36Sopenharmony_ci	struct device *dev = rsnd_priv_to_dev(priv);
8662306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
8762306a36Sopenharmony_ci	u32 val;
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	if (!rsnd_is_accessible_reg(priv, gen, reg))
9062306a36Sopenharmony_ci		return 0;
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	regmap_fields_read(gen->regs[reg], rsnd_mod_id_cmd(mod), &val);
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci	dev_dbg(dev, "r %s - %-18s (%4d) : %08x\n",
9562306a36Sopenharmony_ci		rsnd_mod_name(mod),
9662306a36Sopenharmony_ci		rsnd_reg_name(gen, reg), reg, val);
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	return val;
9962306a36Sopenharmony_ci}
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_civoid rsnd_mod_write(struct rsnd_mod *mod,
10262306a36Sopenharmony_ci		    enum rsnd_reg reg, u32 data)
10362306a36Sopenharmony_ci{
10462306a36Sopenharmony_ci	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
10562306a36Sopenharmony_ci	struct device *dev = rsnd_priv_to_dev(priv);
10662306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci	if (!rsnd_is_accessible_reg(priv, gen, reg))
10962306a36Sopenharmony_ci		return;
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	regmap_fields_force_write(gen->regs[reg], rsnd_mod_id_cmd(mod), data);
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci	dev_dbg(dev, "w %s - %-18s (%4d) : %08x\n",
11462306a36Sopenharmony_ci		rsnd_mod_name(mod),
11562306a36Sopenharmony_ci		rsnd_reg_name(gen, reg), reg, data);
11662306a36Sopenharmony_ci}
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_civoid rsnd_mod_bset(struct rsnd_mod *mod,
11962306a36Sopenharmony_ci		   enum rsnd_reg reg, u32 mask, u32 data)
12062306a36Sopenharmony_ci{
12162306a36Sopenharmony_ci	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
12262306a36Sopenharmony_ci	struct device *dev = rsnd_priv_to_dev(priv);
12362306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci	if (!rsnd_is_accessible_reg(priv, gen, reg))
12662306a36Sopenharmony_ci		return;
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci	regmap_fields_force_update_bits(gen->regs[reg],
12962306a36Sopenharmony_ci					rsnd_mod_id_cmd(mod), mask, data);
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci	dev_dbg(dev, "b %s - %-18s (%4d) : %08x/%08x\n",
13262306a36Sopenharmony_ci		rsnd_mod_name(mod),
13362306a36Sopenharmony_ci		rsnd_reg_name(gen, reg), reg, data, mask);
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci}
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciphys_addr_t rsnd_gen_get_phy_addr(struct rsnd_priv *priv, int reg_id)
13862306a36Sopenharmony_ci{
13962306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	return	gen->res[reg_id];
14262306a36Sopenharmony_ci}
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#ifdef CONFIG_DEBUG_FS
14562306a36Sopenharmony_civoid __iomem *rsnd_gen_get_base_addr(struct rsnd_priv *priv, int reg_id)
14662306a36Sopenharmony_ci{
14762306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci	return	gen->base[reg_id];
15062306a36Sopenharmony_ci}
15162306a36Sopenharmony_ci#endif
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define rsnd_gen_regmap_init(priv, id_size, reg_id, name, conf)		\
15462306a36Sopenharmony_ci	_rsnd_gen_regmap_init(priv, id_size, reg_id, name, conf, ARRAY_SIZE(conf))
15562306a36Sopenharmony_cistatic int _rsnd_gen_regmap_init(struct rsnd_priv *priv,
15662306a36Sopenharmony_ci				 int id_size,
15762306a36Sopenharmony_ci				 int reg_id,
15862306a36Sopenharmony_ci				 const char *name,
15962306a36Sopenharmony_ci				 const struct rsnd_regmap_field_conf *conf,
16062306a36Sopenharmony_ci				 int conf_size)
16162306a36Sopenharmony_ci{
16262306a36Sopenharmony_ci	struct platform_device *pdev = rsnd_priv_to_pdev(priv);
16362306a36Sopenharmony_ci	struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
16462306a36Sopenharmony_ci	struct device *dev = rsnd_priv_to_dev(priv);
16562306a36Sopenharmony_ci	struct resource *res;
16662306a36Sopenharmony_ci	struct regmap_config regc;
16762306a36Sopenharmony_ci	struct regmap_field *regs;
16862306a36Sopenharmony_ci	struct regmap *regmap;
16962306a36Sopenharmony_ci	struct reg_field regf;
17062306a36Sopenharmony_ci	void __iomem *base;
17162306a36Sopenharmony_ci	int i;
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci	memset(&regc, 0, sizeof(regc));
17462306a36Sopenharmony_ci	regc.reg_bits = 32;
17562306a36Sopenharmony_ci	regc.val_bits = 32;
17662306a36Sopenharmony_ci	regc.reg_stride = 4;
17762306a36Sopenharmony_ci	regc.name = name;
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
18062306a36Sopenharmony_ci	if (!res)
18162306a36Sopenharmony_ci		res = platform_get_resource(pdev, IORESOURCE_MEM, reg_id);
18262306a36Sopenharmony_ci	if (!res)
18362306a36Sopenharmony_ci		return -ENODEV;
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci	base = devm_ioremap_resource(dev, res);
18662306a36Sopenharmony_ci	if (IS_ERR(base))
18762306a36Sopenharmony_ci		return PTR_ERR(base);
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci	regmap = devm_regmap_init_mmio(dev, base, &regc);
19062306a36Sopenharmony_ci	if (IS_ERR(regmap))
19162306a36Sopenharmony_ci		return PTR_ERR(regmap);
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	/* RSND_BASE_MAX base */
19462306a36Sopenharmony_ci	gen->base[reg_id] = base;
19562306a36Sopenharmony_ci	gen->regmap[reg_id] = regmap;
19662306a36Sopenharmony_ci	gen->res[reg_id] = res->start;
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci	for (i = 0; i < conf_size; i++) {
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci		regf.reg	= conf[i].reg_offset;
20162306a36Sopenharmony_ci		regf.id_offset	= conf[i].id_offset;
20262306a36Sopenharmony_ci		regf.lsb	= 0;
20362306a36Sopenharmony_ci		regf.msb	= 31;
20462306a36Sopenharmony_ci		regf.id_size	= id_size;
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci		regs = devm_regmap_field_alloc(dev, regmap, regf);
20762306a36Sopenharmony_ci		if (IS_ERR(regs))
20862306a36Sopenharmony_ci			return PTR_ERR(regs);
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci		/* RSND_REG_MAX base */
21162306a36Sopenharmony_ci		gen->regs[conf[i].idx] = regs;
21262306a36Sopenharmony_ci		gen->reg_name[conf[i].idx] = conf[i].reg_name;
21362306a36Sopenharmony_ci	}
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci	return 0;
21662306a36Sopenharmony_ci}
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/*
21962306a36Sopenharmony_ci *		Gen4
22062306a36Sopenharmony_ci */
22162306a36Sopenharmony_cistatic int rsnd_gen4_probe(struct rsnd_priv *priv)
22262306a36Sopenharmony_ci{
22362306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_ssiu[] = {
22462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0,	0x850),
22562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2,	0x858),
22662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4,	0x890),
22762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6,	0x898),
22862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS0,		0x840),
22962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS2,		0x848),
23062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS4,		0x880),
23162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS6,		0x888),
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF0_MODE,		0x0),
23462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF0_ADINR,	0x4),
23562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF0_DALIGN,	0x8),
23662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF1_MODE,		0x20),
23762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF1_ADINR,	0x24),
23862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF1_DALIGN,	0x28),
23962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF2_MODE,		0x40),
24062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF2_ADINR,	0x44),
24162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF2_DALIGN,	0x48),
24262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF3_MODE,		0x60),
24362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF3_ADINR,	0x64),
24462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF3_DALIGN,	0x68),
24562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF4_MODE,		0x500),
24662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF4_ADINR,	0x504),
24762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF4_DALIGN,	0x508),
24862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF5_MODE,		0x520),
24962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF5_ADINR,	0x524),
25062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF5_DALIGN,	0x528),
25162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF6_MODE,		0x540),
25262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF6_ADINR,	0x544),
25362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF6_DALIGN,	0x548),
25462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF7_MODE,		0x560),
25562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF7_ADINR,	0x564),
25662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_BUSIF7_DALIGN,	0x568),
25762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_CTRL,		0x010),
25862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_INT_ENABLE,		0x018),
25962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_MODE,		0x00c),
26062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_MODE2,		0xa0c),
26162306a36Sopenharmony_ci	};
26262306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_adg[] = {
26362306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRA,			0x00),
26462306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRB,			0x04),
26562306a36Sopenharmony_ci		RSND_GEN_S_REG(BRGCKR,			0x08),
26662306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL0,		0x0c),
26762306a36Sopenharmony_ci	};
26862306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_ssi[] = {
26962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSICR,			0x00),
27062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSISR,			0x04),
27162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSITDR,			0x08),
27262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSIRDR,			0x0c),
27362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSIWSR,			0x20),
27462306a36Sopenharmony_ci	};
27562306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_sdmc[] = {
27662306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF,		0x0, 0x8000),
27762306a36Sopenharmony_ci	};
27862306a36Sopenharmony_ci	int ret_adg  = rsnd_gen_regmap_init(priv, 10, RSND_GEN4_ADG,  "adg",  conf_adg);
27962306a36Sopenharmony_ci	int ret_ssiu = rsnd_gen_regmap_init(priv, 10, RSND_GEN4_SSIU, "ssiu", conf_ssiu);
28062306a36Sopenharmony_ci	int ret_ssi  = rsnd_gen_regmap_init(priv, 10, RSND_GEN4_SSI,  "ssi",  conf_ssi);
28162306a36Sopenharmony_ci	int ret_sdmc = rsnd_gen_regmap_init(priv, 10, RSND_GEN4_SDMC, "sdmc", conf_sdmc);
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci	return ret_adg | ret_ssiu | ret_ssi | ret_sdmc;
28462306a36Sopenharmony_ci}
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci/*
28762306a36Sopenharmony_ci *		Gen2
28862306a36Sopenharmony_ci */
28962306a36Sopenharmony_cistatic int rsnd_gen2_probe(struct rsnd_priv *priv)
29062306a36Sopenharmony_ci{
29162306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_ssiu[] = {
29262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_MODE0,	0x800),
29362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_MODE1,	0x804),
29462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_MODE2,	0x808),
29562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_CONTROL,	0x810),
29662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS0,	0x840),
29762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS1,	0x844),
29862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS2,	0x848),
29962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS3,	0x84c),
30062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS4,	0x880),
30162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS5,	0x884),
30262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS6,	0x888),
30362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_STATUS7,	0x88c),
30462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850),
30562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854),
30662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858),
30762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c),
30862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4, 0x890),
30962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE5, 0x894),
31062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6, 0x898),
31162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI_SYS_INT_ENABLE7, 0x89c),
31262306a36Sopenharmony_ci		RSND_GEN_S_REG(HDMI0_SEL,	0x9e0),
31362306a36Sopenharmony_ci		RSND_GEN_S_REG(HDMI1_SEL,	0x9e4),
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci		/* FIXME: it needs SSI_MODE2/3 in the future */
31662306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF0_MODE,		0x0,	0x80),
31762306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF0_ADINR,	0x4,	0x80),
31862306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF0_DALIGN,	0x8,	0x80),
31962306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF1_MODE,		0x20,	0x80),
32062306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF1_ADINR,	0x24,	0x80),
32162306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF1_DALIGN,	0x28,	0x80),
32262306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF2_MODE,		0x40,	0x80),
32362306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF2_ADINR,	0x44,	0x80),
32462306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF2_DALIGN,	0x48,	0x80),
32562306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF3_MODE,		0x60,	0x80),
32662306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF3_ADINR,	0x64,	0x80),
32762306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF3_DALIGN,	0x68,	0x80),
32862306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF4_MODE,		0x500,	0x80),
32962306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF4_ADINR,	0x504,	0x80),
33062306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF4_DALIGN,	0x508,	0x80),
33162306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF5_MODE,		0x520,	0x80),
33262306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF5_ADINR,	0x524,	0x80),
33362306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF5_DALIGN,	0x528,	0x80),
33462306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF6_MODE,		0x540,	0x80),
33562306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF6_ADINR,	0x544,	0x80),
33662306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF6_DALIGN,	0x548,	0x80),
33762306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF7_MODE,		0x560,	0x80),
33862306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF7_ADINR,	0x564,	0x80),
33962306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_BUSIF7_DALIGN,	0x568,	0x80),
34062306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_MODE,		0xc,	0x80),
34162306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_CTRL,		0x10,	0x80),
34262306a36Sopenharmony_ci		RSND_GEN_M_REG(SSI_INT_ENABLE,		0x18,	0x80),
34362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF0_MODE,	0x48c),
34462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF0_ADINR,	0x484),
34562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF0_DALIGN,	0x488),
34662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF1_MODE,	0x4a0),
34762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF1_ADINR,	0x4a4),
34862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF1_DALIGN,	0x4a8),
34962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF2_MODE,	0x4c0),
35062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF2_ADINR,	0x4c4),
35162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF2_DALIGN,	0x4c8),
35262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF3_MODE,	0x4e0),
35362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF3_ADINR,	0x4e4),
35462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF3_DALIGN,	0x4e8),
35562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF4_MODE,	0xd80),
35662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF4_ADINR,	0xd84),
35762306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF4_DALIGN,	0xd88),
35862306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF5_MODE,	0xda0),
35962306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF5_ADINR,	0xda4),
36062306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF5_DALIGN,	0xda8),
36162306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF6_MODE,	0xdc0),
36262306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF6_ADINR,	0xdc4),
36362306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF6_DALIGN,	0xdc8),
36462306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF7_MODE,	0xde0),
36562306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF7_ADINR,	0xde4),
36662306a36Sopenharmony_ci		RSND_GEN_S_REG(SSI9_BUSIF7_DALIGN,	0xde8),
36762306a36Sopenharmony_ci	};
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_scu[] = {
37062306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_I_BUSIF_MODE,0x0,	0x20),
37162306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_O_BUSIF_MODE,0x4,	0x20),
37262306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_BUSIF_DALIGN,0x8,	0x20),
37362306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_ROUTE_MODE0,	0xc,	0x20),
37462306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_CTRL,	0x10,	0x20),
37562306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_INT_ENABLE0,	0x18,	0x20),
37662306a36Sopenharmony_ci		RSND_GEN_M_REG(CMD_BUSIF_MODE,	0x184,	0x20),
37762306a36Sopenharmony_ci		RSND_GEN_M_REG(CMD_BUSIF_DALIGN,0x188,	0x20),
37862306a36Sopenharmony_ci		RSND_GEN_M_REG(CMD_ROUTE_SLCT,	0x18c,	0x20),
37962306a36Sopenharmony_ci		RSND_GEN_M_REG(CMD_CTRL,	0x190,	0x20),
38062306a36Sopenharmony_ci		RSND_GEN_S_REG(SCU_SYS_STATUS0,	0x1c8),
38162306a36Sopenharmony_ci		RSND_GEN_S_REG(SCU_SYS_INT_EN0,	0x1cc),
38262306a36Sopenharmony_ci		RSND_GEN_S_REG(SCU_SYS_STATUS1,	0x1d0),
38362306a36Sopenharmony_ci		RSND_GEN_S_REG(SCU_SYS_INT_EN1,	0x1d4),
38462306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_SWRSR,	0x200,	0x40),
38562306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_SRCIR,	0x204,	0x40),
38662306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_ADINR,	0x214,	0x40),
38762306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_IFSCR,	0x21c,	0x40),
38862306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_IFSVR,	0x220,	0x40),
38962306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_SRCCR,	0x224,	0x40),
39062306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_BSDSR,	0x22c,	0x40),
39162306a36Sopenharmony_ci		RSND_GEN_M_REG(SRC_BSISR,	0x238,	0x40),
39262306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SWRSR,	0x500,	0x100),
39362306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_CTUIR,	0x504,	0x100),
39462306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_ADINR,	0x508,	0x100),
39562306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_CPMDR,	0x510,	0x100),
39662306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SCMDR,	0x514,	0x100),
39762306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV00R,	0x518,	0x100),
39862306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV01R,	0x51c,	0x100),
39962306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV02R,	0x520,	0x100),
40062306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV03R,	0x524,	0x100),
40162306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV04R,	0x528,	0x100),
40262306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV05R,	0x52c,	0x100),
40362306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV06R,	0x530,	0x100),
40462306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV07R,	0x534,	0x100),
40562306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV10R,	0x538,	0x100),
40662306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV11R,	0x53c,	0x100),
40762306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV12R,	0x540,	0x100),
40862306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV13R,	0x544,	0x100),
40962306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV14R,	0x548,	0x100),
41062306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV15R,	0x54c,	0x100),
41162306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV16R,	0x550,	0x100),
41262306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV17R,	0x554,	0x100),
41362306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV20R,	0x558,	0x100),
41462306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV21R,	0x55c,	0x100),
41562306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV22R,	0x560,	0x100),
41662306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV23R,	0x564,	0x100),
41762306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV24R,	0x568,	0x100),
41862306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV25R,	0x56c,	0x100),
41962306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV26R,	0x570,	0x100),
42062306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV27R,	0x574,	0x100),
42162306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV30R,	0x578,	0x100),
42262306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV31R,	0x57c,	0x100),
42362306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV32R,	0x580,	0x100),
42462306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV33R,	0x584,	0x100),
42562306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV34R,	0x588,	0x100),
42662306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV35R,	0x58c,	0x100),
42762306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV36R,	0x590,	0x100),
42862306a36Sopenharmony_ci		RSND_GEN_M_REG(CTU_SV37R,	0x594,	0x100),
42962306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_SWRSR,	0xd00,	0x40),
43062306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MIXIR,	0xd04,	0x40),
43162306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_ADINR,	0xd08,	0x40),
43262306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MIXMR,	0xd10,	0x40),
43362306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MVPDR,	0xd14,	0x40),
43462306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MDBAR,	0xd18,	0x40),
43562306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MDBBR,	0xd1c,	0x40),
43662306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MDBCR,	0xd20,	0x40),
43762306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MDBDR,	0xd24,	0x40),
43862306a36Sopenharmony_ci		RSND_GEN_M_REG(MIX_MDBER,	0xd28,	0x40),
43962306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_SWRSR,	0xe00,	0x100),
44062306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_DVUIR,	0xe04,	0x100),
44162306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_ADINR,	0xe08,	0x100),
44262306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_DVUCR,	0xe10,	0x100),
44362306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_ZCMCR,	0xe14,	0x100),
44462306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VRCTR,	0xe18,	0x100),
44562306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VRPDR,	0xe1c,	0x100),
44662306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VRDBR,	0xe20,	0x100),
44762306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL0R,	0xe28,	0x100),
44862306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL1R,	0xe2c,	0x100),
44962306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL2R,	0xe30,	0x100),
45062306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL3R,	0xe34,	0x100),
45162306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL4R,	0xe38,	0x100),
45262306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL5R,	0xe3c,	0x100),
45362306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL6R,	0xe40,	0x100),
45462306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_VOL7R,	0xe44,	0x100),
45562306a36Sopenharmony_ci		RSND_GEN_M_REG(DVC_DVUER,	0xe48,	0x100),
45662306a36Sopenharmony_ci	};
45762306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_adg[] = {
45862306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRA,		0x00),
45962306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRB,		0x04),
46062306a36Sopenharmony_ci		RSND_GEN_S_REG(BRGCKR,		0x08),
46162306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL0,	0x0c),
46262306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL1,	0x10),
46362306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL2,	0x14),
46462306a36Sopenharmony_ci		RSND_GEN_S_REG(DIV_EN,		0x30),
46562306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCIN_TIMSEL0,	0x34),
46662306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCIN_TIMSEL1,	0x38),
46762306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCIN_TIMSEL2,	0x3c),
46862306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCIN_TIMSEL3,	0x40),
46962306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCIN_TIMSEL4,	0x44),
47062306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCOUT_TIMSEL0,	0x48),
47162306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCOUT_TIMSEL1,	0x4c),
47262306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCOUT_TIMSEL2,	0x50),
47362306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCOUT_TIMSEL3,	0x54),
47462306a36Sopenharmony_ci		RSND_GEN_S_REG(SRCOUT_TIMSEL4,	0x58),
47562306a36Sopenharmony_ci		RSND_GEN_S_REG(CMDOUT_TIMSEL,	0x5c),
47662306a36Sopenharmony_ci	};
47762306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_ssi[] = {
47862306a36Sopenharmony_ci		RSND_GEN_M_REG(SSICR,		0x00,	0x40),
47962306a36Sopenharmony_ci		RSND_GEN_M_REG(SSISR,		0x04,	0x40),
48062306a36Sopenharmony_ci		RSND_GEN_M_REG(SSITDR,		0x08,	0x40),
48162306a36Sopenharmony_ci		RSND_GEN_M_REG(SSIRDR,		0x0c,	0x40),
48262306a36Sopenharmony_ci		RSND_GEN_M_REG(SSIWSR,		0x20,	0x40),
48362306a36Sopenharmony_ci	};
48462306a36Sopenharmony_ci	int ret_ssiu;
48562306a36Sopenharmony_ci	int ret_scu;
48662306a36Sopenharmony_ci	int ret_adg;
48762306a36Sopenharmony_ci	int ret_ssi;
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ci	ret_ssiu = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSIU, "ssiu", conf_ssiu);
49062306a36Sopenharmony_ci	ret_scu  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SCU,  "scu",  conf_scu);
49162306a36Sopenharmony_ci	ret_adg  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_ADG,  "adg",  conf_adg);
49262306a36Sopenharmony_ci	ret_ssi  = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSI,  "ssi",  conf_ssi);
49362306a36Sopenharmony_ci	if (ret_ssiu < 0 ||
49462306a36Sopenharmony_ci	    ret_scu  < 0 ||
49562306a36Sopenharmony_ci	    ret_adg  < 0 ||
49662306a36Sopenharmony_ci	    ret_ssi  < 0)
49762306a36Sopenharmony_ci		return ret_ssiu | ret_scu | ret_adg | ret_ssi;
49862306a36Sopenharmony_ci
49962306a36Sopenharmony_ci	return 0;
50062306a36Sopenharmony_ci}
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci/*
50362306a36Sopenharmony_ci *		Gen1
50462306a36Sopenharmony_ci */
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_cistatic int rsnd_gen1_probe(struct rsnd_priv *priv)
50762306a36Sopenharmony_ci{
50862306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_adg[] = {
50962306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRA,		0x00),
51062306a36Sopenharmony_ci		RSND_GEN_S_REG(BRRB,		0x04),
51162306a36Sopenharmony_ci		RSND_GEN_S_REG(BRGCKR,		0x08),
51262306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL0,	0x0c),
51362306a36Sopenharmony_ci		RSND_GEN_S_REG(AUDIO_CLK_SEL1,	0x10),
51462306a36Sopenharmony_ci	};
51562306a36Sopenharmony_ci	static const struct rsnd_regmap_field_conf conf_ssi[] = {
51662306a36Sopenharmony_ci		RSND_GEN_M_REG(SSICR,		0x00,	0x40),
51762306a36Sopenharmony_ci		RSND_GEN_M_REG(SSISR,		0x04,	0x40),
51862306a36Sopenharmony_ci		RSND_GEN_M_REG(SSITDR,		0x08,	0x40),
51962306a36Sopenharmony_ci		RSND_GEN_M_REG(SSIRDR,		0x0c,	0x40),
52062306a36Sopenharmony_ci		RSND_GEN_M_REG(SSIWSR,		0x20,	0x40),
52162306a36Sopenharmony_ci	};
52262306a36Sopenharmony_ci	int ret_adg;
52362306a36Sopenharmony_ci	int ret_ssi;
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci	ret_adg  = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_ADG, "adg", conf_adg);
52662306a36Sopenharmony_ci	ret_ssi  = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_SSI, "ssi", conf_ssi);
52762306a36Sopenharmony_ci	if (ret_adg  < 0 ||
52862306a36Sopenharmony_ci	    ret_ssi  < 0)
52962306a36Sopenharmony_ci		return ret_adg | ret_ssi;
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci	return 0;
53262306a36Sopenharmony_ci}
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_ci/*
53562306a36Sopenharmony_ci *		Gen
53662306a36Sopenharmony_ci */
53762306a36Sopenharmony_ciint rsnd_gen_probe(struct rsnd_priv *priv)
53862306a36Sopenharmony_ci{
53962306a36Sopenharmony_ci	struct device *dev = rsnd_priv_to_dev(priv);
54062306a36Sopenharmony_ci	struct rsnd_gen *gen;
54162306a36Sopenharmony_ci	int ret;
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci	gen = devm_kzalloc(dev, sizeof(*gen), GFP_KERNEL);
54462306a36Sopenharmony_ci	if (!gen)
54562306a36Sopenharmony_ci		return -ENOMEM;
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci	priv->gen = gen;
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci	ret = -ENODEV;
55062306a36Sopenharmony_ci	if (rsnd_is_gen1(priv))
55162306a36Sopenharmony_ci		ret = rsnd_gen1_probe(priv);
55262306a36Sopenharmony_ci	else if (rsnd_is_gen2(priv) ||
55362306a36Sopenharmony_ci		 rsnd_is_gen3(priv))
55462306a36Sopenharmony_ci		ret = rsnd_gen2_probe(priv);
55562306a36Sopenharmony_ci	else if (rsnd_is_gen4(priv))
55662306a36Sopenharmony_ci		ret = rsnd_gen4_probe(priv);
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci	if (ret < 0)
55962306a36Sopenharmony_ci		dev_err(dev, "unknown generation R-Car sound device\n");
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci	return ret;
56262306a36Sopenharmony_ci}
563