blob: f0dbbb7c9c17db74e76cffa2adbdb706b685195c [file] [log] [blame]
/*
* linux/sound/soc/pxa/pxa-nau8810.c
*
* Copyright (C) 2013 Marvell International Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/88pm8xxx-headset.h>
#include <linux/features.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <sound/pcm_params.h>
#include <linux/pxa2xx_ssp.h>
#include <linux/input.h>
#include "pxa-ssp.h"
#ifdef CONFIG_SND_PXA_SSP_DUMP
int ssp_playback_enable;
int ssp_capture_enable;
int gssp_playback_enable;
int gssp_capture_enable;
#endif
#ifndef CONFIG_CPU_ASR18XX
u32 sscr0_hifi;
u32 sscr1_hifi;
#else
u32 top_ctrl_hifi;
u32 fifo_ctrl_hifi;
u32 rwot_ctrl_hifi;
u32 network_ctrl_hifi;
u32 int_en_hifi;
#endif
static int pxa_nau8810_hifi_startup(struct snd_pcm_substream *substream)
{
return 0;
}
static int pxa_nau8810_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
return 0;
}
static int pxa_nau8810_hifi_prepare(struct snd_pcm_substream *substream)
{
return 0;
}
static int pxa_nau8810_late_probe(struct snd_soc_card *card)
{
return 0;
}
static struct snd_soc_ops pxa_nau8810_machine_ops[] = {
{
.startup = pxa_nau8810_hifi_startup,
.hw_params = pxa_nau8810_hw_params,
.prepare = pxa_nau8810_hifi_prepare,
},
};
#if 1
SND_SOC_DAILINK_DEFS(nau8810,
DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.1")),
DAILINK_COMP_ARRAY(COMP_CODEC("nau8810.0-001a", "nau8810-pcm")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-ssp-dai.1")));
static struct snd_soc_dai_link pxa_nau8810_dai[] = {
{
.name = "nau8810 pcm",
.stream_name = "mrvl-ssp",
.ops = &pxa_nau8810_machine_ops[0],
SND_SOC_DAILINK_REG(nau8810),
},
};
#else
static struct snd_soc_dai_link pxa_nau8810_dai[] = {
{
.name = "nau8810 pcm",
.stream_name = "mrvl-ssp",
.codec_name = "nau8810.1-001a",
.platform_name = "pxa-ssp-dai.1",
.cpu_dai_name = "pxa-ssp-dai.1",
.codec_dai_name = "nau8810-pcm",
.ops = &pxa_nau8810_machine_ops[0],
},
};
#endif
static struct snd_soc_card pxa_nau8810_card = {
.name = "pxa-nau8810-dkb-voice",
.dai_link = pxa_nau8810_dai,
.num_links = ARRAY_SIZE(pxa_nau8810_dai),
.late_probe = pxa_nau8810_late_probe,
};
static struct of_device_id pxa_nau8810_dt_ids[] = {
{ .compatible = "ASRMICRO,asrmicro-snd-card", },
{}
};
MODULE_DEVICE_TABLE(of, pxa_nau8810_dt_ids);
static int pxa_nau8810_probe(struct platform_device *pdev)
{
int ret;
struct snd_soc_card *card = &pxa_nau8810_card;
card->dev = &pdev->dev;
ret = devm_snd_soc_register_card(&pdev->dev, card);
//if (ret)
//dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
printk(KERN_INFO"%s/L%d.\n", __FUNCTION__, __LINE__);
return ret;
}
static int pxa_nau8810_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
return 0;
}
static struct platform_driver pxa_nau8810_driver = {
.driver = {
.name = "pxa-nau8810-platform",
.owner = THIS_MODULE,
.of_match_table = pxa_nau8810_dt_ids,
},
.probe = pxa_nau8810_probe,
.remove = pxa_nau8810_remove,
};
module_platform_driver(pxa_nau8810_driver);
/* Module information */
MODULE_AUTHOR("wenchen@asrmicro.com");
MODULE_DESCRIPTION("ALSA SoC TTC DKB");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pxa-nau8810-dkb-voice");