Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp859854ybt; Tue, 7 Jul 2020 01:59:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpFMKZ2EKOxU4CBe0SbknxA6e3kFruhVJ2yULV8w6uuLR1AyXGRFZFFZohNH564YUl9iqP X-Received: by 2002:aa7:c353:: with SMTP id j19mr12758894edr.219.1594112385054; Tue, 07 Jul 2020 01:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594112385; cv=none; d=google.com; s=arc-20160816; b=cJDQNQOnROB6gvltX0UrHH6T6WbzvwDLyXGsziiIPVKVUup344MMs9iCApJVogxw9A aGQ+wKvu1/yHOZRIlbY5xYOLH9gmI7qz4r4nyKdrMzpTa5CZ/nVB3Cld32ZroJkxES9z vcULk374I3T2RUp1z76nXdj5rlJlT0naRm6gRzvWsMyKq+Q0YdZ9iVhOpfSzszY1s5JF cHIxNaRai4QI6I4V3XS3rssAB9Os2JLnn7jmXLC3bypSyLhXKolwM6/5PwZnN7vEtfdm wWvvwjuyBHOJZKGEE6BLuDW7CiB88PoSCUz1/3WtY1KM/zSXF3+V+M6qrcDN9VyRqvmr bFDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=BCUVDhDOT3jJsxQiTtgHx7feTnLBd8eVKHXl8TgDf2M=; b=GMIPSDX4WkMM8kZ+kuLoI36RWE21Fwx5CM5MddzN0N0SkrZiMLiwjnrg6OuApia+XO shFGElRBKR3IZB6U7bagNPVNnEcxXFxdY3hm9XFX9kIL2vMJPnzUDpt7vWlcLxpAuYf1 DWZeow8FsKVowbQq1I2PYqkF00vBP1TcUcxASRNFHqKG5tZXerU98Ss1erbzqkRw7Zij BwzDnr+bnIXjcny85CWht2oHal4v8xXwqWYFPcsamQzsWJcx3FH8ABDKFLP9caIZbILL ubjJ4mkV2VcY1wvo8SIg0qX1EnD5rEGQtQelVF1W+X1zWmpWm5qhU7s1j3HKwk3NvyBs OgnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si14499026edh.256.2020.07.07.01.59.21; Tue, 07 Jul 2020 01:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727853AbgGGI6t (ORCPT + 99 others); Tue, 7 Jul 2020 04:58:49 -0400 Received: from inva021.nxp.com ([92.121.34.21]:50506 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727072AbgGGI6s (ORCPT ); Tue, 7 Jul 2020 04:58:48 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B08D22015DF; Tue, 7 Jul 2020 10:58:46 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6068E2015EC; Tue, 7 Jul 2020 10:58:42 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C7669402F7; Tue, 7 Jul 2020 16:58:36 +0800 (SGT) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] ASoC: fsl_spdif: Add kctl for configuring TX validity bit Date: Tue, 7 Jul 2020 16:54:26 +0800 Message-Id: <1594112066-31297-3-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594112066-31297-1-git-send-email-shengjiu.wang@nxp.com> References: <1594112066-31297-1-git-send-email-shengjiu.wang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add one kctl for configuring TX validity bit from user space. The type of this kctl is boolean: on - Outgoing validity always set off - Outgoing validity always clear Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_spdif.c | 47 +++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 576370dc6e70..37053e8f29d0 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -776,8 +776,8 @@ static int fsl_spdif_vbit_info(struct snd_kcontrol *kcontrol, } /* Get valid good bit from interrupt status register */ -static int fsl_spdif_vbit_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int fsl_spdif_rx_vbit_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(cpu_dai); @@ -791,6 +791,35 @@ static int fsl_spdif_vbit_get(struct snd_kcontrol *kcontrol, return 0; } +static int fsl_spdif_tx_vbit_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); + struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(cpu_dai); + struct regmap *regmap = spdif_priv->regmap; + u32 val; + + regmap_read(regmap, REG_SPDIF_SCR, &val); + val = (val & SCR_VAL_MASK) >> SCR_VAL_OFFSET; + val = 1 - val; + ucontrol->value.integer.value[0] = val; + + return 0; +} + +static int fsl_spdif_tx_vbit_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_dai *cpu_dai = snd_kcontrol_chip(kcontrol); + struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(cpu_dai); + struct regmap *regmap = spdif_priv->regmap; + u32 val = (1 - ucontrol->value.integer.value[0]) << SCR_VAL_OFFSET; + + regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_VAL_MASK, val); + + return 0; +} + /* DPLL lock information */ static int fsl_spdif_rxrate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -948,11 +977,21 @@ static struct snd_kcontrol_new fsl_spdif_ctrls[] = { /* Valid bit error controller */ { .iface = SNDRV_CTL_ELEM_IFACE_PCM, - .name = "IEC958 V-Bit Errors", + .name = "IEC958 RX V-Bit Errors", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = fsl_spdif_vbit_info, - .get = fsl_spdif_vbit_get, + .get = fsl_spdif_rx_vbit_get, + }, + { + .iface = SNDRV_CTL_ELEM_IFACE_PCM, + .name = "IEC958 TX V-Bit", + .access = SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_WRITE | + SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .info = fsl_spdif_vbit_info, + .get = fsl_spdif_tx_vbit_get, + .put = fsl_spdif_tx_vbit_put, }, /* DPLL lock info get controller */ { -- 2.21.0