From patchwork Tue Dec 11 13:47:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 153462 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp635268ljp; Tue, 11 Dec 2018 05:47:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaJfF+E4nsLtDaTqPaRep4lFTMkyy8/V/3lMZJByt45Jpfz1pZozP23XqnmgdNgxiqSUAj X-Received: by 2002:a63:1848:: with SMTP id 8mr14493023pgy.81.1544536051480; Tue, 11 Dec 2018 05:47:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544536051; cv=none; d=google.com; s=arc-20160816; b=hZWgSuayRtONHrvisCE9sPj/JnfnR0xdQQ9TZ/YC2acb9rRApI+rPt/laO6ngij8Fd F6AieLDPh1MpIE8IsNFnn3URyAsnb89Cxk3XhkrEz5aj/hEE++Ae1xyKHSD6gBXURjwm RtUte337gRoxb8oJ12x8KI1Ex0UH4y2xRfaTiSOLyTGGTAXYz77Una4qP/SHLHstycgI N6KznY0zkvpnO+VDS2wML3SySj4skweu537lkO3EWmFg/xIc6e9erLbqXckI3p7lvBnM 17ef8CG4niIRel8EUJzHybV+pRRmq8zkgE4gb76va5PY5BiaMGCsWs5OnWurkkV/51AJ f44w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x8YYSFigv4RU7j7xI4uPHxbxUgrWCBqBqOSREZXXKOw=; b=DyW5iT947YH3HCvtEodlNVrjQPkoqWcBZmaUi9F5cup90dcqGTtctIvRrQYLt6LrkN Ng803eF1MYZpod4JauqvMWDlB5Y5CpVcoKiahd3Yv17x9fx9qKtu23kI8Z5kkmM6J3lm Swsnj4yvReo4othbrDQPO4rbzf03C8fhhCt1/s/12q/DGcgGX8eOQUrj4sRAsjeVCNcn Fagbn3DKuMNhLbqNfBCyARoHmV6M5Sj3gNPFqW3J32eXapVM/ofcpHkFRcbIfM+klpYe IuR88y0ZqYVRqPIIXhsiHKlyANA7IFRG8Olxpiq+S0L8wUTkGKpExpc9jEe1LmPnay8B zk0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=OXfs8+T9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y123si13237461pfy.18.2018.12.11.05.47.31; Tue, 11 Dec 2018 05:47:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=OXfs8+T9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbeLKNra (ORCPT + 31 others); Tue, 11 Dec 2018 08:47:30 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40162 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726653AbeLKNr1 (ORCPT ); Tue, 11 Dec 2018 08:47:27 -0500 Received: by mail-wm1-f68.google.com with SMTP id q26so2298233wmf.5 for ; Tue, 11 Dec 2018 05:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x8YYSFigv4RU7j7xI4uPHxbxUgrWCBqBqOSREZXXKOw=; b=OXfs8+T9xSRXfRguqjtSXuj0tn4XCU7QRhO1JWnm6xRGmRPk/aUY8trzyOiZ0Q0F7y PN4TydfL9OAqsgq7sBZupcVyRx15BGuiXi0Oc/d++nAGCwkVxK1fyp8b0ARdGqBa/wVf drLKBLygnVw+LRAJ17mTkk/KR5Kt98nDP4+8VPetqEImDdxZpX0iFQWsJscWwiMgbPUX l4YC2x8db6i72zVfviAX0PxNW/W6ukVIyhnVl9npVKOp29kKGE8F506KDe/2ndr/0U+1 VorNZsr0WpJYA+c5MBAoHZ3nQ4+0Qsk1vqumtGIfXmhRy+PXVvudkb3Xr01JsGbRTIdD 5D8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x8YYSFigv4RU7j7xI4uPHxbxUgrWCBqBqOSREZXXKOw=; b=E6UPM079X11WZbU7U3RRMtx36u80ubCY/HqsRQsEVxjrGrZkGHgjkJAX8Y6WqpWATK xAh3G11ODpZ4rp1r56aHc0XuKVXkgt/uzY3UrVZz2WuEzfpZDF81K+6DTcASefjDd5iI vUMwtmUkmwzou2w/EkpbEydrlSiR5WDg0EmIhtGTq6kwfBqkC1u1mjA/+UedbSTn/r7W wQ6ivTInTcZ7KFy75ZkxHy9UsIeSKUVC4nqWRXbFyphOgTy7eytRtGJGJ/XIMwqF2il0 H6l1+ViRezqlh3otORq1ZctLyEaHI7IiE3UoTXA0EhC47bTYfE/7nLzQ6gaRF/wwJUDV 0yeg== X-Gm-Message-State: AA+aEWaQ/1rKYIbHzsEo6QKBlAbTcMmGglt4HQ3nf1TQ2KJnglTHY/RM kdR4HgPUrqqBRTYmnJ2klIC19A== X-Received: by 2002:a7b:cb96:: with SMTP id m22mr2432266wmi.39.1544536045551; Tue, 11 Dec 2018 05:47:25 -0800 (PST) Received: from boomer.local ([2a01:e34:eeb6:4690:106b:bae3:31ed:7561]) by smtp.googlemail.com with ESMTPSA id 126sm113768wmd.1.2018.12.11.05.47.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 05:47:25 -0800 (PST) From: Jerome Brunet To: Mark Brown , Kevin Hilman , Carlo Caione Cc: Jerome Brunet , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 1/4] ASoC: meson: axg-toddr: add support for spdifin backend Date: Tue, 11 Dec 2018 14:47:10 +0100 Message-Id: <20181211134713.4908-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211134713.4908-1-jbrunet@baylibre.com> References: <20181211134713.4908-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add IEC958_SUBFRAME_LE to the list of format accepted by the fifo frontend. As opposed to what was initially noted in the toddr dai driver, the spdifin does not place the msb at bit 28, it just output a whole spdif subframe. Placing the msb at bit 28 in the toddr driver just filters out the parity, user, channel status and validity bits. It is better to just provide the whole spdif subframe to the userspace and let the iec958 plugin deal with it. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-fifo.h | 3 ++- sound/soc/meson/axg-toddr.c | 15 +++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) -- 2.19.2 diff --git a/sound/soc/meson/axg-fifo.h b/sound/soc/meson/axg-fifo.h index cb6c4013ca33..d9f516cfbeda 100644 --- a/sound/soc/meson/axg-fifo.h +++ b/sound/soc/meson/axg-fifo.h @@ -25,7 +25,8 @@ struct snd_soc_pcm_runtime; SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) + SNDRV_PCM_FMTBIT_S32_LE | \ + SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) #define AXG_FIFO_BURST 8 #define AXG_FIFO_MIN_CNT 64 diff --git a/sound/soc/meson/axg-toddr.c b/sound/soc/meson/axg-toddr.c index c2c9bb312586..0e9ca3882ae5 100644 --- a/sound/soc/meson/axg-toddr.c +++ b/sound/soc/meson/axg-toddr.c @@ -25,6 +25,8 @@ #define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3) #define CTRL0_TODDR_LSB_POS(x) ((x) << 3) +#define TODDR_MSB_POS 31 + static int axg_toddr_pcm_new(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) { @@ -36,14 +38,7 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct axg_fifo *fifo = snd_soc_dai_get_drvdata(dai); - unsigned int type, width, msb = 31; - - /* - * NOTE: - * Almost all backend will place the MSB at bit 31, except SPDIF Input - * which will put it at index 28. When adding support for the SPDIF - * Input, we'll need to find which type of backend we are connected to. - */ + unsigned int type, width; switch (params_physical_width(params)) { case 8: @@ -66,8 +61,8 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream, CTRL0_TODDR_MSB_POS_MASK | CTRL0_TODDR_LSB_POS_MASK, CTRL0_TODDR_TYPE(type) | - CTRL0_TODDR_MSB_POS(msb) | - CTRL0_TODDR_LSB_POS(msb - (width - 1))); + CTRL0_TODDR_MSB_POS(TODDR_MSB_POS) | + CTRL0_TODDR_LSB_POS(TODDR_MSB_POS - (width - 1))); return 0; }