/*
* Renesas R-Car SRU/SCU/SSIU/SSI support
*
* Copyright (C) 2013 Renesas Solutions Corp.
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*
* Based on fsi.c
* Kuninori Morimoto <morimoto.kuninori@renesas.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.
*/
/*
* Renesas R-Car sound device structure
*
* Gen1
*
* SRU : Sound Routing Unit
* - SRC : Sampling Rate Converter
* - CMD
* - CTU : Channel Count Conversion Unit
* - MIX : Mixer
* - DVC : Digital Volume and Mute Function
* - SSI : Serial Sound Interface
*
* Gen2
*
* SCU : Sampling Rate Converter Unit
* - SRC : Sampling Rate Converter
* - CMD
* - CTU : Channel Count Conversion Unit
* - MIX : Mixer
* - DVC : Digital Volume and Mute Function
* SSIU : Serial Sound Interface Unit
* - SSI : Serial Sound Interface
*/
/*
* driver data Image
*
* rsnd_priv
* |
* | ** this depends on Gen1/Gen2
* |
* +- gen
* |
* | ** these depend on data path
* | ** gen and platform data control it
* |
* +- rdai[0]
* | | sru ssiu ssi
* | +- playback -> [mod] -> [mod] -> [mod] -> ...
* | |
* | | sru ssiu ssi
* | +- capture -> [mod] -> [mod] -> [mod] -> ...
* |
* +- rdai[1]
* | | sru ssiu ssi
* | +- playback -> [mod] -> [mod] -> [mod] -> ...
* | |
* | | sru ssiu ssi
* | +- capture -> [mod] -> [mod] -> [mod] -> ...
* ...
* |
* | ** these control ssi
* |
* +- ssi
* | |
* | +- ssi[0]
* | +- ssi[1]
* | +- ssi[2]
* | ...
* |
* | ** these control src
* |
* +- src
* |
* +- src[0]
* +- src[1]
* +- src[2]
* ...
*
*
* for_each_rsnd_dai(xx, priv, xx)
* rdai[0] => rdai[1] => rdai[2] => ...
*
* for_each_rsnd_mod(xx, rdai, xx)
* [mod] => [mod] => [mod] => ...
*
* rsnd_dai_call(xxx, fn )
* [mod]->fn() -> [mod]->fn() -> [mod]->fn()...
*
*/
#include <linux/pm_runtime.h>
#include "rsnd.h"
#define RSND_RATES SNDRV_PCM_RATE_8000_192000
#define RSND_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
static const struct of_device_id rsnd_of_match[] = {
{ .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 },
{ .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 },
{ .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN2 }, /* gen2 compatible */
{},
};
MODULE_DEVICE_TABLE(of, rsnd_of_match);
/*
* rsnd_mod functions
*/
void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type)
{
if (mod->type != type) {
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
dev_warn(dev, "%s[%d] is not your expected module\n",
rsnd_mod_name(mod), rsnd_mod_id(mod));
}
}