aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 0e17b405042..a9ebc078bea 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -988,6 +988,7 @@ static int snd_soc_rbtree_cache_init(struct snd_soc_codec *codec)
988 return 0; 988 return 0;
989} 989}
990 990
991#ifdef CONFIG_SND_SOC_CACHE_LZO
991struct snd_soc_lzo_ctx { 992struct snd_soc_lzo_ctx {
992 void *wmem; 993 void *wmem;
993 void *dst; 994 void *dst;
@@ -1399,6 +1400,7 @@ err_tofree:
1399 } 1400 }
1400 return ret; 1401 return ret;
1401} 1402}
1403#endif
1402 1404
1403static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) 1405static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
1404{ 1406{
@@ -1531,6 +1533,7 @@ static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
1531 1533
1532/* an array of all supported compression types */ 1534/* an array of all supported compression types */
1533static const struct snd_soc_cache_ops cache_types[] = { 1535static const struct snd_soc_cache_ops cache_types[] = {
1536 /* Flat *must* be the first entry for fallback */
1534 { 1537 {
1535 .id = SND_SOC_FLAT_COMPRESSION, 1538 .id = SND_SOC_FLAT_COMPRESSION,
1536 .name = "flat", 1539 .name = "flat",
@@ -1540,6 +1543,7 @@ static const struct snd_soc_cache_ops cache_types[] = {
1540 .write = snd_soc_flat_cache_write, 1543 .write = snd_soc_flat_cache_write,
1541 .sync = snd_soc_flat_cache_sync 1544 .sync = snd_soc_flat_cache_sync
1542 }, 1545 },
1546#ifdef CONFIG_SND_SOC_CACHE_LZO
1543 { 1547 {
1544 .id = SND_SOC_LZO_COMPRESSION, 1548 .id = SND_SOC_LZO_COMPRESSION,
1545 .name = "LZO", 1549 .name = "LZO",
@@ -1549,6 +1553,7 @@ static const struct snd_soc_cache_ops cache_types[] = {
1549 .write = snd_soc_lzo_cache_write, 1553 .write = snd_soc_lzo_cache_write,
1550 .sync = snd_soc_lzo_cache_sync 1554 .sync = snd_soc_lzo_cache_sync
1551 }, 1555 },
1556#endif
1552 { 1557 {
1553 .id = SND_SOC_RBTREE_COMPRESSION, 1558 .id = SND_SOC_RBTREE_COMPRESSION,
1554 .name = "rbtree", 1559 .name = "rbtree",
@@ -1567,10 +1572,12 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
1567 for (i = 0; i < ARRAY_SIZE(cache_types); ++i) 1572 for (i = 0; i < ARRAY_SIZE(cache_types); ++i)
1568 if (cache_types[i].id == codec->compress_type) 1573 if (cache_types[i].id == codec->compress_type)
1569 break; 1574 break;
1575
1576 /* Fall back to flat compression */
1570 if (i == ARRAY_SIZE(cache_types)) { 1577 if (i == ARRAY_SIZE(cache_types)) {
1571 dev_err(codec->dev, "Could not match compress type: %d\n", 1578 dev_warn(codec->dev, "Could not match compress type: %d\n",
1572 codec->compress_type); 1579 codec->compress_type);
1573 return -EINVAL; 1580 i = 0;
1574 } 1581 }
1575 1582
1576 mutex_init(&codec->cache_rw_mutex); 1583 mutex_init(&codec->cache_rw_mutex);