diff options
Diffstat (limited to 'sound/soc/qcom/lpass-cpu.c')
-rw-r--r-- | sound/soc/qcom/lpass-cpu.c | 107 |
1 files changed, 43 insertions, 64 deletions
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index eff3f9a8b685..5202a584e0c6 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -33,13 +33,10 @@ static int lpass_cpu_daiops_set_sysclk(struct snd_soc_dai *dai, int clk_id, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; - if (IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - return 0; - ret = clk_set_rate(drvdata->mi2s_osr_clk[dai->driver->id], freq); if (ret) - dev_err(dai->dev, "%s() error setting mi2s osrclk to %u: %d\n", - __func__, freq, ret); + dev_err(dai->dev, "error setting mi2s osrclk to %u: %d\n", + freq, ret); return ret; } @@ -50,23 +47,16 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) { - ret = clk_prepare_enable( - drvdata->mi2s_osr_clk[dai->driver->id]); - if (ret) { - dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", - __func__, ret); - return ret; - } + ret = clk_prepare_enable(drvdata->mi2s_osr_clk[dai->driver->id]); + if (ret) { + dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret); + return ret; } ret = clk_prepare_enable(drvdata->mi2s_bit_clk[dai->driver->id]); if (ret) { - dev_err(dai->dev, "%s() error in enabling mi2s bit clk: %d\n", - __func__, ret); - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - clk_disable_unprepare( - drvdata->mi2s_osr_clk[dai->driver->id]); + dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); return ret; } @@ -80,8 +70,7 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]); - if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) - clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); } static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, @@ -96,8 +85,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, bitwidth = snd_pcm_format_width(format); if (bitwidth < 0) { - dev_err(dai->dev, "%s() invalid bit width given: %d\n", - __func__, bitwidth); + dev_err(dai->dev, "invalid bit width given: %d\n", bitwidth); return bitwidth; } @@ -115,8 +103,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, regval |= LPAIF_I2SCTL_BITWIDTH_32; break; default: - dev_err(dai->dev, "%s() invalid bitwidth given: %d\n", - __func__, bitwidth); + dev_err(dai->dev, "invalid bitwidth given: %d\n", bitwidth); return -EINVAL; } @@ -143,8 +130,8 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, regval |= LPAIF_I2SCTL_SPKMONO_STEREO; break; default: - dev_err(dai->dev, "%s() invalid channels given: %u\n", - __func__, channels); + dev_err(dai->dev, "invalid channels given: %u\n", + channels); return -EINVAL; } } else { @@ -170,8 +157,8 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, regval |= LPAIF_I2SCTL_MICMONO_STEREO; break; default: - dev_err(dai->dev, "%s() invalid channels given: %u\n", - __func__, channels); + dev_err(dai->dev, "invalid channels given: %u\n", + channels); return -EINVAL; } } @@ -180,16 +167,15 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), regval); if (ret) { - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret); return ret; } ret = clk_set_rate(drvdata->mi2s_bit_clk[dai->driver->id], rate * bitwidth * 2); if (ret) { - dev_err(dai->dev, "%s() error setting mi2s bitclk to %u: %d\n", - __func__, rate * bitwidth * 2, ret); + dev_err(dai->dev, "error setting mi2s bitclk to %u: %d\n", + rate * bitwidth * 2, ret); return ret; } @@ -206,8 +192,7 @@ static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), 0); if (ret) - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret); return ret; } @@ -231,8 +216,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), mask, val); if (ret) - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret); return ret; } @@ -261,8 +245,8 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, dai->driver->id), mask, val); if (ret) - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", + ret); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: @@ -280,8 +264,8 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, dai->driver->id), mask, val); if (ret) - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", + ret); break; } @@ -308,8 +292,7 @@ int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai) ret = regmap_write(drvdata->lpaif_map, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), 0); if (ret) - dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", - __func__, ret); + dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret); return ret; } @@ -451,8 +434,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0); if (dsp_of_node) { - dev_err(&pdev->dev, "%s() DSP exists and holds audio resources\n", - __func__); + dev_err(&pdev->dev, "DSP exists and holds audio resources\n"); return -EBUSY; } @@ -473,8 +455,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) drvdata->lpaif = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR((void const __force *)drvdata->lpaif)) { - dev_err(&pdev->dev, "%s() error mapping reg resource: %ld\n", - __func__, + dev_err(&pdev->dev, "error mapping reg resource: %ld\n", PTR_ERR((void const __force *)drvdata->lpaif)); return PTR_ERR((void const __force *)drvdata->lpaif); } @@ -486,8 +467,8 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) drvdata->lpaif_map = devm_regmap_init_mmio(&pdev->dev, drvdata->lpaif, &lpass_cpu_regmap_config); if (IS_ERR(drvdata->lpaif_map)) { - dev_err(&pdev->dev, "%s() error initializing regmap: %ld\n", - __func__, PTR_ERR(drvdata->lpaif_map)); + dev_err(&pdev->dev, "error initializing regmap: %ld\n", + PTR_ERR(drvdata->lpaif_map)); return PTR_ERR(drvdata->lpaif_map); } @@ -505,9 +486,10 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) clk_name); if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) { dev_warn(&pdev->dev, - "%s() error getting mi2s-osr-clk: %ld\n", - __func__, + "error getting optional mi2s-osr-clk: %ld\n", PTR_ERR(drvdata->mi2s_osr_clk[dai_id])); + + drvdata->mi2s_osr_clk[dai_id] = NULL; } if (variant->num_dai > 1) @@ -519,8 +501,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) clk_name); if (IS_ERR(drvdata->mi2s_bit_clk[dai_id])) { dev_err(&pdev->dev, - "%s() error getting mi2s-bit-clk: %ld\n", - __func__, + "error getting mi2s-bit-clk: %ld\n", PTR_ERR(drvdata->mi2s_bit_clk[dai_id])); return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]); } @@ -528,24 +509,23 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) drvdata->ahbix_clk = devm_clk_get(&pdev->dev, "ahbix-clk"); if (IS_ERR(drvdata->ahbix_clk)) { - dev_err(&pdev->dev, "%s() error getting ahbix-clk: %ld\n", - __func__, PTR_ERR(drvdata->ahbix_clk)); + dev_err(&pdev->dev, "error getting ahbix-clk: %ld\n", + PTR_ERR(drvdata->ahbix_clk)); return PTR_ERR(drvdata->ahbix_clk); } ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY); if (ret) { - dev_err(&pdev->dev, "%s() error setting rate on ahbix_clk: %d\n", - __func__, ret); + dev_err(&pdev->dev, "error setting rate on ahbix_clk: %d\n", + ret); return ret; } - dev_dbg(&pdev->dev, "%s() set ahbix_clk rate to %lu\n", __func__, - clk_get_rate(drvdata->ahbix_clk)); + dev_dbg(&pdev->dev, "set ahbix_clk rate to %lu\n", + clk_get_rate(drvdata->ahbix_clk)); ret = clk_prepare_enable(drvdata->ahbix_clk); if (ret) { - dev_err(&pdev->dev, "%s() error enabling ahbix_clk: %d\n", - __func__, ret); + dev_err(&pdev->dev, "error enabling ahbix_clk: %d\n", ret); return ret; } @@ -554,15 +534,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) variant->dai_driver, variant->num_dai); if (ret) { - dev_err(&pdev->dev, "%s() error registering cpu driver: %d\n", - __func__, ret); + dev_err(&pdev->dev, "error registering cpu driver: %d\n", ret); goto err_clk; } ret = asoc_qcom_lpass_platform_register(pdev); if (ret) { - dev_err(&pdev->dev, "%s() error registering platform driver: %d\n", - __func__, ret); + dev_err(&pdev->dev, "error registering platform driver: %d\n", + ret); goto err_clk; } |