[alsa-devel] [PATCH v2] ASoC: Intel: bytcr_rt5640: fallback mechanism if MCLK is not enabled
Commit df1a2776a795 ("ASoC: Intel: bytcr_rt5640: add MCLK support") was merged but the corresponding clock framework patches have not, after being bumped from audio to clock to x86 domains. The missing clock-related patches result in a regression starting with 4.9 with the audio card not being created.
Rather than reverting this commit and all following updates already queued up for 4.10, handle run-time dependency on MCLK and fall back to the previous bit-clock mode. This provides the same functionality as in 4.8 for Baytrail devices. On Baytrail-CR most devices remain silent with this fallback but additional patches are needed anyway. As suggested by Mark Brown, the fallback is only allowed with -ENOENT, all other run-time errors, including -EPROBE_DEFER, will stop the probe with no sound card registered.
This patch should be applied to -stable as well as ASoC 4.10 fixes
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/intel/boards/bytcr_rt5640.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index 507a86a..7d66127 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -825,10 +825,20 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && (is_valleyview())) { priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); if (IS_ERR(priv->mclk)) { + ret_val = PTR_ERR(priv->mclk); + dev_err(&pdev->dev, "Failed to get MCLK from pmc_plt_clk_3: %ld\n", - PTR_ERR(priv->mclk)); - return PTR_ERR(priv->mclk); + ret_val); + + /* + * Fall back to bit clock usage for -ENOENT (clock not + * available likely due to missing dependencies), bail + * for all other errors, including -EPROBE_DEFER + */ + if (ret_val != -ENOENT) + return ret_val; + byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN; } }
Hi Pierre-Louis,
[auto build test WARNING on asoc/for-next] [also build test WARNING on v4.9 next-20161215] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pierre-Louis-Bossart/ASoC-Intel-byt... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: i386-randconfig-h0-12161247 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
sound/soc/intel/boards/bytcr_rt5640.c: In function 'snd_byt_rt5640_mc_probe':
sound/soc/intel/boards/bytcr_rt5640.c:831:47: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
"Failed to get MCLK from pmc_plt_clk_3: %ld\n", ^
vim +831 sound/soc/intel/boards/bytcr_rt5640.c
f47088d5 Pierre-Louis Bossart 2016-08-12 815 f47088d5 Pierre-Louis Bossart 2016-08-12 816 /* fixup cpu dai name name */ f47088d5 Pierre-Louis Bossart 2016-08-12 817 snprintf(byt_rt5640_cpu_dai_name, f47088d5 Pierre-Louis Bossart 2016-08-12 818 sizeof(byt_rt5640_cpu_dai_name), f47088d5 Pierre-Louis Bossart 2016-08-12 819 "%s", "ssp0-port"); f47088d5 Pierre-Louis Bossart 2016-08-12 820 f47088d5 Pierre-Louis Bossart 2016-08-12 821 byt_rt5640_dais[dai_index].cpu_dai_name = f47088d5 Pierre-Louis Bossart 2016-08-12 822 byt_rt5640_cpu_dai_name; f47088d5 Pierre-Louis Bossart 2016-08-12 823 } f47088d5 Pierre-Louis Bossart 2016-08-12 824 df1a2776 Irina Tirdea 2016-08-12 825 if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && (is_valleyview())) { df1a2776 Irina Tirdea 2016-08-12 826 priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); df1a2776 Irina Tirdea 2016-08-12 827 if (IS_ERR(priv->mclk)) { 89a6cc1f Pierre-Louis Bossart 2016-12-15 828 ret_val = PTR_ERR(priv->mclk); 89a6cc1f Pierre-Louis Bossart 2016-12-15 829 df1a2776 Irina Tirdea 2016-08-12 830 dev_err(&pdev->dev, df1a2776 Irina Tirdea 2016-08-12 @831 "Failed to get MCLK from pmc_plt_clk_3: %ld\n", 89a6cc1f Pierre-Louis Bossart 2016-12-15 832 ret_val); 89a6cc1f Pierre-Louis Bossart 2016-12-15 833 89a6cc1f Pierre-Louis Bossart 2016-12-15 834 /* 89a6cc1f Pierre-Louis Bossart 2016-12-15 835 * Fall back to bit clock usage for -ENOENT (clock not 89a6cc1f Pierre-Louis Bossart 2016-12-15 836 * available likely due to missing dependencies), bail 89a6cc1f Pierre-Louis Bossart 2016-12-15 837 * for all other errors, including -EPROBE_DEFER 89a6cc1f Pierre-Louis Bossart 2016-12-15 838 */ 89a6cc1f Pierre-Louis Bossart 2016-12-15 839 if (ret_val != -ENOENT)
:::::: The code at line 831 was first introduced by commit :::::: df1a2776a795848f4dbc7c0cb396158b43eb8aa3 ASoC: Intel: bytcr_rt5640: add MCLK support
:::::: TO: Irina Tirdea irina.tirdea@intel.com :::::: CC: Mark Brown broonie@kernel.org
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Pierre-Louis,
[auto build test WARNING on asoc/for-next] [also build test WARNING on v4.9 next-20161215] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Pierre-Louis-Bossart/ASoC-Intel-byt... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-randconfig-s2-12161323 (attached as .config) compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All warnings (new ones prefixed by >>):
sound/soc/intel/boards/bytcr_rt5640.c: In function 'snd_byt_rt5640_mc_probe':
sound/soc/intel/boards/bytcr_rt5640.c:832: warning: format '%ld' expects type 'long int', but argument 3 has type 'int'
vim +832 sound/soc/intel/boards/bytcr_rt5640.c
816 /* fixup cpu dai name name */ 817 snprintf(byt_rt5640_cpu_dai_name, 818 sizeof(byt_rt5640_cpu_dai_name), 819 "%s", "ssp0-port"); 820 821 byt_rt5640_dais[dai_index].cpu_dai_name = 822 byt_rt5640_cpu_dai_name; 823 } 824 825 if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && (is_valleyview())) { 826 priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); 827 if (IS_ERR(priv->mclk)) { 828 ret_val = PTR_ERR(priv->mclk); 829 830 dev_err(&pdev->dev, 831 "Failed to get MCLK from pmc_plt_clk_3: %ld\n",
832 ret_val);
833 834 /* 835 * Fall back to bit clock usage for -ENOENT (clock not 836 * available likely due to missing dependencies), bail 837 * for all other errors, including -EPROBE_DEFER 838 */ 839 if (ret_val != -ENOENT) 840 return ret_val;
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
participants (2)
-
kbuild test robot
-
Pierre-Louis Bossart