/*
 * tonka.c  --  SoC audio for Tonka
 *
 * Author: Misael Lopez Cruz <misael.lopez@ti.com>
 *         Liam Girdwood <lrg@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/clk.h>
#include <linux/platform_device.h>
#include <linux/module.h>

#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/soc-dapm.h>
#include <sound/soc-dsp.h>

#include <asm/mach-types.h>
#include <plat/hardware.h>
#include <plat/mux.h>
#include <plat/mcbsp.h>

#include "omap-pcm.h"
#include "omap-abe.h"
#include "omap-abe-dsp.h"
#include "omap-mcbsp.h"

static int tonka_mcbsp_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int ret = 0;
	unsigned int channels, div;

	/* Codec reference clock. */
	ret = snd_soc_dai_set_sysclk(codec_dai, 0, 12000000, SND_SOC_CLOCK_IN);
	if (unlikely(ret < 0)) {
		dev_err(codec_dai->dev, "can't set reference clock\n");
		return ret;
	}

	/* Set cpu DAI configuration */
	ret = snd_soc_dai_set_fmt(cpu_dai,
				  SND_SOC_DAIFMT_I2S |
				  SND_SOC_DAIFMT_NB_NF |
				  SND_SOC_DAIFMT_CBS_CFS);
	if (unlikely(ret < 0)) {
		dev_err(cpu_dai->dev, "can't set format\n");
		return ret;
	}

	if (params != NULL) {
		/* Configure McBSP internal buffer usage */
		/* this need to be done for playback and/or record */
		channels = params_channels(params);
		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
			omap_mcbsp_set_tx_threshold(
				cpu_dai->id, channels);
		else
			omap_mcbsp_set_rx_threshold(
				cpu_dai->id, channels);
	}

	/* Clock master mode; derive bit clock from FCLK. */
	ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_FCLK,
				     24576000, SND_SOC_CLOCK_IN);
	if (unlikely(ret < 0)) {
		dev_err(cpu_dai->dev, "can't set reference clock\n");
		return ret;
	}

	switch (params_rate(params)) {
	case 44100:	/* XXX 45176 */
		div = 17;
		break;
	case 48000:
		div = 16;
		break;
	default:
		dev_err(cpu_dai->dev, "unknown rate %d\n", params_rate(params));
		return -EINVAL;
	}
	ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, div);
	if (unlikely(ret < 0)) {
		dev_err(cpu_dai->dev, "can't set clock divider\n");
		return ret;
	}

	return 0;
}

static struct snd_soc_ops tonka_mcbsp_ops = {
	.hw_params = tonka_mcbsp_hw_params,
};

static int tonka_mcbsp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
			struct snd_pcm_hw_params *params)
{
	struct snd_interval *channels = hw_param_interval(params,
                                       SNDRV_PCM_HW_PARAM_CHANNELS);

	channels->min = 2;
	channels->max = 2;
	snd_mask_set(&params->masks[SNDRV_PCM_HW_PARAM_FORMAT -
	                            SNDRV_PCM_HW_PARAM_FIRST_MASK],
	                            SNDRV_PCM_FORMAT_S16_LE);
	return 0;
}

static int sdp4430_stream_event(struct snd_soc_dapm_context *dapm, int event)
{
#if 0
	/*
	 * set DL1 gains dynamically according to the active output
	 * (Headset, Earpiece) and HSDAC power mode
	 */
	return sdp4430_set_pdm_dl1_gains(dapm);
#else
	return 0;
#endif
}

static const struct snd_kcontrol_new tonka_controls_display[] = {
};

static const struct snd_soc_dapm_widget tonka_dapm_widgets_display[] = {
};

static const struct snd_soc_dapm_route tonka_dapm_routes_display[] = {
};

static int tonka_display_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	//snd_soc_dapm_nc_pin(dapm, "MIC3L");
	//…

	ret = snd_soc_add_controls(codec, tonka_controls_display,
				   ARRAY_SIZE(tonka_controls_display));
	if (unlikely(ret < 0))
		return ret;

	ret = snd_soc_dapm_new_controls(dapm, tonka_dapm_widgets_display,
					ARRAY_SIZE(tonka_dapm_widgets_display));
	if (unlikely(ret < 0))
		return ret;

	ret = snd_soc_dapm_add_routes(dapm, tonka_dapm_routes_display,
				      ARRAY_SIZE(tonka_dapm_routes_display));
	if (unlikely(ret < 0))
		return ret;

	return 0;
}

static const struct snd_kcontrol_new tonka_controls_speaker[] = {
};

static const struct snd_soc_dapm_widget tonka_dapm_widgets_speaker[] = {
	SND_SOC_DAPM_LINE("Line Out", NULL),
	SND_SOC_DAPM_HP("Headphone Jack", NULL),
	SND_SOC_DAPM_LINE("Line In", NULL),
	SND_SOC_DAPM_MIC("Mic In", NULL),
};

static const struct snd_soc_dapm_route tonka_dapm_routes_speaker[] = {
	{"Line Out", NULL, "Speaker LOUT"},
	{"Line Out", NULL, "Speaker ROUT"},
	{"Headphone Jack", NULL, "Speaker LHPOUT"},
	{"Headphone Jack", NULL, "Speaker RHPOUT"},
	{"Speaker LLINEIN", NULL, "Line In"},
	{"Speaker RLINEIN", NULL, "Line In"},
	{"Speaker MICIN", NULL, "Mic In"},
};

static int tonka_speaker_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	//snd_soc_dapm_nc_pin(dapm, "MIC3L");
	//…

	ret = snd_soc_add_controls(codec, tonka_controls_speaker,
				   ARRAY_SIZE(tonka_controls_speaker));
	if (unlikely(ret < 0))
		return ret;

	ret = snd_soc_dapm_new_controls(dapm, tonka_dapm_widgets_speaker,
					ARRAY_SIZE(tonka_dapm_widgets_speaker));
	if (unlikely(ret < 0))
		return ret;

	ret = snd_soc_dapm_add_routes(dapm, tonka_dapm_routes_speaker,
				      ARRAY_SIZE(tonka_dapm_routes_speaker));
	if (unlikely(ret < 0))
		return ret;

	return 0;
}

static struct snd_soc_dsp_link fe_media = {
	.playback	= true,
	.capture	= true,
	.trigger =
		{SND_SOC_DSP_TRIGGER_BESPOKE, SND_SOC_DSP_TRIGGER_BESPOKE},
};

static struct snd_soc_dsp_link fe_media_capture = {
	.capture	= true,
	.trigger =
		{SND_SOC_DSP_TRIGGER_BESPOKE, SND_SOC_DSP_TRIGGER_BESPOKE},
};

static struct snd_soc_dsp_link fe_tones = {
	.playback	= true,
	.trigger =
		{SND_SOC_DSP_TRIGGER_BESPOKE, SND_SOC_DSP_TRIGGER_BESPOKE},
};

static struct snd_soc_dsp_link fe_lp_media = {
	.playback	= true,
	.trigger =
		{SND_SOC_DSP_TRIGGER_BESPOKE, SND_SOC_DSP_TRIGGER_BESPOKE},
};

static struct snd_soc_dai_link tonka_dai[] = {

/*
 * Frontend DAIs - i.e. userspace visible interfaces (ALSA PCMs)
 */

	{
		.name = "Tonka Media",
		.stream_name = "Multimedia",

		/* ABE components - MM-UL & MM_DL */
		.cpu_dai_name = "MultiMedia1",
		.platform_name = "omap-pcm-audio",

		.dynamic = 1, /* BE is dynamic */
		.dsp_link = &fe_media,
	},
	{
		.name = "Tonka Media Capture",
		.stream_name = "Multimedia Capture",

		/* ABE components - MM-UL2 */
		.cpu_dai_name = "MultiMedia2",
		.platform_name = "omap-pcm-audio",

		.dynamic = 1, /* BE is dynamic */
		.dsp_link = &fe_media_capture,
	},
	{
		.name = "Tonka Voice",
		.stream_name = "Voice",

		/* ABE components - VX-UL & VX-DL */
		.cpu_dai_name = "Voice",
		.platform_name = "omap-pcm-audio",

		.dynamic = 1, /* BE is dynamic */
		.dsp_link = &fe_media,
		.no_host_mode = SND_SOC_DAI_LINK_OPT_HOST,
	},
	{
		.name = "Tonka Tones Playback",
		.stream_name = "Tone Playback",

		/* ABE components - TONES_DL */
		.cpu_dai_name = "Tones",
		.platform_name = "omap-pcm-audio",

		.dynamic = 1, /* BE is dynamic */
		.dsp_link = &fe_tones,
	},
	{
		.name = "Tonka Media LP",
		.stream_name = "Multimedia",

		/* ABE components - MM-DL (mmap) */
		.cpu_dai_name = "MultiMedia1 LP",
		.platform_name = "aess",

		.dynamic = 1, /* BE is dynamic */
		.dsp_link = &fe_lp_media,
	},

/*
 * Backend DAIs - i.e. dynamically matched interfaces, invisible to userspace.
 * Matched to above interfaces at runtime, based upon use case.
 */

