From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C950EC433EF for ; Wed, 9 Mar 2022 17:29:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 07D7017F1; Wed, 9 Mar 2022 18:28:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 07D7017F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646846943; bh=UjnLfQPqw3UUYGqeNSpb4WueN3QxQhXX6nN/Soeq+PM=; h=Date:Subject:To:References:From:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZxX5flNFXtOHTirPT7xtG/mOMpFszMd+i9rnlUw2hJUJNqdJUJiczj0U/yabRwRYE eKMyNwKP3C0WRByjcNkm/XmzcYqGxtUvAvNvrQ3RHVjJ5cu+acCyLdrgVSEaZJrL5B 81A9cnEe0S9bgpP9GjZhBwJkv7xQM/TlyuEyFFSg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6C3F8F8028D; Wed, 9 Mar 2022 18:27:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EA583F804AB; Wed, 9 Mar 2022 18:27:21 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B0B19F80158 for ; Wed, 9 Mar 2022 18:27:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0B19F80158 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SjvMqCo9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646846839; x=1678382839; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=UjnLfQPqw3UUYGqeNSpb4WueN3QxQhXX6nN/Soeq+PM=; b=SjvMqCo95M/xsyWuMv87tb6Po//YCPCdYH0PwzauEiEs6X2+A0yt7M+p v5YcyBJaM2EnAM2NUeGDZyqUXU1RsJzOCBGxt6s/VqKg8TJ2LMAYLbZjr WAFUqNc/SlLuuspMbANeIZUaQB5lJujPCJ0s4cKIrnG87kpBfIqUt06xe U2i2BLt/Ym1LDqAIupAuHxBte6YEoay4zwcPABNbMVNo3ZhI0yloKlAXX rrPKwLjDlOHOa3LtPnh5g6kWeBZH8KR71z/qCjhob/WUOowMXdNmlwF3E X0adys6iEdzr9aCzuG3toHpqwAzDDp1dgCmR3mTffDu7LLxyAHhHwYhpy g==; X-IronPort-AV: E=McAfee;i="6200,9189,10281"; a="242484153" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="242484153" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 09:27:14 -0800 X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554214584" Received: from thihoan5-mobl.amr.corp.intel.com (HELO [10.209.14.48]) ([10.209.14.48]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 09:27:13 -0800 Message-ID: Date: Wed, 9 Mar 2022 11:24:58 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.5.0 Subject: Re: [PATCH 04/20] ALSA: intel-nhlt: add helper to detect SSP link mask Content-Language: en-US To: Cezary Rojewski , alsa-devel@alsa-project.org References: <20220308192610.392950-1-pierre-louis.bossart@linux.intel.com> <20220308192610.392950-5-pierre-louis.bossart@linux.intel.com> From: Pierre-Louis Bossart In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Huajun Li , tiwai@suse.de, =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= , Nikolai Kostrigin , broonie@kernel.org, Mauro Carvalho Chehab , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" >> 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.