Skip to content

Commit a182ecd

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: intel: cht_bsw_max98090_ti: Add quirk for boards using pmc_plt_clk_0
Some boards such as the Swanky model Chromebooks use pmc_plt_clk_0 for the mclk instead of pmc_plt_clk_3. This commit adds a DMI based quirk for this. This fixing audio no longer working on these devices after commit 648e921 ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") that commit fixes us unnecessary keeping unused clocks on, but in case of the Swanky that was breaking audio support since we were not using the right clock in the cht_bsw_max98090_ti machine driver. Cc: [email protected] Fixes: 648e921 ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") Reported-and-tested-by: Dean Wallace <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 2f5d941 commit a182ecd

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

sound/soc/intel/boards/cht_bsw_max98090_ti.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020
*/
2121

22+
#include <linux/dmi.h>
2223
#include <linux/module.h>
2324
#include <linux/platform_device.h>
2425
#include <linux/slab.h>
@@ -35,6 +36,8 @@
3536
#define CHT_PLAT_CLK_3_HZ 19200000
3637
#define CHT_CODEC_DAI "HiFi"
3738

39+
#define QUIRK_PMC_PLT_CLK_0 0x01
40+
3841
struct cht_mc_private {
3942
struct clk *mclk;
4043
struct snd_soc_jack jack;
@@ -385,11 +388,29 @@ static struct snd_soc_card snd_soc_card_cht = {
385388
.num_controls = ARRAY_SIZE(cht_mc_controls),
386389
};
387390

391+
static const struct dmi_system_id cht_max98090_quirk_table[] = {
392+
{
393+
/* Swanky model Chromebook (Toshiba Chromebook 2) */
394+
.matches = {
395+
DMI_MATCH(DMI_PRODUCT_NAME, "Swanky"),
396+
},
397+
.driver_data = (void *)QUIRK_PMC_PLT_CLK_0,
398+
},
399+
{}
400+
};
401+
388402
static int snd_cht_mc_probe(struct platform_device *pdev)
389403
{
404+
const struct dmi_system_id *dmi_id;
390405
struct device *dev = &pdev->dev;
391406
int ret_val = 0;
392407
struct cht_mc_private *drv;
408+
const char *mclk_name;
409+
int quirks = 0;
410+
411+
dmi_id = dmi_first_match(cht_max98090_quirk_table);
412+
if (dmi_id)
413+
quirks = (unsigned long)dmi_id->driver_data;
393414

394415
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
395416
if (!drv)
@@ -411,11 +432,16 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
411432
snd_soc_card_cht.dev = &pdev->dev;
412433
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
413434

414-
drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
435+
if (quirks & QUIRK_PMC_PLT_CLK_0)
436+
mclk_name = "pmc_plt_clk_0";
437+
else
438+
mclk_name = "pmc_plt_clk_3";
439+
440+
drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
415441
if (IS_ERR(drv->mclk)) {
416442
dev_err(&pdev->dev,
417-
"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
418-
PTR_ERR(drv->mclk));
443+
"Failed to get MCLK from %s: %ld\n",
444+
mclk_name, PTR_ERR(drv->mclk));
419445
return PTR_ERR(drv->mclk);
420446
}
421447

0 commit comments

Comments
 (0)