From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham 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 17F56C433E0 for ; Wed, 8 Jul 2020 10:16:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D38DD20739 for ; Wed, 8 Jul 2020 10:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728358AbgGHKQb (ORCPT ); Wed, 8 Jul 2020 06:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728148AbgGHKQa (ORCPT ); Wed, 8 Jul 2020 06:16:30 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFA7C08C5DC for ; Wed, 8 Jul 2020 03:16:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 64CF92A074F Subject: Re: [PATCH] ASoC: cros_ec_codec: Reset I2S RX when probing To: Yu-Hsuan Hsu , linux-kernel@vger.kernel.org Cc: Benson Leung , Guenter Roeck , Cheng-Yi Chiang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Tzung-Bi Shih , Gwendal Grignou , Lee Jones , Yicheng Li , alsa-devel@alsa-project.org References: <20200708071117.3070707-1-yuhsuan@chromium.org> From: Enric Balletbo i Serra Message-ID: Date: Wed, 8 Jul 2020 12:16:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200708071117.3070707-1-yuhsuan@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yu-Hsuan, Thank you for your patch. On 8/7/20 9:11, Yu-Hsuan Hsu wrote: > 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, Is this a new command not available in the firmware that is already in the field? > 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); > + With an old firmware I suspect this message will appear on every boot, right? So, to solve the issue and get rid of this error you're forced to upgrade the firmware. Is that true? > platform_set_drvdata(pdev, priv); > > ret = devm_snd_soc_register_component(dev, &i2s_rx_component_driver, >