diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-24 06:24:03 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-24 06:24:03 -0400 |
commit | 85eb5dce82e0cd6540384116b8e89e98290cccb8 (patch) | |
tree | 5edc5282747f88b064f72679579691d96b6a9e07 | |
parent | 05be686a40b70c298bd6f4bba2cb0cf8fc96085d (diff) | |
parent | 7b09eea52939d2b979f19de40e34b8670feff4c5 (diff) |
Merge remote-tracking branch 'asoc/topic/cs42l73' into asoc-next
-rw-r--r-- | Documentation/devicetree/bindings/sound/cs42l73.txt | 22 | ||||
-rw-r--r-- | include/sound/cs42l73.h | 22 | ||||
-rw-r--r-- | sound/soc/codecs/cs42l73.c | 114 | ||||
-rw-r--r-- | sound/soc/codecs/cs42l73.h | 105 |
4 files changed, 173 insertions, 90 deletions
diff --git a/Documentation/devicetree/bindings/sound/cs42l73.txt b/Documentation/devicetree/bindings/sound/cs42l73.txt new file mode 100644 index 000000000000..80ae910dbf6c --- /dev/null +++ b/Documentation/devicetree/bindings/sound/cs42l73.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | CS42L73 audio CODEC | ||
2 | |||
3 | Required properties: | ||
4 | |||
5 | - compatible : "cirrus,cs42l73" | ||
6 | |||
7 | - reg : the I2C address of the device for I2C | ||
8 | |||
9 | Optional properties: | ||
10 | |||
11 | - reset_gpio : a GPIO spec for the reset pin. | ||
12 | - chgfreq : Charge Pump Frequency values 0x00-0x0F | ||
13 | |||
14 | |||
15 | Example: | ||
16 | |||
17 | codec: cs42l73@4a { | ||
18 | compatible = "cirrus,cs42l73"; | ||
19 | reg = <0x4a>; | ||
20 | reset_gpio = <&gpio 10 0>; | ||
21 | chgfreq = <0x05>; | ||
22 | }; \ No newline at end of file | ||
diff --git a/include/sound/cs42l73.h b/include/sound/cs42l73.h new file mode 100644 index 000000000000..f354be4cdc9e --- /dev/null +++ b/include/sound/cs42l73.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * linux/sound/cs42l73.h -- Platform data for CS42L73 | ||
3 | * | ||
4 | * Copyright (c) 2012 Cirrus Logic Inc. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __CS42L73_H | ||
12 | #define __CS42L73_H | ||
13 | |||
14 | struct cs42l73_platform_data { | ||
15 | /* RST GPIO */ | ||
16 | unsigned int reset_gpio; | ||
17 | unsigned int chgfreq; | ||
18 | int jack_detection; | ||
19 | unsigned int mclk_freq; | ||
20 | }; | ||
21 | |||
22 | #endif /* __CS42L73_H */ | ||
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 3b20c86cdb01..549d5d6a3fef 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/of_gpio.h> | ||
20 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
21 | #include <linux/i2c.h> | 22 | #include <linux/i2c.h> |
22 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
@@ -28,6 +29,7 @@ | |||
28 | #include <sound/soc-dapm.h> | 29 | #include <sound/soc-dapm.h> |
29 | #include <sound/initval.h> | 30 | #include <sound/initval.h> |
30 | #include <sound/tlv.h> | 31 | #include <sound/tlv.h> |
32 | #include <sound/cs42l73.h> | ||
31 | #include "cs42l73.h" | 33 | #include "cs42l73.h" |
32 | 34 | ||
33 | struct sp_config { | 35 | struct sp_config { |
@@ -35,6 +37,7 @@ struct sp_config { | |||
35 | u32 srate; | 37 | u32 srate; |
36 | }; | 38 | }; |
37 | struct cs42l73_private { | 39 | struct cs42l73_private { |
40 | struct cs42l73_platform_data pdata; | ||
38 | struct sp_config config[3]; | 41 | struct sp_config config[3]; |
39 | struct regmap *regmap; | 42 | struct regmap *regmap; |
40 | u32 sysclk; | 43 | u32 sysclk; |
@@ -310,15 +313,6 @@ static const struct soc_enum ng_delay_enum = | |||
310 | SOC_ENUM_SINGLE(CS42L73_NGCAB, 0, | 313 | SOC_ENUM_SINGLE(CS42L73_NGCAB, 0, |
311 | ARRAY_SIZE(cs42l73_ng_delay_text), cs42l73_ng_delay_text); | 314 | ARRAY_SIZE(cs42l73_ng_delay_text), cs42l73_ng_delay_text); |
312 | 315 | ||
313 | static const char * const charge_pump_freq_text[] = { | ||
314 | "0", "1", "2", "3", "4", | ||
315 | "5", "6", "7", "8", "9", | ||
316 | "10", "11", "12", "13", "14", "15" }; | ||
317 | |||
318 | static const struct soc_enum charge_pump_enum = | ||
319 | SOC_ENUM_SINGLE(CS42L73_CPFCHC, 4, | ||
320 | ARRAY_SIZE(charge_pump_freq_text), charge_pump_freq_text); | ||
321 | |||
322 | static const char * const cs42l73_mono_mix_texts[] = { | 316 | static const char * const cs42l73_mono_mix_texts[] = { |
323 | "Left", "Right", "Mono Mix"}; | 317 | "Left", "Right", "Mono Mix"}; |
324 | 318 | ||
@@ -511,8 +505,6 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = { | |||
511 | SOC_SINGLE("NG Threshold", CS42L73_NGCAB, 2, 7, 0), | 505 | SOC_SINGLE("NG Threshold", CS42L73_NGCAB, 2, 7, 0), |
512 | SOC_ENUM("NG Delay", ng_delay_enum), | 506 | SOC_ENUM("NG Delay", ng_delay_enum), |
513 | 507 | ||
514 | SOC_ENUM("Charge Pump Frequency", charge_pump_enum), | ||
515 | |||
516 | SOC_DOUBLE_R_TLV("XSP-IP Volume", | 508 | SOC_DOUBLE_R_TLV("XSP-IP Volume", |
517 | CS42L73_XSPAIPAA, CS42L73_XSPBIPBA, 0, 0x3F, 1, | 509 | CS42L73_XSPAIPAA, CS42L73_XSPBIPBA, 0, 0x3F, 1, |
518 | attn_tlv), | 510 | attn_tlv), |
@@ -1055,11 +1047,11 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
1055 | 1047 | ||
1056 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 1048 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
1057 | case SND_SOC_DAIFMT_CBM_CFM: | 1049 | case SND_SOC_DAIFMT_CBM_CFM: |
1058 | mmcc |= MS_MASTER; | 1050 | mmcc |= CS42L73_MS_MASTER; |
1059 | break; | 1051 | break; |
1060 | 1052 | ||
1061 | case SND_SOC_DAIFMT_CBS_CFS: | 1053 | case SND_SOC_DAIFMT_CBS_CFS: |
1062 | mmcc &= ~MS_MASTER; | 1054 | mmcc &= ~CS42L73_MS_MASTER; |
1063 | break; | 1055 | break; |
1064 | 1056 | ||
1065 | default: | 1057 | default: |
@@ -1071,11 +1063,11 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
1071 | 1063 | ||
1072 | switch (format) { | 1064 | switch (format) { |
1073 | case SND_SOC_DAIFMT_I2S: | 1065 | case SND_SOC_DAIFMT_I2S: |
1074 | spc &= ~SPDIF_PCM; | 1066 | spc &= ~CS42L73_SPDIF_PCM; |
1075 | break; | 1067 | break; |
1076 | case SND_SOC_DAIFMT_DSP_A: | 1068 | case SND_SOC_DAIFMT_DSP_A: |
1077 | case SND_SOC_DAIFMT_DSP_B: | 1069 | case SND_SOC_DAIFMT_DSP_B: |
1078 | if (mmcc & MS_MASTER) { | 1070 | if (mmcc & CS42L73_MS_MASTER) { |
1079 | dev_err(codec->dev, | 1071 | dev_err(codec->dev, |
1080 | "PCM format in slave mode only\n"); | 1072 | "PCM format in slave mode only\n"); |
1081 | return -EINVAL; | 1073 | return -EINVAL; |
@@ -1085,25 +1077,25 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
1085 | "PCM format is not supported on ASP port\n"); | 1077 | "PCM format is not supported on ASP port\n"); |
1086 | return -EINVAL; | 1078 | return -EINVAL; |
1087 | } | 1079 | } |
1088 | spc |= SPDIF_PCM; | 1080 | spc |= CS42L73_SPDIF_PCM; |
1089 | break; | 1081 | break; |
1090 | default: | 1082 | default: |
1091 | return -EINVAL; | 1083 | return -EINVAL; |
1092 | } | 1084 | } |
1093 | 1085 | ||
1094 | if (spc & SPDIF_PCM) { | 1086 | if (spc & CS42L73_SPDIF_PCM) { |
1095 | /* Clear PCM mode, clear PCM_BIT_ORDER bit for MSB->LSB */ | 1087 | /* Clear PCM mode, clear PCM_BIT_ORDER bit for MSB->LSB */ |
1096 | spc &= ~(PCM_MODE_MASK | PCM_BIT_ORDER); | 1088 | spc &= ~(CS42L73_PCM_MODE_MASK | CS42L73_PCM_BIT_ORDER); |
1097 | switch (format) { | 1089 | switch (format) { |
1098 | case SND_SOC_DAIFMT_DSP_B: | 1090 | case SND_SOC_DAIFMT_DSP_B: |
1099 | if (inv == SND_SOC_DAIFMT_IB_IF) | 1091 | if (inv == SND_SOC_DAIFMT_IB_IF) |
1100 | spc |= PCM_MODE0; | 1092 | spc |= CS42L73_PCM_MODE0; |
1101 | if (inv == SND_SOC_DAIFMT_IB_NF) | 1093 | if (inv == SND_SOC_DAIFMT_IB_NF) |
1102 | spc |= PCM_MODE1; | 1094 | spc |= CS42L73_PCM_MODE1; |
1103 | break; | 1095 | break; |
1104 | case SND_SOC_DAIFMT_DSP_A: | 1096 | case SND_SOC_DAIFMT_DSP_A: |
1105 | if (inv == SND_SOC_DAIFMT_IB_IF) | 1097 | if (inv == SND_SOC_DAIFMT_IB_IF) |
1106 | spc |= PCM_MODE1; | 1098 | spc |= CS42L73_PCM_MODE1; |
1107 | break; | 1099 | break; |
1108 | default: | 1100 | default: |
1109 | return -EINVAL; | 1101 | return -EINVAL; |
@@ -1163,7 +1155,7 @@ static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream, | |||
1163 | int mclk_coeff; | 1155 | int mclk_coeff; |
1164 | int srate = params_rate(params); | 1156 | int srate = params_rate(params); |
1165 | 1157 | ||
1166 | if (priv->config[id].mmcc & MS_MASTER) { | 1158 | if (priv->config[id].mmcc & CS42L73_MS_MASTER) { |
1167 | /* CS42L73 Master */ | 1159 | /* CS42L73 Master */ |
1168 | /* MCLK -> srate */ | 1160 | /* MCLK -> srate */ |
1169 | mclk_coeff = | 1161 | mclk_coeff = |
@@ -1182,13 +1174,13 @@ static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream, | |||
1182 | priv->config[id].spc &= 0xFC; | 1174 | priv->config[id].spc &= 0xFC; |
1183 | /* Use SCLK=64*Fs if internal MCLK >= 6.4MHz */ | 1175 | /* Use SCLK=64*Fs if internal MCLK >= 6.4MHz */ |
1184 | if (priv->mclk >= 6400000) | 1176 | if (priv->mclk >= 6400000) |
1185 | priv->config[id].spc |= MCK_SCLK_64FS; | 1177 | priv->config[id].spc |= CS42L73_MCK_SCLK_64FS; |
1186 | else | 1178 | else |
1187 | priv->config[id].spc |= MCK_SCLK_MCLK; | 1179 | priv->config[id].spc |= CS42L73_MCK_SCLK_MCLK; |
1188 | } else { | 1180 | } else { |
1189 | /* CS42L73 Slave */ | 1181 | /* CS42L73 Slave */ |
1190 | priv->config[id].spc &= 0xFC; | 1182 | priv->config[id].spc &= 0xFC; |
1191 | priv->config[id].spc |= MCK_SCLK_64FS; | 1183 | priv->config[id].spc |= CS42L73_MCK_SCLK_64FS; |
1192 | } | 1184 | } |
1193 | /* Update ASRCs */ | 1185 | /* Update ASRCs */ |
1194 | priv->config[id].srate = srate; | 1186 | priv->config[id].srate = srate; |
@@ -1208,8 +1200,8 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1208 | 1200 | ||
1209 | switch (level) { | 1201 | switch (level) { |
1210 | case SND_SOC_BIAS_ON: | 1202 | case SND_SOC_BIAS_ON: |
1211 | snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 0); | 1203 | snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 0); |
1212 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 0); | 1204 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 0); |
1213 | break; | 1205 | break; |
1214 | 1206 | ||
1215 | case SND_SOC_BIAS_PREPARE: | 1207 | case SND_SOC_BIAS_PREPARE: |
@@ -1220,11 +1212,11 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1220 | regcache_cache_only(cs42l73->regmap, false); | 1212 | regcache_cache_only(cs42l73->regmap, false); |
1221 | regcache_sync(cs42l73->regmap); | 1213 | regcache_sync(cs42l73->regmap); |
1222 | } | 1214 | } |
1223 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); | 1215 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 1); |
1224 | break; | 1216 | break; |
1225 | 1217 | ||
1226 | case SND_SOC_BIAS_OFF: | 1218 | case SND_SOC_BIAS_OFF: |
1227 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); | 1219 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, CS42L73_PDN, 1); |
1228 | if (cs42l73->shutdwn_delay > 0) { | 1220 | if (cs42l73->shutdwn_delay > 0) { |
1229 | mdelay(cs42l73->shutdwn_delay); | 1221 | mdelay(cs42l73->shutdwn_delay); |
1230 | cs42l73->shutdwn_delay = 0; | 1222 | cs42l73->shutdwn_delay = 0; |
@@ -1233,7 +1225,7 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1233 | * down. | 1225 | * down. |
1234 | */ | 1226 | */ |
1235 | } | 1227 | } |
1236 | snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 1); | 1228 | snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1); |
1237 | break; | 1229 | break; |
1238 | } | 1230 | } |
1239 | codec->dapm.bias_level = level; | 1231 | codec->dapm.bias_level = level; |
@@ -1367,11 +1359,16 @@ static int cs42l73_probe(struct snd_soc_codec *codec) | |||
1367 | return ret; | 1359 | return ret; |
1368 | } | 1360 | } |
1369 | 1361 | ||
1370 | regcache_cache_only(cs42l73->regmap, true); | ||
1371 | |||
1372 | cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1362 | cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1373 | 1363 | ||
1374 | cs42l73->mclksel = CS42L73_CLKID_MCLK1; /* MCLK1 as master clk */ | 1364 | /* Set Charge Pump Frequency */ |
1365 | if (cs42l73->pdata.chgfreq) | ||
1366 | snd_soc_update_bits(codec, CS42L73_CPFCHC, | ||
1367 | CS42L73_CHARGEPUMP_MASK, | ||
1368 | cs42l73->pdata.chgfreq << 4); | ||
1369 | |||
1370 | /* MCLK1 as master clk */ | ||
1371 | cs42l73->mclksel = CS42L73_CLKID_MCLK1; | ||
1375 | cs42l73->mclk = 0; | 1372 | cs42l73->mclk = 0; |
1376 | 1373 | ||
1377 | return ret; | 1374 | return ret; |
@@ -1415,9 +1412,11 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, | |||
1415 | const struct i2c_device_id *id) | 1412 | const struct i2c_device_id *id) |
1416 | { | 1413 | { |
1417 | struct cs42l73_private *cs42l73; | 1414 | struct cs42l73_private *cs42l73; |
1415 | struct cs42l73_platform_data *pdata = dev_get_platdata(&i2c_client->dev); | ||
1418 | int ret; | 1416 | int ret; |
1419 | unsigned int devid = 0; | 1417 | unsigned int devid = 0; |
1420 | unsigned int reg; | 1418 | unsigned int reg; |
1419 | u32 val32; | ||
1421 | 1420 | ||
1422 | cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), | 1421 | cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), |
1423 | GFP_KERNEL); | 1422 | GFP_KERNEL); |
@@ -1426,14 +1425,49 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, | |||
1426 | return -ENOMEM; | 1425 | return -ENOMEM; |
1427 | } | 1426 | } |
1428 | 1427 | ||
1429 | i2c_set_clientdata(i2c_client, cs42l73); | ||
1430 | |||
1431 | cs42l73->regmap = devm_regmap_init_i2c(i2c_client, &cs42l73_regmap); | 1428 | cs42l73->regmap = devm_regmap_init_i2c(i2c_client, &cs42l73_regmap); |
1432 | if (IS_ERR(cs42l73->regmap)) { | 1429 | if (IS_ERR(cs42l73->regmap)) { |
1433 | ret = PTR_ERR(cs42l73->regmap); | 1430 | ret = PTR_ERR(cs42l73->regmap); |
1434 | dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret); | 1431 | dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret); |
1435 | return ret; | 1432 | return ret; |
1436 | } | 1433 | } |
1434 | |||
1435 | if (pdata) { | ||
1436 | cs42l73->pdata = *pdata; | ||
1437 | } else { | ||
1438 | pdata = devm_kzalloc(&i2c_client->dev, | ||
1439 | sizeof(struct cs42l73_platform_data), | ||
1440 | GFP_KERNEL); | ||
1441 | if (!pdata) { | ||
1442 | dev_err(&i2c_client->dev, "could not allocate pdata\n"); | ||
1443 | return -ENOMEM; | ||
1444 | } | ||
1445 | if (i2c_client->dev.of_node) { | ||
1446 | if (of_property_read_u32(i2c_client->dev.of_node, | ||
1447 | "chgfreq", &val32) >= 0) | ||
1448 | pdata->chgfreq = val32; | ||
1449 | } | ||
1450 | pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, | ||
1451 | "reset-gpio", 0); | ||
1452 | cs42l73->pdata = *pdata; | ||
1453 | } | ||
1454 | |||
1455 | i2c_set_clientdata(i2c_client, cs42l73); | ||
1456 | |||
1457 | if (cs42l73->pdata.reset_gpio) { | ||
1458 | ret = gpio_request_one(cs42l73->pdata.reset_gpio, | ||
1459 | GPIOF_OUT_INIT_HIGH, "CS42L73 /RST"); | ||
1460 | if (ret < 0) { | ||
1461 | dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", | ||
1462 | cs42l73->pdata.reset_gpio, ret); | ||
1463 | return ret; | ||
1464 | } | ||
1465 | gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 0); | ||
1466 | gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 1); | ||
1467 | } | ||
1468 | |||
1469 | regcache_cache_bypass(cs42l73->regmap, true); | ||
1470 | |||
1437 | /* initialize codec */ | 1471 | /* initialize codec */ |
1438 | ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, ®); | 1472 | ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, ®); |
1439 | devid = (reg & 0xFF) << 12; | 1473 | devid = (reg & 0xFF) << 12; |
@@ -1444,7 +1478,6 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, | |||
1444 | ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, ®); | 1478 | ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, ®); |
1445 | devid |= (reg & 0xF0) >> 4; | 1479 | devid |= (reg & 0xF0) >> 4; |
1446 | 1480 | ||
1447 | |||
1448 | if (devid != CS42L73_DEVID) { | 1481 | if (devid != CS42L73_DEVID) { |
1449 | ret = -ENODEV; | 1482 | ret = -ENODEV; |
1450 | dev_err(&i2c_client->dev, | 1483 | dev_err(&i2c_client->dev, |
@@ -1462,7 +1495,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client, | |||
1462 | dev_info(&i2c_client->dev, | 1495 | dev_info(&i2c_client->dev, |
1463 | "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF); | 1496 | "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF); |
1464 | 1497 | ||
1465 | regcache_cache_only(cs42l73->regmap, true); | 1498 | regcache_cache_bypass(cs42l73->regmap, false); |
1466 | 1499 | ||
1467 | ret = snd_soc_register_codec(&i2c_client->dev, | 1500 | ret = snd_soc_register_codec(&i2c_client->dev, |
1468 | &soc_codec_dev_cs42l73, cs42l73_dai, | 1501 | &soc_codec_dev_cs42l73, cs42l73_dai, |
@@ -1478,6 +1511,12 @@ static int cs42l73_i2c_remove(struct i2c_client *client) | |||
1478 | return 0; | 1511 | return 0; |
1479 | } | 1512 | } |
1480 | 1513 | ||
1514 | static const struct of_device_id cs42l73_of_match[] = { | ||
1515 | { .compatible = "cirrus,cs42l73", }, | ||
1516 | {}, | ||
1517 | }; | ||
1518 | MODULE_DEVICE_TABLE(of, cs42l73_of_match); | ||
1519 | |||
1481 | static const struct i2c_device_id cs42l73_id[] = { | 1520 | static const struct i2c_device_id cs42l73_id[] = { |
1482 | {"cs42l73", 0}, | 1521 | {"cs42l73", 0}, |
1483 | {} | 1522 | {} |
@@ -1489,6 +1528,7 @@ static struct i2c_driver cs42l73_i2c_driver = { | |||
1489 | .driver = { | 1528 | .driver = { |
1490 | .name = "cs42l73", | 1529 | .name = "cs42l73", |
1491 | .owner = THIS_MODULE, | 1530 | .owner = THIS_MODULE, |
1531 | .of_match_table = cs42l73_of_match, | ||
1492 | }, | 1532 | }, |
1493 | .id_table = cs42l73_id, | 1533 | .id_table = cs42l73_id, |
1494 | .probe = cs42l73_i2c_probe, | 1534 | .probe = cs42l73_i2c_probe, |
diff --git a/sound/soc/codecs/cs42l73.h b/sound/soc/codecs/cs42l73.h index f30a4c4d62e6..45746186a678 100644 --- a/sound/soc/codecs/cs42l73.h +++ b/sound/soc/codecs/cs42l73.h | |||
@@ -128,59 +128,60 @@ | |||
128 | /* Bitfield Definitions */ | 128 | /* Bitfield Definitions */ |
129 | 129 | ||
130 | /* CS42L73_PWRCTL1 */ | 130 | /* CS42L73_PWRCTL1 */ |
131 | #define PDN_ADCB (1 << 7) | 131 | #define CS42L73_PDN_ADCB (1 << 7) |
132 | #define PDN_DMICB (1 << 6) | 132 | #define CS42L73_PDN_DMICB (1 << 6) |
133 | #define PDN_ADCA (1 << 5) | 133 | #define CS42L73_PDN_ADCA (1 << 5) |
134 | #define PDN_DMICA (1 << 4) | 134 | #define CS42L73_PDN_DMICA (1 << 4) |
135 | #define PDN_LDO (1 << 2) | 135 | #define CS42L73_PDN_LDO (1 << 2) |
136 | #define DISCHG_FILT (1 << 1) | 136 | #define CS42L73_DISCHG_FILT (1 << 1) |
137 | #define PDN (1 << 0) | 137 | #define CS42L73_PDN (1 << 0) |
138 | 138 | ||
139 | /* CS42L73_PWRCTL2 */ | 139 | /* CS42L73_PWRCTL2 */ |
140 | #define PDN_MIC2_BIAS (1 << 7) | 140 | #define CS42L73_PDN_MIC2_BIAS (1 << 7) |
141 | #define PDN_MIC1_BIAS (1 << 6) | 141 | #define CS42L73_PDN_MIC1_BIAS (1 << 6) |
142 | #define PDN_VSP (1 << 4) | 142 | #define CS42L73_PDN_VSP (1 << 4) |
143 | #define PDN_ASP_SDOUT (1 << 3) | 143 | #define CS42L73_PDN_ASP_SDOUT (1 << 3) |
144 | #define PDN_ASP_SDIN (1 << 2) | 144 | #define CS42L73_PDN_ASP_SDIN (1 << 2) |
145 | #define PDN_XSP_SDOUT (1 << 1) | 145 | #define CS42L73_PDN_XSP_SDOUT (1 << 1) |
146 | #define PDN_XSP_SDIN (1 << 0) | 146 | #define CS42L73_PDN_XSP_SDIN (1 << 0) |
147 | 147 | ||
148 | /* CS42L73_PWRCTL3 */ | 148 | /* CS42L73_PWRCTL3 */ |
149 | #define PDN_THMS (1 << 5) | 149 | #define CS42L73_PDN_THMS (1 << 5) |
150 | #define PDN_SPKLO (1 << 4) | 150 | #define CS42L73_PDN_SPKLO (1 << 4) |
151 | #define PDN_EAR (1 << 3) | 151 | #define CS42L73_PDN_EAR (1 << 3) |
152 | #define PDN_SPK (1 << 2) | 152 | #define CS42L73_PDN_SPK (1 << 2) |
153 | #define PDN_LO (1 << 1) | 153 | #define CS42L73_PDN_LO (1 << 1) |
154 | #define PDN_HP (1 << 0) | 154 | #define CS42L73_PDN_HP (1 << 0) |
155 | 155 | ||
156 | /* Thermal Overload Detect. Requires interrupt ... */ | 156 | /* Thermal Overload Detect. Requires interrupt ... */ |
157 | #define THMOVLD_150C 0 | 157 | #define CS42L73_THMOVLD_150C 0 |
158 | #define THMOVLD_132C 1 | 158 | #define CS42L73_THMOVLD_132C 1 |
159 | #define THMOVLD_115C 2 | 159 | #define CS42L73_THMOVLD_115C 2 |
160 | #define THMOVLD_098C 3 | 160 | #define CS42L73_THMOVLD_098C 3 |
161 | 161 | ||
162 | #define CS42L73_CHARGEPUMP_MASK (0xF0) | ||
162 | 163 | ||
163 | /* CS42L73_ASPC, CS42L73_XSPC, CS42L73_VSPC */ | 164 | /* CS42L73_ASPC, CS42L73_XSPC, CS42L73_VSPC */ |
164 | #define SP_3ST (1 << 7) | 165 | #define CS42L73_SP_3ST (1 << 7) |
165 | #define SPDIF_I2S (0 << 6) | 166 | #define CS42L73_SPDIF_I2S (0 << 6) |
166 | #define SPDIF_PCM (1 << 6) | 167 | #define CS42L73_SPDIF_PCM (1 << 6) |
167 | #define PCM_MODE0 (0 << 4) | 168 | #define CS42L73_PCM_MODE0 (0 << 4) |
168 | #define PCM_MODE1 (1 << 4) | 169 | #define CS42L73_PCM_MODE1 (1 << 4) |
169 | #define PCM_MODE2 (2 << 4) | 170 | #define CS42L73_PCM_MODE2 (2 << 4) |
170 | #define PCM_MODE_MASK (3 << 4) | 171 | #define CS42L73_PCM_MODE_MASK (3 << 4) |
171 | #define PCM_BIT_ORDER (1 << 3) | 172 | #define CS42L73_PCM_BIT_ORDER (1 << 3) |
172 | #define MCK_SCLK_64FS (0 << 0) | 173 | #define CS42L73_MCK_SCLK_64FS (0 << 0) |
173 | #define MCK_SCLK_MCLK (2 << 0) | 174 | #define CS42L73_MCK_SCLK_MCLK (2 << 0) |
174 | #define MCK_SCLK_PREMCLK (3 << 0) | 175 | #define CS42L73_MCK_SCLK_PREMCLK (3 << 0) |
175 | 176 | ||
176 | /* CS42L73_xSPMMCC */ | 177 | /* CS42L73_xSPMMCC */ |
177 | #define MS_MASTER (1 << 7) | 178 | #define CS42L73_MS_MASTER (1 << 7) |
178 | 179 | ||
179 | 180 | ||
180 | /* CS42L73_DMMCC */ | 181 | /* CS42L73_DMMCC */ |
181 | #define MCLKDIS (1 << 0) | 182 | #define CS42L73_MCLKDIS (1 << 0) |
182 | #define MCLKSEL_MCLK2 (1 << 4) | 183 | #define CS42L73_MCLKSEL_MCLK2 (1 << 4) |
183 | #define MCLKSEL_MCLK1 (0 << 4) | 184 | #define CS42L73_MCLKSEL_MCLK1 (0 << 4) |
184 | 185 | ||
185 | /* CS42L73 MCLK derived from MCLK1 or MCLK2 */ | 186 | /* CS42L73 MCLK derived from MCLK1 or MCLK2 */ |
186 | #define CS42L73_CLKID_MCLK1 0 | 187 | #define CS42L73_CLKID_MCLK1 0 |
@@ -194,28 +195,26 @@ | |||
194 | #define CS42L73_VSP 2 | 195 | #define CS42L73_VSP 2 |
195 | 196 | ||
196 | /* IS1, IM1 */ | 197 | /* IS1, IM1 */ |
197 | #define MIC2_SDET (1 << 6) | 198 | #define CS42L73_MIC2_SDET (1 << 6) |
198 | #define THMOVLD (1 << 4) | 199 | #define CS42L73_THMOVLD (1 << 4) |
199 | #define DIGMIXOVFL (1 << 3) | 200 | #define CS42L73_DIGMIXOVFL (1 << 3) |
200 | #define IPBOVFL (1 << 1) | 201 | #define CS42L73_IPBOVFL (1 << 1) |
201 | #define IPAOVFL (1 << 0) | 202 | #define CS42L73_IPAOVFL (1 << 0) |
202 | 203 | ||
203 | /* Analog Softramp */ | 204 | /* Analog Softramp */ |
204 | #define ANLGOSFT (1 << 0) | 205 | #define CS42L73_ANLGOSFT (1 << 0) |
205 | 206 | ||
206 | /* HP A/B Analog Mute */ | 207 | /* HP A/B Analog Mute */ |
207 | #define HPA_MUTE (1 << 7) | 208 | #define CS42L73_HPA_MUTE (1 << 7) |
208 | /* LO A/B Analog Mute */ | 209 | /* LO A/B Analog Mute */ |
209 | #define LOA_MUTE (1 << 7) | 210 | #define CS42L73_LOA_MUTE (1 << 7) |
210 | /* Digital Mute */ | 211 | /* Digital Mute */ |
211 | #define HLAD_MUTE (1 << 0) | 212 | #define CS42L73_HLAD_MUTE (1 << 0) |
212 | #define HLBD_MUTE (1 << 1) | 213 | #define CS42L73_HLBD_MUTE (1 << 1) |
213 | #define SPKD_MUTE (1 << 2) | 214 | #define CS42L73_SPKD_MUTE (1 << 2) |
214 | #define ESLD_MUTE (1 << 3) | 215 | #define CS42L73_ESLD_MUTE (1 << 3) |
215 | 216 | ||
216 | /* Misc defines for codec */ | 217 | /* Misc defines for codec */ |
217 | #define CS42L73_RESET_GPIO 143 | ||
218 | |||
219 | #define CS42L73_DEVID 0x00042A73 | 218 | #define CS42L73_DEVID 0x00042A73 |
220 | #define CS42L73_MCLKX_MIN 5644800 | 219 | #define CS42L73_MCLKX_MIN 5644800 |
221 | #define CS42L73_MCLKX_MAX 38400000 | 220 | #define CS42L73_MCLKX_MAX 38400000 |