diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2010-12-06 04:51:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-06 09:13:46 -0500 |
commit | 0d735eaa2c1d80c997fd775b679e36b80b8e85d1 (patch) | |
tree | 7bfcbe748f68808de5e598853c5d893242d5d963 | |
parent | 9545cd85a6dd1cce793b309800d2a03af9a886a8 (diff) |
ASoC: soc-cache: Add optional cache name member to snd_soc_cache_ops
Added an optional name member to snd_soc_cache_ops to enable more
sensible diagnostic messages during cache init, exit and sync.
Remove redundant newline in source code.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/soc.h | 1 | ||||
-rw-r--r-- | sound/soc/soc-cache.c | 18 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 3 |
3 files changed, 17 insertions, 5 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 4abc2f8fe77a..0a962dc42c5b 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -437,6 +437,7 @@ struct snd_soc_ops { | |||
437 | 437 | ||
438 | /* SoC cache ops */ | 438 | /* SoC cache ops */ |
439 | struct snd_soc_cache_ops { | 439 | struct snd_soc_cache_ops { |
440 | const char *name; | ||
440 | enum snd_soc_compress_type id; | 441 | enum snd_soc_compress_type id; |
441 | int (*init)(struct snd_soc_codec *codec); | 442 | int (*init)(struct snd_soc_codec *codec); |
442 | int (*exit)(struct snd_soc_codec *codec); | 443 | int (*exit)(struct snd_soc_codec *codec); |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index ff2bc8beddaa..678fd75d4511 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -1533,6 +1533,7 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec) | |||
1533 | static const struct snd_soc_cache_ops cache_types[] = { | 1533 | static const struct snd_soc_cache_ops cache_types[] = { |
1534 | { | 1534 | { |
1535 | .id = SND_SOC_FLAT_COMPRESSION, | 1535 | .id = SND_SOC_FLAT_COMPRESSION, |
1536 | .name = "flat", | ||
1536 | .init = snd_soc_flat_cache_init, | 1537 | .init = snd_soc_flat_cache_init, |
1537 | .exit = snd_soc_flat_cache_exit, | 1538 | .exit = snd_soc_flat_cache_exit, |
1538 | .read = snd_soc_flat_cache_read, | 1539 | .read = snd_soc_flat_cache_read, |
@@ -1541,6 +1542,7 @@ static const struct snd_soc_cache_ops cache_types[] = { | |||
1541 | }, | 1542 | }, |
1542 | { | 1543 | { |
1543 | .id = SND_SOC_LZO_COMPRESSION, | 1544 | .id = SND_SOC_LZO_COMPRESSION, |
1545 | .name = "LZO", | ||
1544 | .init = snd_soc_lzo_cache_init, | 1546 | .init = snd_soc_lzo_cache_init, |
1545 | .exit = snd_soc_lzo_cache_exit, | 1547 | .exit = snd_soc_lzo_cache_exit, |
1546 | .read = snd_soc_lzo_cache_read, | 1548 | .read = snd_soc_lzo_cache_read, |
@@ -1549,6 +1551,7 @@ static const struct snd_soc_cache_ops cache_types[] = { | |||
1549 | }, | 1551 | }, |
1550 | { | 1552 | { |
1551 | .id = SND_SOC_RBTREE_COMPRESSION, | 1553 | .id = SND_SOC_RBTREE_COMPRESSION, |
1554 | .name = "rbtree", | ||
1552 | .init = snd_soc_rbtree_cache_init, | 1555 | .init = snd_soc_rbtree_cache_init, |
1553 | .exit = snd_soc_rbtree_cache_exit, | 1556 | .exit = snd_soc_rbtree_cache_exit, |
1554 | .read = snd_soc_rbtree_cache_read, | 1557 | .read = snd_soc_rbtree_cache_read, |
@@ -1573,8 +1576,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) | |||
1573 | mutex_init(&codec->cache_rw_mutex); | 1576 | mutex_init(&codec->cache_rw_mutex); |
1574 | codec->cache_ops = &cache_types[i]; | 1577 | codec->cache_ops = &cache_types[i]; |
1575 | 1578 | ||
1576 | if (codec->cache_ops->init) | 1579 | if (codec->cache_ops->init) { |
1580 | if (codec->cache_ops->name) | ||
1581 | dev_dbg(codec->dev, "Initializing %s cache for %s codec\n", | ||
1582 | codec->cache_ops->name, codec->name); | ||
1577 | return codec->cache_ops->init(codec); | 1583 | return codec->cache_ops->init(codec); |
1584 | } | ||
1578 | return -EINVAL; | 1585 | return -EINVAL; |
1579 | } | 1586 | } |
1580 | 1587 | ||
@@ -1584,8 +1591,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec) | |||
1584 | */ | 1591 | */ |
1585 | int snd_soc_cache_exit(struct snd_soc_codec *codec) | 1592 | int snd_soc_cache_exit(struct snd_soc_codec *codec) |
1586 | { | 1593 | { |
1587 | if (codec->cache_ops && codec->cache_ops->exit) | 1594 | if (codec->cache_ops && codec->cache_ops->exit) { |
1595 | if (codec->cache_ops->name) | ||
1596 | dev_dbg(codec->dev, "Destroying %s cache for %s codec\n", | ||
1597 | codec->cache_ops->name, codec->name); | ||
1588 | return codec->cache_ops->exit(codec); | 1598 | return codec->cache_ops->exit(codec); |
1599 | } | ||
1589 | return -EINVAL; | 1600 | return -EINVAL; |
1590 | } | 1601 | } |
1591 | 1602 | ||
@@ -1657,6 +1668,9 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec) | |||
1657 | } | 1668 | } |
1658 | 1669 | ||
1659 | if (codec->cache_ops && codec->cache_ops->sync) { | 1670 | if (codec->cache_ops && codec->cache_ops->sync) { |
1671 | if (codec->cache_ops->name) | ||
1672 | dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", | ||
1673 | codec->cache_ops->name, codec->name); | ||
1660 | ret = codec->cache_ops->sync(codec); | 1674 | ret = codec->cache_ops->sync(codec); |
1661 | if (!ret) | 1675 | if (!ret) |
1662 | codec->cache_sync = 0; | 1676 | codec->cache_sync = 0; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 822bd3bcf148..a90e067fb0ab 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1742,8 +1742,6 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec, | |||
1742 | /* override the compress_type if necessary */ | 1742 | /* override the compress_type if necessary */ |
1743 | if (compress_type && codec->compress_type != compress_type) | 1743 | if (compress_type && codec->compress_type != compress_type) |
1744 | codec->compress_type = compress_type; | 1744 | codec->compress_type = compress_type; |
1745 | dev_dbg(codec->dev, "Cache compress_type for %s is %d\n", | ||
1746 | codec->name, codec->compress_type); | ||
1747 | ret = snd_soc_cache_init(codec); | 1745 | ret = snd_soc_cache_init(codec); |
1748 | if (ret < 0) { | 1746 | if (ret < 0) { |
1749 | dev_err(codec->dev, "Failed to set cache compression type: %d\n", | 1747 | dev_err(codec->dev, "Failed to set cache compression type: %d\n", |
@@ -1754,7 +1752,6 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec, | |||
1754 | return 0; | 1752 | return 0; |
1755 | } | 1753 | } |
1756 | 1754 | ||
1757 | |||
1758 | static void snd_soc_instantiate_card(struct snd_soc_card *card) | 1755 | static void snd_soc_instantiate_card(struct snd_soc_card *card) |
1759 | { | 1756 | { |
1760 | struct platform_device *pdev = to_platform_device(card->dev); | 1757 | struct platform_device *pdev = to_platform_device(card->dev); |