diff options
| -rw-r--r-- | include/sound/soc.h | 7 | ||||
| -rw-r--r-- | sound/soc/codecs/88pm860x-codec.c | 3 | ||||
| -rw-r--r-- | sound/soc/codecs/cq93vc.c | 3 | ||||
| -rw-r--r-- | sound/soc/codecs/mc13783.c | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/si476x.c | 6 | ||||
| -rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 1 | ||||
| -rw-r--r-- | sound/soc/codecs/wm5102.c | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/wm5110.c | 3 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8350.c | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8400.c | 3 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8994.c | 3 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8997.c | 4 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 2 | ||||
| -rw-r--r-- | sound/soc/soc-io.c | 47 |
14 files changed, 36 insertions, 58 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 2d8982db0344..85a5b7bbe39a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
| @@ -354,10 +354,6 @@ typedef int (*hw_write_t)(void *,const char* ,int); | |||
| 354 | 354 | ||
| 355 | extern struct snd_ac97_bus_ops *soc_ac97_ops; | 355 | extern struct snd_ac97_bus_ops *soc_ac97_ops; |
| 356 | 356 | ||
| 357 | enum snd_soc_control_type { | ||
| 358 | SND_SOC_REGMAP, | ||
| 359 | }; | ||
| 360 | |||
| 361 | enum snd_soc_pcm_subclass { | 357 | enum snd_soc_pcm_subclass { |
| 362 | SND_SOC_PCM_CLASS_PCM = 0, | 358 | SND_SOC_PCM_CLASS_PCM = 0, |
| 363 | SND_SOC_PCM_CLASS_BE = 1, | 359 | SND_SOC_PCM_CLASS_BE = 1, |
| @@ -404,8 +400,7 @@ int snd_soc_codec_readable_register(struct snd_soc_codec *codec, | |||
| 404 | int snd_soc_codec_writable_register(struct snd_soc_codec *codec, | 400 | int snd_soc_codec_writable_register(struct snd_soc_codec *codec, |
| 405 | unsigned int reg); | 401 | unsigned int reg); |
| 406 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | 402 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, |
| 407 | int addr_bits, int data_bits, | 403 | struct regmap *regmap); |
| 408 | enum snd_soc_control_type control); | ||
| 409 | int snd_soc_cache_sync(struct snd_soc_codec *codec); | 404 | int snd_soc_cache_sync(struct snd_soc_codec *codec); |
| 410 | int snd_soc_cache_init(struct snd_soc_codec *codec); | 405 | int snd_soc_cache_init(struct snd_soc_codec *codec); |
| 411 | int snd_soc_cache_exit(struct snd_soc_codec *codec); | 406 | int snd_soc_cache_exit(struct snd_soc_codec *codec); |
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 647a72cda005..773b53366ada 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
| @@ -1327,8 +1327,7 @@ static int pm860x_probe(struct snd_soc_codec *codec) | |||
| 1327 | 1327 | ||
| 1328 | pm860x->codec = codec; | 1328 | pm860x->codec = codec; |
| 1329 | 1329 | ||
| 1330 | codec->control_data = pm860x->regmap; | 1330 | ret = snd_soc_codec_set_cache_io(codec, pm860x->regmap); |
| 1331 | ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | ||
| 1332 | if (ret) | 1331 | if (ret) |
| 1333 | return ret; | 1332 | return ret; |
| 1334 | 1333 | ||
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index 43737a27d79c..1e25c7af853b 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c | |||
| @@ -138,9 +138,8 @@ static int cq93vc_probe(struct snd_soc_codec *codec) | |||
| 138 | struct davinci_vc *davinci_vc = codec->dev->platform_data; | 138 | struct davinci_vc *davinci_vc = codec->dev->platform_data; |
| 139 | 139 | ||
| 140 | davinci_vc->cq93vc.codec = codec; | 140 | davinci_vc->cq93vc.codec = codec; |
| 141 | codec->control_data = davinci_vc->regmap; | ||
| 142 | 141 | ||
| 143 | snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP); | 142 | snd_soc_codec_set_cache_io(codec, davinci_vc->regmap); |
| 144 | 143 | ||
| 145 | /* Off, with power on */ | 144 | /* Off, with power on */ |
| 146 | cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 145 | cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 582c2bbd42cb..fc28b20f6c69 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
| @@ -614,8 +614,8 @@ static int mc13783_probe(struct snd_soc_codec *codec) | |||
| 614 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); | 614 | struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 615 | int ret; | 615 | int ret; |
| 616 | 616 | ||
| 617 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); | 617 | ret = snd_soc_codec_set_cache_io(codec, |
| 618 | ret = snd_soc_codec_set_cache_io(codec, 8, 24, SND_SOC_REGMAP); | 618 | dev_get_regmap(codec->dev->parent, NULL)); |
| 619 | if (ret != 0) { | 619 | if (ret != 0) { |
| 620 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | 620 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); |
| 621 | return ret; | 621 | return ret; |
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c index fa2b8e07f420..244c097cd905 100644 --- a/sound/soc/codecs/si476x.c +++ b/sound/soc/codecs/si476x.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| 22 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
| 23 | #include <sound/pcm_params.h> | 23 | #include <sound/pcm_params.h> |
| 24 | #include <linux/regmap.h> | ||
| 24 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
| 25 | #include <sound/initval.h> | 26 | #include <sound/initval.h> |
| 26 | 27 | ||
| @@ -209,8 +210,9 @@ out: | |||
| 209 | 210 | ||
| 210 | static int si476x_codec_probe(struct snd_soc_codec *codec) | 211 | static int si476x_codec_probe(struct snd_soc_codec *codec) |
| 211 | { | 212 | { |
| 212 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); | 213 | struct regmap *regmap = dev_get_regmap(codec->dev->parent, NULL); |
| 213 | return snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | 214 | |
| 215 | return snd_soc_codec_set_cache_io(codec, regmap); | ||
| 214 | } | 216 | } |
| 215 | 217 | ||
| 216 | static struct snd_soc_dai_ops si476x_dai_ops = { | 218 | static struct snd_soc_dai_ops si476x_dai_ops = { |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 4f358393d6d6..64afda740c80 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
| @@ -122,7 +122,6 @@ struct tlv320dac33_priv { | |||
| 122 | unsigned int uthr; | 122 | unsigned int uthr; |
| 123 | 123 | ||
| 124 | enum dac33_state state; | 124 | enum dac33_state state; |
| 125 | enum snd_soc_control_type control_type; | ||
| 126 | void *control_data; | 125 | void *control_data; |
| 127 | }; | 126 | }; |
| 128 | 127 | ||
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index ce9c8e14d4bd..5613d0efe19b 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
| @@ -1758,9 +1758,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec) | |||
| 1758 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); | 1758 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 1759 | int ret; | 1759 | int ret; |
| 1760 | 1760 | ||
| 1761 | codec->control_data = priv->core.arizona->regmap; | 1761 | ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap); |
| 1762 | |||
| 1763 | ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | ||
| 1764 | if (ret != 0) | 1762 | if (ret != 0) |
| 1765 | return ret; | 1763 | return ret; |
| 1766 | 1764 | ||
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 2c3c962d9a85..66d3ad4176c3 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
| @@ -1588,10 +1588,9 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec) | |||
| 1588 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); | 1588 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 1589 | int ret; | 1589 | int ret; |
| 1590 | 1590 | ||
| 1591 | codec->control_data = priv->core.arizona->regmap; | ||
| 1592 | priv->core.arizona->dapm = &codec->dapm; | 1591 | priv->core.arizona->dapm = &codec->dapm; |
| 1593 | 1592 | ||
| 1594 | ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | 1593 | ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap); |
| 1595 | if (ret != 0) | 1594 | if (ret != 0) |
| 1596 | return ret; | 1595 | return ret; |
| 1597 | 1596 | ||
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index a183dcf3d5c1..757256bf7672 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -1505,9 +1505,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1505 | if (ret != 0) | 1505 | if (ret != 0) |
| 1506 | return ret; | 1506 | return ret; |
| 1507 | 1507 | ||
| 1508 | codec->control_data = wm8350->regmap; | 1508 | snd_soc_codec_set_cache_io(codec, wm8350->regmap); |
| 1509 | |||
| 1510 | snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); | ||
| 1511 | 1509 | ||
| 1512 | /* Put the codec into reset if it wasn't already */ | 1510 | /* Put the codec into reset if it wasn't already */ |
| 1513 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); | 1511 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 48dc7d2fee36..939baf83bb59 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
| @@ -1310,10 +1310,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) | |||
| 1310 | 1310 | ||
| 1311 | snd_soc_codec_set_drvdata(codec, priv); | 1311 | snd_soc_codec_set_drvdata(codec, priv); |
| 1312 | priv->wm8400 = wm8400; | 1312 | priv->wm8400 = wm8400; |
| 1313 | codec->control_data = wm8400->regmap; | ||
| 1314 | priv->codec = codec; | 1313 | priv->codec = codec; |
| 1315 | 1314 | ||
| 1316 | snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); | 1315 | snd_soc_codec_set_cache_io(codec, wm8400->regmap); |
| 1317 | 1316 | ||
| 1318 | ret = devm_regulator_bulk_get(wm8400->dev, | 1317 | ret = devm_regulator_bulk_get(wm8400->dev, |
| 1319 | ARRAY_SIZE(power), &power[0]); | 1318 | ARRAY_SIZE(power), &power[0]); |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index b9be9cbc4603..32cc83e3f1ff 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -3985,9 +3985,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 3985 | int ret, i; | 3985 | int ret, i; |
| 3986 | 3986 | ||
| 3987 | wm8994->hubs.codec = codec; | 3987 | wm8994->hubs.codec = codec; |
| 3988 | codec->control_data = control->regmap; | ||
| 3989 | 3988 | ||
| 3990 | snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); | 3989 | snd_soc_codec_set_cache_io(codec, control->regmap); |
| 3991 | 3990 | ||
| 3992 | mutex_init(&wm8994->accdet_lock); | 3991 | mutex_init(&wm8994->accdet_lock); |
| 3993 | INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, | 3992 | INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, |
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 555115ee2159..e3d1522daf64 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c | |||
| @@ -1052,9 +1052,7 @@ static int wm8997_codec_probe(struct snd_soc_codec *codec) | |||
| 1052 | struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); | 1052 | struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 1053 | int ret; | 1053 | int ret; |
| 1054 | 1054 | ||
| 1055 | codec->control_data = priv->core.arizona->regmap; | 1055 | ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap); |
| 1056 | |||
| 1057 | ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | ||
| 1058 | if (ret != 0) | 1056 | if (ret != 0) |
| 1059 | return ret; | 1057 | return ret; |
| 1060 | 1058 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ad2dd14f0e3e..6510a8e4a5af 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -1139,7 +1139,7 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
| 1139 | 1139 | ||
| 1140 | /* Set the default I/O up try regmap */ | 1140 | /* Set the default I/O up try regmap */ |
| 1141 | if (dev_get_regmap(codec->dev, NULL)) | 1141 | if (dev_get_regmap(codec->dev, NULL)) |
| 1142 | snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | 1142 | snd_soc_codec_set_cache_io(codec, NULL); |
| 1143 | 1143 | ||
| 1144 | if (driver->probe) { | 1144 | if (driver->probe) { |
| 1145 | ret = driver->probe(codec); | 1145 | ret = driver->probe(codec); |
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 18353f111b6a..8aa086996866 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c | |||
| @@ -69,9 +69,7 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg) | |||
| 69 | * snd_soc_codec_set_cache_io: Set up standard I/O functions. | 69 | * snd_soc_codec_set_cache_io: Set up standard I/O functions. |
| 70 | * | 70 | * |
| 71 | * @codec: CODEC to configure. | 71 | * @codec: CODEC to configure. |
| 72 | * @addr_bits: Number of bits of register address data. | 72 | * @map: Register map to write to |
| 73 | * @data_bits: Number of bits of data per register. | ||
| 74 | * @control: Control bus used. | ||
| 75 | * | 73 | * |
| 76 | * Register formats are frequently shared between many I2C and SPI | 74 | * Register formats are frequently shared between many I2C and SPI |
| 77 | * devices. In order to promote code reuse the ASoC core provides | 75 | * devices. In order to promote code reuse the ASoC core provides |
| @@ -85,41 +83,36 @@ static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg) | |||
| 85 | * volatile registers. | 83 | * volatile registers. |
| 86 | */ | 84 | */ |
| 87 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | 85 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, |
| 88 | int addr_bits, int data_bits, | 86 | struct regmap *regmap) |
| 89 | enum snd_soc_control_type control) | ||
| 90 | { | 87 | { |
| 91 | int ret; | 88 | int ret; |
| 92 | 89 | ||
| 90 | /* Device has made its own regmap arrangements */ | ||
| 91 | if (!regmap) | ||
| 92 | codec->control_data = dev_get_regmap(codec->dev, NULL); | ||
| 93 | else | ||
| 94 | codec->control_data = regmap; | ||
| 95 | |||
| 96 | if (IS_ERR(codec->control_data)) | ||
| 97 | return PTR_ERR(codec->control_data); | ||
| 98 | |||
| 93 | codec->write = hw_write; | 99 | codec->write = hw_write; |
| 94 | codec->read = hw_read; | 100 | codec->read = hw_read; |
| 95 | 101 | ||
| 96 | switch (control) { | 102 | ret = regmap_get_val_bytes(codec->control_data); |
| 97 | case SND_SOC_REGMAP: | 103 | /* Errors are legitimate for non-integer byte |
| 98 | /* Device has made its own regmap arrangements */ | 104 | * multiples */ |
| 99 | codec->using_regmap = true; | 105 | if (ret > 0) |
| 100 | if (!codec->control_data) | 106 | codec->val_bytes = ret; |
| 101 | codec->control_data = dev_get_regmap(codec->dev, NULL); | 107 | |
| 102 | 108 | codec->using_regmap = true; | |
| 103 | if (codec->control_data) { | ||
| 104 | ret = regmap_get_val_bytes(codec->control_data); | ||
| 105 | /* Errors are legitimate for non-integer byte | ||
| 106 | * multiples */ | ||
| 107 | if (ret > 0) | ||
| 108 | codec->val_bytes = ret; | ||
| 109 | } | ||
| 110 | break; | ||
| 111 | |||
| 112 | default: | ||
| 113 | return -EINVAL; | ||
| 114 | } | ||
| 115 | 109 | ||
| 116 | return PTR_ERR_OR_ZERO(codec->control_data); | 110 | return 0; |
| 117 | } | 111 | } |
| 118 | EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); | 112 | EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); |
| 119 | #else | 113 | #else |
| 120 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | 114 | int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, |
| 121 | int addr_bits, int data_bits, | 115 | struct regmap *regmap) |
| 122 | enum snd_soc_control_type control) | ||
| 123 | { | 116 | { |
| 124 | return -ENOTSUPP; | 117 | return -ENOTSUPP; |
| 125 | } | 118 | } |
