From patchwork Wed Jul 8 07:11:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-Hsuan Hsu X-Patchwork-Id: 11650847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F327B739 for ; Wed, 8 Jul 2020 07:12:33 +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 EAAC3206DF for ; Wed, 8 Jul 2020 07:12:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rgCgcOSR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MFfhw4Ca" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAAC3206DF 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 BE72015E5; Wed, 8 Jul 2020 09:11:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE72015E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1594192350; bh=0xhIDkxi2urpYLrfJ27GRGtoflGby4z2+mUU8u2mMrQ=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=rgCgcOSRXGLjaSsI13n1LCEEbnW+82JAesChdbU3jEYwsGyEfkDh5qPVrIq4WaUkR 99+URoAGiZBLThba+dxLhbdwy0ieDJkBoLhcmCFxVL5zFH/SC0+CN3ZGYtvCCe5FBV OcPKorvMQl4LLTPQDT1Z9Ndm+35Dr4sCLG8P7h2U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 499A6F80150; Wed, 8 Jul 2020 09:11:43 +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 C7497F8015A; Wed, 8 Jul 2020 09:11:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 75240F800AE for ; Wed, 8 Jul 2020 09:11:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 75240F800AE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MFfhw4Ca" Received: by mail-pg1-x543.google.com with SMTP id z5so21225183pgb.6 for ; Wed, 08 Jul 2020 00:11:30 -0700 (PDT) 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=+a5Yprqxr4YrC8ddRW3zptpr1c8vgN9ZuXvWQPKlFVg=; b=MFfhw4CakjJVB9f0UmWu8pC0qAsbx035oeNJnZ8AZNdtg7Ji/ZCHbJVR3yXwhItAPs F0QRtUCO6DB/ikQWHkEDO36hf7A63FNsqRaDtQPm3wBHQpkrORRfGYteBm9LFZNjOtFN IT+sXoF6yYRCFgT+8Y9qMWQMJ4r1ku5nRbo+c= 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=+a5Yprqxr4YrC8ddRW3zptpr1c8vgN9ZuXvWQPKlFVg=; b=sx8f7O178A80V70JDdTJfhOtkeYyMCO0s8UGrFACPmMX2XnrA0yzS1SdzN5cpyzVtd 5ZGWqyZr7KcD6LMM6QxTGj79kIO554MCqN9FM5wKwX5igpJo6QCVpvWj0ceMerazpd8t wR1RR4u82cQPryIOt8KOJCT9sbmBYHUxMrZDhK+ChJa6GBjZ8QozsRIilQ24B/syg8ub OSa3JYag5NsDQ9U3ILMybfWwsn2Gx3cFBX27mTnXneurYsuhdANuNW7NuCGGzv0m/6dR ritacm0M7aLXGlwHXfmLzkaLWE9S+jxukUoIupksbuQLUXtBElZxIcGR7drQ0vo6z2YT MXGQ== X-Gm-Message-State: AOAM532aO3bCpVqrsf7hIFnNtoTAoGKbNCYGGuQI17INqe2gl/ZDepO8 AhH7iGQbyMRNk2el8j2u28318A== X-Google-Smtp-Source: ABdhPJxPe+FrQXu/yLvuqwBRWqt2yTo1MAuvXoVYQVlzKsLdn7kZhMgTOxEwJgHQeWcJeGRJFQd3jg== X-Received: by 2002:aa7:9abc:: with SMTP id x28mr27241417pfi.145.1594192287030; Wed, 08 Jul 2020 00:11:27 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id q13sm4694320pjc.21.2020.07.08.00.11.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jul 2020 00:11:25 -0700 (PDT) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: cros_ec_codec: Reset I2S RX when probing Date: Wed, 8 Jul 2020 15:11:17 +0800 Message-Id: <20200708071117.3070707-1-yuhsuan@chromium.org> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog MIME-Version: 1.0 Cc: Gwendal Grignou , alsa-devel@alsa-project.org, Tzung-Bi Shih , Lee Jones , Takashi Iwai , Liam Girdwood , Guenter Roeck , Yicheng Li , Mark Brown , 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 69210881ebac8..11ce917ca924c 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -4598,6 +4598,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 8d45c628e988e..5495214e73e68 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -1034,6 +1034,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_err(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,