diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-10-21 23:15:29 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-10-24 18:03:12 +0100 |
commit | 109cb2160128211ca7b17bad79cb0441f1440bc9 (patch) | |
tree | 28397ccac6bf79ba242668533c5da70c75054b7a /sound | |
parent | 2cb54788393134d8174ee594002baae3ce52c61e (diff) | |
download | lwn-109cb2160128211ca7b17bad79cb0441f1440bc9.tar.gz lwn-109cb2160128211ca7b17bad79cb0441f1440bc9.zip |
ASoC: Intel: bytcr_wm5102: Add support for Lenovo Yoga Tab 3 Pro YT3-X90
The Lenovo Yoga Tab 3 Pro YT3-X90 x86 tablet, which ships with Android
with a custom kernel as factory OS, does not list the used WM5102 codec
inside its DSDT.
So acpi_dev_get_first_match_dev() is going to fail on this board.
Fallback to using "spi-$(mach->id)" as codec device name in this case
to allow bytcr_wm5102 to work on these tablets.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231021211534.114991-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/intel/boards/bytcr_wm5102.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c index 643f1d0094c4..fd7d5fdfd3fd 100644 --- a/sound/soc/intel/boards/bytcr_wm5102.c +++ b/sound/soc/intel/boards/bytcr_wm5102.c @@ -413,14 +413,15 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) */ mach = dev->platform_data; adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1); - if (!adev) { - dev_err(dev, "Error cannot find acpi-dev for codec\n"); - return -ENOENT; + if (adev) { + snprintf(codec_name, sizeof(codec_name), "spi-%s", acpi_dev_name(adev)); + acpi_dev_put(adev); + } else { + /* Special case for when the codec is missing from the DSTD */ + strscpy(codec_name, "spi1.0", sizeof(codec_name)); } - snprintf(codec_name, sizeof(codec_name), "spi-%s", acpi_dev_name(adev)); codec_dev = bus_find_device_by_name(&spi_bus_type, NULL, codec_name); - acpi_dev_put(adev); if (!codec_dev) return -EPROBE_DEFER; |