raphael: tfa98xx: Use hw_module_t->dso instead of RTLD_NEXT

W audio_amplifier: amp_module_open: enable_snd_device not found (undefined symbol: enable_snd_device)
E audio_hw_primary: Amplifier initialization failed

Change-Id: If313889c4749c589d0682982f1d804e4069ffff9
This commit is contained in:
LuK1337
2025-02-22 20:35:38 +01:00
committed by Joey
parent bd0b1b7941
commit a25679d72a
2 changed files with 9 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ cc_library_shared {
shared_libs: [
"libdl",
"libhardware",
"liblog",
"libtinyalsa",
],

View File

@@ -41,6 +41,7 @@ typedef struct amp_device {
struct audio_device* adev;
struct audio_usecase* usecase_tx;
struct pcm* tfa98xx_out;
const struct hw_module_t* module_ahal;
typeof(enable_snd_device)* enable_snd_device;
typeof(enable_audio_route)* enable_audio_route;
typeof(disable_snd_device)* disable_snd_device;
@@ -166,9 +167,15 @@ static int amp_module_open(const hw_module_t* module, const char* name, hw_devic
tfa_dev->amp_dev.set_feedback = amp_set_feedback;
if (hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID, AUDIO_HARDWARE_MODULE_ID_PRIMARY,
&tfa_dev->module_ahal)) {
ALOGW("%s: Failed to load audio.primary", __func__);
return -ENODEV;
}
#define LOAD_AHAL_SYMBOL(symbol) \
do { \
tfa_dev->symbol = dlsym(RTLD_NEXT, #symbol); \
tfa_dev->symbol = dlsym(tfa_dev->module_ahal->dso, #symbol); \
if (tfa_dev->symbol == NULL) { \
ALOGW("%s: %s not found (%s)", __func__, #symbol, dlerror()); \
free(tfa_dev); \