/*
 * ALSA SoC codec driver for DS925 audio on OMAP processors.
 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
 * Author: Ricardo Neri <ricardo.neri@ti.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * 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., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */
#include <linux/module.h>
#include <sound/soc.h>

#define DRV_NAME "ds925-audio-codec"



static int ds925_pcm_prepare(struct snd_pcm_substream *substream,
                                   struct snd_soc_dai *dai)
{
	printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
	return 0;
}
static int ds925_hw_params(struct snd_pcm_substream *substream,
                                 struct snd_pcm_hw_params *params,
                                 struct snd_soc_dai *dai)
{
        printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
        return 0;
}

static void ds925_shutdown(struct snd_pcm_substream *substream,
                                 struct snd_soc_dai *dai)
{
        printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
}

static int ds925_mute(struct snd_soc_dai *dai, int mute)
{
        printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
        return 0;
}

static int ds925_set_dai_fmt(struct snd_soc_dai *codec_dai,
                                   unsigned int fmt)
{
        printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
        return 0;
}

static int ds925_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                      int clk_id, unsigned int freq, int dir)
{
        printk("RES:::::: %s,%s,%d\n",__FILE__,__func__,__LINE__);
        return 0;
}


static struct snd_soc_codec_driver omap_ds925_codec;

static const struct snd_soc_dai_ops ds925_dai_ops = {
        .prepare        = ds925_pcm_prepare,
        .hw_params      = ds925_hw_params,
        .shutdown       = ds925_shutdown,
        .digital_mute   = ds925_mute,
        .set_fmt        = ds925_set_dai_fmt,
        .set_sysclk     = ds925_set_dai_sysclk,
};

static struct snd_soc_dai_driver omap_ds925_codec_dai = {
	.name = "omap-ds925-hifi",
	.playback = {
		.channels_min = 2,
		.channels_max = 8,
//		.rates = SNDRV_PCM_RATE_32000 |
		.rates = SNDRV_PCM_RATE_8000_96000, 
//			SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
//			SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
		//.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | 
		.formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE,

/*
		.formats =     SNDRV_PCM_FMTBIT_S8 |
                               SNDRV_PCM_FMTBIT_S16_LE |
                               SNDRV_PCM_FMTBIT_S32_LE |
                               SNDRV_PCM_FMTBIT_S32_BE,
*/	},
//        .ops = &ds925_dai_ops,
};

static int omap_ds925_codec_probe(struct platform_device *pdev)
{
	printk("DELPHIIIIII:---->%s,%s,%d\n",__FILE__,__func__,__LINE__);
	return snd_soc_register_codec(&pdev->dev, &omap_ds925_codec,
			&omap_ds925_codec_dai, 1);
}

static int omap_ds925_codec_remove(struct platform_device *pdev)
{
	printk("DELPHIIIIII:--->%s,%s,%d\n",__FILE__,__func__,__LINE__);
	snd_soc_unregister_codec(&pdev->dev);
	return 0;
}

static const struct of_device_id omap_ds925_of_match[] = {
        {.compatible = "ti,ds925-lvds-audio-codec", },
        { },
};

static struct platform_driver omap_ds925_codec_driver = {
	.driver		= {
		.name	= DRV_NAME,
		.owner	= THIS_MODULE,
		.of_match_table = omap_ds925_of_match,	
	},

	.probe		= omap_ds925_codec_probe,
	.remove		= omap_ds925_codec_remove,
};

module_platform_driver(omap_ds925_codec_driver);

MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
MODULE_DESCRIPTION("ASoC OMAP DS925 codec driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
