[PATCH 04/20] ALSA: intel-nhlt: add helper to detect SSP link mask

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Wed Mar 9 18:24:58 CET 2022


>> diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c
>> index 128476aa7c61..4063da378283 100644
>> --- a/sound/hda/intel-nhlt.c
>> +++ b/sound/hda/intel-nhlt.c
>> @@ -130,6 +130,28 @@ bool intel_nhlt_has_endpoint_type(struct 
>> nhlt_acpi_table *nhlt, u8 link_type)
>>   }
>>   EXPORT_SYMBOL(intel_nhlt_has_endpoint_type);
>> +int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 
>> device_type)
>> +{
>> +    struct nhlt_endpoint *epnt;
>> +    int ssp_mask = 0;
>> +    int i;
>> +
>> +    if (!nhlt || (device_type != NHLT_DEVICE_BT && device_type != 
>> NHLT_DEVICE_I2S))
> 
> The '!nhlt' safety is superfluous in my opinion. Kernel core API e.g.: 
> device one assumes caller is sane in basically all cases.

Agree. I will remove this test in a follow-up optimization patch. the 
same pattern is used for existing dmic stuff so it's better to remove it 
in one shot.

>> +        return 0;
>> +
>> +    epnt = (struct nhlt_endpoint *)nhlt->desc;
>> +    for (i = 0; i < nhlt->endpoint_count; i++) {
>> +        if (epnt->linktype == NHLT_LINK_SSP && epnt->device_type == 
>> device_type) {
>> +            /* for SSP the virtual bus id is the SSP port */
>> +            ssp_mask |= BIT(epnt->virtual_bus_id);
>> +        }
>> +        epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
>> +    }
>> +
>> +    return ssp_mask;
>> +}
>> +EXPORT_SYMBOL(intel_nhlt_ssp_endpoint_mask);
> 
> Since this is a *public* API - not direct part of any driver, really - 
> providing kernel-doc is recommended.

there isn't a single line of kernel-doc for the entire NHLT stuff.  and 
ahem, that includes recent additions from your team ;-)

bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 
link_type);

So agree, but let's do this in a follow-up patchset. the goal of this 
patchset is to help community users that don't see an audio card 
created, not to make NHLT support super shiny.


More information about the Alsa-devel mailing list