sm6250-common: amplifier: 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 Onelots
parent 13c252199f
commit 9be4c94274
2 changed files with 9 additions and 1 deletions

View File

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

View File

@@ -54,6 +54,7 @@ typedef struct tas2562_amp {
tas2562_profile_t profile;
struct audio_device* adev;
struct pcm* pcm;
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;
@@ -294,9 +295,15 @@ static int tas2562_module_open(const hw_module_t* module, const char* name, hw_d
tas2562->profile = PROFILE_MUSIC;
if (hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID, AUDIO_HARDWARE_MODULE_ID_PRIMARY,
&tas2562->module_ahal)) {
ALOGW("%s: Failed to load audio.primary", __func__);
return -ENODEV;
}
#define LOAD_AHAL_SYMBOL(symbol) \
do { \
tas2562->symbol = dlsym(RTLD_NEXT, #symbol); \
tas2562->symbol = dlsym(tas2562->module_ahal->dso, #symbol); \
if (tas2562->symbol == NULL) { \
ALOGW("%s: %s not found (%s)", __func__, #symbol, dlerror()); \
free(tas2562); \