18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci// linux/sound/bcm/bcm63xx-i2s-whistler.c
38c2ecf20Sopenharmony_ci// BCM63xx whistler i2s driver
48c2ecf20Sopenharmony_ci// Copyright (c) 2020 Broadcom Corporation
58c2ecf20Sopenharmony_ci// Author: Kevin-Ke Li <kevin-ke.li@broadcom.com>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/clk.h>
88c2ecf20Sopenharmony_ci#include <linux/dma-mapping.h>
98c2ecf20Sopenharmony_ci#include <linux/io.h>
108c2ecf20Sopenharmony_ci#include <linux/module.h>
118c2ecf20Sopenharmony_ci#include <linux/regmap.h>
128c2ecf20Sopenharmony_ci#include <sound/pcm_params.h>
138c2ecf20Sopenharmony_ci#include <sound/soc.h>
148c2ecf20Sopenharmony_ci#include "bcm63xx-i2s.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define DRV_NAME "brcm-i2s"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistatic bool brcm_i2s_wr_reg(struct device *dev, unsigned int reg)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci	switch (reg) {
218c2ecf20Sopenharmony_ci	case I2S_TX_CFG ... I2S_TX_DESC_IFF_LEN:
228c2ecf20Sopenharmony_ci	case I2S_TX_CFG_2 ... I2S_RX_DESC_IFF_LEN:
238c2ecf20Sopenharmony_ci	case I2S_RX_CFG_2 ... I2S_REG_MAX:
248c2ecf20Sopenharmony_ci		return true;
258c2ecf20Sopenharmony_ci	default:
268c2ecf20Sopenharmony_ci		return false;
278c2ecf20Sopenharmony_ci	}
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic bool brcm_i2s_rd_reg(struct device *dev, unsigned int reg)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	switch (reg) {
338c2ecf20Sopenharmony_ci	case I2S_TX_CFG ... I2S_REG_MAX:
348c2ecf20Sopenharmony_ci		return true;
358c2ecf20Sopenharmony_ci	default:
368c2ecf20Sopenharmony_ci		return false;
378c2ecf20Sopenharmony_ci	}
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistatic bool brcm_i2s_volatile_reg(struct device *dev, unsigned int reg)
418c2ecf20Sopenharmony_ci{
428c2ecf20Sopenharmony_ci	switch (reg) {
438c2ecf20Sopenharmony_ci	case I2S_TX_CFG:
448c2ecf20Sopenharmony_ci	case I2S_TX_IRQ_CTL:
458c2ecf20Sopenharmony_ci	case I2S_TX_DESC_IFF_ADDR:
468c2ecf20Sopenharmony_ci	case I2S_TX_DESC_IFF_LEN:
478c2ecf20Sopenharmony_ci	case I2S_TX_DESC_OFF_ADDR:
488c2ecf20Sopenharmony_ci	case I2S_TX_DESC_OFF_LEN:
498c2ecf20Sopenharmony_ci	case I2S_TX_CFG_2:
508c2ecf20Sopenharmony_ci	case I2S_RX_CFG:
518c2ecf20Sopenharmony_ci	case I2S_RX_IRQ_CTL:
528c2ecf20Sopenharmony_ci	case I2S_RX_DESC_OFF_ADDR:
538c2ecf20Sopenharmony_ci	case I2S_RX_DESC_OFF_LEN:
548c2ecf20Sopenharmony_ci	case I2S_RX_DESC_IFF_LEN:
558c2ecf20Sopenharmony_ci	case I2S_RX_DESC_IFF_ADDR:
568c2ecf20Sopenharmony_ci	case I2S_RX_CFG_2:
578c2ecf20Sopenharmony_ci		return true;
588c2ecf20Sopenharmony_ci	default:
598c2ecf20Sopenharmony_ci		return false;
608c2ecf20Sopenharmony_ci	}
618c2ecf20Sopenharmony_ci}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistatic const struct regmap_config brcm_i2s_regmap_config = {
648c2ecf20Sopenharmony_ci	.reg_bits = 32,
658c2ecf20Sopenharmony_ci	.reg_stride = 4,
668c2ecf20Sopenharmony_ci	.val_bits = 32,
678c2ecf20Sopenharmony_ci	.max_register = I2S_REG_MAX,
688c2ecf20Sopenharmony_ci	.writeable_reg = brcm_i2s_wr_reg,
698c2ecf20Sopenharmony_ci	.readable_reg = brcm_i2s_rd_reg,
708c2ecf20Sopenharmony_ci	.volatile_reg = brcm_i2s_volatile_reg,
718c2ecf20Sopenharmony_ci	.cache_type = REGCACHE_FLAT,
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_cistatic int bcm63xx_i2s_hw_params(struct snd_pcm_substream *substream,
758c2ecf20Sopenharmony_ci				 struct snd_pcm_hw_params *params,
768c2ecf20Sopenharmony_ci				 struct snd_soc_dai *dai)
778c2ecf20Sopenharmony_ci{
788c2ecf20Sopenharmony_ci	int ret = 0;
798c2ecf20Sopenharmony_ci	struct bcm_i2s_priv *i2s_priv = snd_soc_dai_get_drvdata(dai);
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	ret = clk_set_rate(i2s_priv->i2s_clk, params_rate(params));
828c2ecf20Sopenharmony_ci	if (ret < 0)
838c2ecf20Sopenharmony_ci		dev_err(i2s_priv->dev,
848c2ecf20Sopenharmony_ci			"Can't set sample rate, err: %d\n", ret);
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	return ret;
878c2ecf20Sopenharmony_ci}
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistatic int bcm63xx_i2s_startup(struct snd_pcm_substream *substream,
908c2ecf20Sopenharmony_ci			       struct snd_soc_dai *dai)
918c2ecf20Sopenharmony_ci{
928c2ecf20Sopenharmony_ci	unsigned int slavemode;
938c2ecf20Sopenharmony_ci	struct bcm_i2s_priv *i2s_priv = snd_soc_dai_get_drvdata(dai);
948c2ecf20Sopenharmony_ci	struct regmap *regmap_i2s = i2s_priv->regmap_i2s;
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
978c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_TX_CFG,
988c2ecf20Sopenharmony_ci				   I2S_TX_OUT_R | I2S_TX_DATA_ALIGNMENT |
998c2ecf20Sopenharmony_ci				   I2S_TX_DATA_ENABLE | I2S_TX_CLOCK_ENABLE,
1008c2ecf20Sopenharmony_ci				   I2S_TX_OUT_R | I2S_TX_DATA_ALIGNMENT |
1018c2ecf20Sopenharmony_ci				   I2S_TX_DATA_ENABLE | I2S_TX_CLOCK_ENABLE);
1028c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_CTL, 0);
1038c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_IFF_THLD, 0);
1048c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_OFF_THLD, 1);
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci		/* TX and RX block each have an independent bit to indicate
1078c2ecf20Sopenharmony_ci		 * if it is generating the clock for the I2S bus. The bus
1088c2ecf20Sopenharmony_ci		 * clocks need to be generated from either the TX or RX block,
1098c2ecf20Sopenharmony_ci		 * but not both
1108c2ecf20Sopenharmony_ci		 */
1118c2ecf20Sopenharmony_ci		regmap_read(regmap_i2s, I2S_RX_CFG_2, &slavemode);
1128c2ecf20Sopenharmony_ci		if (slavemode & I2S_RX_SLAVE_MODE_MASK)
1138c2ecf20Sopenharmony_ci			regmap_update_bits(regmap_i2s, I2S_TX_CFG_2,
1148c2ecf20Sopenharmony_ci					   I2S_TX_SLAVE_MODE_MASK,
1158c2ecf20Sopenharmony_ci					   I2S_TX_MASTER_MODE);
1168c2ecf20Sopenharmony_ci		else
1178c2ecf20Sopenharmony_ci			regmap_update_bits(regmap_i2s, I2S_TX_CFG_2,
1188c2ecf20Sopenharmony_ci					   I2S_TX_SLAVE_MODE_MASK,
1198c2ecf20Sopenharmony_ci					   I2S_TX_SLAVE_MODE);
1208c2ecf20Sopenharmony_ci	} else {
1218c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_RX_CFG,
1228c2ecf20Sopenharmony_ci				   I2S_RX_IN_R | I2S_RX_DATA_ALIGNMENT |
1238c2ecf20Sopenharmony_ci				   I2S_RX_CLOCK_ENABLE,
1248c2ecf20Sopenharmony_ci				   I2S_RX_IN_R | I2S_RX_DATA_ALIGNMENT |
1258c2ecf20Sopenharmony_ci				   I2S_RX_CLOCK_ENABLE);
1268c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_CTL, 0);
1278c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_IFF_THLD, 0);
1288c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_OFF_THLD, 1);
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci		regmap_read(regmap_i2s, I2S_TX_CFG_2, &slavemode);
1318c2ecf20Sopenharmony_ci		if (slavemode & I2S_TX_SLAVE_MODE_MASK)
1328c2ecf20Sopenharmony_ci			regmap_update_bits(regmap_i2s, I2S_RX_CFG_2,
1338c2ecf20Sopenharmony_ci					   I2S_RX_SLAVE_MODE_MASK, 0);
1348c2ecf20Sopenharmony_ci		else
1358c2ecf20Sopenharmony_ci			regmap_update_bits(regmap_i2s, I2S_RX_CFG_2,
1368c2ecf20Sopenharmony_ci					   I2S_RX_SLAVE_MODE_MASK,
1378c2ecf20Sopenharmony_ci					   I2S_RX_SLAVE_MODE);
1388c2ecf20Sopenharmony_ci	}
1398c2ecf20Sopenharmony_ci	return 0;
1408c2ecf20Sopenharmony_ci}
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistatic void bcm63xx_i2s_shutdown(struct snd_pcm_substream *substream,
1438c2ecf20Sopenharmony_ci				struct snd_soc_dai *dai)
1448c2ecf20Sopenharmony_ci{
1458c2ecf20Sopenharmony_ci	unsigned int enabled, slavemode;
1468c2ecf20Sopenharmony_ci	struct bcm_i2s_priv *i2s_priv = snd_soc_dai_get_drvdata(dai);
1478c2ecf20Sopenharmony_ci	struct regmap *regmap_i2s = i2s_priv->regmap_i2s;
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1508c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_TX_CFG,
1518c2ecf20Sopenharmony_ci				   I2S_TX_OUT_R | I2S_TX_DATA_ALIGNMENT |
1528c2ecf20Sopenharmony_ci				   I2S_TX_DATA_ENABLE | I2S_TX_CLOCK_ENABLE, 0);
1538c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_CTL, 1);
1548c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_IFF_THLD, 4);
1558c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_TX_IRQ_OFF_THLD, 4);
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci		regmap_read(regmap_i2s, I2S_TX_CFG_2, &slavemode);
1588c2ecf20Sopenharmony_ci		slavemode = slavemode & I2S_TX_SLAVE_MODE_MASK;
1598c2ecf20Sopenharmony_ci		if (!slavemode) {
1608c2ecf20Sopenharmony_ci			regmap_read(regmap_i2s, I2S_RX_CFG, &enabled);
1618c2ecf20Sopenharmony_ci			enabled = enabled & I2S_RX_ENABLE_MASK;
1628c2ecf20Sopenharmony_ci			if (enabled)
1638c2ecf20Sopenharmony_ci				regmap_update_bits(regmap_i2s, I2S_RX_CFG_2,
1648c2ecf20Sopenharmony_ci						   I2S_RX_SLAVE_MODE_MASK,
1658c2ecf20Sopenharmony_ci						   I2S_RX_MASTER_MODE);
1668c2ecf20Sopenharmony_ci		}
1678c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_TX_CFG_2,
1688c2ecf20Sopenharmony_ci				   I2S_TX_SLAVE_MODE_MASK,
1698c2ecf20Sopenharmony_ci				   I2S_TX_SLAVE_MODE);
1708c2ecf20Sopenharmony_ci	} else {
1718c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_RX_CFG,
1728c2ecf20Sopenharmony_ci				   I2S_RX_IN_R | I2S_RX_DATA_ALIGNMENT |
1738c2ecf20Sopenharmony_ci				   I2S_RX_CLOCK_ENABLE, 0);
1748c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_CTL, 1);
1758c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_IFF_THLD, 4);
1768c2ecf20Sopenharmony_ci		regmap_write(regmap_i2s, I2S_RX_IRQ_OFF_THLD, 4);
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci		regmap_read(regmap_i2s, I2S_RX_CFG_2, &slavemode);
1798c2ecf20Sopenharmony_ci		slavemode = slavemode & I2S_RX_SLAVE_MODE_MASK;
1808c2ecf20Sopenharmony_ci		if (!slavemode) {
1818c2ecf20Sopenharmony_ci			regmap_read(regmap_i2s, I2S_TX_CFG, &enabled);
1828c2ecf20Sopenharmony_ci			enabled = enabled & I2S_TX_ENABLE_MASK;
1838c2ecf20Sopenharmony_ci			if (enabled)
1848c2ecf20Sopenharmony_ci				regmap_update_bits(regmap_i2s, I2S_TX_CFG_2,
1858c2ecf20Sopenharmony_ci						   I2S_TX_SLAVE_MODE_MASK,
1868c2ecf20Sopenharmony_ci						   I2S_TX_MASTER_MODE);
1878c2ecf20Sopenharmony_ci		}
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci		regmap_update_bits(regmap_i2s, I2S_RX_CFG_2,
1908c2ecf20Sopenharmony_ci				   I2S_RX_SLAVE_MODE_MASK, I2S_RX_SLAVE_MODE);
1918c2ecf20Sopenharmony_ci	}
1928c2ecf20Sopenharmony_ci}
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops bcm63xx_i2s_dai_ops = {
1958c2ecf20Sopenharmony_ci	.startup = bcm63xx_i2s_startup,
1968c2ecf20Sopenharmony_ci	.shutdown = bcm63xx_i2s_shutdown,
1978c2ecf20Sopenharmony_ci	.hw_params = bcm63xx_i2s_hw_params,
1988c2ecf20Sopenharmony_ci};
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_cistatic struct snd_soc_dai_driver bcm63xx_i2s_dai = {
2018c2ecf20Sopenharmony_ci	.name = DRV_NAME,
2028c2ecf20Sopenharmony_ci	.playback = {
2038c2ecf20Sopenharmony_ci		.channels_min = 2,
2048c2ecf20Sopenharmony_ci		.channels_max = 2,
2058c2ecf20Sopenharmony_ci		.rates = SNDRV_PCM_RATE_8000_192000,
2068c2ecf20Sopenharmony_ci		.formats = SNDRV_PCM_FMTBIT_S32_LE,
2078c2ecf20Sopenharmony_ci	},
2088c2ecf20Sopenharmony_ci	.capture = {
2098c2ecf20Sopenharmony_ci		.channels_min = 2,
2108c2ecf20Sopenharmony_ci		.channels_max = 2,
2118c2ecf20Sopenharmony_ci		.rates = SNDRV_PCM_RATE_8000_192000,
2128c2ecf20Sopenharmony_ci		.formats = SNDRV_PCM_FMTBIT_S32_LE,
2138c2ecf20Sopenharmony_ci	},
2148c2ecf20Sopenharmony_ci	.ops = &bcm63xx_i2s_dai_ops,
2158c2ecf20Sopenharmony_ci	.symmetric_rates = 1,
2168c2ecf20Sopenharmony_ci	.symmetric_channels = 1,
2178c2ecf20Sopenharmony_ci};
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_cistatic const struct snd_soc_component_driver bcm63xx_i2s_component = {
2208c2ecf20Sopenharmony_ci	.name = "bcm63xx",
2218c2ecf20Sopenharmony_ci};
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_cistatic int bcm63xx_i2s_dev_probe(struct platform_device *pdev)
2248c2ecf20Sopenharmony_ci{
2258c2ecf20Sopenharmony_ci	int ret = 0;
2268c2ecf20Sopenharmony_ci	void __iomem *regs;
2278c2ecf20Sopenharmony_ci	struct resource *r_mem, *region;
2288c2ecf20Sopenharmony_ci	struct bcm_i2s_priv *i2s_priv;
2298c2ecf20Sopenharmony_ci	struct regmap *regmap_i2s;
2308c2ecf20Sopenharmony_ci	struct clk *i2s_clk;
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	i2s_priv = devm_kzalloc(&pdev->dev, sizeof(*i2s_priv), GFP_KERNEL);
2338c2ecf20Sopenharmony_ci	if (!i2s_priv)
2348c2ecf20Sopenharmony_ci		return -ENOMEM;
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	i2s_clk = devm_clk_get(&pdev->dev, "i2sclk");
2378c2ecf20Sopenharmony_ci	if (IS_ERR(i2s_clk)) {
2388c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "%s: cannot get a brcm clock: %ld\n",
2398c2ecf20Sopenharmony_ci					__func__, PTR_ERR(i2s_clk));
2408c2ecf20Sopenharmony_ci		return PTR_ERR(i2s_clk);
2418c2ecf20Sopenharmony_ci	}
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci	r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2448c2ecf20Sopenharmony_ci	if (!r_mem) {
2458c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "Unable to get register resource.\n");
2468c2ecf20Sopenharmony_ci		return -ENODEV;
2478c2ecf20Sopenharmony_ci	}
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	region = devm_request_mem_region(&pdev->dev, r_mem->start,
2508c2ecf20Sopenharmony_ci					resource_size(r_mem), DRV_NAME);
2518c2ecf20Sopenharmony_ci	if (!region) {
2528c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "Memory region already claimed\n");
2538c2ecf20Sopenharmony_ci		return -EBUSY;
2548c2ecf20Sopenharmony_ci	}
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci	regs = devm_ioremap_resource(&pdev->dev, r_mem);
2578c2ecf20Sopenharmony_ci	if (IS_ERR(regs)) {
2588c2ecf20Sopenharmony_ci		ret = PTR_ERR(regs);
2598c2ecf20Sopenharmony_ci		return ret;
2608c2ecf20Sopenharmony_ci	}
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci	regmap_i2s = devm_regmap_init_mmio(&pdev->dev,
2638c2ecf20Sopenharmony_ci					regs, &brcm_i2s_regmap_config);
2648c2ecf20Sopenharmony_ci	if (IS_ERR(regmap_i2s))
2658c2ecf20Sopenharmony_ci		return PTR_ERR(regmap_i2s);
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	regmap_update_bits(regmap_i2s, I2S_MISC_CFG,
2688c2ecf20Sopenharmony_ci			   I2S_PAD_LVL_LOOP_DIS_MASK,
2698c2ecf20Sopenharmony_ci			   I2S_PAD_LVL_LOOP_DIS_ENABLE);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	ret = devm_snd_soc_register_component(&pdev->dev,
2728c2ecf20Sopenharmony_ci					      &bcm63xx_i2s_component,
2738c2ecf20Sopenharmony_ci					      &bcm63xx_i2s_dai, 1);
2748c2ecf20Sopenharmony_ci	if (ret) {
2758c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "failed to register the dai\n");
2768c2ecf20Sopenharmony_ci		return ret;
2778c2ecf20Sopenharmony_ci	}
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	i2s_priv->dev = &pdev->dev;
2808c2ecf20Sopenharmony_ci	i2s_priv->i2s_clk = i2s_clk;
2818c2ecf20Sopenharmony_ci	i2s_priv->regmap_i2s = regmap_i2s;
2828c2ecf20Sopenharmony_ci	dev_set_drvdata(&pdev->dev, i2s_priv);
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	ret = bcm63xx_soc_platform_probe(pdev, i2s_priv);
2858c2ecf20Sopenharmony_ci	if (ret)
2868c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "failed to register the pcm\n");
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	return ret;
2898c2ecf20Sopenharmony_ci}
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_cistatic int bcm63xx_i2s_dev_remove(struct platform_device *pdev)
2928c2ecf20Sopenharmony_ci{
2938c2ecf20Sopenharmony_ci	bcm63xx_soc_platform_remove(pdev);
2948c2ecf20Sopenharmony_ci	return 0;
2958c2ecf20Sopenharmony_ci}
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci#ifdef CONFIG_OF
2988c2ecf20Sopenharmony_cistatic const struct of_device_id snd_soc_bcm_audio_match[] = {
2998c2ecf20Sopenharmony_ci	{.compatible = "brcm,bcm63xx-i2s"},
3008c2ecf20Sopenharmony_ci	{ }
3018c2ecf20Sopenharmony_ci};
3028c2ecf20Sopenharmony_ci#endif
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cistatic struct platform_driver bcm63xx_i2s_driver = {
3058c2ecf20Sopenharmony_ci	.driver = {
3068c2ecf20Sopenharmony_ci		.name = DRV_NAME,
3078c2ecf20Sopenharmony_ci		.of_match_table = of_match_ptr(snd_soc_bcm_audio_match),
3088c2ecf20Sopenharmony_ci	},
3098c2ecf20Sopenharmony_ci	.probe = bcm63xx_i2s_dev_probe,
3108c2ecf20Sopenharmony_ci	.remove = bcm63xx_i2s_dev_remove,
3118c2ecf20Sopenharmony_ci};
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_cimodule_platform_driver(bcm63xx_i2s_driver);
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ciMODULE_AUTHOR("Kevin,Li <kevin-ke.li@broadcom.com>");
3168c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Broadcom DSL XPON ASOC I2S Interface");
3178c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
318