From patchwork Thu Jan 14 06:54:00 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: 362886 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 4ABC2C433DB for ; Thu, 14 Jan 2021 06:55:25 +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 ADC982395C for ; Thu, 14 Jan 2021 06:55:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADC982395C 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 4B9631678; Thu, 14 Jan 2021 07:54:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4B9631678 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610607320; bh=kKyKa2DlKb7CQrMFXJzPA3t9jQRiyLtA1AJejdEySQE=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=j0xPDswheGe5C59NlR66xtb6GQjVl7KgwuGzje2wG/P5TYoQqIOVYKvNpUW/4ETTA bblzfkpTj6JAUkFZO3rocEr6ZaVSaZQ/+dfmLaW4BeqDjNJb/o1nac7Uw5QV0oz3bZ m4lbZjdXYaJQKYoyqdLSDHDd3lbL8Pav+KfgUoCU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 88DC6F8025E; Thu, 14 Jan 2021 07:54:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8279EF8025E; Thu, 14 Jan 2021 07:54:27 +0100 (CET) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 DCF32F80113 for ; Thu, 14 Jan 2021 07:54:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCF32F80113 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GPQmUe3t" Received: by mail-pj1-x1033.google.com with SMTP id w1so4201724pjc.0 for ; Wed, 13 Jan 2021 22:54:18 -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=HYdrT8a6f0LVSrxXK4xev5Rwn6hJkcTFQFSmJHarTgc=; b=GPQmUe3tJSZOpSWj3nAIihyHt7k4kvtbsPU2joLTvlD2ckj0+FMJwIQQXmYl4Y0ApL nK5A/6/goVzYZk72RJ2l9KC1h1YLZ3G9op1AI/mHwsCm2VzGKXwkUxoSggXPNNmRP8aF diDUPjvT0etWQeNOwTAsQpnPeWgj6Xvt8PT+k= 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=HYdrT8a6f0LVSrxXK4xev5Rwn6hJkcTFQFSmJHarTgc=; b=X9SnlbCp+qWjYl/f9oeI7InbJYINm6dM7PXB/hIoVTFm1vQglt39Jdd6x0Wv2OJ136 7Gc2RbLZtV8lwv49JI6wDdgYhMi1CdLRju6HQHYoAcePpMPze2YMR3e8HkhYzT7S57ql Y+OF3YxFhb3YAYTYhb1pjWqr73RklaeXL3bhSXiCr7aLWtKGUBV2AQqExLI7BSANdprh msyF9ouh+9AMBq9tHOtLWMWrlJoCgtreJIjmAwXysO65yZqGzIEQh/TqcgKtYIk5o9hG YLuQiIx/p8ceBQYtEYPuSNUMuzdtagWeWjBQgLGhL+kZbSzWi9KihuTLeokTKVABle0L ubRg== X-Gm-Message-State: AOAM531D9IxEYX1baaZIwxWWznpBNuav4NSIcZOPqvNu6oaC+r6CTRAm 7MLk5nd5Yi0z7Ns1zE4FO2o1Dg== X-Google-Smtp-Source: ABdhPJz5JZJR4nRH4Nfg1e1npHnVc4s7TRpx/+nEC/kJ4978coxtMnAOmGwm2zmQ1iW3USJMp89o5A== X-Received: by 2002:a17:90b:31cc:: with SMTP id jv12mr617846pjb.213.1610607256940; Wed, 13 Jan 2021 22:54:16 -0800 (PST) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id a4sm4483186pgn.40.2021.01.13.22.54.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jan 2021 22:54:16 -0800 (PST) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH v6 1/2] cros_ec_commands: Add EC_CODEC_I2S_RX_RESET Date: Thu, 14 Jan 2021 14:54:00 +0800 Message-Id: <20210114065401.3498725-1-yuhsuan@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-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" Add the new command EC_CODEC_I2S_RX_RESET in ec_codec_i2s_rx_subcmd, which is used for resetting the EC codec. Signed-off-by: Yu-Hsuan Hsu Reviewed-by: Enric Balletbo i Serra --- include/linux/platform_data/cros_ec_commands.h | 1 + 1 file changed, 1 insertion(+) 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, }; From patchwork Thu Jan 14 06:54:01 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: 363858 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 D6625C433E0 for ; Thu, 14 Jan 2021 06:56:28 +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 EAC9F2395C for ; Thu, 14 Jan 2021 06:56:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAC9F2395C 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 85AC9168D; Thu, 14 Jan 2021 07:55:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 85AC9168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610607376; bh=RJJgsIGZLViFYIMPXfwdha2uMBpwYY/q05Aul1IJyrY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=J9NaRX8kw+btJY6li644N7nBRtf2exNuvmBrcvC2ZkCxHCk4pLF0df7hik5KBXw1O GNxSud3rH1AvfetH4Z8HpB6f0c3h9HbDKA3MPLj7RKA/yglYq57MiIJDqra/pXD22N MS8ciBP9JLIN+Ze/Ciq+qN/q3T35YA9IjAE7kv4Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 79707F80113; Thu, 14 Jan 2021 07:54:35 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 50E33F80475; Thu, 14 Jan 2021 07:54:34 +0100 (CET) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (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 38062F80118 for ; Thu, 14 Jan 2021 07:54:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38062F80118 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ELrACYWW" Received: by mail-pl1-x62e.google.com with SMTP id s15so2426952plr.9 for ; Wed, 13 Jan 2021 22:54:25 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=CK5a6fUoK9laud59EzgY0vTTWUjabBhgf/iGUHSlr84=; b=ELrACYWWcAWsFy2a70XpkDWOptj8AcVg7qorcWvajv2AMwMhu3dLgvWlNWA9yAtUwO qlx/baQm1U69k//c82xgSZFc52lIJwL4VlkEYyTtng8kq2+dumA3ewtFUmIeLMKnCeTE 0W46BiH6SQR8uOEeCX9cvgShgGmpS4fX6LwoU= 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=CK5a6fUoK9laud59EzgY0vTTWUjabBhgf/iGUHSlr84=; b=BYzr4QGmBnxrEcDa+5WztakdhBlsLJBZYYvOeGDAGUzpBVEc3k3iKk2n8sW0HtCRgS YBKTt89NoOEh6dVselL/F1rxbZ2Dn0UPs6BfD2Fwc+fk2nQo3YYJwd3zBkFFkGxBA8+o 2Ss49Hto6Rae9fo6rU4Vuuv4HgJu7E6QgInHtE5yCleTq0rJgHuu5dy1V3juU8iefQOt Wzt6rjm5eibO2hN85KqD6ds2ScAJPbeQn+8xL7czT6gunIkKBFdizbbwcKp858bWBvhM LsGfDu0TCrxCvn799PHKZGV7wjgm2C8QPdPZ8cBgn5L8XPBaj1JEvWBliRUuvgjEVvPf cFrw== X-Gm-Message-State: AOAM533PuiayYNtYFh8V+iWtRcRaAWlD9Tf996/CKNpUYhmkQ2NpDYbD 5ISaFf7xK7Cn8eh9+6RBVk0WLA== X-Google-Smtp-Source: ABdhPJwGek4x/wN2BRK4FinpqyikVPDyQ39T9E6PbUP4yc13Tx1iATTT1z6JizyDQy/mmyJuFruMbw== X-Received: by 2002:a17:903:22c2:b029:de:45c0:69f2 with SMTP id y2-20020a17090322c2b02900de45c069f2mr3473606plg.26.1610607264230; Wed, 13 Jan 2021 22:54:24 -0800 (PST) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id w9sm4182032pfj.128.2021.01.13.22.54.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Jan 2021 22:54:23 -0800 (PST) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH v6 2/2] ASoC: cros_ec_codec: Reset I2S RX when probing Date: Thu, 14 Jan 2021 14:54:01 +0800 Message-Id: <20210114065401.3498725-2-yuhsuan@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210114065401.3498725-1-yuhsuan@chromium.org> References: <20210114065401.3498725-1-yuhsuan@chromium.org> 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 --- Returns the error code when it fails to reset. sound/soc/codecs/cros_ec_codec.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index f33a2a9654e7..40e437aa1d55 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -1011,6 +1011,18 @@ 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 == -ENOPROTOOPT) { + dev_info(dev, + "Command not found. Please update the EC firmware.\n"); + } else if (ret) { + dev_err(dev, "failed to EC_CODEC_I2S_RESET: %d\n", ret); + return ret; + } + platform_set_drvdata(pdev, priv); ret = devm_snd_soc_register_component(dev, &i2s_rx_component_driver,