2009-08-21 00:42:59 +00: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>
|
2011-07-15 16:38:28 +00:00
|
|
|
#include <linux/module.h>
|
2009-08-21 00:42:59 +00:00
|
|
|
#include <sound/sh_fsi.h>
|
|
|
|
|
2010-11-30 02:32:04 +00:00
|
|
|
struct fsi_ak4642_data {
|
|
|
|
const char *name;
|
2010-12-01 06:50:52 +00:00
|
|
|
const char *card;
|
2010-11-30 02:32:04 +00:00
|
|
|
const char *cpu_dai;
|
|
|
|
const char *codec;
|
|
|
|
const char *platform;
|
2011-01-12 06:32:07 +00:00
|
|
|
int id;
|
2010-11-30 02:32:04 +00:00
|
|
|
};
|
|
|
|
|
2010-03-17 20:15:21 +00:00
|
|
|
static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
|
2010-03-23 07:27:28 +00:00
|
|
|
{
|
2011-01-20 02:46:02 +00:00
|
|
|
struct snd_soc_dai *codec = rtd->codec_dai;
|
|
|
|
struct snd_soc_dai *cpu = rtd->cpu_dai;
|
2010-03-23 07:27:28 +00:00
|
|
|
int ret;
|
|
|
|
|
2011-01-20 02:46:02 +00:00
|
|
|
ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J |
|
|
|
|
SND_SOC_DAIFMT_CBM_CFM);
|
2010-03-15 09:10:50 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2011-01-20 02:46:02 +00:00
|
|
|
ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2011-01-24 01:43:19 +00:00
|
|
|
ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J |
|
|
|
|
SND_SOC_DAIFMT_CBS_CFS);
|
2010-03-23 07:27:28 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-08-21 00:42:59 +00:00
|
|
|
static struct snd_soc_dai_link fsi_dai_link = {
|
2010-03-17 20:15:21 +00:00
|
|
|
.codec_dai_name = "ak4642-hifi",
|
2010-03-23 07:27:28 +00:00
|
|
|
.init = fsi_ak4642_dai_init,
|
2009-08-21 00:42:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct snd_soc_card fsi_soc_card = {
|
2011-12-23 06:53:32 +00:00
|
|
|
.owner = THIS_MODULE,
|
2009-08-21 00:42:59 +00:00
|
|
|
.dai_link = &fsi_dai_link,
|
|
|
|
.num_links = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device *fsi_snd_device;
|
|
|
|
|
2010-11-30 02:32:04 +00:00
|
|
|
static int fsi_ak4642_probe(struct platform_device *pdev)
|
2009-08-21 00:42:59 +00:00
|
|
|
{
|
|
|
|
int ret = -ENOMEM;
|
2011-11-24 00:55:34 +00:00
|
|
|
struct fsi_ak4642_info *pinfo = pdev->dev.platform_data;
|
2010-11-30 02:32:04 +00:00
|
|
|
|
2011-11-24 00:55:34 +00:00
|
|
|
if (!pinfo) {
|
|
|
|
dev_err(&pdev->dev, "no info for fsi ak4642\n");
|
|
|
|
goto out;
|
2010-11-30 02:32:04 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 00:55:34 +00:00
|
|
|
fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id);
|
2009-08-21 00:42:59 +00:00
|
|
|
if (!fsi_snd_device)
|
|
|
|
goto out;
|
|
|
|
|
2011-11-24 00:55:34 +00:00
|
|
|
fsi_dai_link.name = pinfo->name;
|
|
|
|
fsi_dai_link.stream_name = pinfo->name;
|
|
|
|
fsi_dai_link.cpu_dai_name = pinfo->cpu_dai;
|
|
|
|
fsi_dai_link.platform_name = pinfo->platform;
|
|
|
|
fsi_dai_link.codec_name = pinfo->codec;
|
|
|
|
fsi_soc_card.name = pinfo->card;
|
2010-11-30 02:32:04 +00:00
|
|
|
|
2010-03-17 20:15:21 +00:00
|
|
|
platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
|
2009-08-21 00:42:59 +00:00
|
|
|
ret = platform_device_add(fsi_snd_device);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
platform_device_put(fsi_snd_device);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-11-30 02:32:04 +00:00
|
|
|
static int fsi_ak4642_remove(struct platform_device *pdev)
|
2009-08-21 00:42:59 +00:00
|
|
|
{
|
|
|
|
platform_device_unregister(fsi_snd_device);
|
2010-11-30 02:32:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver fsi_ak4642 = {
|
|
|
|
.driver = {
|
|
|
|
.name = "fsi-ak4642-audio",
|
|
|
|
},
|
|
|
|
.probe = fsi_ak4642_probe,
|
|
|
|
.remove = fsi_ak4642_remove,
|
|
|
|
};
|
|
|
|
|
2011-11-25 02:15:07 +00:00
|
|
|
module_platform_driver(fsi_ak4642);
|
2009-08-21 00:42:59 +00:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
|
|
|
|
MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
|