blob: a283570064e038e63b43da9675fcdb2d2bfb06f5 [file] [log] [blame]
/*
* linux/sound/soc/pxa/pxa-es8311.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
//extern void enable_5616_MClock(void);
//extern void codec_es8311_Enable_Headsetdetection(void);
static int pxa_es8311_hifi_startup(struct snd_pcm_substream *substream)
{
return 0;
}
static int pxa_es8311_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
return 0;
}
static int pxa_es8311_hifi_prepare(struct snd_pcm_substream *substream)
{
return 0;
}
static int pxa_es8311_late_probe(struct snd_soc_card *card)
{
//enable_5616_MClock();
//codec_rt5616_Enable_Headsetdetection();
printk(KERN_INFO"%s/L%d.\n", __FUNCTION__, __LINE__);
return 0;
}
static const struct snd_soc_ops pxa_es8311_machine_ops[] = {
{
.startup = pxa_es8311_hifi_startup,
.hw_params = pxa_es8311_hw_params,
.prepare = pxa_es8311_hifi_prepare,
},
};
#ifdef CONFIG_CPU_ASR1901
SND_SOC_DAILINK_DEFS(es8311,
DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.1")),
DAILINK_COMP_ARRAY(COMP_CODEC("es8311.1-001b", "es8311-pcm")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-ssp-dai.1")));
#else
SND_SOC_DAILINK_DEFS(es8311,
DAILINK_COMP_ARRAY(COMP_CPU("pxa-ssp-dai.1")),
DAILINK_COMP_ARRAY(COMP_CODEC("es8311.0-0018", "es8311-pcm")),
DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-ssp-dai.1")));
#endif
static struct snd_soc_dai_link pxa_es8311_dai[] = {
{
.name = "es8311 pcm",
.stream_name = "mrvl-ssp",
.ops = &pxa_es8311_machine_ops[0],
SND_SOC_DAILINK_REG(es8311),
},
};
static struct snd_soc_card pxa_es8311_card = {
.name = "pxa-es8311-dkb-voice",
.dai_link = pxa_es8311_dai,
.num_links = ARRAY_SIZE(pxa_es8311_dai),
.late_probe = pxa_es8311_late_probe,
};
static struct of_device_id pxa_es8311_dt_ids[] = {
{ .compatible = "ASRMICRO,asrmicro-snd-card", },
{}
};
MODULE_DEVICE_TABLE(of, pxa_es8311_dt_ids);
static int pxa_es8311_probe(struct platform_device *pdev)
{
int ret;
struct snd_soc_card *card = &pxa_es8311_card;
pr_pm_debug(KERN_INFO"[8311 card probe: begin] %s/L%d.\n", __FUNCTION__, __LINE__);
printk("--->%s/L%d\n", __FUNCTION__, __LINE__);
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);
pr_pm_debug(KERN_INFO"[8311 card probe: end] %s/L%d.\n", __FUNCTION__, __LINE__);
return ret;
}
static struct platform_driver pxa_es8311_driver = {
.driver = {
.name = "pxa-es8311-platform",
.of_match_table = pxa_es8311_dt_ids,
.pm = &snd_soc_pm_ops,
},
.probe = pxa_es8311_probe,
};
module_platform_driver(pxa_es8311_driver);
/* Module information */
MODULE_AUTHOR("wenchen@asrmicro.com");
MODULE_DESCRIPTION("ALSA SoC TTC DKB");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pxa-es8311-dkb-voice");