diff --git a/include/sound/sdca.h b/include/sound/sdca.h index db2672b3aae27a..e2007277e75568 100644 --- a/include/sound/sdca.h +++ b/include/sound/sdca.h @@ -58,6 +58,7 @@ struct sdca_device_data { enum sdca_quirk { SDCA_QUIRKS_RT712_VB, SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING, + SDCA_QUIRKS_TAS2783_SMART_AMP_FUNC_TYPE, }; #if IS_ENABLED(CONFIG_SND_SOC_SDCA) diff --git a/sound/soc/sdca/sdca_device.c b/sound/soc/sdca/sdca_device.c index 3f302bfa545779..43e5e9ad7fef57 100644 --- a/sound/soc/sdca/sdca_device.c +++ b/sound/soc/sdca/sdca_device.c @@ -97,6 +97,25 @@ static bool sdca_device_quirk_skip_func_type_patching(struct sdw_slave *slave) return false; } +/* + * The HP OmniBook Ultra 14 (board 8EB4) firmware declares the Function + * Topology control (0x05) of its TI TAS2783 amplifiers with access mode 3 + * and no DisCo constant, so the function type cannot be parsed. The + * TAS2783 only implements a SmartAmp function. + */ +static bool sdca_device_quirk_tas2783_smart_amp_func_type(struct sdw_slave *slave) +{ + const char *vendor, *board; + + if (slave->id.mfg_id != 0x0102 || slave->id.part_id != 0x0000) + return false; + + vendor = dmi_get_system_info(DMI_SYS_VENDOR); + board = dmi_get_system_info(DMI_BOARD_NAME); + + return vendor && board && !strcmp(vendor, "HP") && !strcmp(board, "8EB4"); +} + bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) { switch (quirk) { @@ -104,6 +123,8 @@ bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) return sdca_device_quirk_rt712_vb(slave); case SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING: return sdca_device_quirk_skip_func_type_patching(slave); + case SDCA_QUIRKS_TAS2783_SMART_AMP_FUNC_TYPE: + return sdca_device_quirk_tas2783_smart_amp_func_type(slave); default: break; } diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index 1eb6418e132dcb..3ca96c4204ca06 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -101,6 +101,7 @@ static int find_sdca_function(struct acpi_device *adev, void *data) u32 function_type; int function_index; u64 addr; + bool has_dc_value; int i, ret; if (sdca_data->num_functions >= SDCA_MAX_FUNCTION_COUNT) { @@ -132,12 +133,18 @@ static int find_sdca_function(struct acpi_device *adev, void *data) if (!control5) return -ENODEV; + has_dc_value = fwnode_property_present(control5, + "mipi-sdca-control-dc-value"); ret = fwnode_property_read_u32(control5, "mipi-sdca-control-dc-value", &function_type); fwnode_handle_put(control5); - if (ret < 0) { + if (!has_dc_value && + sdca_device_quirk_match(slave, SDCA_QUIRKS_TAS2783_SMART_AMP_FUNC_TYPE)) { + dev_warn(dev, FW_BUG "function type not a DisCo constant, assuming SmartAmp\n"); + function_type = SDCA_FUNCTION_TYPE_SMART_AMP; + } else if (ret < 0) { dev_err(dev, "function type only supported as DisCo constant\n"); return ret; }