Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120293
b: refs/heads/master
c: 9115171
h: refs/heads/master
i:
  120291: a944d20
v: v3
  • Loading branch information
Mark Brown committed Dec 9, 2008
1 parent 5fc8139 commit da83e70
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5af3a2e192d333997d1e191f3eba7fd2f869681
refs/heads/master: 9115171a6b79b6b4d5c6697f123556b6efc37f1f
8 changes: 8 additions & 0 deletions trunk/include/sound/soc-dai.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ struct snd_soc_dai_ops;
struct snd_soc_dai;
struct snd_ac97_bus_ops;

/* Digital Audio Interface registration */
int snd_soc_register_dai(struct snd_soc_dai *dai);
void snd_soc_unregister_dai(struct snd_soc_dai *dai);
int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count);
void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count);

/* Digital Audio Interface clocking API.*/
int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
unsigned int freq, int dir);
Expand Down Expand Up @@ -186,6 +192,8 @@ struct snd_soc_dai {
unsigned int id;
int ac97_control;

struct device *dev;

/* DAI callbacks */
int (*probe)(struct platform_device *pdev,
struct snd_soc_dai *dai);
Expand Down
83 changes: 83 additions & 0 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static struct dentry *debugfs_root;

static DEFINE_MUTEX(client_mutex);
static LIST_HEAD(card_list);
static LIST_HEAD(dai_list);

static int snd_soc_register_card(struct snd_soc_card *card);
static int snd_soc_unregister_card(struct snd_soc_card *card);
Expand Down Expand Up @@ -2019,6 +2020,88 @@ static int snd_soc_unregister_card(struct snd_soc_card *card)
return 0;
}

/**
* snd_soc_register_dai - Register a DAI with the ASoC core
*
* @param dai DAI to register
*/
int snd_soc_register_dai(struct snd_soc_dai *dai)
{
if (!dai->name)
return -EINVAL;

/* The device should become mandatory over time */
if (!dai->dev)
printk(KERN_WARNING "No device for DAI %s\n", dai->name);

INIT_LIST_HEAD(&dai->list);

mutex_lock(&client_mutex);
list_add(&dai->list, &dai_list);
mutex_unlock(&client_mutex);

pr_debug("Registered DAI '%s'\n", dai->name);

return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_register_dai);

/**
* snd_soc_unregister_dai - Unregister a DAI from the ASoC core
*
* @param dai DAI to unregister
*/
void snd_soc_unregister_dai(struct snd_soc_dai *dai)
{
mutex_lock(&client_mutex);
list_del(&dai->list);
mutex_unlock(&client_mutex);

pr_debug("Unregistered DAI '%s'\n", dai->name);
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_dai);

/**
* snd_soc_register_dais - Register multiple DAIs with the ASoC core
*
* @param dai Array of DAIs to register
* @param count Number of DAIs
*/
int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
{
int i, ret;

for (i = 0; i < count; i++) {
ret = snd_soc_register_dai(&dai[i]);
if (ret != 0)
goto err;
}

return 0;

err:
for (i--; i >= 0; i--)
snd_soc_unregister_dai(&dai[i]);

return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_register_dais);

/**
* snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core
*
* @param dai Array of DAIs to unregister
* @param count Number of DAIs
*/
void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count)
{
int i;

for (i = 0; i < count; i++)
snd_soc_unregister_dai(&dai[i]);
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);

static int __devinit snd_soc_init(void)
{
#ifdef CONFIG_DEBUG_FS
Expand Down

0 comments on commit da83e70

Please sign in to comment.