summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/ak4641.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 22:26:23 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 22:26:23 +0400
commitd4371f94bc003e912d4825f5c4bdf57959857073 (patch)
tree919e196d72fc83cba8c67ee720a233671938d265 /sound/soc/codecs/ak4641.c
parenta547df99aad777c1807e23991fa2471693c0e4cc (diff)
parent7552f34a790069a008bd3e2ab4c0954b30c2f63b (diff)
downloadlinux-d4371f94bc003e912d4825f5c4bdf57959857073.tar.xz
Merge tag 'sound-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "It was holiday season, so no wonder that there are little changes in framework level, although diffstat shows quite many changes spreaded over sound/* directories. Most of changes are cleanups, code refactoring and fixes. Some highlights: - Removal of OSS sleep_on usages by Arnd - Simplified memalloc helper codes, drop obsoleted features; now it's built into PCM driver instead of an individual module - Warn if PCM buffer preallocation fails, which will show page allocation issues more clearly - Compress offload API updates for sample rates by Vinod - PCM glitch workaround on ctxfi emu20k1 by Sarah - Drop cs46xx DSP blobs, using firmware loader now - USB-audio quitks for Plantronics Gamecom 780, Creative VF0420, and Focusrite Saffire 6 HD-audio specifics: - Standardize Kconfigs of HD-audio codec drivers; now "make localmodconfig" recognizes configs properly (finally!) - Parallel PM implementation by Mengdong - BayleyBay/ValleyView2 board fixups - Broadwell audio support - Runtime PM improvement (PantherPoint, etc) - Quirks: Dell subwooer, Gigabyte mobo jack detection oddity, Dell AiO click noise fixes, Dell headset mic fixes, etc - Automatic bind with HDMI codec parser without generic parser - More AD codec fixes (since 3.12 regression) including the automatic stereo mix support - Common Thinkpad ACPI helper for Realtek and Conexant codecs ASoC specifics: - Update to the generic DMA code to support deferred probe and managed resources - New drivers for BCM2835 (used in Raspberry Pi), Tegra with MAX98090 and Analog Devices AXI I2S and S/PDIF controller IPs - Device tree support for the simple card, max98090 and cs42l52 - Conversion of the Samsung drivers to native dmaengine, making them multiplatform compatible and hopefully helping keep them more modern and up to date. - More regmap conversions, including a very welcome one for twl6040 from Peter Ujfalusi - A big overhaul of the DaVinci drivers also from Peter Ujfalusi - Lots of DMA updates from Lars-Peter - Improvements to the constraints handling code from Lars-Peter - A very helpful conversion of the TWL4030 driver to regmap from Peter - A new driver for the Freescale ESAI controller from Nicolin Chen - Conversion of some of the drivers to use params_width() - Extensions to DPCM for use with compressed audio from Liam" * tag 'sound-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (396 commits) ASoC: dapm: Fix double prefix addition ASoC: compress: Add suport for DPCM into compressed audio ASoC: DPCM: make some DPCM API calls non static for compressed usage ASoC: core: Fix possible NULL pointer dereference of pcm->config ALSA: hda - add headset mic detect quirks for some Dell machines ASoC: tlv320aic32x4: Fix regmap range_min ASoC: core: Return -ENOTSUPP from set_sysclk() if no operation provided ASoC: dapm: Change prototype of soc_widget_read ASoC: samsung: Remove SND_DMAENGINE_PCM_FLAG_NO_RESIDUE flag ASoC: axi-{spdif,i2s}: Remove SND_DMAENGINE_PCM_FLAG_NO_RESIDUE flag ASoC: generic-dmaengine-pcm: Check DMA residue granularity ASoC: generic-dmaengine-pcm: Check NO_RESIDUE flag at runtime dma: pl330: Set residue_granularity dma: Indicate residue granularity in dma_slave_caps ASoC: simple-card: fix one bug to writing to the platform data ASoC: pcm: Use snd_pcm_rate_mask_intersect() helper ALSA: Add helper function for intersecting two rate masks ASoC: s6000: Don't mix SNDRV_PCM_RATE_CONTINUOUS with specific rates ASoC: fsl: Don't mix SNDRV_PCM_RATE_CONTINUOUS with specific rates ASoC: pcm: Properly initialize hw->rate_max ...
Diffstat (limited to 'sound/soc/codecs/ak4641.c')
-rw-r--r--sound/soc/codecs/ak4641.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 49cc5f6d6dba..94cbe508dd37 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -17,6 +17,7 @@
#include <linux/gpio.h>
#include <linux/pm.h>
#include <linux/i2c.h>
+#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -30,6 +31,7 @@
/* codec private data */
struct ak4641_priv {
+ struct regmap *regmap;
unsigned int sysclk;
int deemph;
int playback_fs;
@@ -38,12 +40,12 @@ struct ak4641_priv {
/*
* ak4641 register cache
*/
-static const u8 ak4641_reg[AK4641_CACHEREGNUM] = {
- 0x00, 0x80, 0x00, 0x80,
- 0x02, 0x00, 0x11, 0x05,
- 0x00, 0x00, 0x36, 0x10,
- 0x00, 0x00, 0x57, 0x00,
- 0x88, 0x88, 0x08, 0x08
+static const struct reg_default ak4641_reg_defaults[] = {
+ { 0, 0x00 }, { 1, 0x80 }, { 2, 0x00 }, { 3, 0x80 },
+ { 4, 0x02 }, { 5, 0x00 }, { 6, 0x11 }, { 7, 0x05 },
+ { 8, 0x00 }, { 9, 0x00 }, { 10, 0x36 }, { 11, 0x10 },
+ { 12, 0x00 }, { 13, 0x00 }, { 14, 0x57 }, { 15, 0x00 },
+ { 16, 0x88 }, { 17, 0x88 }, { 18, 0x08 }, { 19, 0x08 }
};
static const int deemph_settings[] = {44100, 0, 48000, 32000};
@@ -396,6 +398,7 @@ static int ak4641_mute(struct snd_soc_dai *dai, int mute)
static int ak4641_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
+ struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec);
struct ak4641_platform_data *pdata = codec->dev->platform_data;
int ret;
@@ -417,7 +420,7 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec,
gpio_set_value(pdata->gpio_npdn, 1);
mdelay(1);
- ret = snd_soc_cache_sync(codec);
+ ret = regcache_sync(ak4641->regmap);
if (ret) {
dev_err(codec->dev,
"Failed to sync cache: %d\n", ret);
@@ -433,7 +436,7 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec,
gpio_set_value(pdata->gpio_npdn, 0);
if (pdata && gpio_is_valid(pdata->gpio_power))
gpio_set_value(pdata->gpio_power, 0);
- codec->cache_sync = 1;
+ regcache_mark_dirty(ak4641->regmap);
break;
}
codec->dapm.bias_level = level;
@@ -518,7 +521,7 @@ static int ak4641_probe(struct snd_soc_codec *codec)
{
int ret;
- ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
+ ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret != 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
@@ -550,12 +553,17 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
.dapm_routes = ak4641_audio_map,
.num_dapm_routes = ARRAY_SIZE(ak4641_audio_map),
.set_bias_level = ak4641_set_bias_level,
- .reg_cache_size = ARRAY_SIZE(ak4641_reg),
- .reg_word_size = sizeof(u8),
- .reg_cache_default = ak4641_reg,
- .reg_cache_step = 1,
};
+static const struct regmap_config ak4641_regmap = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = AK4641_BTIF,
+ .reg_defaults = ak4641_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(ak4641_reg_defaults),
+ .cache_type = REGCACHE_RBTREE,
+};
static int ak4641_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
@@ -569,6 +577,10 @@ static int ak4641_i2c_probe(struct i2c_client *i2c,
if (!ak4641)
return -ENOMEM;
+ ak4641->regmap = devm_regmap_init_i2c(i2c, &ak4641_regmap);
+ if (IS_ERR(ak4641->regmap))
+ return PTR_ERR(ak4641->regmap);
+
if (pdata) {
if (gpio_is_valid(pdata->gpio_power)) {
ret = gpio_request_one(pdata->gpio_power,