xref: /linux/sound/soc/qcom/lpass-sc7180.c (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
124caf8d9SAjit Pandey // SPDX-License-Identifier: GPL-2.0-only
224caf8d9SAjit Pandey /*
324caf8d9SAjit Pandey  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
424caf8d9SAjit Pandey  *
524caf8d9SAjit Pandey  * lpass-sc7180.c -- ALSA SoC platform-machine driver for QTi LPASS
624caf8d9SAjit Pandey  */
724caf8d9SAjit Pandey 
824caf8d9SAjit Pandey #include <linux/clk.h>
924caf8d9SAjit Pandey #include <linux/device.h>
1024caf8d9SAjit Pandey #include <linux/err.h>
1124caf8d9SAjit Pandey #include <linux/kernel.h>
1224caf8d9SAjit Pandey #include <linux/module.h>
1324caf8d9SAjit Pandey #include <linux/of.h>
1424caf8d9SAjit Pandey #include <linux/platform_device.h>
15a9392efaSClaudiu Beznea #include <linux/pm.h>
1624caf8d9SAjit Pandey #include <dt-bindings/sound/sc7180-lpass.h>
1724caf8d9SAjit Pandey #include <sound/pcm.h>
1824caf8d9SAjit Pandey #include <sound/soc.h>
1924caf8d9SAjit Pandey 
2024caf8d9SAjit Pandey #include "lpass-lpaif-reg.h"
2124caf8d9SAjit Pandey #include "lpass.h"
2224caf8d9SAjit Pandey 
2324caf8d9SAjit Pandey static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
24cd3484f7SSrinivas Kandagatla 	{
2524caf8d9SAjit Pandey 		.id = MI2S_PRIMARY,
2624caf8d9SAjit Pandey 		.name = "Primary MI2S",
2724caf8d9SAjit Pandey 		.playback = {
2824caf8d9SAjit Pandey 			.stream_name = "Primary Playback",
2924caf8d9SAjit Pandey 			.formats	= SNDRV_PCM_FMTBIT_S16,
3024caf8d9SAjit Pandey 			.rates = SNDRV_PCM_RATE_48000,
3124caf8d9SAjit Pandey 			.rate_min	= 48000,
3224caf8d9SAjit Pandey 			.rate_max	= 48000,
3324caf8d9SAjit Pandey 			.channels_min	= 2,
3424caf8d9SAjit Pandey 			.channels_max	= 2,
3524caf8d9SAjit Pandey 		},
3624caf8d9SAjit Pandey 		.capture = {
3724caf8d9SAjit Pandey 			.stream_name = "Primary Capture",
38313ebec4SV Sujith Kumar Reddy 			.formats = SNDRV_PCM_FMTBIT_S16 |
39313ebec4SV Sujith Kumar Reddy 				SNDRV_PCM_FMTBIT_S32,
4024caf8d9SAjit Pandey 			.rates = SNDRV_PCM_RATE_48000,
4124caf8d9SAjit Pandey 			.rate_min	= 48000,
4224caf8d9SAjit Pandey 			.rate_max	= 48000,
4324caf8d9SAjit Pandey 			.channels_min	= 2,
4424caf8d9SAjit Pandey 			.channels_max	= 2,
4524caf8d9SAjit Pandey 		},
4624caf8d9SAjit Pandey 		.ops    = &asoc_qcom_lpass_cpu_dai_ops,
47cd3484f7SSrinivas Kandagatla 	}, {
4824caf8d9SAjit Pandey 		.id = MI2S_SECONDARY,
4924caf8d9SAjit Pandey 		.name = "Secondary MI2S",
5024caf8d9SAjit Pandey 		.playback = {
5124caf8d9SAjit Pandey 			.stream_name = "Secondary Playback",
5224caf8d9SAjit Pandey 			.formats	= SNDRV_PCM_FMTBIT_S16,
5324caf8d9SAjit Pandey 			.rates = SNDRV_PCM_RATE_48000,
5424caf8d9SAjit Pandey 			.rate_min	= 48000,
5524caf8d9SAjit Pandey 			.rate_max	= 48000,
5624caf8d9SAjit Pandey 			.channels_min	= 2,
5724caf8d9SAjit Pandey 			.channels_max	= 2,
5824caf8d9SAjit Pandey 		},
59e4222bbdSKuninori Morimoto 		.ops    = &asoc_qcom_lpass_cpu_dai_ops2,
60cd3484f7SSrinivas Kandagatla 	}, {
612ad63dc8SV Sujith Kumar Reddy 		.id = LPASS_DP_RX,
622ad63dc8SV Sujith Kumar Reddy 		.name = "Hdmi",
632ad63dc8SV Sujith Kumar Reddy 		.playback = {
642ad63dc8SV Sujith Kumar Reddy 			.stream_name = "Hdmi Playback",
652ad63dc8SV Sujith Kumar Reddy 			.formats	= SNDRV_PCM_FMTBIT_S24,
662ad63dc8SV Sujith Kumar Reddy 			.rates = SNDRV_PCM_RATE_48000,
672ad63dc8SV Sujith Kumar Reddy 			.rate_min	= 48000,
682ad63dc8SV Sujith Kumar Reddy 			.rate_max	= 48000,
692ad63dc8SV Sujith Kumar Reddy 			.channels_min	= 2,
702ad63dc8SV Sujith Kumar Reddy 			.channels_max	= 2,
712ad63dc8SV Sujith Kumar Reddy 		},
722ad63dc8SV Sujith Kumar Reddy 		.ops    = &asoc_qcom_lpass_hdmi_dai_ops,
732ad63dc8SV Sujith Kumar Reddy 	},
7424caf8d9SAjit Pandey };
7524caf8d9SAjit Pandey 
sc7180_lpass_alloc_dma_channel(struct lpass_data * drvdata,int direction,unsigned int dai_id)7624caf8d9SAjit Pandey static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
772ad63dc8SV Sujith Kumar Reddy 					   int direction, unsigned int dai_id)
7824caf8d9SAjit Pandey {
79ec5236c2SRob Herring 	const struct lpass_variant *v = drvdata->variant;
8024caf8d9SAjit Pandey 	int chan = 0;
8124caf8d9SAjit Pandey 
822ad63dc8SV Sujith Kumar Reddy 	if (dai_id == LPASS_DP_RX) {
832ad63dc8SV Sujith Kumar Reddy 		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
842ad63dc8SV Sujith Kumar Reddy 			chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
852ad63dc8SV Sujith Kumar Reddy 						v->hdmi_rdma_channels);
862ad63dc8SV Sujith Kumar Reddy 
872ad63dc8SV Sujith Kumar Reddy 			if (chan >= v->hdmi_rdma_channels)
882ad63dc8SV Sujith Kumar Reddy 				return -EBUSY;
892ad63dc8SV Sujith Kumar Reddy 		}
902ad63dc8SV Sujith Kumar Reddy 		set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
912ad63dc8SV Sujith Kumar Reddy 	} else {
9224caf8d9SAjit Pandey 		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
9324caf8d9SAjit Pandey 			chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
9424caf8d9SAjit Pandey 						v->rdma_channels);
9524caf8d9SAjit Pandey 
9624caf8d9SAjit Pandey 			if (chan >= v->rdma_channels)
9724caf8d9SAjit Pandey 				return -EBUSY;
9824caf8d9SAjit Pandey 		} else {
9924caf8d9SAjit Pandey 			chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
10024caf8d9SAjit Pandey 					v->wrdma_channel_start +
10124caf8d9SAjit Pandey 					v->wrdma_channels,
10224caf8d9SAjit Pandey 					v->wrdma_channel_start);
10324caf8d9SAjit Pandey 
10424caf8d9SAjit Pandey 			if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
10524caf8d9SAjit Pandey 				return -EBUSY;
10624caf8d9SAjit Pandey 		}
10724caf8d9SAjit Pandey 
10824caf8d9SAjit Pandey 		set_bit(chan, &drvdata->dma_ch_bit_map);
1092ad63dc8SV Sujith Kumar Reddy 	}
11024caf8d9SAjit Pandey 	return chan;
11124caf8d9SAjit Pandey }
11224caf8d9SAjit Pandey 
sc7180_lpass_free_dma_channel(struct lpass_data * drvdata,int chan,unsigned int dai_id)1132ad63dc8SV Sujith Kumar Reddy static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, unsigned int dai_id)
11424caf8d9SAjit Pandey {
1152ad63dc8SV Sujith Kumar Reddy 	if (dai_id == LPASS_DP_RX)
1162ad63dc8SV Sujith Kumar Reddy 		clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
1172ad63dc8SV Sujith Kumar Reddy 	else
11824caf8d9SAjit Pandey 		clear_bit(chan, &drvdata->dma_ch_bit_map);
11924caf8d9SAjit Pandey 
12024caf8d9SAjit Pandey 	return 0;
12124caf8d9SAjit Pandey }
12224caf8d9SAjit Pandey 
sc7180_lpass_init(struct platform_device * pdev)12324caf8d9SAjit Pandey static int sc7180_lpass_init(struct platform_device *pdev)
12424caf8d9SAjit Pandey {
12524caf8d9SAjit Pandey 	struct lpass_data *drvdata = platform_get_drvdata(pdev);
126ec5236c2SRob Herring 	const struct lpass_variant *variant = drvdata->variant;
12724caf8d9SAjit Pandey 	struct device *dev = &pdev->dev;
12824caf8d9SAjit Pandey 	int ret, i;
12924caf8d9SAjit Pandey 
13024caf8d9SAjit Pandey 	drvdata->clks = devm_kcalloc(dev, variant->num_clks,
13124caf8d9SAjit Pandey 				     sizeof(*drvdata->clks), GFP_KERNEL);
1321bf5ee97SYuan Can 	if (!drvdata->clks)
1331bf5ee97SYuan Can 		return -ENOMEM;
1341bf5ee97SYuan Can 
13524caf8d9SAjit Pandey 	drvdata->num_clks = variant->num_clks;
13624caf8d9SAjit Pandey 
13724caf8d9SAjit Pandey 	for (i = 0; i < drvdata->num_clks; i++)
13824caf8d9SAjit Pandey 		drvdata->clks[i].id = variant->clk_name[i];
13924caf8d9SAjit Pandey 
14024caf8d9SAjit Pandey 	ret = devm_clk_bulk_get(dev, drvdata->num_clks, drvdata->clks);
14124caf8d9SAjit Pandey 	if (ret) {
14224caf8d9SAjit Pandey 		dev_err(dev, "Failed to get clocks %d\n", ret);
14324caf8d9SAjit Pandey 		return ret;
14424caf8d9SAjit Pandey 	}
14524caf8d9SAjit Pandey 
14624caf8d9SAjit Pandey 	ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
14724caf8d9SAjit Pandey 	if (ret) {
14824caf8d9SAjit Pandey 		dev_err(dev, "sc7180 clk_enable failed\n");
14924caf8d9SAjit Pandey 		return ret;
15024caf8d9SAjit Pandey 	}
15124caf8d9SAjit Pandey 
15224caf8d9SAjit Pandey 	return 0;
15324caf8d9SAjit Pandey }
15424caf8d9SAjit Pandey 
sc7180_lpass_exit(struct platform_device * pdev)15524caf8d9SAjit Pandey static int sc7180_lpass_exit(struct platform_device *pdev)
15624caf8d9SAjit Pandey {
15724caf8d9SAjit Pandey 	struct lpass_data *drvdata = platform_get_drvdata(pdev);
15824caf8d9SAjit Pandey 
15924caf8d9SAjit Pandey 	clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
16024caf8d9SAjit Pandey 	return 0;
16124caf8d9SAjit Pandey }
16224caf8d9SAjit Pandey 
sc7180_lpass_dev_resume(struct device * dev)163e8679db2SSrinivasa Rao Mandadapu static int __maybe_unused sc7180_lpass_dev_resume(struct device *dev)
1642d68148fSSrinivasa Rao Mandadapu {
1652d68148fSSrinivasa Rao Mandadapu 	struct lpass_data *drvdata = dev_get_drvdata(dev);
1662d68148fSSrinivasa Rao Mandadapu 
167863b9179SMatthias Kaehlcke 	return clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
1682d68148fSSrinivasa Rao Mandadapu }
1692d68148fSSrinivasa Rao Mandadapu 
sc7180_lpass_dev_suspend(struct device * dev)170e8679db2SSrinivasa Rao Mandadapu static int __maybe_unused sc7180_lpass_dev_suspend(struct device *dev)
1712d68148fSSrinivasa Rao Mandadapu {
1722d68148fSSrinivasa Rao Mandadapu 	struct lpass_data *drvdata = dev_get_drvdata(dev);
1732d68148fSSrinivasa Rao Mandadapu 
1742d68148fSSrinivasa Rao Mandadapu 	clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
1752d68148fSSrinivasa Rao Mandadapu 	return 0;
1762d68148fSSrinivasa Rao Mandadapu }
1772d68148fSSrinivasa Rao Mandadapu 
1782d68148fSSrinivasa Rao Mandadapu static const struct dev_pm_ops sc7180_lpass_pm_ops = {
1792d68148fSSrinivasa Rao Mandadapu 	SET_SYSTEM_SLEEP_PM_OPS(sc7180_lpass_dev_suspend, sc7180_lpass_dev_resume)
1802d68148fSSrinivasa Rao Mandadapu };
1812d68148fSSrinivasa Rao Mandadapu 
182ec5236c2SRob Herring static const struct lpass_variant sc7180_data = {
18324caf8d9SAjit Pandey 	.i2sctrl_reg_base	= 0x1000,
18424caf8d9SAjit Pandey 	.i2sctrl_reg_stride	= 0x1000,
18524caf8d9SAjit Pandey 	.i2s_ports		= 3,
18624caf8d9SAjit Pandey 	.irq_reg_base		= 0x9000,
18724caf8d9SAjit Pandey 	.irq_reg_stride		= 0x1000,
18824caf8d9SAjit Pandey 	.irq_ports		= 3,
18924caf8d9SAjit Pandey 	.rdma_reg_base		= 0xC000,
19024caf8d9SAjit Pandey 	.rdma_reg_stride	= 0x1000,
19124caf8d9SAjit Pandey 	.rdma_channels		= 5,
1922ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_reg_base		= 0x64000,
1932ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_reg_stride	= 0x1000,
194e681b1a6SSrinivasa Rao Mandadapu 	.hdmi_rdma_channels		= 4,
19524caf8d9SAjit Pandey 	.dmactl_audif_start	= 1,
19624caf8d9SAjit Pandey 	.wrdma_reg_base		= 0x18000,
19724caf8d9SAjit Pandey 	.wrdma_reg_stride	= 0x1000,
19824caf8d9SAjit Pandey 	.wrdma_channel_start	= 5,
19924caf8d9SAjit Pandey 	.wrdma_channels		= 4,
20024caf8d9SAjit Pandey 
20124caf8d9SAjit Pandey 	.loopback		= REG_FIELD_ID(0x1000, 17, 17, 3, 0x1000),
20224caf8d9SAjit Pandey 	.spken			= REG_FIELD_ID(0x1000, 16, 16, 3, 0x1000),
20324caf8d9SAjit Pandey 	.spkmode		= REG_FIELD_ID(0x1000, 11, 15, 3, 0x1000),
20424caf8d9SAjit Pandey 	.spkmono		= REG_FIELD_ID(0x1000, 10, 10, 3, 0x1000),
20524caf8d9SAjit Pandey 	.micen			= REG_FIELD_ID(0x1000, 9, 9, 3, 0x1000),
20624caf8d9SAjit Pandey 	.micmode		= REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
20724caf8d9SAjit Pandey 	.micmono		= REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
20824caf8d9SAjit Pandey 	.wssrc			= REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
209cf9d2198SV Sujith Kumar Reddy 	.bitwidth		= REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
21024caf8d9SAjit Pandey 
21124caf8d9SAjit Pandey 	.rdma_dyncclk		= REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
21224caf8d9SAjit Pandey 	.rdma_bursten		= REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
21324caf8d9SAjit Pandey 	.rdma_wpscnt		= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
21424caf8d9SAjit Pandey 	.rdma_intf			= REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
21524caf8d9SAjit Pandey 	.rdma_fifowm		= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
21624caf8d9SAjit Pandey 	.rdma_enable		= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
21724caf8d9SAjit Pandey 
21824caf8d9SAjit Pandey 	.wrdma_dyncclk		= REG_FIELD_ID(0x18000, 22, 22, 4, 0x1000),
21924caf8d9SAjit Pandey 	.wrdma_bursten		= REG_FIELD_ID(0x18000, 21, 21, 4, 0x1000),
22024caf8d9SAjit Pandey 	.wrdma_wpscnt		= REG_FIELD_ID(0x18000, 17, 20, 4, 0x1000),
22124caf8d9SAjit Pandey 	.wrdma_intf		= REG_FIELD_ID(0x18000, 12, 16, 4, 0x1000),
22224caf8d9SAjit Pandey 	.wrdma_fifowm		= REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
22324caf8d9SAjit Pandey 	.wrdma_enable		= REG_FIELD_ID(0x18000, 0, 0, 4, 0x1000),
22424caf8d9SAjit Pandey 
2252ad63dc8SV Sujith Kumar Reddy 	.hdmi_tx_ctl_addr	= 0x1000,
2262ad63dc8SV Sujith Kumar Reddy 	.hdmi_legacy_addr	= 0x1008,
2272ad63dc8SV Sujith Kumar Reddy 	.hdmi_vbit_addr		= 0x610c0,
2282ad63dc8SV Sujith Kumar Reddy 	.hdmi_ch_lsb_addr	= 0x61048,
2292ad63dc8SV Sujith Kumar Reddy 	.hdmi_ch_msb_addr	= 0x6104c,
2302ad63dc8SV Sujith Kumar Reddy 	.ch_stride		= 0x8,
2312ad63dc8SV Sujith Kumar Reddy 	.hdmi_parity_addr	= 0x61034,
2322ad63dc8SV Sujith Kumar Reddy 	.hdmi_dmactl_addr	= 0x61038,
2332ad63dc8SV Sujith Kumar Reddy 	.hdmi_dma_stride	= 0x4,
2342ad63dc8SV Sujith Kumar Reddy 	.hdmi_DP_addr		= 0x610c8,
2352ad63dc8SV Sujith Kumar Reddy 	.hdmi_sstream_addr	= 0x6101c,
2362ad63dc8SV Sujith Kumar Reddy 	.hdmi_irq_reg_base		= 0x63000,
2372ad63dc8SV Sujith Kumar Reddy 	.hdmi_irq_ports		= 1,
2382ad63dc8SV Sujith Kumar Reddy 
2392ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_dyncclk		= REG_FIELD_ID(0x64000, 14, 14, 4, 0x1000),
2402ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_bursten		= REG_FIELD_ID(0x64000, 13, 13, 4, 0x1000),
2412ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_burst8		= REG_FIELD_ID(0x64000, 15, 15, 4, 0x1000),
2422ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_burst16		= REG_FIELD_ID(0x64000, 16, 16, 4, 0x1000),
2432ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_dynburst		= REG_FIELD_ID(0x64000, 18, 18, 4, 0x1000),
2442ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_wpscnt		= REG_FIELD_ID(0x64000, 10, 12, 4, 0x1000),
2452ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_fifowm		= REG_FIELD_ID(0x64000, 1, 5, 4, 0x1000),
2462ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_enable		= REG_FIELD_ID(0x64000, 0, 0, 4, 0x1000),
2472ad63dc8SV Sujith Kumar Reddy 
2482ad63dc8SV Sujith Kumar Reddy 	.sstream_en		= REG_FIELD(0x6101c, 0, 0),
2492ad63dc8SV Sujith Kumar Reddy 	.dma_sel			= REG_FIELD(0x6101c, 1, 2),
2502ad63dc8SV Sujith Kumar Reddy 	.auto_bbit_en	= REG_FIELD(0x6101c, 3, 3),
2512ad63dc8SV Sujith Kumar Reddy 	.layout			= REG_FIELD(0x6101c, 4, 4),
2522ad63dc8SV Sujith Kumar Reddy 	.layout_sp		= REG_FIELD(0x6101c, 5, 8),
2532ad63dc8SV Sujith Kumar Reddy 	.set_sp_on_en	= REG_FIELD(0x6101c, 10, 10),
2542ad63dc8SV Sujith Kumar Reddy 	.dp_audio		= REG_FIELD(0x6101c, 11, 11),
2552ad63dc8SV Sujith Kumar Reddy 	.dp_staffing_en	= REG_FIELD(0x6101c, 12, 12),
2562ad63dc8SV Sujith Kumar Reddy 	.dp_sp_b_hw_en	= REG_FIELD(0x6101c, 13, 13),
2572ad63dc8SV Sujith Kumar Reddy 
2582ad63dc8SV Sujith Kumar Reddy 	.mute			= REG_FIELD(0x610c8, 0, 0),
2592ad63dc8SV Sujith Kumar Reddy 	.as_sdp_cc		= REG_FIELD(0x610c8, 1, 3),
2602ad63dc8SV Sujith Kumar Reddy 	.as_sdp_ct		= REG_FIELD(0x610c8, 4, 7),
2612ad63dc8SV Sujith Kumar Reddy 	.aif_db4			= REG_FIELD(0x610c8, 8, 15),
2622ad63dc8SV Sujith Kumar Reddy 	.frequency		= REG_FIELD(0x610c8, 16, 21),
2632ad63dc8SV Sujith Kumar Reddy 	.mst_index		= REG_FIELD(0x610c8, 28, 29),
2642ad63dc8SV Sujith Kumar Reddy 	.dptx_index		= REG_FIELD(0x610c8, 30, 31),
2652ad63dc8SV Sujith Kumar Reddy 
2662ad63dc8SV Sujith Kumar Reddy 	.soft_reset		= REG_FIELD(0x1000, 31, 31),
2672ad63dc8SV Sujith Kumar Reddy 	.force_reset	= REG_FIELD(0x1000, 30, 30),
2682ad63dc8SV Sujith Kumar Reddy 
2692ad63dc8SV Sujith Kumar Reddy 	.use_hw_chs		= REG_FIELD(0x61038, 0, 0),
2702ad63dc8SV Sujith Kumar Reddy 	.use_hw_usr		= REG_FIELD(0x61038, 1, 1),
2712ad63dc8SV Sujith Kumar Reddy 	.hw_chs_sel		= REG_FIELD(0x61038, 2, 4),
2722ad63dc8SV Sujith Kumar Reddy 	.hw_usr_sel		= REG_FIELD(0x61038, 5, 6),
2732ad63dc8SV Sujith Kumar Reddy 
2742ad63dc8SV Sujith Kumar Reddy 	.replace_vbit	= REG_FIELD(0x610c0, 0, 0),
2752ad63dc8SV Sujith Kumar Reddy 	.vbit_stream	= REG_FIELD(0x610c0, 1, 1),
2762ad63dc8SV Sujith Kumar Reddy 
2772ad63dc8SV Sujith Kumar Reddy 	.legacy_en		=  REG_FIELD(0x1008, 0, 0),
2782ad63dc8SV Sujith Kumar Reddy 	.calc_en		=  REG_FIELD(0x61034, 0, 0),
2792ad63dc8SV Sujith Kumar Reddy 	.lsb_bits		=  REG_FIELD(0x61048, 0, 31),
2802ad63dc8SV Sujith Kumar Reddy 	.msb_bits		=  REG_FIELD(0x6104c, 0, 31),
2812ad63dc8SV Sujith Kumar Reddy 
2822ad63dc8SV Sujith Kumar Reddy 
28324caf8d9SAjit Pandey 	.clk_name		= (const char*[]) {
28424caf8d9SAjit Pandey 				   "pcnoc-sway-clk",
28524caf8d9SAjit Pandey 				   "audio-core",
28624caf8d9SAjit Pandey 				   "pcnoc-mport-clk",
28724caf8d9SAjit Pandey 				},
28824caf8d9SAjit Pandey 	.num_clks		= 3,
28924caf8d9SAjit Pandey 	.dai_driver		= sc7180_lpass_cpu_dai_driver,
29024caf8d9SAjit Pandey 	.num_dai		= ARRAY_SIZE(sc7180_lpass_cpu_dai_driver),
29124caf8d9SAjit Pandey 	.dai_osr_clk_names      = (const char *[]) {
29224caf8d9SAjit Pandey 				   "mclk0",
29324caf8d9SAjit Pandey 				   "null",
29424caf8d9SAjit Pandey 				},
29524caf8d9SAjit Pandey 	.dai_bit_clk_names      = (const char *[]) {
29624caf8d9SAjit Pandey 				   "mi2s-bit-clk0",
29724caf8d9SAjit Pandey 				   "mi2s-bit-clk1",
29824caf8d9SAjit Pandey 				},
29924caf8d9SAjit Pandey 	.init			= sc7180_lpass_init,
30024caf8d9SAjit Pandey 	.exit			= sc7180_lpass_exit,
30124caf8d9SAjit Pandey 	.alloc_dma_channel	= sc7180_lpass_alloc_dma_channel,
30224caf8d9SAjit Pandey 	.free_dma_channel	= sc7180_lpass_free_dma_channel,
30324caf8d9SAjit Pandey };
30424caf8d9SAjit Pandey 
305377c7b7cSKrzysztof Kozlowski static const struct of_device_id sc7180_lpass_cpu_device_id[] __maybe_unused = {
30624caf8d9SAjit Pandey 	{.compatible = "qcom,sc7180-lpass-cpu", .data = &sc7180_data},
30724caf8d9SAjit Pandey 	{}
30824caf8d9SAjit Pandey };
309dcde34c4SDouglas Anderson MODULE_DEVICE_TABLE(of, sc7180_lpass_cpu_device_id);
31024caf8d9SAjit Pandey 
31124caf8d9SAjit Pandey static struct platform_driver sc7180_lpass_cpu_platform_driver = {
31224caf8d9SAjit Pandey 	.driver = {
31324caf8d9SAjit Pandey 		.name = "sc7180-lpass-cpu",
31424caf8d9SAjit Pandey 		.of_match_table = of_match_ptr(sc7180_lpass_cpu_device_id),
3152d68148fSSrinivasa Rao Mandadapu 		.pm = &sc7180_lpass_pm_ops,
31624caf8d9SAjit Pandey 	},
31724caf8d9SAjit Pandey 	.probe = asoc_qcom_lpass_cpu_platform_probe,
318*130af75bSUwe Kleine-König 	.remove = asoc_qcom_lpass_cpu_platform_remove,
31960a97386SV Sujith Kumar Reddy 	.shutdown = asoc_qcom_lpass_cpu_platform_shutdown,
32024caf8d9SAjit Pandey };
32124caf8d9SAjit Pandey 
32224caf8d9SAjit Pandey module_platform_driver(sc7180_lpass_cpu_platform_driver);
32324caf8d9SAjit Pandey 
32424caf8d9SAjit Pandey MODULE_DESCRIPTION("SC7180 LPASS CPU DRIVER");
325bb339245SKrzysztof Kozlowski MODULE_LICENSE("GPL");
326