| OLD | NEW |
| 1 /* | 1 /* |
| 2 * wm8400.c -- WM8400 ALSA Soc Audio driver | 2 * wm8400.c -- WM8400 ALSA Soc Audio driver |
| 3 * | 3 * |
| 4 * Copyright 2008, 2009 Wolfson Microelectronics PLC. | 4 * Copyright 2008, 2009 Wolfson Microelectronics PLC. |
| 5 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | 5 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or modify it | 7 * This program is free software; you can redistribute it and/or modify it |
| 8 * under the terms of the GNU General Public License as published by the | 8 * under the terms of the GNU General Public License as published by the |
| 9 * Free Software Foundation; either version 2 of the License, or (at your | 9 * Free Software Foundation; either version 2 of the License, or (at your |
| 10 * option) any later version. | 10 * option) any later version. |
| 11 * | 11 * |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 #include <linux/module.h> | 14 #include <linux/module.h> |
| 15 #include <linux/moduleparam.h> | 15 #include <linux/moduleparam.h> |
| 16 #include <linux/kernel.h> | 16 #include <linux/kernel.h> |
| 17 #include <linux/slab.h> | 17 #include <linux/slab.h> |
| 18 #include <linux/init.h> | 18 #include <linux/init.h> |
| 19 #include <linux/delay.h> | 19 #include <linux/delay.h> |
| 20 #include <linux/pm.h> | 20 #include <linux/pm.h> |
| 21 #include <linux/platform_device.h> | 21 #include <linux/platform_device.h> |
| 22 #include <linux/regulator/consumer.h> | 22 #include <linux/regulator/consumer.h> |
| 23 #include <linux/mfd/wm8400-audio.h> | 23 #include <linux/mfd/wm8400-audio.h> |
| 24 #include <linux/mfd/wm8400-private.h> | 24 #include <linux/mfd/wm8400-private.h> |
| 25 #include <sound/core.h> | 25 #include <sound/core.h> |
| 26 #include <sound/pcm.h> | 26 #include <sound/pcm.h> |
| 27 #include <sound/pcm_params.h> | 27 #include <sound/pcm_params.h> |
| 28 #include <sound/soc.h> | 28 #include <sound/soc.h> |
| 29 #include <sound/soc-dapm.h> | |
| 30 #include <sound/initval.h> | 29 #include <sound/initval.h> |
| 31 #include <sound/tlv.h> | 30 #include <sound/tlv.h> |
| 32 | 31 |
| 33 #include "wm8400.h" | 32 #include "wm8400.h" |
| 34 | 33 |
| 35 /* Fake register for internal state */ | 34 /* Fake register for internal state */ |
| 36 #define WM8400_INTDRIVBITS (WM8400_REGISTER_COUNT + 1) | 35 #define WM8400_INTDRIVBITS (WM8400_REGISTER_COUNT + 1) |
| 37 #define WM8400_INMIXL_PWR 0 | 36 #define WM8400_INMIXL_PWR 0 |
| 38 #define WM8400_AINLMUX_PWR 1 | 37 #define WM8400_AINLMUX_PWR 1 |
| 39 #define WM8400_INMIXR_PWR 2 | 38 #define WM8400_INMIXR_PWR 2 |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 {"LOUT", NULL, "LOUT PGA"}, | 903 {"LOUT", NULL, "LOUT PGA"}, |
| 905 {"SPKN", NULL, "SPKMIX"}, | 904 {"SPKN", NULL, "SPKMIX"}, |
| 906 {"ROUT", NULL, "ROUT PGA"}, | 905 {"ROUT", NULL, "ROUT PGA"}, |
| 907 {"OUT4", NULL, "OUT4MIX"}, | 906 {"OUT4", NULL, "OUT4MIX"}, |
| 908 {"ROP", NULL, "ROPMIX"}, | 907 {"ROP", NULL, "ROPMIX"}, |
| 909 {"RON", NULL, "RONMIX"}, | 908 {"RON", NULL, "RONMIX"}, |
| 910 }; | 909 }; |
| 911 | 910 |
| 912 static int wm8400_add_widgets(struct snd_soc_codec *codec) | 911 static int wm8400_add_widgets(struct snd_soc_codec *codec) |
| 913 { | 912 { |
| 914 » snd_soc_dapm_new_controls(codec, wm8400_dapm_widgets, | 913 » struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 914 |
| 915 » snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets, |
| 915 ARRAY_SIZE(wm8400_dapm_widgets)); | 916 ARRAY_SIZE(wm8400_dapm_widgets)); |
| 916 | 917 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 917 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | |
| 918 | 918 |
| 919 return 0; | 919 return 0; |
| 920 } | 920 } |
| 921 | 921 |
| 922 /* | 922 /* |
| 923 * Clock after FLL and dividers | 923 * Clock after FLL and dividers |
| 924 */ | 924 */ |
| 925 static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai, | 925 static int wm8400_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
| 926 int clk_id, unsigned int freq, int dir) | 926 int clk_id, unsigned int freq, int dir) |
| 927 { | 927 { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 break; | 1212 break; |
| 1213 | 1213 |
| 1214 case SND_SOC_BIAS_PREPARE: | 1214 case SND_SOC_BIAS_PREPARE: |
| 1215 /* VMID=2*50k */ | 1215 /* VMID=2*50k */ |
| 1216 val = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1) & | 1216 val = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1) & |
| 1217 ~WM8400_VMID_MODE_MASK; | 1217 ~WM8400_VMID_MODE_MASK; |
| 1218 wm8400_write(codec, WM8400_POWER_MANAGEMENT_1, val | 0x2); | 1218 wm8400_write(codec, WM8400_POWER_MANAGEMENT_1, val | 0x2); |
| 1219 break; | 1219 break; |
| 1220 | 1220 |
| 1221 case SND_SOC_BIAS_STANDBY: | 1221 case SND_SOC_BIAS_STANDBY: |
| 1222 » » if (codec->bias_level == SND_SOC_BIAS_OFF) { | 1222 » » if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
| 1223 ret = regulator_bulk_enable(ARRAY_SIZE(power), | 1223 ret = regulator_bulk_enable(ARRAY_SIZE(power), |
| 1224 &power[0]); | 1224 &power[0]); |
| 1225 if (ret != 0) { | 1225 if (ret != 0) { |
| 1226 dev_err(wm8400->wm8400->dev, | 1226 dev_err(wm8400->wm8400->dev, |
| 1227 "Failed to enable regulators: %d\n", | 1227 "Failed to enable regulators: %d\n", |
| 1228 ret); | 1228 ret); |
| 1229 return ret; | 1229 return ret; |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 wm8400_write(codec, WM8400_POWER_MANAGEMENT_1, | 1232 wm8400_write(codec, WM8400_POWER_MANAGEMENT_1, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 wm8400_write(codec, WM8400_ANTIPOP2, 0x0); | 1299 wm8400_write(codec, WM8400_ANTIPOP2, 0x0); |
| 1300 | 1300 |
| 1301 ret = regulator_bulk_disable(ARRAY_SIZE(power), | 1301 ret = regulator_bulk_disable(ARRAY_SIZE(power), |
| 1302 &power[0]); | 1302 &power[0]); |
| 1303 if (ret != 0) | 1303 if (ret != 0) |
| 1304 return ret; | 1304 return ret; |
| 1305 | 1305 |
| 1306 break; | 1306 break; |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 » codec->bias_level = level; | 1309 » codec->dapm.bias_level = level; |
| 1310 return 0; | 1310 return 0; |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 #define WM8400_RATES SNDRV_PCM_RATE_8000_96000 | 1313 #define WM8400_RATES SNDRV_PCM_RATE_8000_96000 |
| 1314 | 1314 |
| 1315 #define WM8400_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 1315 #define WM8400_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
| 1316 SNDRV_PCM_FMTBIT_S24_LE) | 1316 SNDRV_PCM_FMTBIT_S24_LE) |
| 1317 | 1317 |
| 1318 static struct snd_soc_dai_ops wm8400_dai_ops = { | 1318 static struct snd_soc_dai_ops wm8400_dai_ops = { |
| 1319 .hw_params = wm8400_hw_params, | 1319 .hw_params = wm8400_hw_params, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 static __exit void wm8400_exit(void) | 1485 static __exit void wm8400_exit(void) |
| 1486 { | 1486 { |
| 1487 platform_driver_unregister(&wm8400_codec_driver); | 1487 platform_driver_unregister(&wm8400_codec_driver); |
| 1488 } | 1488 } |
| 1489 module_exit(wm8400_exit); | 1489 module_exit(wm8400_exit); |
| 1490 | 1490 |
| 1491 MODULE_DESCRIPTION("ASoC WM8400 driver"); | 1491 MODULE_DESCRIPTION("ASoC WM8400 driver"); |
| 1492 MODULE_AUTHOR("Mark Brown"); | 1492 MODULE_AUTHOR("Mark Brown"); |
| 1493 MODULE_LICENSE("GPL"); | 1493 MODULE_LICENSE("GPL"); |
| 1494 MODULE_ALIAS("platform:wm8400-codec"); | 1494 MODULE_ALIAS("platform:wm8400-codec"); |
| OLD | NEW |