Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp247309ybb; Wed, 15 Apr 2020 00:14:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJ//RXdwLXGqJNeFF6M/U3iXnlzx4kT1Ip0z4p4uIrarYQLXoaDLKSufQmRUV4zRt4QyptO X-Received: by 2002:aa7:c352:: with SMTP id j18mr5943059edr.196.1586934840707; Wed, 15 Apr 2020 00:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586934840; cv=none; d=google.com; s=arc-20160816; b=k3Q3Mal1xKk/dBlwWmcjGrBh6WAfr3GHsqG3AjE8xQNl+VWwsr0EWfMJpq03w5mHQZ Whd08ylvXBltgr2hZSnbstyuJWdNOquQ0MxjZB+M7euj59vw09OY4m9V7pgmExR8Squ5 3cHmDW2qL7jMxHMz6N1Z2/VWtG8BbKWlo/1t0wz5KVsCrJ0xGWfem4TnrHTiQu4pDdPA gykOOFOimZEjfmNaEZqfAjYB4DxaMLIqkWxZO4Vq2TPKZTFjmxMUeWfPJt3dmjc7Sdj5 1JCM0tAdYfMRRl4CVn2YQ9CwQ3ta31rvvw0CqXiBKcJ9kob5f+VTolsJk+XKwbi4XCX0 As8w== 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:references :in-reply-to:message-id:date:subject:cc:to:from; bh=1Q6141cD4lWCFNr6ymrSLhyjSjYB+4+6M6LoHD5vTmQ=; b=tTpv99pyatIawnAxW3OPMPaTDfCpIez8jT5ADoVtRqA1pE9UyeN5uw40np8zI2O22q UjED6q2SZaaYnKF02sZXrDmRLs6SvxaRcf4pcF4ZsvP0qdGoDjYD2wt16xZAjeX0IrRh iWymr5qgTqBUO/t7KCaKiviiIiSYhIZ3JhOLyp37pK0KSc0eOMO4QUSaqzRG0Xc1ATN7 G6vrQ5mCTiBmA44e1Z/77NsC7654amtNQaA8ysfIFYKkEMNfI6dPpVFkRZMmRx+aowhr sD+pYT0PnS3T2jgwfl1T9iG7DMTrtTlj/TQ7IeQoYFqdZ3heagvsk2hWbt7ezc3o0xp/ 2tUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for 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 j23si10590179ejt.284.2020.04.15.00.13.36; Wed, 15 Apr 2020 00:14:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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: best guess record for 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 S2390602AbgDNAvk (ORCPT + 99 others); Mon, 13 Apr 2020 20:51:40 -0400 Received: from inva020.nxp.com ([92.121.34.13]:56616 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390576AbgDNAva (ORCPT ); Mon, 13 Apr 2020 20:51:30 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 19E561A0231; Tue, 14 Apr 2020 02:51:28 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6A76C1A024C; Tue, 14 Apr 2020 02:51:22 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5B8F1402E2; Tue, 14 Apr 2020 08:51:15 +0800 (SGT) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 3/7] ASoC: fsl-asoc-card: Support new property fsl,asrc-format Date: Tue, 14 Apr 2020 08:43:05 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: 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 In order to align with new ESARC, we add new property fsl,asrc-format. The fsl,asrc-format can replace the fsl,asrc-width, driver can accept format from devicetree, don't need to convert it to format through width. Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen --- sound/soc/fsl/fsl-asoc-card.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index bb33601fab84..cf4feb835743 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -680,17 +680,23 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; } - ret = of_property_read_u32(asrc_np, "fsl,asrc-width", &width); + ret = of_property_read_u32(asrc_np, "fsl,asrc-format", + &priv->asrc_format); if (ret) { - dev_err(&pdev->dev, "failed to get output rate\n"); - ret = -EINVAL; - goto asrc_fail; - } + /* Fallback to old binding; translate to asrc_format */ + ret = of_property_read_u32(asrc_np, "fsl,asrc-width", + &width); + if (ret) { + dev_err(&pdev->dev, + "failed to decide output format\n"); + goto asrc_fail; + } - if (width == 24) - priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; - else - priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; + if (width == 24) + priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; + else + priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; + } } /* Finish card registering */ -- 2.21.0