2009-08-21 04:42:59 +04:00
|
|
|
/*
|
|
|
|
* FSI-AK464x sound support for ms7724se
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Renesas Solutions Corp.
|
|
|
|
* Kuninori Morimoto <morimoto.kuninori@renesas.com>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <sound/sh_fsi.h>
|
|
|
|
|
2010-11-30 05:32:04 +03:00
|
|
|
struct fsi_ak4642_data {
|
|
|
|
const char *name;
|
2010-12-01 09:50:52 +03:00
|
|
|
const char *card;
|
2010-11-30 05:32:04 +03:00
|
|
|
const char *cpu_dai;
|
|
|
|
const char *codec;
|
|
|
|
const char *platform;
|
|
|
|
};
|
|
|
|
|
2010-03-17 23:15:21 +03:00
|
|
|
static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
|
2010-03-23 10:27:28 +03:00
|
|
|
{
|
2010-03-17 23:15:21 +03:00
|
|
|
struct snd_soc_dai *dai = rtd->codec_dai;
|
2010-03-23 10:27:28 +03:00
|
|
|
int ret;
|
|
|
|
|
2010-03-17 23:15:21 +03:00
|
|
|
ret = snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_CBM_CFM);
|
2010-03-15 12:10:50 +03:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2010-03-17 23:15:21 +03:00
|
|
|
ret = snd_soc_dai_set_sysclk(dai, 0, 11289600, 0);
|
2010-03-23 10:27:28 +03:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-08-21 04:42:59 +04:00
|
|
|
static struct snd_soc_dai_link fsi_dai_link = {
|
2010-03-17 23:15:21 +03:00
|
|
|
.codec_dai_name = "ak4642-hifi",
|
2010-03-23 10:27:28 +03:00
|
|
|
.init = fsi_ak4642_dai_init,
|
2009-08-21 04:42:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct snd_soc_card fsi_soc_card = {
|
|
|
|
.dai_link = &fsi_dai_link,
|
|
|
|
.num_links = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device *fsi_snd_device;
|
|
|
|
|
2010-11-30 05:32:04 +03:00
|
|
|
static int fsi_ak4642_probe(struct platform_device *pdev)
|
2009-08-21 04:42:59 +04:00
|
|
|
{
|
|
|
|
int ret = -ENOMEM;
|
2010-11-30 05:32:04 +03:00
|
|
|
const struct platform_device_id *id_entry;
|
|
|
|
struct fsi_ak4642_data *pdata;
|
|
|
|
|
|
|
|
id_entry = pdev->id_entry;
|
|
|
|
if (!id_entry) {
|
|
|
|
dev_err(&pdev->dev, "unknown fsi ak4642\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
pdata = (struct fsi_ak4642_data *)id_entry->driver_data;
|
2009-08-21 04:42:59 +04:00
|
|
|
|
2010-07-16 14:51:06 +04:00
|
|
|
fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_A);
|
2009-08-21 04:42:59 +04:00
|
|
|
if (!fsi_snd_device)
|
|
|
|
goto out;
|
|
|
|
|
2010-11-30 05:32:04 +03:00
|
|
|
fsi_dai_link.name = pdata->name;
|
|
|
|
fsi_dai_link.stream_name = pdata->name;
|
|
|
|
fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
|
|
|
|
fsi_dai_link.platform_name = pdata->platform;
|
|
|
|
fsi_dai_link.codec_name = pdata->codec;
|
2010-12-01 09:50:52 +03:00
|
|
|
fsi_soc_card.name = pdata->card;
|
2010-11-30 05:32:04 +03:00
|
|
|
|
2010-03-17 23:15:21 +03:00
|
|
|
platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
|
2009-08-21 04:42:59 +04:00
|
|
|
ret = platform_device_add(fsi_snd_device);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
platform_device_put(fsi_snd_device);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-11-30 05:32:04 +03:00
|
|
|
static int fsi_ak4642_remove(struct platform_device *pdev)
|
2009-08-21 04:42:59 +04:00
|
|
|
{
|
|
|
|
platform_device_unregister(fsi_snd_device);
|
2010-11-30 05:32:04 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi_a_ak4642 = {
|
|
|
|
.name = "AK4642",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSIA (AK4642)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsia-dai",
|
|
|
|
.codec = "ak4642-codec.0-0012",
|
|
|
|
.platform = "sh_fsi.0",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi_b_ak4642 = {
|
|
|
|
.name = "AK4642",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSIB (AK4642)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsib-dai",
|
|
|
|
.codec = "ak4642-codec.0-0012",
|
|
|
|
.platform = "sh_fsi.0",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi_a_ak4643 = {
|
|
|
|
.name = "AK4643",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSIA (AK4643)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsia-dai",
|
|
|
|
.codec = "ak4642-codec.0-0013",
|
|
|
|
.platform = "sh_fsi.0",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi_b_ak4643 = {
|
|
|
|
.name = "AK4643",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSIB (AK4643)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsib-dai",
|
|
|
|
.codec = "ak4642-codec.0-0013",
|
|
|
|
.platform = "sh_fsi.0",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi2_a_ak4642 = {
|
|
|
|
.name = "AK4642",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSI2A (AK4642)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsia-dai",
|
|
|
|
.codec = "ak4642-codec.0-0012",
|
|
|
|
.platform = "sh_fsi2",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi2_b_ak4642 = {
|
|
|
|
.name = "AK4642",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSI2B (AK4642)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsib-dai",
|
|
|
|
.codec = "ak4642-codec.0-0012",
|
|
|
|
.platform = "sh_fsi2",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi2_a_ak4643 = {
|
|
|
|
.name = "AK4643",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSI2A (AK4643)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsia-dai",
|
|
|
|
.codec = "ak4642-codec.0-0013",
|
|
|
|
.platform = "sh_fsi2",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct fsi_ak4642_data fsi2_b_ak4643 = {
|
|
|
|
.name = "AK4643",
|
2010-12-01 09:50:52 +03:00
|
|
|
.card = "FSI2B (AK4643)",
|
2010-11-30 05:32:04 +03:00
|
|
|
.cpu_dai = "fsib-dai",
|
|
|
|
.codec = "ak4642-codec.0-0013",
|
|
|
|
.platform = "sh_fsi2",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device_id fsi_id_table[] = {
|
|
|
|
/* FSI */
|
|
|
|
{ "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 },
|
|
|
|
{ "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 },
|
|
|
|
{ "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 },
|
|
|
|
{ "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 },
|
|
|
|
|
|
|
|
/* FSI 2 */
|
|
|
|
{ "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 },
|
|
|
|
{ "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 },
|
|
|
|
{ "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 },
|
|
|
|
{ "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_driver fsi_ak4642 = {
|
|
|
|
.driver = {
|
|
|
|
.name = "fsi-ak4642-audio",
|
|
|
|
},
|
|
|
|
.probe = fsi_ak4642_probe,
|
|
|
|
.remove = fsi_ak4642_remove,
|
|
|
|
.id_table = fsi_id_table,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init fsi_ak4642_init(void)
|
|
|
|
{
|
|
|
|
return platform_driver_register(&fsi_ak4642);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit fsi_ak4642_exit(void)
|
|
|
|
{
|
|
|
|
platform_driver_unregister(&fsi_ak4642);
|
2009-08-21 04:42:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(fsi_ak4642_init);
|
|
|
|
module_exit(fsi_ak4642_exit);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
|
|
|
|
MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
|