From patchwork Fri Jan 15 07:53: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: 12021791 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 E89AAC433DB for ; Fri, 15 Jan 2021 07:54: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 036D623118 for ; Fri, 15 Jan 2021 07:54:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 036D623118 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 35C0217A4; Fri, 15 Jan 2021 08:53:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 35C0217A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610697255; bh=HQQXAjY0KkmMSUtsKyOlTbkxGud67JSesr3fAQJW0CA=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=M1rc6/X4BOYkgnCnQEYM/xFb4uVt429xnnn3tYjUnt6XJWrafJC+rbriUzU6jOGIF 86DRlxXCac7hPeQnBzfcU5kTvxr/YhpHoHwLpJmbehWhJheFHlwudIc3Nn4nnAluRx nq0qPj1enymxPLDuCn+5Mt1les0pv7iZdPA+9Tnc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 67A5FF80132; Fri, 15 Jan 2021 08:53:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 980E3F80132; Fri, 15 Jan 2021 08:53:21 +0100 (CET) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 DAB09F80134 for ; Fri, 15 Jan 2021 08:53:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DAB09F80134 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QY5+gDN5" Received: by mail-pj1-x1029.google.com with SMTP id v1so4610007pjr.2 for ; Thu, 14 Jan 2021 23:53:12 -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=k5rUWYQ53xu61NYNf2N+FFBOArG/WXlQJYbUH9t64RY=; b=QY5+gDN5VQmgj0lztLbKDumIK/YeAPPVjlWdL/rFU1w9qbzynU4Vphn6xB1iU6o8wW d5IoDMDjioobQNWqXJWuFc0WOog6d4CPrd4GdV2y738jlOKlp9d9/pGHaR3ZFLYx3KR2 3y/AL+XvPl8lMkWBbmTwBNeNuPnSHeoVHt+Hg= 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=k5rUWYQ53xu61NYNf2N+FFBOArG/WXlQJYbUH9t64RY=; b=ue53GkZaZESIKnKz0qVH2XmG5H88FultkA6Cb8RR/fyKQ/TE02xcSqXllINqH1hGve VIyK/jYmTdcSiABr2AOOvjHK4RclgHxZJ5/JVRNeIMOLmuPrjSonCQzsggEXH+tGlBiy RfvCSjl+lxxSXRehhzUWCI1qpTbbE2cnVdfJ27IxvAeyi1yiYl7EHgw5WFKZ7700gU1J 55JYag/6nbCIKrnQzsJr1eAMTHuOOGs2/YXvad6IXYe/ZBIh9ZdXr/+4RGso10fuouuo R2I8ul0+1/kWtqrSOljyn21xoHJAslMoMXmocCeGlMsy6rFlHP7W/N/N3Tl/M/b3ZESM PM5w== X-Gm-Message-State: AOAM533ux3pxeynJpGrBgw3iEoEVxVLTZUJBXSudt/nJvs2S+2yfoVB0 T+0reSwFHCP3JMUEihq42l9v4g== X-Google-Smtp-Source: ABdhPJzhirIDFWw+9irQUOwF9CKpaqpYnbavJoyZQgwKjRnVwoHcOgNCZOjMIBDbKCCCuYIQTE4C8w== X-Received: by 2002:a17:902:c155:b029:da:9460:99a0 with SMTP id 21-20020a170902c155b02900da946099a0mr11443829plj.20.1610697189811; Thu, 14 Jan 2021 23:53:09 -0800 (PST) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id p3sm7113402pjg.53.2021.01.14.23.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jan 2021 23:53:09 -0800 (PST) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH v7 1/2] cros_ec_commands: Add EC_CODEC_I2S_RX_RESET Date: Fri, 15 Jan 2021 15:53:00 +0800 Message-Id: <20210115075301.47995-1-yuhsuan@chromium.org> X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-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 Acked-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 Fri Jan 15 07:53: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: 12021793 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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 91788C433DB for ; Fri, 15 Jan 2021 07:55:19 +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 D4FA8221FA for ; Fri, 15 Jan 2021 07:55:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4FA8221FA 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 (unknown [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 501B117CA; Fri, 15 Jan 2021 08:54:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 501B117CA Authentication-Results: alsa0.perex.cz; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Dmse58G/" Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 14645F8025F; Fri, 15 Jan 2021 08:53:29 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18579F8016D; Fri, 15 Jan 2021 08:53:27 +0100 (CET) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (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 31E07F8016D for ; Fri, 15 Jan 2021 08:53:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 31E07F8016D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Dmse58G/" Received: by mail-pl1-x635.google.com with SMTP id s15so4282338plr.9 for ; Thu, 14 Jan 2021 23:53: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=MbBZrDP4IrIPZxUvjAYid9N/Fa9d/bofmIE0flpsVB0=; b=Dmse58G/vKR25BWNNFJR75Iv5H2awuqE5/NF6KzNjEV+sQ0TtwrrDNUZ9dtpcBTOIi IHSQ7Uqlkr3OHOrWjHL0e17tkDBCrnj7zEj32Uh5tLtCJ8DLoCTj5yCtpVy2hQPKMo5G u9eSOHRju7b4ZwwQnSSPyWb3ltRx+vN/AjDIc= 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=MbBZrDP4IrIPZxUvjAYid9N/Fa9d/bofmIE0flpsVB0=; b=j9Tn39NS40W/oX2TrOBMb4OKkaLtv6uFBNsINUqEkV6Wbhk6ymW2cxK7WmjzHX5q5l 23WJtIhroZbMDM5+3z5kA+df76cxTotmsYG8qz+Uzr3VLvetQmTrYUnyP/yaORCgcXM3 S2ctAsWJpf8Sl1koHIIYq/yRoIgDPhobc0gT44bfFvVj0MO0GAP3A7peNQQYYkMqAJZu iwDI8o19hVqoYhmVmvSzC0FZ9CT2KF5i23mSSXYYe4J5OUL5V3RlrqTIvRIypp+h5Rve IOzKx6GPAFo2HwnvGuBYaXYLSrS83zRtfTk8vO664lRn7T2vhNKOVJpW9f3wIX3nuttt sQxw== X-Gm-Message-State: AOAM532WBWGZcGNnbjxBGZ/KDClk5Rb+tIb7/T+jCW4l5jMTL9SWXqLT vtlGbfe2wHHvrm9R8Da1dXjb2g== X-Google-Smtp-Source: ABdhPJwwaXkf6UapnuX17hkLlro4eGY9ncbgFIiB2O6mEloQCt26637wgpmH7rEeVUtD0YWCLmTgGQ== X-Received: by 2002:a17:90b:78f:: with SMTP id l15mr353390pjz.234.1610697196496; Thu, 14 Jan 2021 23:53:16 -0800 (PST) Received: from localhost ([2401:fa00:1:10:725a:fff:fe46:44eb]) by smtp.gmail.com with ESMTPSA id e5sm7531175pjs.0.2021.01.14.23.53.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jan 2021 23:53:15 -0800 (PST) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH v7 2/2] ASoC: cros_ec_codec: Reset I2S RX when probing Date: Fri, 15 Jan 2021 15:53:01 +0800 Message-Id: <20210115075301.47995-2-yuhsuan@chromium.org> X-Mailer: git-send-email 2.30.0.296.g2bfb1c46d8-goog In-Reply-To: <20210115075301.47995-1-yuhsuan@chromium.org> References: <20210115075301.47995-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 Reviewed-by: Enric Balletbo i Serra --- Updated the info message. 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..c4772f82485a 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, + "Missing reset command. Please update 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,