diff options
author | Daniel Mack <zonque@gmail.com> | 2014-05-05 05:49:23 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-05 15:52:59 -0400 |
commit | 7c2fcccc323909c1a4e56b79fc882168a0880146 (patch) | |
tree | c9e7f7e82a702e176055160dd04c325511f384d2 | |
parent | 09af62ff184bfeae4a72874ab28ed637a2329ee4 (diff) |
ASoC: sta350: add support for bits in miscellaneous registers
Add support for RPDNEN, NSHHPEN, BRIDGOFF, CPWMEN and PNDLSL, and add DT
bindings to access them.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/sound/st,sta350.txt | 24 | ||||
-rw-r--r-- | include/sound/sta350.h | 5 | ||||
-rw-r--r-- | sound/soc/codecs/sta350.c | 45 | ||||
-rw-r--r-- | sound/soc/codecs/sta350.h | 10 |
4 files changed, 83 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/st,sta350.txt b/Documentation/devicetree/bindings/sound/st,sta350.txt index ecd7a623c8bd..b7e71bf5caf4 100644 --- a/Documentation/devicetree/bindings/sound/st,sta350.txt +++ b/Documentation/devicetree/bindings/sound/st,sta350.txt | |||
@@ -86,7 +86,29 @@ Optional properties: | |||
86 | - st,invalid-input-detect-mute: | 86 | - st,invalid-input-detect-mute: |
87 | If present, automatic invalid input detect mute is enabled. | 87 | If present, automatic invalid input detect mute is enabled. |
88 | 88 | ||
89 | 89 | - st,activate-mute-output: | |
90 | If present, a mute output will be activated in ase the volume will | ||
91 | reach a value lower than -76 dBFS. | ||
92 | |||
93 | - st,bridge-immediate-off: | ||
94 | If present, the bridge will be switched off immediately after the | ||
95 | power-down-gpio goes low. Otherwise, the bridge will wait for 13 | ||
96 | million clock cycles to pass before shutting down. | ||
97 | |||
98 | - st,noise-shape-dc-cut: | ||
99 | If present, the noise-shaping technique on the DC cutoff filter are | ||
100 | enabled. | ||
101 | |||
102 | - st,powerdown-master-volume: | ||
103 | If present, the power-down pin and I2C power-down functions will | ||
104 | act on the master volume. Otherwise, the functions will act on the | ||
105 | mute commands. | ||
106 | |||
107 | - st,powerdown-delay-divider: | ||
108 | If present, the bridge power-down time will be divided by the provided | ||
109 | value. If not specified, a divider of 1 will be used. Allowed values | ||
110 | are 1, 2, 4, 8, 16, 32, 64 and 128. | ||
111 | This property has to be specified as '/bits/ 8' value. | ||
90 | 112 | ||
91 | Example: | 113 | Example: |
92 | 114 | ||
diff --git a/include/sound/sta350.h b/include/sound/sta350.h index 3a3298106b22..42edceb096a0 100644 --- a/include/sound/sta350.h +++ b/include/sound/sta350.h | |||
@@ -37,6 +37,7 @@ struct sta350_platform_data { | |||
37 | u8 ch3_output_mapping; | 37 | u8 ch3_output_mapping; |
38 | u8 ffx_power_output_mode; | 38 | u8 ffx_power_output_mode; |
39 | u8 drop_compensation_ns; | 39 | u8 drop_compensation_ns; |
40 | u8 powerdown_delay_divider; | ||
40 | unsigned int thermal_warning_recovery:1; | 41 | unsigned int thermal_warning_recovery:1; |
41 | unsigned int thermal_warning_adjustment:1; | 42 | unsigned int thermal_warning_adjustment:1; |
42 | unsigned int fault_detect_recovery:1; | 43 | unsigned int fault_detect_recovery:1; |
@@ -47,6 +48,10 @@ struct sta350_platform_data { | |||
47 | unsigned int odd_pwm_speed_mode:1; | 48 | unsigned int odd_pwm_speed_mode:1; |
48 | unsigned int distortion_compensation:1; | 49 | unsigned int distortion_compensation:1; |
49 | unsigned int invalid_input_detect_mute:1; | 50 | unsigned int invalid_input_detect_mute:1; |
51 | unsigned int activate_mute_output:1; | ||
52 | unsigned int bridge_immediate_off:1; | ||
53 | unsigned int noise_shape_dc_cut:1; | ||
54 | unsigned int powerdown_master_vol:1; | ||
50 | }; | 55 | }; |
51 | 56 | ||
52 | #endif /* __LINUX_SND__STA350_H */ | 57 | #endif /* __LINUX_SND__STA350_H */ |
diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c index 12ebbaf5d95f..cc97dd52aa9c 100644 --- a/sound/soc/codecs/sta350.c +++ b/sound/soc/codecs/sta350.c | |||
@@ -1020,6 +1020,29 @@ static int sta350_probe(struct snd_soc_codec *codec) | |||
1020 | pdata->ch3_output_mapping | 1020 | pdata->ch3_output_mapping |
1021 | << STA350_CxCFG_OM_SHIFT); | 1021 | << STA350_CxCFG_OM_SHIFT); |
1022 | 1022 | ||
1023 | /* miscellaneous registers */ | ||
1024 | regmap_update_bits(sta350->regmap, STA350_MISC1, | ||
1025 | STA350_MISC1_CPWMEN, | ||
1026 | pdata->activate_mute_output ? | ||
1027 | STA350_MISC1_CPWMEN : 0); | ||
1028 | regmap_update_bits(sta350->regmap, STA350_MISC1, | ||
1029 | STA350_MISC1_BRIDGOFF, | ||
1030 | pdata->bridge_immediate_off ? | ||
1031 | STA350_MISC1_BRIDGOFF : 0); | ||
1032 | regmap_update_bits(sta350->regmap, STA350_MISC1, | ||
1033 | STA350_MISC1_NSHHPEN, | ||
1034 | pdata->noise_shape_dc_cut ? | ||
1035 | STA350_MISC1_NSHHPEN : 0); | ||
1036 | regmap_update_bits(sta350->regmap, STA350_MISC1, | ||
1037 | STA350_MISC1_RPDNEN, | ||
1038 | pdata->powerdown_master_vol ? | ||
1039 | STA350_MISC1_RPDNEN: 0); | ||
1040 | |||
1041 | regmap_update_bits(sta350->regmap, STA350_MISC2, | ||
1042 | STA350_MISC2_PNDLSL_MASK, | ||
1043 | pdata->powerdown_delay_divider | ||
1044 | << STA350_MISC2_PNDLSL_SHIFT); | ||
1045 | |||
1023 | /* initialize coefficient shadow RAM with reset values */ | 1046 | /* initialize coefficient shadow RAM with reset values */ |
1024 | for (i = 4; i <= 49; i += 5) | 1047 | for (i = 4; i <= 49; i += 5) |
1025 | sta350->coef_shadow[i] = 0x400000; | 1048 | sta350->coef_shadow[i] = 0x400000; |
@@ -1094,6 +1117,7 @@ static int sta350_probe_dt(struct device *dev, struct sta350_priv *sta350) | |||
1094 | struct sta350_platform_data *pdata; | 1117 | struct sta350_platform_data *pdata; |
1095 | const char *ffx_power_mode; | 1118 | const char *ffx_power_mode; |
1096 | u16 tmp; | 1119 | u16 tmp; |
1120 | u8 tmp8; | ||
1097 | 1121 | ||
1098 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 1122 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
1099 | if (!pdata) | 1123 | if (!pdata) |
@@ -1158,6 +1182,27 @@ static int sta350_probe_dt(struct device *dev, struct sta350_priv *sta350) | |||
1158 | if (of_get_property(np, "st,invalid-input-detect-mute", NULL)) | 1182 | if (of_get_property(np, "st,invalid-input-detect-mute", NULL)) |
1159 | pdata->invalid_input_detect_mute = 1; | 1183 | pdata->invalid_input_detect_mute = 1; |
1160 | 1184 | ||
1185 | /* MISC */ | ||
1186 | if (of_get_property(np, "st,activate-mute-output", NULL)) | ||
1187 | pdata->activate_mute_output = 1; | ||
1188 | |||
1189 | if (of_get_property(np, "st,bridge-immediate-off", NULL)) | ||
1190 | pdata->bridge_immediate_off = 1; | ||
1191 | |||
1192 | if (of_get_property(np, "st,noise-shape-dc-cut", NULL)) | ||
1193 | pdata->noise_shape_dc_cut = 1; | ||
1194 | |||
1195 | if (of_get_property(np, "st,powerdown-master-volume", NULL)) | ||
1196 | pdata->powerdown_master_vol = 1; | ||
1197 | |||
1198 | if (!of_property_read_u8(np, "st,powerdown-delay-divider", &tmp8)) { | ||
1199 | if (is_power_of_2(tmp8) && tmp8 >= 1 && tmp8 <= 128) | ||
1200 | pdata->powerdown_delay_divider = ilog2(tmp8); | ||
1201 | else | ||
1202 | dev_warn(dev, "Unsupported powerdown delay divider %d\n", | ||
1203 | tmp8); | ||
1204 | } | ||
1205 | |||
1161 | sta350->pdata = pdata; | 1206 | sta350->pdata = pdata; |
1162 | 1207 | ||
1163 | return 0; | 1208 | return 0; |
diff --git a/sound/soc/codecs/sta350.h b/sound/soc/codecs/sta350.h index c3248f0fad2c..fb7285290779 100644 --- a/sound/soc/codecs/sta350.h +++ b/sound/soc/codecs/sta350.h | |||
@@ -225,4 +225,14 @@ | |||
225 | #define STA350_C3_MIX1 60 | 225 | #define STA350_C3_MIX1 60 |
226 | #define STA350_C3_MIX2 61 | 226 | #define STA350_C3_MIX2 61 |
227 | 227 | ||
228 | /* miscellaneous register 1 */ | ||
229 | #define STA350_MISC1_CPWMEN BIT(2) | ||
230 | #define STA350_MISC1_BRIDGOFF BIT(5) | ||
231 | #define STA350_MISC1_NSHHPEN BIT(6) | ||
232 | #define STA350_MISC1_RPDNEN BIT(7) | ||
233 | |||
234 | /* miscellaneous register 2 */ | ||
235 | #define STA350_MISC2_PNDLSL_MASK 0x1c | ||
236 | #define STA350_MISC2_PNDLSL_SHIFT 2 | ||
237 | |||
228 | #endif /* _ASOC_STA_350_H */ | 238 | #endif /* _ASOC_STA_350_H */ |