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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 0D266C433ED for ; Fri, 7 May 2021 14:08:15 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 71EAF60720 for ; Fri, 7 May 2021 14:08:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71EAF60720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8rNUcj3ben0utBlqV92KZ8CuJootM1syRCDitP83n7k=; b=STxv51FqqmiNfm1Gw/eD27Spt iO2uAe5tn/L5T7mMcVW7KkqJJ/m9QCj6W/PUaTH84fJLuGX27llusuqOMNRgFiiwfK1xqR9jndFO3 nGFj1+WmJWcniOpVTcm/VJK46ZQuGytv1ngCxYyn8WkJTdk5WLwQrkfU+mt9Zrym3CRvWKfyj6oUY KJQQ6EBmNowwd3p2ewU8osT0v7dhVnnSH8KdegNng4JOgSwozL5gEPera/G8IfZYK5B88EfVjWxR3 fX68ACzRWZNE6r9/K0SFF4iKqcRHOYyy0cRraXOjSiWan8WJ2YoMa4/8VyEuR8IlKxmA/WyxUqrkg ab2KVBRhw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf17M-007Fgb-TK; Fri, 07 May 2021 14:06:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf169-007FUZ-Ec; Fri, 07 May 2021 14:04:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=p4zNkQ6XqSu531sqVPafbjFGIX0E1EULqXXdj3asw88=; b=KqI+lGVB32AECIMDuwoEMMi59O 45PZsE+nf0KInwxS7lFWba0IGGRLcfxTLOmcLqc3LSrJyp3dVe/uWQV6eg6vLMesGUAhWuG2O7RkJ u8pp92+oF8c9PFAZGJlgtDzu+nRij2SFAjjgrUw6Z+/4pO8n1nE3f9iTIw4N+nVViEqBb8kCJJidR 6FnNbbSVi8ERpr8avSjMZ6/C3wVb3+I1dotwetUFwhaAX66EV4MJzz1KkeCh8FMMKHEQyOJQwCPOE cNMLaZuRbNSe8DXJ/NJVy148FA6X1Apu0z9k6rYUqyow1XbJvGB4Yd/5647fktX7C8Kw0CBbOIpjA AVXVpZag==; Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf166-006uX1-Lv; Fri, 07 May 2021 14:04:56 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id A409BC82; Fri, 7 May 2021 10:04:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 07 May 2021 10:04:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=p4zNkQ6XqSu53 1sqVPafbjFGIX0E1EULqXXdj3asw88=; b=b+o1gs9kqt42h8FDXMFQBMaAq5EIY Y61zxCthjPYd0PYYRRmVFk4Y6hbhQSbyda3qcwLQ0W6UwbomliRnH3DnqesUPUox dn0v9KN5aYmE1zpMqK66JWUO8akYPvTTC58WSDoX3gMRDNhxe8kUeOEeKMusy4jr oPnYlbQ8G+JfCUFIEC+y5PldrOgBiePSU87UTJlDcW8aDzGA0oHLUPnwhC3dEWLD cLeVUiMCbKAQND18f3JGccjePbq/ONBi1C2uIlFfNycXFncEjsUgxonjV1iPXZOo zcxUmyZ0ja3I+eYItvRAKsXgIH3cErYa2XsWGfs9qSyLj3hj3u9XX4FEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=p4zNkQ6XqSu531sqVPafbjFGIX0E1EULqXXdj3asw88=; b=sfgEYNl3 KEYOaerCWT0EZO7ibWnt8UIbcFyT7qlk56JtzvjvAv8caTmTPrxq84a+oaNFQiKK 3tPXP50iyFZeerowCaIQpT8+aaGScaFWZ78sQ5cDXKAQte/lMjwV7kP/kOjxv84r nrwAiHbFNGaeSdqn/PAaSjOV2TbgDselj/+5sGMsZgFeHKWVDhzNc902tYBK9zAh K1MmlV1eCexg8rjJOtYQP3km3ppxyoa9/JIWxBl+0Z91XHOKoeUB0Qe1ojGTSKlE hN6Jy4uoBd8lSjBUIyuhN21Nvx+AFSemwDhaWYcFc9BvnxFBoignlgq5iKO97suW sgU0c2KCA0lXqw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 10:04:51 -0400 (EDT) From: Maxime Ripard To: Mark Brown , Takashi Iwai , Liam Girdwood , Jaroslav Kysela , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Nicolas Saenz Julienne , Rob Herring , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Maxime Ripard , linux-kernel@vger.kernel.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Daniel Vetter , linux-rpi-kernel@lists.infradead.org, Eric Anholt Subject: [PATCH 02/11] ASoC: hdmi-codec: Rework to support more controls Date: Fri, 7 May 2021 16:03:25 +0200 Message-Id: <20210507140334.204865-3-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507140334.204865-1-maxime@cerno.tech> References: <20210507140334.204865-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_070454_757864_915D81B1 X-CRM114-Status: GOOD ( 15.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We're going to add more controls to support the IEC958 output, so let's rework the control registration a bit to support more of them. Signed-off-by: Maxime Ripard --- sound/soc/codecs/hdmi-codec.c | 43 ++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 422539f933de..bc0d695d2df0 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -621,21 +621,23 @@ static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |\ SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) -static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, - struct snd_soc_dai *dai) -{ - struct snd_soc_dai_driver *drv = dai->driver; - struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); - struct snd_kcontrol *kctl; - struct snd_kcontrol_new hdmi_eld_ctl = { - .access = SNDRV_CTL_ELEM_ACCESS_READ | - SNDRV_CTL_ELEM_ACCESS_VOLATILE, +struct snd_kcontrol_new hdmi_codec_controls[] = { + { + .access = (SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE), .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = "ELD", .info = hdmi_eld_ctl_info, .get = hdmi_eld_ctl_get, - .device = rtd->pcm->device, - }; + }, +}; + +static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, + struct snd_soc_dai *dai) +{ + struct snd_soc_dai_driver *drv = dai->driver; + struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + unsigned int i; int ret; ret = snd_pcm_add_chmap_ctls(rtd->pcm, SNDRV_PCM_STREAM_PLAYBACK, @@ -652,12 +654,21 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, hcp->chmap_info->chmap = hdmi_codec_stereo_chmaps; hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; - /* add ELD ctl with the device number corresponding to the PCM stream */ - kctl = snd_ctl_new1(&hdmi_eld_ctl, dai->component); - if (!kctl) - return -ENOMEM; + for (i = 0; i < ARRAY_SIZE(hdmi_codec_controls); i++) { + struct snd_kcontrol *kctl; - return snd_ctl_add(rtd->card->snd_card, kctl); + /* add ELD ctl with the device number corresponding to the PCM stream */ + kctl = snd_ctl_new1(&hdmi_codec_controls[i], dai->component); + if (!kctl) + return -ENOMEM; + + kctl->id.device = rtd->pcm->device; + ret = snd_ctl_add(rtd->card->snd_card, kctl); + if (ret < 0) + return ret; + } + + return 0; } static int hdmi_dai_probe(struct snd_soc_dai *dai) -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel