Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 12 Apr 2013 12:57:15 +0000 (13:57 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 12 Apr 2013 12:57:15 +0000 (13:57 +0100)
1  2 
sound/soc/codecs/si476x.c

@@@ -1,3 -1,22 +1,22 @@@
+ /*
+  * 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/slab.h>
  #include <sound/pcm.h>
@@@ -45,13 -64,23 +64,23 @@@ static unsigned int si476x_codec_read(s
                                      unsigned int reg)
  {
        int err;
+       unsigned int val;
        struct si476x_core *core = codec->control_data;
  
        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);
  
-       return err;
+       if (err < 0)
+               return err;
+       return val;
  }
  
  static int si476x_codec_write(struct snd_soc_codec *codec,
        struct si476x_core *core = codec->control_data;
  
        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);
  
        return err;
@@@ -140,7 -175,7 +175,7 @@@ static int si476x_codec_set_dai_fmt(str
                dev_err(codec_dai->codec->dev, "Failed to set output format\n");
                return err;
        }
-       
        return 0;
  }
  
@@@ -159,7 -194,6 +194,7 @@@ static int si476x_codec_hw_params(struc
        switch (params_format(params)) {
        case SNDRV_PCM_FORMAT_S8:
                width = SI476X_PCM_FORMAT_S8;
 +              break;
        case SNDRV_PCM_FORMAT_S16_LE:
                width = SI476X_PCM_FORMAT_S16_LE;
                break;
  
        err = snd_soc_update_bits(dai->codec, SI476X_DIGITAL_IO_OUTPUT_FORMAT,
                                  SI476X_DIGITAL_IO_OUTPUT_WIDTH_MASK,
-                                 (width << SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) | 
+                                 (width << SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) |
                                  (width << SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT));
        if (err < 0) {
                dev_err(dai->codec->dev, "Failed to set output width\n");
@@@ -251,6 -285,6 +286,6 @@@ static struct platform_driver si476x_pl
  };
  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_LICENSE("GPL");