	{
		.name = OMAP_ABE_BE_BT_VX_UL,
		.stream_name = "BT Capture",

		/* ABE components - MCBSP2 - BT-VX */
		.cpu_dai_name = "omap-mcbsp-dai.1",
		.platform_name = "aess",

		/* Bluetooth */
		.codec_dai_name = "tlv320aic23-hifi",
		.codec_name = "tlv320aic23-codec.3-001a",
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
			   SND_SOC_DAIFMT_CBS_CFS,
		.init = tonka_display_init,

		.no_pcm = 1, /* don't create ALSA pcm for this */
		.be_hw_params_fixup = tonka_mcbsp_be_hw_params_fixup,
		.ops = &tonka_mcbsp_ops,
		.be_id = OMAP_ABE_DAI_BT_VX,
	},
	{
		.name = OMAP_ABE_BE_BT_VX_DL,
		.stream_name = "BT Playback",

		/* ABE components - MCBSP2 - BT-VX */
		.cpu_dai_name = "omap-mcbsp-dai.1",
		.platform_name = "aess",

		/* Bluetooth */
		.codec_dai_name = "tlv320aic23-hifi",
		.codec_name = "tlv320aic23-codec.3-001a",
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
			   SND_SOC_DAIFMT_CBS_CFS,
		//.init = tonka_display_init,

		.no_pcm = 1, /* don't create ALSA pcm for this */
		.be_hw_params_fixup = tonka_mcbsp_be_hw_params_fixup,
		.ops = &tonka_mcbsp_ops,
		.be_id = OMAP_ABE_DAI_BT_VX,
	},
	{
		.name = "MM-EXT-UL",
		.stream_name = "FM Capture",

		/* ABE components - MCBSP1 - MM-EXT */
		.cpu_dai_name = "omap-mcbsp-dai.0",
		.platform_name = "aess",

		/* FM */
		.codec_dai_name = "tlv320aic23-hifi",
		.codec_name = "tlv320aic23-codec.3-001b",
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
			   SND_SOC_DAIFMT_CBS_CFS,
		.init = tonka_speaker_init,

		.no_pcm = 1, /* don't create ALSA pcm for this */
		.be_hw_params_fixup = tonka_mcbsp_be_hw_params_fixup,
		.ops = &tonka_mcbsp_ops,
		.be_id = OMAP_ABE_DAI_MM_FM,
	},
	{
		.name = "MM-EXT-DL",
		.stream_name = "FM Playback",

		/* ABE components - MCBSP1 - MM-EXT */
		.cpu_dai_name = "omap-mcbsp-dai.0",
		.platform_name = "aess",

		/* FM */
		.codec_dai_name = "tlv320aic23-hifi",
		.codec_name = "tlv320aic23-codec.3-001b",
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
			   SND_SOC_DAIFMT_CBS_CFS,
		//.init = tonka_speaker_init,

		.no_pcm = 1, /* don't create ALSA pcm for this */
		.be_hw_params_fixup = tonka_mcbsp_be_hw_params_fixup,
		.ops = &tonka_mcbsp_ops,
		.be_id = OMAP_ABE_DAI_MM_FM,
	},
};

static struct snd_soc_codec_conf tonka_codec_conf[] = {
	{
		.dev_name = "tlv320aic23-codec.3-001a",
		.name_prefix = "Display",
	},
	{
		.dev_name = "tlv320aic23-codec.3-001b",
		.name_prefix = "Speaker",
	},
};

/* Audio machine driver */
static struct snd_soc_card snd_soc_tonka = {
	.name = "Tonka",
	.driver_name = "OMAP4",
	.long_name = "TI OMAP4 Board",
	.dai_link = tonka_dai,
	.num_links = ARRAY_SIZE(tonka_dai),
	.codec_conf = tonka_codec_conf,
	.num_configs = ARRAY_SIZE(tonka_codec_conf),

	.stream_event = sdp4430_stream_event,
};

static struct platform_device *tonka_snd_device;

static int __init tonka_soc_init(void)
{
	int ret;

	printk(KERN_INFO "Tonka SoC init\n");

	tonka_snd_device = platform_device_alloc("soc-audio", -1);
	if (!tonka_snd_device)
		return -ENOMEM;

	platform_set_drvdata(tonka_snd_device, &snd_soc_tonka);

	ret = platform_device_add(tonka_snd_device);
	if (ret)
		goto err;

	return 0;

err:
	platform_device_put(tonka_snd_device);
	return ret;
}
module_init(tonka_soc_init);

static void __exit tonka_soc_exit(void)
{
	platform_device_unregister(tonka_snd_device);
}
module_exit(tonka_soc_exit);

MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
MODULE_DESCRIPTION("ALSA SoC Tonka");
MODULE_LICENSE("GPL");
