xref: /linux/sound/soc/qcom/lpass-sc7180.c (revision a9392efae9f5de42673cfc1b81ac6fb88bdb26b2)
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>
15*a9392efaSClaudiu 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 		.probe	= &asoc_qcom_lpass_cpu_dai_probe,
4724caf8d9SAjit Pandey 		.ops    = &asoc_qcom_lpass_cpu_dai_ops,
48cd3484f7SSrinivas Kandagatla 	}, {
4924caf8d9SAjit Pandey 		.id = MI2S_SECONDARY,
5024caf8d9SAjit Pandey 		.name = "Secondary MI2S",
5124caf8d9SAjit Pandey 		.playback = {
5224caf8d9SAjit Pandey 			.stream_name = "Secondary Playback",
5324caf8d9SAjit Pandey 			.formats	= SNDRV_PCM_FMTBIT_S16,
5424caf8d9SAjit Pandey 			.rates = SNDRV_PCM_RATE_48000,
5524caf8d9SAjit Pandey 			.rate_min	= 48000,
5624caf8d9SAjit Pandey 			.rate_max	= 48000,
5724caf8d9SAjit Pandey 			.channels_min	= 2,
5824caf8d9SAjit Pandey 			.channels_max	= 2,
5924caf8d9SAjit Pandey 		},
6024caf8d9SAjit Pandey 		.probe	= &asoc_qcom_lpass_cpu_dai_probe,
6124caf8d9SAjit Pandey 		.ops    = &asoc_qcom_lpass_cpu_dai_ops,
62c223f41cSSrinivasa Rao Mandadapu 		.pcm_new = lpass_cpu_pcm_new,
63cd3484f7SSrinivas Kandagatla 	}, {
642ad63dc8SV Sujith Kumar Reddy 		.id = LPASS_DP_RX,
652ad63dc8SV Sujith Kumar Reddy 		.name = "Hdmi",
662ad63dc8SV Sujith Kumar Reddy 		.playback = {
672ad63dc8SV Sujith Kumar Reddy 			.stream_name = "Hdmi Playback",
682ad63dc8SV Sujith Kumar Reddy 			.formats	= SNDRV_PCM_FMTBIT_S24,
692ad63dc8SV Sujith Kumar Reddy 			.rates = SNDRV_PCM_RATE_48000,
702ad63dc8SV Sujith Kumar Reddy 			.rate_min	= 48000,
712ad63dc8SV Sujith Kumar Reddy 			.rate_max	= 48000,
722ad63dc8SV Sujith Kumar Reddy 			.channels_min	= 2,
732ad63dc8SV Sujith Kumar Reddy 			.channels_max	= 2,
742ad63dc8SV Sujith Kumar Reddy 		},
752ad63dc8SV Sujith Kumar Reddy 		.ops    = &asoc_qcom_lpass_hdmi_dai_ops,
762ad63dc8SV Sujith Kumar Reddy 	},
7724caf8d9SAjit Pandey };
7824caf8d9SAjit Pandey 
7924caf8d9SAjit Pandey static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
802ad63dc8SV Sujith Kumar Reddy 					   int direction, unsigned int dai_id)
8124caf8d9SAjit Pandey {
8224caf8d9SAjit Pandey 	struct lpass_variant *v = drvdata->variant;
8324caf8d9SAjit Pandey 	int chan = 0;
8424caf8d9SAjit Pandey 
852ad63dc8SV Sujith Kumar Reddy 	if (dai_id == LPASS_DP_RX) {
862ad63dc8SV Sujith Kumar Reddy 		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
872ad63dc8SV Sujith Kumar Reddy 			chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
882ad63dc8SV Sujith Kumar Reddy 						v->hdmi_rdma_channels);
892ad63dc8SV Sujith Kumar Reddy 
902ad63dc8SV Sujith Kumar Reddy 			if (chan >= v->hdmi_rdma_channels)
912ad63dc8SV Sujith Kumar Reddy 				return -EBUSY;
922ad63dc8SV Sujith Kumar Reddy 		}
932ad63dc8SV Sujith Kumar Reddy 		set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
942ad63dc8SV Sujith Kumar Reddy 	} else {
9524caf8d9SAjit Pandey 		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
9624caf8d9SAjit Pandey 			chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
9724caf8d9SAjit Pandey 						v->rdma_channels);
9824caf8d9SAjit Pandey 
9924caf8d9SAjit Pandey 			if (chan >= v->rdma_channels)
10024caf8d9SAjit Pandey 				return -EBUSY;
10124caf8d9SAjit Pandey 		} else {
10224caf8d9SAjit Pandey 			chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
10324caf8d9SAjit Pandey 					v->wrdma_channel_start +
10424caf8d9SAjit Pandey 					v->wrdma_channels,
10524caf8d9SAjit Pandey 					v->wrdma_channel_start);
10624caf8d9SAjit Pandey 
10724caf8d9SAjit Pandey 			if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
10824caf8d9SAjit Pandey 				return -EBUSY;
10924caf8d9SAjit Pandey 		}
11024caf8d9SAjit Pandey 
11124caf8d9SAjit Pandey 		set_bit(chan, &drvdata->dma_ch_bit_map);
1122ad63dc8SV Sujith Kumar Reddy 	}
11324caf8d9SAjit Pandey 	return chan;
11424caf8d9SAjit Pandey }
11524caf8d9SAjit Pandey 
1162ad63dc8SV Sujith Kumar Reddy static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, unsigned int dai_id)
11724caf8d9SAjit Pandey {
1182ad63dc8SV Sujith Kumar Reddy 	if (dai_id == LPASS_DP_RX)
1192ad63dc8SV Sujith Kumar Reddy 		clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
1202ad63dc8SV Sujith Kumar Reddy 	else
12124caf8d9SAjit Pandey 		clear_bit(chan, &drvdata->dma_ch_bit_map);
12224caf8d9SAjit Pandey 
12324caf8d9SAjit Pandey 	return 0;
12424caf8d9SAjit Pandey }
12524caf8d9SAjit Pandey 
12624caf8d9SAjit Pandey static int sc7180_lpass_init(struct platform_device *pdev)
12724caf8d9SAjit Pandey {
12824caf8d9SAjit Pandey 	struct lpass_data *drvdata = platform_get_drvdata(pdev);
12924caf8d9SAjit Pandey 	struct lpass_variant *variant = drvdata->variant;
13024caf8d9SAjit Pandey 	struct device *dev = &pdev->dev;
13124caf8d9SAjit Pandey 	int ret, i;
13224caf8d9SAjit Pandey 
13324caf8d9SAjit Pandey 	drvdata->clks = devm_kcalloc(dev, variant->num_clks,
13424caf8d9SAjit Pandey 				     sizeof(*drvdata->clks), GFP_KERNEL);
1351bf5ee97SYuan Can 	if (!drvdata->clks)
1361bf5ee97SYuan Can 		return -ENOMEM;
1371bf5ee97SYuan Can 
13824caf8d9SAjit Pandey 	drvdata->num_clks = variant->num_clks;
13924caf8d9SAjit Pandey 
14024caf8d9SAjit Pandey 	for (i = 0; i < drvdata->num_clks; i++)
14124caf8d9SAjit Pandey 		drvdata->clks[i].id = variant->clk_name[i];
14224caf8d9SAjit Pandey 
14324caf8d9SAjit Pandey 	ret = devm_clk_bulk_get(dev, drvdata->num_clks, drvdata->clks);
14424caf8d9SAjit Pandey 	if (ret) {
14524caf8d9SAjit Pandey 		dev_err(dev, "Failed to get clocks %d\n", ret);
14624caf8d9SAjit Pandey 		return ret;
14724caf8d9SAjit Pandey 	}
14824caf8d9SAjit Pandey 
14924caf8d9SAjit Pandey 	ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
15024caf8d9SAjit Pandey 	if (ret) {
15124caf8d9SAjit Pandey 		dev_err(dev, "sc7180 clk_enable failed\n");
15224caf8d9SAjit Pandey 		return ret;
15324caf8d9SAjit Pandey 	}
15424caf8d9SAjit Pandey 
15524caf8d9SAjit Pandey 	return 0;
15624caf8d9SAjit Pandey }
15724caf8d9SAjit Pandey 
15824caf8d9SAjit Pandey static int sc7180_lpass_exit(struct platform_device *pdev)
15924caf8d9SAjit Pandey {
16024caf8d9SAjit Pandey 	struct lpass_data *drvdata = platform_get_drvdata(pdev);
16124caf8d9SAjit Pandey 
16224caf8d9SAjit Pandey 	clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
16324caf8d9SAjit Pandey 	return 0;
16424caf8d9SAjit Pandey }
16524caf8d9SAjit Pandey 
166e8679db2SSrinivasa Rao Mandadapu static int __maybe_unused sc7180_lpass_dev_resume(struct device *dev)
1672d68148fSSrinivasa Rao Mandadapu {
1682d68148fSSrinivasa Rao Mandadapu 	struct lpass_data *drvdata = dev_get_drvdata(dev);
1692d68148fSSrinivasa Rao Mandadapu 
170863b9179SMatthias Kaehlcke 	return clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks);
1712d68148fSSrinivasa Rao Mandadapu }
1722d68148fSSrinivasa Rao Mandadapu 
173e8679db2SSrinivasa Rao Mandadapu static int __maybe_unused sc7180_lpass_dev_suspend(struct device *dev)
1742d68148fSSrinivasa Rao Mandadapu {
1752d68148fSSrinivasa Rao Mandadapu 	struct lpass_data *drvdata = dev_get_drvdata(dev);
1762d68148fSSrinivasa Rao Mandadapu 
1772d68148fSSrinivasa Rao Mandadapu 	clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks);
1782d68148fSSrinivasa Rao Mandadapu 	return 0;
1792d68148fSSrinivasa Rao Mandadapu }
1802d68148fSSrinivasa Rao Mandadapu 
1812d68148fSSrinivasa Rao Mandadapu static const struct dev_pm_ops sc7180_lpass_pm_ops = {
1822d68148fSSrinivasa Rao Mandadapu 	SET_SYSTEM_SLEEP_PM_OPS(sc7180_lpass_dev_suspend, sc7180_lpass_dev_resume)
1832d68148fSSrinivasa Rao Mandadapu };
1842d68148fSSrinivasa Rao Mandadapu 
18524caf8d9SAjit Pandey static struct lpass_variant sc7180_data = {
18624caf8d9SAjit Pandey 	.i2sctrl_reg_base	= 0x1000,
18724caf8d9SAjit Pandey 	.i2sctrl_reg_stride	= 0x1000,
18824caf8d9SAjit Pandey 	.i2s_ports		= 3,
18924caf8d9SAjit Pandey 	.irq_reg_base		= 0x9000,
19024caf8d9SAjit Pandey 	.irq_reg_stride		= 0x1000,
19124caf8d9SAjit Pandey 	.irq_ports		= 3,
19224caf8d9SAjit Pandey 	.rdma_reg_base		= 0xC000,
19324caf8d9SAjit Pandey 	.rdma_reg_stride	= 0x1000,
19424caf8d9SAjit Pandey 	.rdma_channels		= 5,
1952ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_reg_base		= 0x64000,
1962ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_reg_stride	= 0x1000,
197e681b1a6SSrinivasa Rao Mandadapu 	.hdmi_rdma_channels		= 4,
19824caf8d9SAjit Pandey 	.dmactl_audif_start	= 1,
19924caf8d9SAjit Pandey 	.wrdma_reg_base		= 0x18000,
20024caf8d9SAjit Pandey 	.wrdma_reg_stride	= 0x1000,
20124caf8d9SAjit Pandey 	.wrdma_channel_start	= 5,
20224caf8d9SAjit Pandey 	.wrdma_channels		= 4,
20324caf8d9SAjit Pandey 
20424caf8d9SAjit Pandey 	.loopback		= REG_FIELD_ID(0x1000, 17, 17, 3, 0x1000),
20524caf8d9SAjit Pandey 	.spken			= REG_FIELD_ID(0x1000, 16, 16, 3, 0x1000),
20624caf8d9SAjit Pandey 	.spkmode		= REG_FIELD_ID(0x1000, 11, 15, 3, 0x1000),
20724caf8d9SAjit Pandey 	.spkmono		= REG_FIELD_ID(0x1000, 10, 10, 3, 0x1000),
20824caf8d9SAjit Pandey 	.micen			= REG_FIELD_ID(0x1000, 9, 9, 3, 0x1000),
20924caf8d9SAjit Pandey 	.micmode		= REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
21024caf8d9SAjit Pandey 	.micmono		= REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
21124caf8d9SAjit Pandey 	.wssrc			= REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
212cf9d2198SV Sujith Kumar Reddy 	.bitwidth		= REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
21324caf8d9SAjit Pandey 
21424caf8d9SAjit Pandey 	.rdma_dyncclk		= REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
21524caf8d9SAjit Pandey 	.rdma_bursten		= REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
21624caf8d9SAjit Pandey 	.rdma_wpscnt		= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
21724caf8d9SAjit Pandey 	.rdma_intf			= REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
21824caf8d9SAjit Pandey 	.rdma_fifowm		= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
21924caf8d9SAjit Pandey 	.rdma_enable		= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
22024caf8d9SAjit Pandey 
22124caf8d9SAjit Pandey 	.wrdma_dyncclk		= REG_FIELD_ID(0x18000, 22, 22, 4, 0x1000),
22224caf8d9SAjit Pandey 	.wrdma_bursten		= REG_FIELD_ID(0x18000, 21, 21, 4, 0x1000),
22324caf8d9SAjit Pandey 	.wrdma_wpscnt		= REG_FIELD_ID(0x18000, 17, 20, 4, 0x1000),
22424caf8d9SAjit Pandey 	.wrdma_intf		= REG_FIELD_ID(0x18000, 12, 16, 4, 0x1000),
22524caf8d9SAjit Pandey 	.wrdma_fifowm		= REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
22624caf8d9SAjit Pandey 	.wrdma_enable		= REG_FIELD_ID(0x18000, 0, 0, 4, 0x1000),
22724caf8d9SAjit Pandey 
2282ad63dc8SV Sujith Kumar Reddy 	.hdmi_tx_ctl_addr	= 0x1000,
2292ad63dc8SV Sujith Kumar Reddy 	.hdmi_legacy_addr	= 0x1008,
2302ad63dc8SV Sujith Kumar Reddy 	.hdmi_vbit_addr		= 0x610c0,
2312ad63dc8SV Sujith Kumar Reddy 	.hdmi_ch_lsb_addr	= 0x61048,
2322ad63dc8SV Sujith Kumar Reddy 	.hdmi_ch_msb_addr	= 0x6104c,
2332ad63dc8SV Sujith Kumar Reddy 	.ch_stride		= 0x8,
2342ad63dc8SV Sujith Kumar Reddy 	.hdmi_parity_addr	= 0x61034,
2352ad63dc8SV Sujith Kumar Reddy 	.hdmi_dmactl_addr	= 0x61038,
2362ad63dc8SV Sujith Kumar Reddy 	.hdmi_dma_stride	= 0x4,
2372ad63dc8SV Sujith Kumar Reddy 	.hdmi_DP_addr		= 0x610c8,
2382ad63dc8SV Sujith Kumar Reddy 	.hdmi_sstream_addr	= 0x6101c,
2392ad63dc8SV Sujith Kumar Reddy 	.hdmi_irq_reg_base		= 0x63000,
2402ad63dc8SV Sujith Kumar Reddy 	.hdmi_irq_ports		= 1,
2412ad63dc8SV Sujith Kumar Reddy 
2422ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_dyncclk		= REG_FIELD_ID(0x64000, 14, 14, 4, 0x1000),
2432ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_bursten		= REG_FIELD_ID(0x64000, 13, 13, 4, 0x1000),
2442ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_burst8		= REG_FIELD_ID(0x64000, 15, 15, 4, 0x1000),
2452ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_burst16		= REG_FIELD_ID(0x64000, 16, 16, 4, 0x1000),
2462ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_dynburst		= REG_FIELD_ID(0x64000, 18, 18, 4, 0x1000),
2472ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_wpscnt		= REG_FIELD_ID(0x64000, 10, 12, 4, 0x1000),
2482ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_fifowm		= REG_FIELD_ID(0x64000, 1, 5, 4, 0x1000),
2492ad63dc8SV Sujith Kumar Reddy 	.hdmi_rdma_enable		= REG_FIELD_ID(0x64000, 0, 0, 4, 0x1000),
2502ad63dc8SV Sujith Kumar Reddy 
2512ad63dc8SV Sujith Kumar Reddy 	.sstream_en		= REG_FIELD(0x6101c, 0, 0),
2522ad63dc8SV Sujith Kumar Reddy 	.dma_sel			= REG_FIELD(0x6101c, 1, 2),
2532ad63dc8SV Sujith Kumar Reddy 	.auto_bbit_en	= REG_FIELD(0x6101c, 3, 3),
2542ad63dc8SV Sujith Kumar Reddy 	.layout			= REG_FIELD(0x6101c, 4, 4),
2552ad63dc8SV Sujith Kumar Reddy 	.layout_sp		= REG_FIELD(0x6101c, 5, 8),
2562ad63dc8SV Sujith Kumar Reddy 	.set_sp_on_en	= REG_FIELD(0x6101c, 10, 10),
2572ad63dc8SV Sujith Kumar Reddy 	.dp_audio		= REG_FIELD(0x6101c, 11, 11),
2582ad63dc8SV Sujith Kumar Reddy 	.dp_staffing_en	= REG_FIELD(0x6101c, 12, 12),
2592ad63dc8SV Sujith Kumar Reddy 	.dp_sp_b_hw_en	= REG_FIELD(0x6101c, 13, 13),
2602ad63dc8SV Sujith Kumar Reddy 
2612ad63dc8SV Sujith Kumar Reddy 	.mute			= REG_FIELD(0x610c8, 0, 0),
2622ad63dc8SV Sujith Kumar Reddy 	.as_sdp_cc		= REG_FIELD(0x610c8, 1, 3),
2632ad63dc8SV Sujith Kumar Reddy 	.as_sdp_ct		= REG_FIELD(0x610c8, 4, 7),
2642ad63dc8SV Sujith Kumar Reddy 	.aif_db4			= REG_FIELD(0x610c8, 8, 15),
2652ad63dc8SV Sujith Kumar Reddy 	.frequency		= REG_FIELD(0x610c8, 16, 21),
2662ad63dc8SV Sujith Kumar Reddy 	.mst_index		= REG_FIELD(0x610c8, 28, 29),
2672ad63dc8SV Sujith Kumar Reddy 	.dptx_index		= REG_FIELD(0x610c8, 30, 31),
2682ad63dc8SV Sujith Kumar Reddy 
2692ad63dc8SV Sujith Kumar Reddy 	.soft_reset		= REG_FIELD(0x1000, 31, 31),
2702ad63dc8SV Sujith Kumar Reddy 	.force_reset	= REG_FIELD(0x1000, 30, 30),
2712ad63dc8SV Sujith Kumar Reddy 
2722ad63dc8SV Sujith Kumar Reddy 	.use_hw_chs		= REG_FIELD(0x61038, 0, 0),
2732ad63dc8SV Sujith Kumar Reddy 	.use_hw_usr		= REG_FIELD(0x61038, 1, 1),
2742ad63dc8SV Sujith Kumar Reddy 	.hw_chs_sel		= REG_FIELD(0x61038, 2, 4),
2752ad63dc8SV Sujith Kumar Reddy 	.hw_usr_sel		= REG_FIELD(0x61038, 5, 6),
2762ad63dc8SV Sujith Kumar Reddy 
2772ad63dc8SV Sujith Kumar Reddy 	.replace_vbit	= REG_FIELD(0x610c0, 0, 0),
2782ad63dc8SV Sujith Kumar Reddy 	.vbit_stream	= REG_FIELD(0x610c0, 1, 1),
2792ad63dc8SV Sujith Kumar Reddy 
2802ad63dc8SV Sujith Kumar Reddy 	.legacy_en		=  REG_FIELD(0x1008, 0, 0),
2812ad63dc8SV Sujith Kumar Reddy 	.calc_en		=  REG_FIELD(0x61034, 0, 0),
2822ad63dc8SV Sujith Kumar Reddy 	.lsb_bits		=  REG_FIELD(0x61048, 0, 31),
2832ad63dc8SV Sujith Kumar Reddy 	.msb_bits		=  REG_FIELD(0x6104c, 0, 31),
2842ad63dc8SV Sujith Kumar Reddy 
2852ad63dc8SV Sujith Kumar Reddy 
28624caf8d9SAjit Pandey 	.clk_name		= (const char*[]) {
28724caf8d9SAjit Pandey 				   "pcnoc-sway-clk",
28824caf8d9SAjit Pandey 				   "audio-core",
28924caf8d9SAjit Pandey 				   "pcnoc-mport-clk",
29024caf8d9SAjit Pandey 				},
29124caf8d9SAjit Pandey 	.num_clks		= 3,
29224caf8d9SAjit Pandey 	.dai_driver		= sc7180_lpass_cpu_dai_driver,
29324caf8d9SAjit Pandey 	.num_dai		= ARRAY_SIZE(sc7180_lpass_cpu_dai_driver),
29424caf8d9SAjit Pandey 	.dai_osr_clk_names      = (const char *[]) {
29524caf8d9SAjit Pandey 				   "mclk0",
29624caf8d9SAjit Pandey 				   "null",
29724caf8d9SAjit Pandey 				},
29824caf8d9SAjit Pandey 	.dai_bit_clk_names      = (const char *[]) {
29924caf8d9SAjit Pandey 				   "mi2s-bit-clk0",
30024caf8d9SAjit Pandey 				   "mi2s-bit-clk1",
30124caf8d9SAjit Pandey 				},
30224caf8d9SAjit Pandey 	.init			= sc7180_lpass_init,
30324caf8d9SAjit Pandey 	.exit			= sc7180_lpass_exit,
30424caf8d9SAjit Pandey 	.alloc_dma_channel	= sc7180_lpass_alloc_dma_channel,
30524caf8d9SAjit Pandey 	.free_dma_channel	= sc7180_lpass_free_dma_channel,
30624caf8d9SAjit Pandey };
30724caf8d9SAjit Pandey 
308377c7b7cSKrzysztof Kozlowski static const struct of_device_id sc7180_lpass_cpu_device_id[] __maybe_unused = {
30924caf8d9SAjit Pandey 	{.compatible = "qcom,sc7180-lpass-cpu", .data = &sc7180_data},
31024caf8d9SAjit Pandey 	{}
31124caf8d9SAjit Pandey };
312dcde34c4SDouglas Anderson MODULE_DEVICE_TABLE(of, sc7180_lpass_cpu_device_id);
31324caf8d9SAjit Pandey 
31424caf8d9SAjit Pandey static struct platform_driver sc7180_lpass_cpu_platform_driver = {
31524caf8d9SAjit Pandey 	.driver = {
31624caf8d9SAjit Pandey 		.name = "sc7180-lpass-cpu",
31724caf8d9SAjit Pandey 		.of_match_table = of_match_ptr(sc7180_lpass_cpu_device_id),
3182d68148fSSrinivasa Rao Mandadapu 		.pm = &sc7180_lpass_pm_ops,
31924caf8d9SAjit Pandey 	},
32024caf8d9SAjit Pandey 	.probe = asoc_qcom_lpass_cpu_platform_probe,
32124caf8d9SAjit Pandey 	.remove = asoc_qcom_lpass_cpu_platform_remove,
32260a97386SV Sujith Kumar Reddy 	.shutdown = asoc_qcom_lpass_cpu_platform_shutdown,
32324caf8d9SAjit Pandey };
32424caf8d9SAjit Pandey 
32524caf8d9SAjit Pandey module_platform_driver(sc7180_lpass_cpu_platform_driver);
32624caf8d9SAjit Pandey 
32724caf8d9SAjit Pandey MODULE_DESCRIPTION("SC7180 LPASS CPU DRIVER");
32824caf8d9SAjit Pandey MODULE_LICENSE("GPL v2");
329