From patchwork Mon Apr 8 10:47:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 10889281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D205C139A for ; Mon, 8 Apr 2019 10:48:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2D04285E1 for ; Mon, 8 Apr 2019 10:48:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A59F928630; Mon, 8 Apr 2019 10:48:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B5B1285E1 for ; Mon, 8 Apr 2019 10:48:40 +0000 (UTC) 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 86B179EB; Mon, 8 Apr 2019 12:47:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 86B179EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1554720518; bh=mToTUsbsd9KKBSN05Z9rGzAZWYqI8DGkDMizlu7fK+E=; h=Date:From:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=tzuEvqeavQzvybz07JfPDSi+LiE5wEjtyWmJtHsi8oAUpAgATsiaoiOaorovHqYhn paP5BsXvMCuyEY7w5nceBssxrGLOKHp/u+41Hd3ShwmS/nSvtMQmiW37dD6JwGRd8P AMraSLr81d+GvCXyB7v4BkT2F7wW/auuM64F+SNs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DE745F89618; Mon, 8 Apr 2019 12:47:47 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D055F896DD; Mon, 8 Apr 2019 12:47:46 +0200 (CEST) Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 92801F8076C for ; Mon, 8 Apr 2019 12:47:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 92801F8076C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="q615Ysmy" Received: by mail-qk1-x749.google.com with SMTP id d131so11175074qkc.18 for ; Mon, 08 Apr 2019 03:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=+2C9AqnwEcRwceF0WLRqL/MERR0j6x6Fqc3qJ2lc/F0=; b=q615YsmyfCUIZvQvwBWkRdVqzkFb4wEzxuDHrVr77Lo3vORuFue+aC67O1QJ1QyomR TEv04wSTExmjlvPZCWXD2Z3uZ2qMrPN0UH6Q5KbsOvE/IWgNIur8o7HoAL6p+rdihsAc lhG4uzpcmavnhD5ojjm06Qz7fxBU0bDWldC/OPOsnS7WMQFT5vn1C6db8PxkxuO9nlgs gEUXQHBmgBc6nF0tjky/OOfHDhKoopeyWM+frCHpoFMLX4FJd3NTpsXTeX6jxwK10lop iZ5o5EtS6SW2PiIkaMK9pAAYiveyhPEQQ/GG+OOZd1fWRh+eJ2ff6tCE0DF8YyUpRA4q uQJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=+2C9AqnwEcRwceF0WLRqL/MERR0j6x6Fqc3qJ2lc/F0=; b=cMT/mKveghXojCAOFNMsmYM/j7Dd1vhQxhmVJNxeJwg/6W6/RPACMU3xYWQv21eD7a vz+kAq3sDMqI5jVYdglnpyd9iUC8a44mDyeaAaX6AYWRDFWr8EKXuSgvw3HN2jnR8JcU yLPM+WbrhjUlHLgg2GS4ZqxQpWV2gkHud7mBJ82GD3ezddsWPyOrvd8iJk+odfY++BDO xoIR+AK5M9+r8JTgjrMIDeZjdypJJoEEq8FQKX66L3Udp4vZZfmsXDwegpRAeOgu5try eoyNrT8jHk+rka+Rq6gBx/W2ECchd96UNd3RQVsxYrfL+KL1iCueD6xyra4Mi2PMZX3d dhmQ== X-Gm-Message-State: APjAAAV12rV1mxhI04F8Z5LQfMhbkQoTFfCjzurXrutRQo4hdAeZTdUo gqoNF4cgEHyn0oesWtlCV9xryFPDu6jW X-Google-Smtp-Source: APXvYqyNVRGr47QrWnNHOFu6mKsjOutDQYxmbjSisAtKDAWZwcU+uu2SwmAKn7ZEOY1aUx1mkpOOvlqCZqMc X-Received: by 2002:a37:6d82:: with SMTP id i124mr3165972qkc.22.1554720461546; Mon, 08 Apr 2019 03:47:41 -0700 (PDT) Date: Mon, 8 Apr 2019 18:47:28 +0800 Message-Id: <20190408104728.57351-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog From: Tzung-Bi Shih To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, cychiang@google.com, jiaxin.yu@mediatek.com, tzungbi@google.com, shunli.wang@mediatek.com, dgreid@google.com Subject: [alsa-devel] [PATCH] ASoC: Mediatek: MT8183: change supported formats of DL2 and UL1 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP DL2 and UL1 are for BTSCO. They should only provide 16-bit, mono, 8kHz and 16kHz to userspace. Change the formats accordingly. Signed-off-by: Tzung-Bi Shih --- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 681bedb524f9..4e44e5689d6f 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -69,6 +69,46 @@ mt8183_mt6358_ts3a227_max98357_dapm_routes[] = { {"IT6505_8CH", NULL, "TDM"}, }; +static int +mt8183_mt6358_ts3a227_max98357_bt_sco_startup( + struct snd_pcm_substream *substream) +{ + static const unsigned int rates[] = { + 8000, 16000 + }; + static const struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, + }; + static const unsigned int channels[] = { + 1, + }; + static const struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, + }; + + struct snd_pcm_runtime *runtime = substream->runtime; + + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + runtime->hw.channels_max = 1; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); + + return 0; +} + +static const struct snd_soc_ops mt8183_mt6358_ts3a227_max98357_bt_sco_ops = { + .startup = mt8183_mt6358_ts3a227_max98357_bt_sco_startup, +}; + static struct snd_soc_dai_link mt8183_mt6358_ts3a227_max98357_dai_links[] = { /* FE */ @@ -93,6 +133,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_playback = 1, + .ops = &mt8183_mt6358_ts3a227_max98357_bt_sco_ops, }, { .name = "Playback_3", @@ -115,6 +156,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_capture = 1, + .ops = &mt8183_mt6358_ts3a227_max98357_bt_sco_ops, }, { .name = "Capture_2",