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 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 623E7C4CECE for ; Thu, 17 Oct 2019 08:07:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DDB95214E0 for ; Thu, 17 Oct 2019 08:07:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="cY2nr7t7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDB95214E0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 C87E7850; Thu, 17 Oct 2019 10:06:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C87E7850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571299622; bh=VmI3qGpOFGmWvmhBWoWnonI8exBgXN3NEuIYK8D9rZw=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cY2nr7t7nTMZlTV189E+MRNwtXrPf0+TxZpj+mOL9iGpK/DtvE0e2qUmxNvb7UwEQ TlLHm22lrAHYNlr/QeXm0SVSVfq2Z10XsV3/woWytTf/R0a2NXpgLycAJLHSXU3/J5 zJHek5UIirSattUDqX/GSpfns/WkS/3qKaTLNisU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2955FF804A9; Thu, 17 Oct 2019 10:06:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5FEB2F804AA; Thu, 17 Oct 2019 10:06:10 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A774BF80276 for ; Thu, 17 Oct 2019 10:06:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A774BF80276 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7E9E5AFF2; Thu, 17 Oct 2019 08:06:06 +0000 (UTC) Date: Thu, 17 Oct 2019 10:06:06 +0200 Message-ID: From: Takashi Iwai To: Kai Vehmanen In-Reply-To: <20191011112745.25800-4-kai.vehmanen@linux.intel.com> References: <20191011112745.25800-1-kai.vehmanen@linux.intel.com> <20191011112745.25800-4-kai.vehmanen@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: libin.yang@intel.com, alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com Subject: Re: [alsa-devel] [PATCH v6 3/9] ASoC: Intel: skl-hda-dsp-generic: use snd-hda-codec-hdmi 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, 11 Oct 2019 13:27:39 +0200, Kai Vehmanen wrote: > > diff --git a/sound/soc/intel/boards/hda_dsp_common.h b/sound/soc/intel/boards/hda_dsp_common.h > new file mode 100644 > index 000000000000..a4f7ae81bcc0 > --- /dev/null > +++ b/sound/soc/intel/boards/hda_dsp_common.h > @@ -0,0 +1,97 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright(c) 2019 Intel Corporation. > + */ > + > +/* > + * This file defines helper functions used by multiple > + * Intel HDA based machine drivers. > + */ > + > +#ifndef __HDA_DSP_COMMON_H > +#define __HDA_DSP_COMMON_H > + > +#include > +#include > +#include "../../codecs/hdac_hda.h" > + > +/* > + * Search card topology and return PCM device number > + * matching Nth HDMI device (zero-based index). > + */ > +static inline struct snd_pcm *hda_dsp_hdmi_pcm_handle(struct snd_soc_card *card, > + int hdmi_idx) > +{ > + struct snd_soc_pcm_runtime *rtd; > + struct snd_pcm *spcm; > + int i = 0; > + > + for_each_card_rtds(card, rtd) { > + spcm = rtd->pcm ? > + rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].pcm : 0; > + if (spcm && strstr(spcm->id, "HDMI")) { > + if (i == hdmi_idx) > + return rtd->pcm; > + ++i; > + } > + } > + > + return 0; > +} > + > +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) > +/* > + * Search card topology and register HDMI PCM related controls > + * to codec driver. > + */ > +static inline int hda_dsp_hdmi_build_controls(struct snd_soc_card *card, > + struct snd_soc_component *comp) > +{ > + struct hdac_hda_priv *hda_pvt; > + struct hda_codec *hcodec; > + struct snd_pcm *spcm; > + struct hda_pcm *hpcm; > + int err = 0, i = 0; > + > + if (!comp) > + return -EINVAL; > + > + hda_pvt = snd_soc_component_get_drvdata(comp); > + hcodec = &hda_pvt->codec; > + > + list_for_each_entry(hpcm, &hcodec->pcm_list_head, list) { > + spcm = hda_dsp_hdmi_pcm_handle(card, i); > + if (spcm) { > + hpcm->pcm = spcm; > + hpcm->device = spcm->device; > + dev_dbg(card->dev, > + "%s: mapping HDMI converter %d to PCM %d (%p)\n", > + __func__, i, hpcm->device, spcm); > + } else { > + hpcm->pcm = 0; > + hpcm->device = SNDRV_PCM_INVALID_DEVICE; > + dev_warn(card->dev, > + "%s: no PCM in topology for HDMI converter %d\n\n", > + __func__, i); > + } > + i++; > + } > + snd_hdac_display_power(hcodec->core.bus, > + HDA_CODEC_IDX_CONTROLLER, true); > + err = snd_hda_codec_build_controls(hcodec); > + if (err < 0) > + dev_err(card->dev, "unable to create controls %d\n", err); > + snd_hdac_display_power(hcodec->core.bus, > + HDA_CODEC_IDX_CONTROLLER, false); > + > + return err; > +} > +#else These additions look a bit too large for inline functions. Wouldn't it be difficult to make them non-inline? thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel