From patchwork Wed Jan 6 05:05:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-Hsuan Hsu X-Patchwork-Id: 12000991 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=-16.8 required=3.0 tests=BAYES_00,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 49D3BC433DB for ; Wed, 6 Jan 2021 05:07:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 A2DD622CAF for ; Wed, 6 Jan 2021 05:07:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2DD622CAF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 5439686F; Wed, 6 Jan 2021 06:06:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5439686F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1609909634; bh=qq8btwwNVAS26MkIndQR7HvnBqko/OuI+G6k1r3Oqqw=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=h88vv5g2Oo4cgUaRJfInnDR7RyMrR76Nf382nHsyAy47hEpTcjW+j9T/gdrxA/Bbu vKqxjsUKt+YRfBcnnVD707c6a0Rrcv51PCLOSMyMpckf8juo1UYNA00vpsp9EGJN7v l0oRbeimi64E6GAf5gJd1yk84rv6/mxyvFOw+byM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C9B88F80165; Wed, 6 Jan 2021 06:06:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C5E85F80166; Wed, 6 Jan 2021 06:06:20 +0100 (CET) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 8917EF800DD for ; Wed, 6 Jan 2021 06:06:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8917EF800DD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="n6ErXUBc" Received: by mail-pl1-x632.google.com with SMTP id x18so964895pln.6 for ; Tue, 05 Jan 2021 21:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a+jp8aijiy58DxcPOl4wMV4A6IsbTlkbWpcRF+h39no=; b=n6ErXUBc9DzTkG9itHjGJ+eQztJ4nFXJ0bEjylysEqFfyomIYNiuZEeopa9+2QrQFb dgXajEXrK3vArf7eJM0inY9jm4f6O+quKZZWNf8KY7Mu4te/M+crpoedpBfQjeo0sn2j W7DWx2Msdwgc239HhH7U79VtA9+bjoAJG+nBk= 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:mime-version :content-transfer-encoding; bh=a+jp8aijiy58DxcPOl4wMV4A6IsbTlkbWpcRF+h39no=; b=Tncy9FxtQVCYFcUrE4Pc1ERT2z/Zr+8VJD6kmZvI2gaJgBrQYET6lBlGFdp17R4fhP jzPmQlTauBlpgXcIRpqnU4rUxgll0v1bFcwutr5+ZsWMgG2zZKncZtuwYIxFgIpyFLdv VAc6PB/J/Q5e0abS0AVE6SENLzXehkqdITYI1ygg6Pm0pF8REfngvKCRzgv9XQvamLw+ 2sgcjuoEfn778nMw7X/7Xmcfg1EZQC3xeS+iANvrqNsOeWy0IXEBzpSeGtWIyrnaoYgw TW3mLyqOGG3r0oFvoKAuo6O43AlkLXHLewYU4G56JgPUWebP5Dns8MfACAzXVBNuEFWz Rvag== X-Gm-Message-State: AOAM533M9ZyWlVG0n3+NWHSzdOtUzbwJYTBMFIp7LjB//saL24uM10PF mLDXEbclFg4QCoDKmYFcfbs6zQ== X-Google-Smtp-Source: ABdhPJyCbhXlMX97B3jAUFrMxSj9rBddxh5FIX/r5Xx2XIEuyf28wNRiNg+HEbpL3MWu6IcVctaf8w== X-Received: by 2002:a17:90b:1983:: with SMTP id mv3mr2580134pjb.211.1609909567741; Tue, 05 Jan 2021 21:06:07 -0800 (PST) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id h16sm931002pgd.62.2021.01.05.21.06.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Jan 2021 21:06:07 -0800 (PST) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: cros_ec_codec: Reset I2S RX when probing Date: Wed, 6 Jan 2021 13:05:59 +0800 Message-Id: <20210106050559.1459027-1-yuhsuan@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, "Gustavo A . R . Silva" , Takashi Iwai , Liam Girdwood , Guenter Roeck , Mark Brown , Prashant Malani , Pi-Hsun Shih , Enric Balletbo i Serra , Benson Leung , Yu-Hsuan Hsu , Cheng-Yi Chiang 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" It is not guaranteed that I2S RX is disabled when the kernel booting. For example, if the kernel crashes while it is enabled, it will keep enabled until the next time EC reboots. Reset I2S RX when probing to fix this issue. Signed-off-by: Yu-Hsuan Hsu --- include/linux/platform_data/cros_ec_commands.h | 1 + sound/soc/codecs/cros_ec_codec.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index 86376779ab31..95889ada83a3 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -4600,6 +4600,7 @@ enum ec_codec_i2s_rx_subcmd { EC_CODEC_I2S_RX_SET_SAMPLE_DEPTH = 0x2, EC_CODEC_I2S_RX_SET_DAIFMT = 0x3, EC_CODEC_I2S_RX_SET_BCLK = 0x4, + EC_CODEC_I2S_RX_RESET = 0x5, EC_CODEC_I2S_RX_SUBCMD_COUNT, }; diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index f33a2a9654e7..28b3e2c48c86 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -1011,6 +1011,13 @@ static int cros_ec_codec_platform_probe(struct platform_device *pdev) } priv->ec_capabilities = r.capabilities; + /* Reset EC codec i2s rx. */ + p.cmd = EC_CODEC_I2S_RX_RESET; + ret = send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC_I2S_RX, + (uint8_t *)&p, sizeof(p), NULL, 0); + if (ret) + dev_warn(dev, "failed to EC_CODEC_I2S_RESET: %d\n", ret); + platform_set_drvdata(pdev, priv); ret = devm_snd_soc_register_component(dev, &i2s_rx_component_driver,