Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: codecs: msm8916-wcd-analog: Drop invalid mclk

The audio codec typically used for the MSM8916 SoC is split into two
parts: the digital codec is part of the SoC, while the analog codec is
part of the PM8916 PMIC.

The analog codec in the PMIC has no direct connection to the mclk of
the SoC (GCC_CODEC_DIGCODEC_CLK). As the name of the clock suggests
this is supplied to the digital part of the codec. During playback it
will use this clock to transmit the audio data via the "CDC PDM" pins
to the PMIC. In this case the analog codec indirectly receives the
clock signal through the digital codec.

GCC_CODEC_DIGCODEC_CLK is already managed by the driver of the digital
part of the codec in the SoC. Having this clock on the analog PMIC part
additionally is redundant and incorrect because the analog codec cannot
receive the clock signal without going through the digital codec.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20230718-pm8916-mclk-v1-4-4b4a58b4240a@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Stephan Gerhold and committed by
Mark Brown
97f29c1a 469c6d9c

+6 -37
+6 -37
sound/soc/codecs/msm8916-wcd-analog.c
··· 7 7 #include <linux/delay.h> 8 8 #include <linux/regulator/consumer.h> 9 9 #include <linux/types.h> 10 - #include <linux/clk.h> 11 10 #include <linux/of.h> 12 11 #include <linux/platform_device.h> 13 12 #include <linux/regmap.h> ··· 1197 1198 if (ret < 0) 1198 1199 return ret; 1199 1200 1200 - priv->mclk = devm_clk_get(dev, "mclk"); 1201 - if (IS_ERR(priv->mclk)) { 1202 - dev_err(dev, "failed to get mclk\n"); 1203 - return PTR_ERR(priv->mclk); 1204 - } 1205 - 1206 1201 for (i = 0; i < ARRAY_SIZE(supply_names); i++) 1207 1202 priv->supplies[i].supply = supply_names[i]; 1208 1203 ··· 1207 1214 return ret; 1208 1215 } 1209 1216 1210 - ret = clk_prepare_enable(priv->mclk); 1211 - if (ret < 0) { 1212 - dev_err(dev, "failed to enable mclk %d\n", ret); 1213 - return ret; 1214 - } 1215 - 1216 1217 irq = platform_get_irq_byname(pdev, "mbhc_switch_int"); 1217 - if (irq < 0) { 1218 - ret = irq; 1219 - goto err_disable_clk; 1220 - } 1218 + if (irq < 0) 1219 + return irq; 1221 1220 1222 1221 ret = devm_request_threaded_irq(dev, irq, NULL, 1223 1222 pm8916_mbhc_switch_irq_handler, ··· 1221 1236 1222 1237 if (priv->mbhc_btn_enabled) { 1223 1238 irq = platform_get_irq_byname(pdev, "mbhc_but_press_det"); 1224 - if (irq < 0) { 1225 - ret = irq; 1226 - goto err_disable_clk; 1227 - } 1239 + if (irq < 0) 1240 + return irq; 1228 1241 1229 1242 ret = devm_request_threaded_irq(dev, irq, NULL, 1230 1243 mbhc_btn_press_irq_handler, ··· 1233 1250 dev_err(dev, "cannot request mbhc button press irq\n"); 1234 1251 1235 1252 irq = platform_get_irq_byname(pdev, "mbhc_but_rel_det"); 1236 - if (irq < 0) { 1237 - ret = irq; 1238 - goto err_disable_clk; 1239 - } 1253 + if (irq < 0) 1254 + return irq; 1240 1255 1241 1256 ret = devm_request_threaded_irq(dev, irq, NULL, 1242 1257 mbhc_btn_release_irq_handler, ··· 1251 1270 return devm_snd_soc_register_component(dev, &pm8916_wcd_analog, 1252 1271 pm8916_wcd_analog_dai, 1253 1272 ARRAY_SIZE(pm8916_wcd_analog_dai)); 1254 - 1255 - err_disable_clk: 1256 - clk_disable_unprepare(priv->mclk); 1257 - return ret; 1258 - } 1259 - 1260 - static void pm8916_wcd_analog_spmi_remove(struct platform_device *pdev) 1261 - { 1262 - struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(&pdev->dev); 1263 - 1264 - clk_disable_unprepare(priv->mclk); 1265 1273 } 1266 1274 1267 1275 static const struct of_device_id pm8916_wcd_analog_spmi_match_table[] = { ··· 1266 1296 .of_match_table = pm8916_wcd_analog_spmi_match_table, 1267 1297 }, 1268 1298 .probe = pm8916_wcd_analog_spmi_probe, 1269 - .remove_new = pm8916_wcd_analog_spmi_remove, 1270 1299 }; 1271 1300 1272 1301 module_platform_driver(pm8916_wcd_analog_spmi_driver);