xref: /linux/sound/soc/meson/aiu.c (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
16ae9ca9cSJerome Brunet // SPDX-License-Identifier: GPL-2.0
26ae9ca9cSJerome Brunet //
36ae9ca9cSJerome Brunet // Copyright (c) 2020 BayLibre, SAS.
46ae9ca9cSJerome Brunet // Author: Jerome Brunet <jbrunet@baylibre.com>
56ae9ca9cSJerome Brunet 
66ae9ca9cSJerome Brunet #include <linux/bitfield.h>
76ae9ca9cSJerome Brunet #include <linux/clk.h>
86ae9ca9cSJerome Brunet #include <linux/module.h>
96ae9ca9cSJerome Brunet #include <linux/of_platform.h>
106ae9ca9cSJerome Brunet #include <linux/regmap.h>
116ae9ca9cSJerome Brunet #include <linux/reset.h>
126ae9ca9cSJerome Brunet #include <sound/soc.h>
136ae9ca9cSJerome Brunet #include <sound/soc-dai.h>
146ae9ca9cSJerome Brunet 
156ae9ca9cSJerome Brunet #include <dt-bindings/sound/meson-aiu.h>
166ae9ca9cSJerome Brunet #include "aiu.h"
176ae9ca9cSJerome Brunet #include "aiu-fifo.h"
186ae9ca9cSJerome Brunet 
196ae9ca9cSJerome Brunet #define AIU_I2S_MISC_958_SRC_SHIFT 3
206ae9ca9cSJerome Brunet 
216ae9ca9cSJerome Brunet static const char * const aiu_spdif_encode_sel_texts[] = {
226ae9ca9cSJerome Brunet 	"SPDIF", "I2S",
236ae9ca9cSJerome Brunet };
246ae9ca9cSJerome Brunet 
256ae9ca9cSJerome Brunet static SOC_ENUM_SINGLE_DECL(aiu_spdif_encode_sel_enum, AIU_I2S_MISC,
266ae9ca9cSJerome Brunet 			    AIU_I2S_MISC_958_SRC_SHIFT,
276ae9ca9cSJerome Brunet 			    aiu_spdif_encode_sel_texts);
286ae9ca9cSJerome Brunet 
296ae9ca9cSJerome Brunet static const struct snd_kcontrol_new aiu_spdif_encode_mux =
306ae9ca9cSJerome Brunet 	SOC_DAPM_ENUM("SPDIF Buffer Src", aiu_spdif_encode_sel_enum);
316ae9ca9cSJerome Brunet 
326ae9ca9cSJerome Brunet static const struct snd_soc_dapm_widget aiu_cpu_dapm_widgets[] = {
336ae9ca9cSJerome Brunet 	SND_SOC_DAPM_MUX("SPDIF SRC SEL", SND_SOC_NOPM, 0, 0,
346ae9ca9cSJerome Brunet 			 &aiu_spdif_encode_mux),
356ae9ca9cSJerome Brunet };
366ae9ca9cSJerome Brunet 
376ae9ca9cSJerome Brunet static const struct snd_soc_dapm_route aiu_cpu_dapm_routes[] = {
386ae9ca9cSJerome Brunet 	{ "I2S Encoder Playback", NULL, "I2S FIFO Playback" },
396ae9ca9cSJerome Brunet 	{ "SPDIF SRC SEL", "SPDIF", "SPDIF FIFO Playback" },
406ae9ca9cSJerome Brunet 	{ "SPDIF SRC SEL", "I2S", "I2S FIFO Playback" },
416ae9ca9cSJerome Brunet 	{ "SPDIF Encoder Playback", NULL, "SPDIF SRC SEL" },
426ae9ca9cSJerome Brunet };
436ae9ca9cSJerome Brunet 
aiu_of_xlate_dai_name(struct snd_soc_component * component,const struct of_phandle_args * args,const char ** dai_name,unsigned int component_id)446ae9ca9cSJerome Brunet int aiu_of_xlate_dai_name(struct snd_soc_component *component,
45933f98beSKrzysztof Kozlowski 			  const struct of_phandle_args *args,
466ae9ca9cSJerome Brunet 			  const char **dai_name,
476ae9ca9cSJerome Brunet 			  unsigned int component_id)
486ae9ca9cSJerome Brunet {
496ae9ca9cSJerome Brunet 	struct snd_soc_dai *dai;
506ae9ca9cSJerome Brunet 	int id;
516ae9ca9cSJerome Brunet 
526ae9ca9cSJerome Brunet 	if (args->args_count != 2)
536ae9ca9cSJerome Brunet 		return -EINVAL;
546ae9ca9cSJerome Brunet 
556ae9ca9cSJerome Brunet 	if (args->args[0] != component_id)
566ae9ca9cSJerome Brunet 		return -EINVAL;
576ae9ca9cSJerome Brunet 
586ae9ca9cSJerome Brunet 	id = args->args[1];
596ae9ca9cSJerome Brunet 
606ae9ca9cSJerome Brunet 	if (id < 0 || id >= component->num_dai)
616ae9ca9cSJerome Brunet 		return -EINVAL;
626ae9ca9cSJerome Brunet 
636ae9ca9cSJerome Brunet 	for_each_component_dais(component, dai) {
646ae9ca9cSJerome Brunet 		if (id == 0)
656ae9ca9cSJerome Brunet 			break;
666ae9ca9cSJerome Brunet 		id--;
676ae9ca9cSJerome Brunet 	}
686ae9ca9cSJerome Brunet 
696ae9ca9cSJerome Brunet 	*dai_name = dai->driver->name;
706ae9ca9cSJerome Brunet 
716ae9ca9cSJerome Brunet 	return 0;
726ae9ca9cSJerome Brunet }
736ae9ca9cSJerome Brunet 
aiu_cpu_of_xlate_dai_name(struct snd_soc_component * component,const struct of_phandle_args * args,const char ** dai_name)746ae9ca9cSJerome Brunet static int aiu_cpu_of_xlate_dai_name(struct snd_soc_component *component,
75933f98beSKrzysztof Kozlowski 				     const struct of_phandle_args *args,
766ae9ca9cSJerome Brunet 				     const char **dai_name)
776ae9ca9cSJerome Brunet {
786ae9ca9cSJerome Brunet 	return aiu_of_xlate_dai_name(component, args, dai_name, AIU_CPU);
796ae9ca9cSJerome Brunet }
806ae9ca9cSJerome Brunet 
aiu_cpu_component_probe(struct snd_soc_component * component)816ae9ca9cSJerome Brunet static int aiu_cpu_component_probe(struct snd_soc_component *component)
826ae9ca9cSJerome Brunet {
836ae9ca9cSJerome Brunet 	struct aiu *aiu = snd_soc_component_get_drvdata(component);
846ae9ca9cSJerome Brunet 
856ae9ca9cSJerome Brunet 	/* Required for the SPDIF Source control operation */
866ae9ca9cSJerome Brunet 	return clk_prepare_enable(aiu->i2s.clks[PCLK].clk);
876ae9ca9cSJerome Brunet }
886ae9ca9cSJerome Brunet 
aiu_cpu_component_remove(struct snd_soc_component * component)896ae9ca9cSJerome Brunet static void aiu_cpu_component_remove(struct snd_soc_component *component)
906ae9ca9cSJerome Brunet {
916ae9ca9cSJerome Brunet 	struct aiu *aiu = snd_soc_component_get_drvdata(component);
926ae9ca9cSJerome Brunet 
936ae9ca9cSJerome Brunet 	clk_disable_unprepare(aiu->i2s.clks[PCLK].clk);
946ae9ca9cSJerome Brunet }
956ae9ca9cSJerome Brunet 
966ae9ca9cSJerome Brunet static const struct snd_soc_component_driver aiu_cpu_component = {
976ae9ca9cSJerome Brunet 	.name			= "AIU CPU",
986ae9ca9cSJerome Brunet 	.dapm_widgets		= aiu_cpu_dapm_widgets,
996ae9ca9cSJerome Brunet 	.num_dapm_widgets	= ARRAY_SIZE(aiu_cpu_dapm_widgets),
1006ae9ca9cSJerome Brunet 	.dapm_routes		= aiu_cpu_dapm_routes,
1016ae9ca9cSJerome Brunet 	.num_dapm_routes	= ARRAY_SIZE(aiu_cpu_dapm_routes),
1026ae9ca9cSJerome Brunet 	.of_xlate_dai_name	= aiu_cpu_of_xlate_dai_name,
1036ae9ca9cSJerome Brunet 	.pointer		= aiu_fifo_pointer,
1046ae9ca9cSJerome Brunet 	.probe			= aiu_cpu_component_probe,
1056ae9ca9cSJerome Brunet 	.remove			= aiu_cpu_component_remove,
106fc35880dSHeiner Kallweit #ifdef CONFIG_DEBUG_FS
107fc35880dSHeiner Kallweit 	.debugfs_prefix		= "cpu",
108fc35880dSHeiner Kallweit #endif
1096ae9ca9cSJerome Brunet };
1106ae9ca9cSJerome Brunet 
1116ae9ca9cSJerome Brunet static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = {
1126ae9ca9cSJerome Brunet 	[CPU_I2S_FIFO] = {
1136ae9ca9cSJerome Brunet 		.name = "I2S FIFO",
1146ae9ca9cSJerome Brunet 		.playback = {
1156ae9ca9cSJerome Brunet 			.stream_name	= "I2S FIFO Playback",
1166ae9ca9cSJerome Brunet 			.channels_min	= 2,
1176ae9ca9cSJerome Brunet 			.channels_max	= 8,
1186ae9ca9cSJerome Brunet 			.rates		= SNDRV_PCM_RATE_CONTINUOUS,
1196ae9ca9cSJerome Brunet 			.rate_min	= 5512,
1206ae9ca9cSJerome Brunet 			.rate_max	= 192000,
1216ae9ca9cSJerome Brunet 			.formats	= AIU_FORMATS,
1226ae9ca9cSJerome Brunet 		},
1236ae9ca9cSJerome Brunet 		.ops		= &aiu_fifo_i2s_dai_ops,
1246ae9ca9cSJerome Brunet 	},
1256ae9ca9cSJerome Brunet 	[CPU_SPDIF_FIFO] = {
1266ae9ca9cSJerome Brunet 		.name = "SPDIF FIFO",
1276ae9ca9cSJerome Brunet 		.playback = {
1286ae9ca9cSJerome Brunet 			.stream_name	= "SPDIF FIFO Playback",
1296ae9ca9cSJerome Brunet 			.channels_min	= 2,
1306ae9ca9cSJerome Brunet 			.channels_max	= 2,
1316ae9ca9cSJerome Brunet 			.rates		= SNDRV_PCM_RATE_CONTINUOUS,
1326ae9ca9cSJerome Brunet 			.rate_min	= 5512,
1336ae9ca9cSJerome Brunet 			.rate_max	= 192000,
1346ae9ca9cSJerome Brunet 			.formats	= AIU_FORMATS,
1356ae9ca9cSJerome Brunet 		},
1366ae9ca9cSJerome Brunet 		.ops		= &aiu_fifo_spdif_dai_ops,
1376ae9ca9cSJerome Brunet 	},
1386ae9ca9cSJerome Brunet 	[CPU_I2S_ENCODER] = {
1396ae9ca9cSJerome Brunet 		.name = "I2S Encoder",
1406ae9ca9cSJerome Brunet 		.playback = {
1416ae9ca9cSJerome Brunet 			.stream_name = "I2S Encoder Playback",
1426ae9ca9cSJerome Brunet 			.channels_min = 2,
1436ae9ca9cSJerome Brunet 			.channels_max = 8,
1446ae9ca9cSJerome Brunet 			.rates = SNDRV_PCM_RATE_8000_192000,
1456ae9ca9cSJerome Brunet 			.formats = AIU_FORMATS,
1466ae9ca9cSJerome Brunet 		},
1476ae9ca9cSJerome Brunet 		.ops = &aiu_encoder_i2s_dai_ops,
1486ae9ca9cSJerome Brunet 	},
1496ae9ca9cSJerome Brunet 	[CPU_SPDIF_ENCODER] = {
1506ae9ca9cSJerome Brunet 		.name = "SPDIF Encoder",
1516ae9ca9cSJerome Brunet 		.playback = {
1526ae9ca9cSJerome Brunet 			.stream_name = "SPDIF Encoder Playback",
1536ae9ca9cSJerome Brunet 			.channels_min = 2,
1546ae9ca9cSJerome Brunet 			.channels_max = 2,
1556ae9ca9cSJerome Brunet 			.rates = (SNDRV_PCM_RATE_32000  |
1566ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_44100  |
1576ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_48000  |
1586ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_88200  |
1596ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_96000  |
1606ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_176400 |
1616ae9ca9cSJerome Brunet 				  SNDRV_PCM_RATE_192000),
1626ae9ca9cSJerome Brunet 			.formats = AIU_FORMATS,
1636ae9ca9cSJerome Brunet 		},
1646ae9ca9cSJerome Brunet 		.ops = &aiu_encoder_spdif_dai_ops,
1656ae9ca9cSJerome Brunet 	}
1666ae9ca9cSJerome Brunet };
1676ae9ca9cSJerome Brunet 
1686ae9ca9cSJerome Brunet static const struct regmap_config aiu_regmap_cfg = {
1696ae9ca9cSJerome Brunet 	.reg_bits	= 32,
1706ae9ca9cSJerome Brunet 	.val_bits	= 32,
1716ae9ca9cSJerome Brunet 	.reg_stride	= 4,
1726ae9ca9cSJerome Brunet 	.max_register	= 0x2ac,
1736ae9ca9cSJerome Brunet };
1746ae9ca9cSJerome Brunet 
aiu_clk_bulk_get(struct device * dev,const char * const * ids,unsigned int num,struct aiu_interface * interface)1756ae9ca9cSJerome Brunet static int aiu_clk_bulk_get(struct device *dev,
1766ae9ca9cSJerome Brunet 			    const char * const *ids,
1776ae9ca9cSJerome Brunet 			    unsigned int num,
1786ae9ca9cSJerome Brunet 			    struct aiu_interface *interface)
1796ae9ca9cSJerome Brunet {
1806ae9ca9cSJerome Brunet 	struct clk_bulk_data *clks;
1816ae9ca9cSJerome Brunet 	int i, ret;
1826ae9ca9cSJerome Brunet 
183269f0017SJerome Brunet 	clks = devm_kcalloc(dev, num, sizeof(*clks), GFP_KERNEL);
1846ae9ca9cSJerome Brunet 	if (!clks)
1856ae9ca9cSJerome Brunet 		return -ENOMEM;
1866ae9ca9cSJerome Brunet 
1876ae9ca9cSJerome Brunet 	for (i = 0; i < num; i++)
1886ae9ca9cSJerome Brunet 		clks[i].id = ids[i];
1896ae9ca9cSJerome Brunet 
1906ae9ca9cSJerome Brunet 	ret = devm_clk_bulk_get(dev, num, clks);
1916ae9ca9cSJerome Brunet 	if (ret < 0)
1926ae9ca9cSJerome Brunet 		return ret;
1936ae9ca9cSJerome Brunet 
1946ae9ca9cSJerome Brunet 	interface->clks = clks;
1956ae9ca9cSJerome Brunet 	interface->clk_num = num;
1966ae9ca9cSJerome Brunet 	return 0;
1976ae9ca9cSJerome Brunet }
1986ae9ca9cSJerome Brunet 
1996ae9ca9cSJerome Brunet static const char * const aiu_i2s_ids[] = {
2006ae9ca9cSJerome Brunet 	[PCLK]	= "i2s_pclk",
2016ae9ca9cSJerome Brunet 	[AOCLK]	= "i2s_aoclk",
2026ae9ca9cSJerome Brunet 	[MCLK]	= "i2s_mclk",
2036ae9ca9cSJerome Brunet 	[MIXER]	= "i2s_mixer",
2046ae9ca9cSJerome Brunet };
2056ae9ca9cSJerome Brunet 
2066ae9ca9cSJerome Brunet static const char * const aiu_spdif_ids[] = {
2076ae9ca9cSJerome Brunet 	[PCLK]	= "spdif_pclk",
2086ae9ca9cSJerome Brunet 	[AOCLK]	= "spdif_aoclk",
2096ae9ca9cSJerome Brunet 	[MCLK]	= "spdif_mclk_sel"
2106ae9ca9cSJerome Brunet };
2116ae9ca9cSJerome Brunet 
aiu_clk_get(struct device * dev)2126ae9ca9cSJerome Brunet static int aiu_clk_get(struct device *dev)
2136ae9ca9cSJerome Brunet {
2146ae9ca9cSJerome Brunet 	struct aiu *aiu = dev_get_drvdata(dev);
21598ac85a0SJerome Brunet 	struct clk *pclk;
2166ae9ca9cSJerome Brunet 	int ret;
2176ae9ca9cSJerome Brunet 
21898ac85a0SJerome Brunet 	pclk = devm_clk_get_enabled(dev, "pclk");
21998ac85a0SJerome Brunet 	if (IS_ERR(pclk))
22098ac85a0SJerome Brunet 		return dev_err_probe(dev, PTR_ERR(pclk), "Can't get the aiu pclk\n");
2216ae9ca9cSJerome Brunet 
2226ae9ca9cSJerome Brunet 	aiu->spdif_mclk = devm_clk_get(dev, "spdif_mclk");
2232ff4e003SKuninori Morimoto 	if (IS_ERR(aiu->spdif_mclk))
2242ff4e003SKuninori Morimoto 		return dev_err_probe(dev, PTR_ERR(aiu->spdif_mclk),
2252ff4e003SKuninori Morimoto 				     "Can't get the aiu spdif master clock\n");
2266ae9ca9cSJerome Brunet 
2276ae9ca9cSJerome Brunet 	ret = aiu_clk_bulk_get(dev, aiu_i2s_ids, ARRAY_SIZE(aiu_i2s_ids),
2286ae9ca9cSJerome Brunet 			       &aiu->i2s);
2292ff4e003SKuninori Morimoto 	if (ret)
2302ff4e003SKuninori Morimoto 		return dev_err_probe(dev, ret, "Can't get the i2s clocks\n");
2316ae9ca9cSJerome Brunet 
2326ae9ca9cSJerome Brunet 	ret = aiu_clk_bulk_get(dev, aiu_spdif_ids, ARRAY_SIZE(aiu_spdif_ids),
2336ae9ca9cSJerome Brunet 			       &aiu->spdif);
2342ff4e003SKuninori Morimoto 	if (ret)
2352ff4e003SKuninori Morimoto 		return dev_err_probe(dev, ret, "Can't get the spdif clocks\n");
2366ae9ca9cSJerome Brunet 
2376ae9ca9cSJerome Brunet 	return ret;
2386ae9ca9cSJerome Brunet }
2396ae9ca9cSJerome Brunet 
aiu_probe(struct platform_device * pdev)2406ae9ca9cSJerome Brunet static int aiu_probe(struct platform_device *pdev)
2416ae9ca9cSJerome Brunet {
2426ae9ca9cSJerome Brunet 	struct device *dev = &pdev->dev;
2436ae9ca9cSJerome Brunet 	void __iomem *regs;
2446ae9ca9cSJerome Brunet 	struct regmap *map;
2456ae9ca9cSJerome Brunet 	struct aiu *aiu;
2466ae9ca9cSJerome Brunet 	int ret;
2476ae9ca9cSJerome Brunet 
2486ae9ca9cSJerome Brunet 	aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL);
2496ae9ca9cSJerome Brunet 	if (!aiu)
2506ae9ca9cSJerome Brunet 		return -ENOMEM;
251edc76180SMartin Blumenstingl 
252edc76180SMartin Blumenstingl 	aiu->platform = device_get_match_data(dev);
253edc76180SMartin Blumenstingl 	if (!aiu->platform)
254edc76180SMartin Blumenstingl 		return -ENODEV;
255edc76180SMartin Blumenstingl 
2566ae9ca9cSJerome Brunet 	platform_set_drvdata(pdev, aiu);
2576ae9ca9cSJerome Brunet 
2586ae9ca9cSJerome Brunet 	ret = device_reset(dev);
2592ff4e003SKuninori Morimoto 	if (ret)
2602ff4e003SKuninori Morimoto 		return dev_err_probe(dev, ret, "Failed to reset device\n");
2616ae9ca9cSJerome Brunet 
2626ae9ca9cSJerome Brunet 	regs = devm_platform_ioremap_resource(pdev, 0);
2636ae9ca9cSJerome Brunet 	if (IS_ERR(regs))
2646ae9ca9cSJerome Brunet 		return PTR_ERR(regs);
2656ae9ca9cSJerome Brunet 
2666ae9ca9cSJerome Brunet 	map = devm_regmap_init_mmio(dev, regs, &aiu_regmap_cfg);
2676ae9ca9cSJerome Brunet 	if (IS_ERR(map)) {
2686ae9ca9cSJerome Brunet 		dev_err(dev, "failed to init regmap: %ld\n",
2696ae9ca9cSJerome Brunet 			PTR_ERR(map));
2706ae9ca9cSJerome Brunet 		return PTR_ERR(map);
2716ae9ca9cSJerome Brunet 	}
2726ae9ca9cSJerome Brunet 
2736ae9ca9cSJerome Brunet 	aiu->i2s.irq = platform_get_irq_byname(pdev, "i2s");
2746e700f06SJerome Brunet 	if (aiu->i2s.irq < 0)
2756ae9ca9cSJerome Brunet 		return aiu->i2s.irq;
2766ae9ca9cSJerome Brunet 
2776ae9ca9cSJerome Brunet 	aiu->spdif.irq = platform_get_irq_byname(pdev, "spdif");
2786e700f06SJerome Brunet 	if (aiu->spdif.irq < 0)
2796ae9ca9cSJerome Brunet 		return aiu->spdif.irq;
2806ae9ca9cSJerome Brunet 
2816ae9ca9cSJerome Brunet 	ret = aiu_clk_get(dev);
2826ae9ca9cSJerome Brunet 	if (ret)
2836ae9ca9cSJerome Brunet 		return ret;
2846ae9ca9cSJerome Brunet 
2856ae9ca9cSJerome Brunet 	/* Register the cpu component of the aiu */
2866ae9ca9cSJerome Brunet 	ret = snd_soc_register_component(dev, &aiu_cpu_component,
2876ae9ca9cSJerome Brunet 					 aiu_cpu_dai_drv,
2886ae9ca9cSJerome Brunet 					 ARRAY_SIZE(aiu_cpu_dai_drv));
289b82b734cSJerome Brunet 	if (ret) {
2906ae9ca9cSJerome Brunet 		dev_err(dev, "Failed to register cpu component\n");
291b82b734cSJerome Brunet 		return ret;
292b82b734cSJerome Brunet 	}
2936ae9ca9cSJerome Brunet 
294b82b734cSJerome Brunet 	/* Register the hdmi codec control component */
295b82b734cSJerome Brunet 	ret = aiu_hdmi_ctrl_register_component(dev);
296b82b734cSJerome Brunet 	if (ret) {
297b82b734cSJerome Brunet 		dev_err(dev, "Failed to register hdmi control component\n");
298b82b734cSJerome Brunet 		goto err;
299b82b734cSJerome Brunet 	}
300b82b734cSJerome Brunet 
30165816025SJerome Brunet 	/* Register the internal dac control component on gxl */
302edc76180SMartin Blumenstingl 	if (aiu->platform->has_acodec) {
30365816025SJerome Brunet 		ret = aiu_acodec_ctrl_register_component(dev);
30465816025SJerome Brunet 		if (ret) {
30565816025SJerome Brunet 			dev_err(dev,
30665816025SJerome Brunet 			    "Failed to register acodec control component\n");
30765816025SJerome Brunet 			goto err;
30865816025SJerome Brunet 		}
30965816025SJerome Brunet 	}
31065816025SJerome Brunet 
311b82b734cSJerome Brunet 	return 0;
312b82b734cSJerome Brunet err:
313b82b734cSJerome Brunet 	snd_soc_unregister_component(dev);
3146ae9ca9cSJerome Brunet 	return ret;
3156ae9ca9cSJerome Brunet }
3166ae9ca9cSJerome Brunet 
aiu_remove(struct platform_device * pdev)317ed354c69SUwe Kleine-König static void aiu_remove(struct platform_device *pdev)
3186ae9ca9cSJerome Brunet {
3196ae9ca9cSJerome Brunet 	snd_soc_unregister_component(&pdev->dev);
3206ae9ca9cSJerome Brunet }
3216ae9ca9cSJerome Brunet 
322edc76180SMartin Blumenstingl static const struct aiu_platform_data aiu_gxbb_pdata = {
323edc76180SMartin Blumenstingl 	.has_acodec = false,
3243e25c445SMartin Blumenstingl 	.has_clk_ctrl_more_i2s_div = true,
325edc76180SMartin Blumenstingl };
326edc76180SMartin Blumenstingl 
327edc76180SMartin Blumenstingl static const struct aiu_platform_data aiu_gxl_pdata = {
328edc76180SMartin Blumenstingl 	.has_acodec = true,
3293e25c445SMartin Blumenstingl 	.has_clk_ctrl_more_i2s_div = true,
3303e25c445SMartin Blumenstingl };
3313e25c445SMartin Blumenstingl 
3323e25c445SMartin Blumenstingl static const struct aiu_platform_data aiu_meson8_pdata = {
3333e25c445SMartin Blumenstingl 	.has_acodec = false,
3343e25c445SMartin Blumenstingl 	.has_clk_ctrl_more_i2s_div = false,
335edc76180SMartin Blumenstingl };
336edc76180SMartin Blumenstingl 
3376ae9ca9cSJerome Brunet static const struct of_device_id aiu_of_match[] = {
338edc76180SMartin Blumenstingl 	{ .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata },
339edc76180SMartin Blumenstingl 	{ .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata },
3403e25c445SMartin Blumenstingl 	{ .compatible = "amlogic,aiu-meson8", .data = &aiu_meson8_pdata },
3413e25c445SMartin Blumenstingl 	{ .compatible = "amlogic,aiu-meson8b", .data = &aiu_meson8_pdata },
3426ae9ca9cSJerome Brunet 	{}
3436ae9ca9cSJerome Brunet };
3446ae9ca9cSJerome Brunet MODULE_DEVICE_TABLE(of, aiu_of_match);
3456ae9ca9cSJerome Brunet 
3466ae9ca9cSJerome Brunet static struct platform_driver aiu_pdrv = {
3476ae9ca9cSJerome Brunet 	.probe = aiu_probe,
348*130af75bSUwe Kleine-König 	.remove = aiu_remove,
3496ae9ca9cSJerome Brunet 	.driver = {
3506ae9ca9cSJerome Brunet 		.name = "meson-aiu",
3516ae9ca9cSJerome Brunet 		.of_match_table = aiu_of_match,
3526ae9ca9cSJerome Brunet 	},
3536ae9ca9cSJerome Brunet };
3546ae9ca9cSJerome Brunet module_platform_driver(aiu_pdrv);
3556ae9ca9cSJerome Brunet 
3566ae9ca9cSJerome Brunet MODULE_DESCRIPTION("Meson AIU Driver");
3576ae9ca9cSJerome Brunet MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
3586ae9ca9cSJerome Brunet MODULE_LICENSE("GPL v2");
359