From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>,
Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
cezary.rojewski@intel.com, liam.r.girdwood@linux.intel.com,
peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.dev,
alban.boye@protonmail.com, u.kleine-koenig@baylibre.com,
tomlohave@gmail.com, linux-sound@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 03/14] ASoC: Intel: bytcr_rt5640: Add support for non ACPI instantiated codec
Date: Mon, 4 Nov 2024 05:51:55 -0500 [thread overview]
Message-ID: <20241104105228.97053-3-sashal@kernel.org> (raw)
In-Reply-To: <20241104105228.97053-1-sashal@kernel.org>
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit d48696b915527b5bcdd207a299aec03fb037eb17 ]
On some x86 Bay Trail tablets which shipped with Android as factory OS,
the DSDT is so broken that the codec needs to be manually instantatiated
by the special x86-android-tablets.ko "fixup" driver for cases like this.
This means that the codec-dev cannot be retrieved through its ACPI fwnode,
add support to the bytcr_rt5640 machine driver for such manually
instantiated rt5640 i2c_clients.
An example of a tablet which needs this is the Vexia EDU ATLA 10 tablet,
which has been distributed to schools in the Spanish Andalucía region.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patch.msgid.link/20241024211615.79518-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/intel/boards/bytcr_rt5640.c | 33 ++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 5b8b21ade9cfe..79c50498144ec 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -17,6 +17,7 @@
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/device.h>
+#include <linux/device/bus.h>
#include <linux/dmi.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
@@ -32,6 +33,8 @@
#include "../atom/sst-atom-controls.h"
#include "../common/soc-intel-quirks.h"
+#define BYT_RT5640_FALLBACK_CODEC_DEV_NAME "i2c-rt5640"
+
enum {
BYT_RT5640_DMIC1_MAP,
BYT_RT5640_DMIC2_MAP,
@@ -1697,9 +1700,33 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
- if (!codec_dev)
- return -EPROBE_DEFER;
- priv->codec_dev = get_device(codec_dev);
+
+ if (codec_dev) {
+ priv->codec_dev = get_device(codec_dev);
+ } else {
+ /*
+ * Special case for Android tablets where the codec i2c_client
+ * has been manually instantiated by x86_android_tablets.ko due
+ * to a broken DSDT.
+ */
+ codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
+ BYT_RT5640_FALLBACK_CODEC_DEV_NAME);
+ if (!codec_dev)
+ return -EPROBE_DEFER;
+
+ if (!i2c_verify_client(codec_dev)) {
+ dev_err(dev, "Error '%s' is not an i2c_client\n",
+ BYT_RT5640_FALLBACK_CODEC_DEV_NAME);
+ put_device(codec_dev);
+ }
+
+ /* fixup codec name */
+ strscpy(byt_rt5640_codec_name, BYT_RT5640_FALLBACK_CODEC_DEV_NAME,
+ sizeof(byt_rt5640_codec_name));
+
+ /* bus_find_device() returns a reference no need to get() */
+ priv->codec_dev = codec_dev;
+ }
/*
* swap SSP0 if bytcr is detected
--
2.43.0
next prev parent reply other threads:[~2024-11-04 10:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 10:51 [PATCH AUTOSEL 6.6 01/14] wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings Sasha Levin
2024-11-04 10:51 ` [PATCH AUTOSEL 6.6 02/14] ASoC: codecs: rt5640: Always disable IRQs from rt5640_cancel_work() Sasha Levin
2024-11-04 10:51 ` Sasha Levin [this message]
2024-11-04 10:51 ` [PATCH AUTOSEL 6.6 04/14] ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet Sasha Levin
2024-11-04 10:51 ` [PATCH AUTOSEL 6.6 05/14] ASoC: Intel: sst: Support LPE0F28 ACPI HID Sasha Levin
2024-11-04 10:51 ` [PATCH AUTOSEL 6.6 06/14] wifi: iwlwifi: mvm: Use the sync timepoint API in suspend Sasha Levin
2024-11-04 10:51 ` [PATCH AUTOSEL 6.6 07/14] mac80211: fix user-power when emulating chanctx Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 08/14] usb: add support for new USB device ID 0x17EF:0x3098 for the r8152 driver Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 09/14] usb: typec: use cleanup facility for 'altmodes_node' Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 10/14] selftests/watchdog-test: Fix system accidentally reset after watchdog-test Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 11/14] ALSA: hda/realtek: Add subwoofer quirk for Infinix ZERO BOOK 13 Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 12/14] x86/amd_nb: Fix compile-testing without CONFIG_AMD_NB Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 13/14] bpf: fix filed access without lock Sasha Levin
2024-11-04 10:52 ` [PATCH AUTOSEL 6.6 14/14] net: usb: qmi_wwan: add Quectel RG650V Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241104105228.97053-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alban.boye@protonmail.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=hdegoede@redhat.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=tomlohave@gmail.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).