xref: /kernel/linux/linux-5.10/sound/soc/sh/hac.c (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci//
38c2ecf20Sopenharmony_ci// Hitachi Audio Controller (AC97) support for SH7760/SH7780
48c2ecf20Sopenharmony_ci//
58c2ecf20Sopenharmony_ci// Copyright (c) 2007 Manuel Lauss <mano@roarinelk.homelinux.net>
68c2ecf20Sopenharmony_ci//
78c2ecf20Sopenharmony_ci// dont forget to set IPSEL/OMSEL register bits (in your board code) to
88c2ecf20Sopenharmony_ci// enable HAC output pins!
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* BIG FAT FIXME: although the SH7760 has 2 independent AC97 units, only
118c2ecf20Sopenharmony_ci * the FIRST can be used since ASoC does not pass any information to the
128c2ecf20Sopenharmony_ci * ac97_read/write() functions regarding WHICH unit to use.  You'll have
138c2ecf20Sopenharmony_ci * to edit the code a bit to use the other AC97 unit.		--mlau
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/init.h>
178c2ecf20Sopenharmony_ci#include <linux/module.h>
188c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
198c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
208c2ecf20Sopenharmony_ci#include <linux/wait.h>
218c2ecf20Sopenharmony_ci#include <linux/delay.h>
228c2ecf20Sopenharmony_ci#include <sound/core.h>
238c2ecf20Sopenharmony_ci#include <sound/pcm.h>
248c2ecf20Sopenharmony_ci#include <sound/ac97_codec.h>
258c2ecf20Sopenharmony_ci#include <sound/initval.h>
268c2ecf20Sopenharmony_ci#include <sound/soc.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* regs and bits */
298c2ecf20Sopenharmony_ci#define HACCR		0x08
308c2ecf20Sopenharmony_ci#define HACCSAR		0x20
318c2ecf20Sopenharmony_ci#define HACCSDR		0x24
328c2ecf20Sopenharmony_ci#define HACPCML		0x28
338c2ecf20Sopenharmony_ci#define HACPCMR		0x2C
348c2ecf20Sopenharmony_ci#define HACTIER		0x50
358c2ecf20Sopenharmony_ci#define	HACTSR		0x54
368c2ecf20Sopenharmony_ci#define HACRIER		0x58
378c2ecf20Sopenharmony_ci#define HACRSR		0x5C
388c2ecf20Sopenharmony_ci#define HACACR		0x60
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define CR_CR		(1 << 15)	/* "codec-ready" indicator */
418c2ecf20Sopenharmony_ci#define CR_CDRT		(1 << 11)	/* cold reset */
428c2ecf20Sopenharmony_ci#define CR_WMRT		(1 << 10)	/* warm reset */
438c2ecf20Sopenharmony_ci#define CR_B9		(1 << 9)	/* the mysterious "bit 9" */
448c2ecf20Sopenharmony_ci#define CR_ST		(1 << 5)	/* AC97 link start bit */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define CSAR_RD		(1 << 19)	/* AC97 data read bit */
478c2ecf20Sopenharmony_ci#define CSAR_WR		(0)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define TSR_CMDAMT	(1 << 31)
508c2ecf20Sopenharmony_ci#define TSR_CMDDMT	(1 << 30)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define RSR_STARY	(1 << 22)
538c2ecf20Sopenharmony_ci#define RSR_STDRY	(1 << 21)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define ACR_DMARX16	(1 << 30)
568c2ecf20Sopenharmony_ci#define ACR_DMATX16	(1 << 29)
578c2ecf20Sopenharmony_ci#define ACR_TX12ATOM	(1 << 26)
588c2ecf20Sopenharmony_ci#define ACR_DMARX20	((1 << 24) | (1 << 22))
598c2ecf20Sopenharmony_ci#define ACR_DMATX20	((1 << 23) | (1 << 21))
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define CSDR_SHIFT	4
628c2ecf20Sopenharmony_ci#define CSDR_MASK	(0xffff << CSDR_SHIFT)
638c2ecf20Sopenharmony_ci#define CSAR_SHIFT	12
648c2ecf20Sopenharmony_ci#define CSAR_MASK	(0x7f << CSAR_SHIFT)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define AC97_WRITE_RETRY	1
678c2ecf20Sopenharmony_ci#define AC97_READ_RETRY		5
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* manual-suggested AC97 codec access timeouts (us) */
708c2ecf20Sopenharmony_ci#define TMO_E1	500	/* 21 < E1 < 1000 */
718c2ecf20Sopenharmony_ci#define TMO_E2	13	/* 13 < E2 */
728c2ecf20Sopenharmony_ci#define TMO_E3	21	/* 21 < E3 */
738c2ecf20Sopenharmony_ci#define TMO_E4	500	/* 21 < E4 < 1000 */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistruct hac_priv {
768c2ecf20Sopenharmony_ci	unsigned long mmio;	/* HAC base address */
778c2ecf20Sopenharmony_ci} hac_cpu_data[] = {
788c2ecf20Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7760)
798c2ecf20Sopenharmony_ci	{
808c2ecf20Sopenharmony_ci		.mmio	= 0xFE240000,
818c2ecf20Sopenharmony_ci	},
828c2ecf20Sopenharmony_ci	{
838c2ecf20Sopenharmony_ci		.mmio	= 0xFE250000,
848c2ecf20Sopenharmony_ci	},
858c2ecf20Sopenharmony_ci#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
868c2ecf20Sopenharmony_ci	{
878c2ecf20Sopenharmony_ci		.mmio	= 0xFFE40000,
888c2ecf20Sopenharmony_ci	},
898c2ecf20Sopenharmony_ci#else
908c2ecf20Sopenharmony_ci#error "Unsupported SuperH SoC"
918c2ecf20Sopenharmony_ci#endif
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define HACREG(reg)	(*(unsigned long *)(hac->mmio + (reg)))
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/*
978c2ecf20Sopenharmony_ci * AC97 read/write flow as outlined in the SH7760 manual (pages 903-906)
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_cistatic int hac_get_codec_data(struct hac_priv *hac, unsigned short r,
1008c2ecf20Sopenharmony_ci			      unsigned short *v)
1018c2ecf20Sopenharmony_ci{
1028c2ecf20Sopenharmony_ci	unsigned int to1, to2, i;
1038c2ecf20Sopenharmony_ci	unsigned short adr;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	for (i = AC97_READ_RETRY; i; i--) {
1068c2ecf20Sopenharmony_ci		*v = 0;
1078c2ecf20Sopenharmony_ci		/* wait for HAC to receive something from the codec */
1088c2ecf20Sopenharmony_ci		for (to1 = TMO_E4;
1098c2ecf20Sopenharmony_ci		     to1 && !(HACREG(HACRSR) & RSR_STARY);
1108c2ecf20Sopenharmony_ci		     --to1)
1118c2ecf20Sopenharmony_ci			udelay(1);
1128c2ecf20Sopenharmony_ci		for (to2 = TMO_E4;
1138c2ecf20Sopenharmony_ci		     to2 && !(HACREG(HACRSR) & RSR_STDRY);
1148c2ecf20Sopenharmony_ci		     --to2)
1158c2ecf20Sopenharmony_ci			udelay(1);
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci		if (!to1 && !to2)
1188c2ecf20Sopenharmony_ci			return 0;	/* codec comm is down */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci		adr = ((HACREG(HACCSAR) & CSAR_MASK) >> CSAR_SHIFT);
1218c2ecf20Sopenharmony_ci		*v  = ((HACREG(HACCSDR) & CSDR_MASK) >> CSDR_SHIFT);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci		HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci		if (r == adr)
1268c2ecf20Sopenharmony_ci			break;
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci		/* manual says: wait at least 21 usec before retrying */
1298c2ecf20Sopenharmony_ci		udelay(21);
1308c2ecf20Sopenharmony_ci	}
1318c2ecf20Sopenharmony_ci	HACREG(HACRSR) &= ~(RSR_STDRY | RSR_STARY);
1328c2ecf20Sopenharmony_ci	return i;
1338c2ecf20Sopenharmony_ci}
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_cistatic unsigned short hac_read_codec_aux(struct hac_priv *hac,
1368c2ecf20Sopenharmony_ci					 unsigned short reg)
1378c2ecf20Sopenharmony_ci{
1388c2ecf20Sopenharmony_ci	unsigned short val;
1398c2ecf20Sopenharmony_ci	unsigned int i, to;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	for (i = AC97_READ_RETRY; i; i--) {
1428c2ecf20Sopenharmony_ci		/* send_read_request */
1438c2ecf20Sopenharmony_ci		local_irq_disable();
1448c2ecf20Sopenharmony_ci		HACREG(HACTSR) &= ~(TSR_CMDAMT);
1458c2ecf20Sopenharmony_ci		HACREG(HACCSAR) = (reg << CSAR_SHIFT) | CSAR_RD;
1468c2ecf20Sopenharmony_ci		local_irq_enable();
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci		for (to = TMO_E3;
1498c2ecf20Sopenharmony_ci		     to && !(HACREG(HACTSR) & TSR_CMDAMT);
1508c2ecf20Sopenharmony_ci		     --to)
1518c2ecf20Sopenharmony_ci			udelay(1);
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci		HACREG(HACTSR) &= ~TSR_CMDAMT;
1548c2ecf20Sopenharmony_ci		val = 0;
1558c2ecf20Sopenharmony_ci		if (hac_get_codec_data(hac, reg, &val) != 0)
1568c2ecf20Sopenharmony_ci			break;
1578c2ecf20Sopenharmony_ci	}
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	return i ? val : ~0;
1608c2ecf20Sopenharmony_ci}
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_cistatic void hac_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
1638c2ecf20Sopenharmony_ci			   unsigned short val)
1648c2ecf20Sopenharmony_ci{
1658c2ecf20Sopenharmony_ci	int unit_id = 0 /* ac97->private_data */;
1668c2ecf20Sopenharmony_ci	struct hac_priv *hac = &hac_cpu_data[unit_id];
1678c2ecf20Sopenharmony_ci	unsigned int i, to;
1688c2ecf20Sopenharmony_ci	/* write_codec_aux */
1698c2ecf20Sopenharmony_ci	for (i = AC97_WRITE_RETRY; i; i--) {
1708c2ecf20Sopenharmony_ci		/* send_write_request */
1718c2ecf20Sopenharmony_ci		local_irq_disable();
1728c2ecf20Sopenharmony_ci		HACREG(HACTSR) &= ~(TSR_CMDDMT | TSR_CMDAMT);
1738c2ecf20Sopenharmony_ci		HACREG(HACCSDR) = (val << CSDR_SHIFT);
1748c2ecf20Sopenharmony_ci		HACREG(HACCSAR) = (reg << CSAR_SHIFT) & (~CSAR_RD);
1758c2ecf20Sopenharmony_ci		local_irq_enable();
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci		/* poll-wait for CMDAMT and CMDDMT */
1788c2ecf20Sopenharmony_ci		for (to = TMO_E1;
1798c2ecf20Sopenharmony_ci		     to && !(HACREG(HACTSR) & (TSR_CMDAMT|TSR_CMDDMT));
1808c2ecf20Sopenharmony_ci		     --to)
1818c2ecf20Sopenharmony_ci			udelay(1);
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci		HACREG(HACTSR) &= ~(TSR_CMDAMT | TSR_CMDDMT);
1848c2ecf20Sopenharmony_ci		if (to)
1858c2ecf20Sopenharmony_ci			break;
1868c2ecf20Sopenharmony_ci		/* timeout, try again */
1878c2ecf20Sopenharmony_ci	}
1888c2ecf20Sopenharmony_ci}
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_cistatic unsigned short hac_ac97_read(struct snd_ac97 *ac97,
1918c2ecf20Sopenharmony_ci				    unsigned short reg)
1928c2ecf20Sopenharmony_ci{
1938c2ecf20Sopenharmony_ci	int unit_id = 0 /* ac97->private_data */;
1948c2ecf20Sopenharmony_ci	struct hac_priv *hac = &hac_cpu_data[unit_id];
1958c2ecf20Sopenharmony_ci	return hac_read_codec_aux(hac, reg);
1968c2ecf20Sopenharmony_ci}
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_cistatic void hac_ac97_warmrst(struct snd_ac97 *ac97)
1998c2ecf20Sopenharmony_ci{
2008c2ecf20Sopenharmony_ci	int unit_id = 0 /* ac97->private_data */;
2018c2ecf20Sopenharmony_ci	struct hac_priv *hac = &hac_cpu_data[unit_id];
2028c2ecf20Sopenharmony_ci	unsigned int tmo;
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci	HACREG(HACCR) = CR_WMRT | CR_ST | CR_B9;
2058c2ecf20Sopenharmony_ci	msleep(10);
2068c2ecf20Sopenharmony_ci	HACREG(HACCR) = CR_ST | CR_B9;
2078c2ecf20Sopenharmony_ci	for (tmo = 1000; (tmo > 0) && !(HACREG(HACCR) & CR_CR); tmo--)
2088c2ecf20Sopenharmony_ci		udelay(1);
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	if (!tmo)
2118c2ecf20Sopenharmony_ci		printk(KERN_INFO "hac: reset: AC97 link down!\n");
2128c2ecf20Sopenharmony_ci	/* settings this bit lets us have a conversation with codec */
2138c2ecf20Sopenharmony_ci	HACREG(HACACR) |= ACR_TX12ATOM;
2148c2ecf20Sopenharmony_ci}
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistatic void hac_ac97_coldrst(struct snd_ac97 *ac97)
2178c2ecf20Sopenharmony_ci{
2188c2ecf20Sopenharmony_ci	int unit_id = 0 /* ac97->private_data */;
2198c2ecf20Sopenharmony_ci	struct hac_priv *hac;
2208c2ecf20Sopenharmony_ci	hac = &hac_cpu_data[unit_id];
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	HACREG(HACCR) = 0;
2238c2ecf20Sopenharmony_ci	HACREG(HACCR) = CR_CDRT | CR_ST | CR_B9;
2248c2ecf20Sopenharmony_ci	msleep(10);
2258c2ecf20Sopenharmony_ci	hac_ac97_warmrst(ac97);
2268c2ecf20Sopenharmony_ci}
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_cistatic struct snd_ac97_bus_ops hac_ac97_ops = {
2298c2ecf20Sopenharmony_ci	.read	= hac_ac97_read,
2308c2ecf20Sopenharmony_ci	.write	= hac_ac97_write,
2318c2ecf20Sopenharmony_ci	.reset	= hac_ac97_coldrst,
2328c2ecf20Sopenharmony_ci	.warm_reset = hac_ac97_warmrst,
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_cistatic int hac_hw_params(struct snd_pcm_substream *substream,
2368c2ecf20Sopenharmony_ci			 struct snd_pcm_hw_params *params,
2378c2ecf20Sopenharmony_ci			 struct snd_soc_dai *dai)
2388c2ecf20Sopenharmony_ci{
2398c2ecf20Sopenharmony_ci	struct hac_priv *hac = &hac_cpu_data[dai->id];
2408c2ecf20Sopenharmony_ci	int d = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0 : 1;
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci	switch (params->msbits) {
2438c2ecf20Sopenharmony_ci	case 16:
2448c2ecf20Sopenharmony_ci		HACREG(HACACR) |= d ?  ACR_DMARX16 :  ACR_DMATX16;
2458c2ecf20Sopenharmony_ci		HACREG(HACACR) &= d ? ~ACR_DMARX20 : ~ACR_DMATX20;
2468c2ecf20Sopenharmony_ci		break;
2478c2ecf20Sopenharmony_ci	case 20:
2488c2ecf20Sopenharmony_ci		HACREG(HACACR) &= d ? ~ACR_DMARX16 : ~ACR_DMATX16;
2498c2ecf20Sopenharmony_ci		HACREG(HACACR) |= d ?  ACR_DMARX20 :  ACR_DMATX20;
2508c2ecf20Sopenharmony_ci		break;
2518c2ecf20Sopenharmony_ci	default:
2528c2ecf20Sopenharmony_ci		pr_debug("hac: invalid depth %d bit\n", params->msbits);
2538c2ecf20Sopenharmony_ci		return -EINVAL;
2548c2ecf20Sopenharmony_ci		break;
2558c2ecf20Sopenharmony_ci	}
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	return 0;
2588c2ecf20Sopenharmony_ci}
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#define AC97_RATES	\
2618c2ecf20Sopenharmony_ci	SNDRV_PCM_RATE_8000_192000
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci#define AC97_FMTS	\
2648c2ecf20Sopenharmony_ci	SNDRV_PCM_FMTBIT_S16_LE
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_cistatic const struct snd_soc_dai_ops hac_dai_ops = {
2678c2ecf20Sopenharmony_ci	.hw_params	= hac_hw_params,
2688c2ecf20Sopenharmony_ci};
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_cistatic struct snd_soc_dai_driver sh4_hac_dai[] = {
2718c2ecf20Sopenharmony_ci{
2728c2ecf20Sopenharmony_ci	.name			= "hac-dai.0",
2738c2ecf20Sopenharmony_ci	.playback = {
2748c2ecf20Sopenharmony_ci		.rates		= AC97_RATES,
2758c2ecf20Sopenharmony_ci		.formats	= AC97_FMTS,
2768c2ecf20Sopenharmony_ci		.channels_min	= 2,
2778c2ecf20Sopenharmony_ci		.channels_max	= 2,
2788c2ecf20Sopenharmony_ci	},
2798c2ecf20Sopenharmony_ci	.capture = {
2808c2ecf20Sopenharmony_ci		.rates		= AC97_RATES,
2818c2ecf20Sopenharmony_ci		.formats	= AC97_FMTS,
2828c2ecf20Sopenharmony_ci		.channels_min	= 2,
2838c2ecf20Sopenharmony_ci		.channels_max	= 2,
2848c2ecf20Sopenharmony_ci	},
2858c2ecf20Sopenharmony_ci	.ops = &hac_dai_ops,
2868c2ecf20Sopenharmony_ci},
2878c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_SUBTYPE_SH7760
2888c2ecf20Sopenharmony_ci{
2898c2ecf20Sopenharmony_ci	.name			= "hac-dai.1",
2908c2ecf20Sopenharmony_ci	.id			= 1,
2918c2ecf20Sopenharmony_ci	.playback = {
2928c2ecf20Sopenharmony_ci		.rates		= AC97_RATES,
2938c2ecf20Sopenharmony_ci		.formats	= AC97_FMTS,
2948c2ecf20Sopenharmony_ci		.channels_min	= 2,
2958c2ecf20Sopenharmony_ci		.channels_max	= 2,
2968c2ecf20Sopenharmony_ci	},
2978c2ecf20Sopenharmony_ci	.capture = {
2988c2ecf20Sopenharmony_ci		.rates		= AC97_RATES,
2998c2ecf20Sopenharmony_ci		.formats	= AC97_FMTS,
3008c2ecf20Sopenharmony_ci		.channels_min	= 2,
3018c2ecf20Sopenharmony_ci		.channels_max	= 2,
3028c2ecf20Sopenharmony_ci	},
3038c2ecf20Sopenharmony_ci	.ops = &hac_dai_ops,
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci},
3068c2ecf20Sopenharmony_ci#endif
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_cistatic const struct snd_soc_component_driver sh4_hac_component = {
3108c2ecf20Sopenharmony_ci	.name		= "sh4-hac",
3118c2ecf20Sopenharmony_ci};
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_cistatic int hac_soc_platform_probe(struct platform_device *pdev)
3148c2ecf20Sopenharmony_ci{
3158c2ecf20Sopenharmony_ci	int ret;
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	ret = snd_soc_set_ac97_ops(&hac_ac97_ops);
3188c2ecf20Sopenharmony_ci	if (ret != 0)
3198c2ecf20Sopenharmony_ci		return ret;
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	return devm_snd_soc_register_component(&pdev->dev, &sh4_hac_component,
3228c2ecf20Sopenharmony_ci					  sh4_hac_dai, ARRAY_SIZE(sh4_hac_dai));
3238c2ecf20Sopenharmony_ci}
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_cistatic int hac_soc_platform_remove(struct platform_device *pdev)
3268c2ecf20Sopenharmony_ci{
3278c2ecf20Sopenharmony_ci	snd_soc_set_ac97_ops(NULL);
3288c2ecf20Sopenharmony_ci	return 0;
3298c2ecf20Sopenharmony_ci}
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_cistatic struct platform_driver hac_pcm_driver = {
3328c2ecf20Sopenharmony_ci	.driver = {
3338c2ecf20Sopenharmony_ci			.name = "hac-pcm-audio",
3348c2ecf20Sopenharmony_ci	},
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	.probe = hac_soc_platform_probe,
3378c2ecf20Sopenharmony_ci	.remove = hac_soc_platform_remove,
3388c2ecf20Sopenharmony_ci};
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_cimodule_platform_driver(hac_pcm_driver);
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
3438c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("SuperH onchip HAC (AC97) audio driver");
3448c2ecf20Sopenharmony_ciMODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");
345