Commit 4b6142ae authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next

parents df00b71f 06d7c133
/*
* sound/soc/codecs/si476x.c -- Codec driver for SI476X chips
*
* Copyright (C) 2012 Innovative Converged Devices(ICD)
* Copyright (C) 2013 Andrey Smirnov
*
* Author: Andrey Smirnov <andrew.smirnov@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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.
*
*/
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -45,13 +64,23 @@ static unsigned int si476x_codec_read(struct snd_soc_codec *codec, ...@@ -45,13 +64,23 @@ static unsigned int si476x_codec_read(struct snd_soc_codec *codec,
unsigned int reg) unsigned int reg)
{ {
int err; int err;
unsigned int val;
struct si476x_core *core = codec->control_data; struct si476x_core *core = codec->control_data;
si476x_core_lock(core); si476x_core_lock(core);
err = si476x_core_cmd_get_property(core, reg); if (!si476x_core_is_powered_up(core))
regcache_cache_only(core->regmap, true);
err = regmap_read(core->regmap, reg, &val);
if (!si476x_core_is_powered_up(core))
regcache_cache_only(core->regmap, false);
si476x_core_unlock(core); si476x_core_unlock(core);
if (err < 0)
return err; return err;
return val;
} }
static int si476x_codec_write(struct snd_soc_codec *codec, static int si476x_codec_write(struct snd_soc_codec *codec,
...@@ -61,7 +90,13 @@ static int si476x_codec_write(struct snd_soc_codec *codec, ...@@ -61,7 +90,13 @@ static int si476x_codec_write(struct snd_soc_codec *codec,
struct si476x_core *core = codec->control_data; struct si476x_core *core = codec->control_data;
si476x_core_lock(core); si476x_core_lock(core);
err = si476x_core_cmd_set_property(core, reg, val); if (!si476x_core_is_powered_up(core))
regcache_cache_only(core->regmap, true);
err = regmap_write(core->regmap, reg, val);
if (!si476x_core_is_powered_up(core))
regcache_cache_only(core->regmap, false);
si476x_core_unlock(core); si476x_core_unlock(core);
return err; return err;
...@@ -251,6 +286,6 @@ static struct platform_driver si476x_platform_driver = { ...@@ -251,6 +286,6 @@ static struct platform_driver si476x_platform_driver = {
}; };
module_platform_driver(si476x_platform_driver); module_platform_driver(si476x_platform_driver);
MODULE_AUTHOR("Andrey Smirnov <andrey.smirnov@convergeddevices.net>"); MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
MODULE_DESCRIPTION("ASoC Si4761/64 codec driver"); MODULE_DESCRIPTION("ASoC Si4761/64 codec driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment