Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) // Copyright 2012 Freescale Semiconductor, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) // Copyright 2012 Linaro Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/of_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/of_gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <sound/jack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "imx-audmux.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define DAI_NAME_SIZE	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define MUX_PORT_MAX	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct imx_es8328_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	struct snd_soc_dai_link dai;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	struct snd_soc_card card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	char codec_dai_name[DAI_NAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	char platform_name[DAI_NAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	int jack_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) static struct snd_soc_jack_gpio headset_jack_gpios[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		.gpio = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		.name = "headset-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		.report = SND_JACK_HEADSET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		.invert = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		.debounce_time = 200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) static struct snd_soc_jack headset_jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct imx_es8328_data *data = container_of(rtd->card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 					struct imx_es8328_data, card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	/* Headphone jack detection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	if (gpio_is_valid(data->jack_gpio)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		ret = snd_soc_card_jack_new(rtd->card, "Headphone",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 					    SND_JACK_HEADPHONE | SND_JACK_BTN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 					    &headset_jack, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		headset_jack_gpios[0].gpio = data->jack_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		ret = snd_soc_jack_add_gpios(&headset_jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 					     ARRAY_SIZE(headset_jack_gpios),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 					     headset_jack_gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static const struct snd_soc_dapm_widget imx_es8328_dapm_widgets[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	SND_SOC_DAPM_MIC("Mic Jack", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	SND_SOC_DAPM_HP("Headphone", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	SND_SOC_DAPM_SPK("Speaker", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	SND_SOC_DAPM_REGULATOR_SUPPLY("audio-amp", 1, 0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static int imx_es8328_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	struct device_node *np = pdev->dev.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct device_node *ssi_np = NULL, *codec_np = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct platform_device *ssi_pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	struct imx_es8328_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct snd_soc_dai_link_component *comp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	u32 int_port, ext_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	ret = of_property_read_u32(np, "mux-int-port", &int_port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		dev_err(dev, "mux-int-port missing or invalid\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (int_port > MUX_PORT_MAX || int_port == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		dev_err(dev, "mux-int-port: hardware only has %d mux ports\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			MUX_PORT_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		dev_err(dev, "mux-ext-port missing or invalid\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	if (ext_port > MUX_PORT_MAX || ext_port == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		dev_err(dev, "mux-ext-port: hardware only has %d mux ports\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			MUX_PORT_MAX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	 * The port numbering in the hardware manual starts at 1, while
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	 * the audmux API expects it starts at 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	int_port--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	ext_port--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	ret = imx_audmux_v2_configure_port(int_port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			IMX_AUDMUX_V2_PTCR_SYN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			IMX_AUDMUX_V2_PTCR_TFSDIR |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			IMX_AUDMUX_V2_PTCR_TCLKDIR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		dev_err(dev, "audmux internal port setup failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	ret = imx_audmux_v2_configure_port(ext_port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 			IMX_AUDMUX_V2_PTCR_SYN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		dev_err(dev, "audmux external port setup failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	if (!ssi_np || !codec_np) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		dev_err(dev, "phandle missing or invalid\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	ssi_pdev = of_find_device_by_node(ssi_np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (!ssi_pdev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		dev_err(dev, "failed to find SSI platform device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		goto fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	if (!data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	comp = devm_kzalloc(dev, 3 * sizeof(*comp), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	if (!comp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	data->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	data->jack_gpio = of_get_named_gpio(pdev->dev.of_node, "jack-gpio", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	data->dai.cpus		= &comp[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	data->dai.codecs	= &comp[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	data->dai.platforms	= &comp[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	data->dai.num_cpus	= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	data->dai.num_codecs	= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	data->dai.num_platforms	= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	data->dai.name = "hifi";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	data->dai.stream_name = "hifi";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	data->dai.codecs->dai_name = "es8328-hifi-analog";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	data->dai.codecs->of_node = codec_np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	data->dai.cpus->of_node = ssi_np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	data->dai.platforms->of_node = ssi_np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	data->dai.init = &imx_es8328_dai_init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			    SND_SOC_DAIFMT_CBM_CFM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	data->card.dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	data->card.dapm_widgets = imx_es8328_dapm_widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	data->card.num_dapm_widgets = ARRAY_SIZE(imx_es8328_dapm_widgets);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	ret = snd_soc_of_parse_card_name(&data->card, "model");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		dev_err(dev, "Unable to parse card name\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		dev_err(dev, "Unable to parse routing: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	data->card.num_links = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	data->card.owner = THIS_MODULE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	data->card.dai_link = &data->dai;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	ret = snd_soc_register_card(&data->card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		dev_err(dev, "Unable to register: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		goto put_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	platform_set_drvdata(pdev, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) put_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	put_device(&ssi_pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	of_node_put(ssi_np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	of_node_put(codec_np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static int imx_es8328_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct imx_es8328_data *data = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	snd_soc_unregister_card(&data->card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static const struct of_device_id imx_es8328_dt_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	{ .compatible = "fsl,imx-audio-es8328", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	{ /* sentinel */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) MODULE_DEVICE_TABLE(of, imx_es8328_dt_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static struct platform_driver imx_es8328_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		.name = "imx-es8328",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		.of_match_table = imx_es8328_dt_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.probe = imx_es8328_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.remove = imx_es8328_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) module_platform_driver(imx_es8328_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_AUTHOR("Sean Cross <xobs@kosagi.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) MODULE_DESCRIPTION("Kosagi i.MX6 ES8328 ASoC machine driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) MODULE_LICENSE("GPL v2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) MODULE_ALIAS("platform:imx-audio-es8328");