From patchwork Sun Mar 14 15:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400591 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=-10.9 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,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 C7281C433E0 for ; Sun, 14 Mar 2021 15:48:26 +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 D501164E69 for ; Sun, 14 Mar 2021 15:48:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D501164E69 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 6C1951755; Sun, 14 Mar 2021 16:47:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6C1951755 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736904; bh=CYJjRJhoMnn2KFhzl7+b3xrxw3bi3OGb5u7HaEYOyzE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TW1724W6ojvGnpfBRzMfN4EtvzI/qFxxqEXEgJU2ywMjzw7UQmX1XTK6yVIepZAFs mYtC/v7+RLUjKzNbS1nfoWy2jNDdziUF3iNQbhH0OHM+2J0o8Iu5DMikiohSqmG7m4 yYF4OC0/iU2hl1JwaMZhfkPO6w5UAQdAtHTyTq8I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A68A6F804B0; Sun, 14 Mar 2021 16:45:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0DD41F804A9; Sun, 14 Mar 2021 16:45:38 +0100 (CET) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 33240F80272 for ; Sun, 14 Mar 2021 16:45:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 33240F80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S807ZZou" Received: by mail-wr1-x435.google.com with SMTP id e9so4449094wrw.10 for ; Sun, 14 Mar 2021 08:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eNVjcoR01FRpoFa6dcxhxiG3Pm0KTDWnEWsUfy39F9k=; b=S807ZZouwwXiXTG9Ad2UTbCgVHcjn+TJkKy79koNKTWXToOcN5pCugUwW2KqtIKlPp /EsL6mXU035kVSJRt93PADxI6okFbFjSjYYwnFdgO8ynIqU4cIrMYVXlAKzoYmz0fTpV PxOo+suXTtWMLnTdBpzlTlTkBI4VDiTphXnG0+mLH7xmdI1TNblny2RSJntcYASg8Kl+ CI7YQijzu0ULHEMZbYGst8nCY+4b6cs+qyqXn4MTTf1+OfS4AvskmTnTHojroPqwcYJA kqwdm02weAlrnqaA0Y5aHY7YmiILqznrJSEe/bZDn45smGLMrb9Lic3ULsOZynMmqbCw 7yUA== 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=eNVjcoR01FRpoFa6dcxhxiG3Pm0KTDWnEWsUfy39F9k=; b=MhA3wTmPwprqscImcNbS3jfBU7MdNM3Ydj+j3xUzA+UX0hyXvicU0zQ2LviMBaUlce wc1PTDM1nMTQMPaQnhfQUvbLIuStFBswAfLvExUmAlQ9aMaU6dnX2smrUXA0tzFuG9gT /K1dKAoHCVqN9ILVaMAS02zey5kCMhykT3DU3nWOyZRqKqkOUFYHnossmYHvFxLBmKEU co1bLGFYt6E3RA7HLjmevQYCw1FgP4FwfoYUT1AafuB7vWCl1PyL1Ggr9q6NHJ+Rm8gm MrIzbvFrV4K3p65OQc2nVyTXGsIBu64OeCJWVkrVQ9x0wQwdW7TefleUiCiDC5GdUuy8 N0zw== X-Gm-Message-State: AOAM53237P7jbUUblaVP74+68OmjJ7zkCZC2Hd6csJMmin4j3bu1NB1D 4CjscE4GcXbsDp5AGn42tFt5+0fZSD4= X-Google-Smtp-Source: ABdhPJwBV24pahHUbzEGPiCqN4pR8i0eptAX4fnHzjRjhlfAqP+aMc5WU7Bvqptcvr1lzzuVbjG9SQ== X-Received: by 2002:adf:ef4a:: with SMTP id c10mr23063976wrp.427.1615736721372; Sun, 14 Mar 2021 08:45:21 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:21 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 01/17] ASoC: tegra20: ac97: Add reset control Date: Sun, 14 Mar 2021 18:44:43 +0300 Message-Id: <20210314154459.15375-2-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra20 AC97 driver doesn't manage the AC97 controller reset, relying on implicit deassertion of the reset by tegra-clk driver, which needs to be fixed since this behaviour is unacceptable by other Tegra drivers. Add explicit reset control to the Tegra20 AC97 driver. Note that AC97 reset was always specified in Tegra20 device-tree, hence DTB ABI changes aren't required. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_ac97.c | 21 +++++++++++++++++++++ sound/soc/tegra/tegra20_ac97.h | 1 + 2 files changed, 22 insertions(+) diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 06c728ae17ed..c454a34c15c4 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -313,6 +314,12 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) } dev_set_drvdata(&pdev->dev, ac97); + ac97->reset = devm_reset_control_get_exclusive(&pdev->dev, "ac97"); + if (IS_ERR(ac97->reset)) { + dev_err(&pdev->dev, "Can't retrieve ac97 reset\n"); + return PTR_ERR(ac97->reset); + } + ac97->clk_ac97 = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(ac97->clk_ac97)) { dev_err(&pdev->dev, "Can't retrieve ac97 clock\n"); @@ -364,12 +371,26 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ac97->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; ac97->playback_dma_data.maxburst = 4; + ret = reset_control_assert(ac97->reset); + if (ret) { + dev_err(&pdev->dev, "Failed to assert AC'97 reset: %d\n", ret); + goto err_clk_put; + } + ret = clk_prepare_enable(ac97->clk_ac97); if (ret) { dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); goto err_clk_put; } + usleep_range(10, 100); + + ret = reset_control_deassert(ac97->reset); + if (ret) { + dev_err(&pdev->dev, "Failed to deassert AC'97 reset: %d\n", ret); + goto err_clk_disable_unprepare; + } + ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); if (ret) { dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); diff --git a/sound/soc/tegra/tegra20_ac97.h b/sound/soc/tegra/tegra20_ac97.h index e467cd1ff2ca..870ea09ff301 100644 --- a/sound/soc/tegra/tegra20_ac97.h +++ b/sound/soc/tegra/tegra20_ac97.h @@ -78,6 +78,7 @@ struct tegra20_ac97 { struct clk *clk_ac97; struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; + struct reset_control *reset; struct regmap *regmap; int reset_gpio; int sync_gpio; From patchwork Sun Mar 14 15:44:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400592 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,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 E48E0C433E0 for ; Sun, 14 Mar 2021 15:47:15 +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 142DD64E89 for ; Sun, 14 Mar 2021 15:47:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 142DD64E89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 9B5331741; Sun, 14 Mar 2021 16:46:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9B5331741 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736833; bh=9Y/3q+1+DQN2mntAF/q3iuvJArkqhGtcBAxftmx9hkM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NJD91K9DXTcN/+O4FL3TmEMt5FjQWu278sXff8Pa6qSZ4Ue9IIe8OVjOPWLFCAkFL UPvAnYvBuKZtigHn7quhlvwZ+v14l/IKj95Pwq5DFY3tRZu1313x2mEEp6l/fqZYIn f498J1P5i5FEl7vRj+VIVj/3LLGjZsxd/7acQAtg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C5B06F80425; Sun, 14 Mar 2021 16:45:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BDD29F80100; Sun, 14 Mar 2021 16:45:29 +0100 (CET) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 59831F8010E for ; Sun, 14 Mar 2021 16:45:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 59831F8010E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X+zebKcy" Received: by mail-wr1-x42b.google.com with SMTP id x13so4446440wrs.9 for ; Sun, 14 Mar 2021 08:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bBgS52ohSAjwSwQTAebOyEnKVyU7OG0mf9DfTmO+cgo=; b=X+zebKcylQMfOnYwAUFh7t8xptvxbwzHwUOH625furvKhQuj6ln5p/kzWVCEwGRmZb 55SaLGoBeWMJ/vn9d1ht/tgSucCOXw7FyVpuL7bXMUZ9ZYiOP+uP0nb5nNepnLNcY4gk QDEsre5SdcTmkeJTTrgXn7PmeT04qT7OECCJ3SXv1IDFodjYNK7rhOtLt+pnbisIRNnh 9v0hYgfj5pUVozFJFjWaZI0DbYksfpAvXplv5z5GRPXQo4i1n1x5AcgwRjIcL9R7iiTB ZBe3Bj4y7TtOP4TJWKwfo9oA0WMsGV/1cJYheUtgh72gMjLoDZgoBvEf6FAz+z+TaAXJ sPQw== 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=bBgS52ohSAjwSwQTAebOyEnKVyU7OG0mf9DfTmO+cgo=; b=qyV+F2jX09rUO1QgSErBWG0zdhM9bhuILNqBVfh7j+blC28YOXVdTCnr/RYU7yM/e0 7nkpS0O09cop1xvN+cUBkXDRZLZcspKI1+qTa4PE5OH1hCqgYOT/nfA1piPiN9V+VG0A k/CH7ZwLcrF+VdRFEZ7PXHoHUmM/rCLGyfubiIofupTGoFEFq58nw7sB6Oqer8U2ndis 2YAZAcUl0pSzvWItzOOLLOUMh1FFia9ucmG5/Wz14jF8WC9iKdL0ym8HlbN86PaZv2lJ VWk0qUZI93G54MXf5aekn30vugYjQ+GUHDEad6slkT6iYtmDSDe3Yxb62a4q6C3Nzlvm dUOw== X-Gm-Message-State: AOAM532kxMrZdO8OiUZtkkXU/lv2Fw4BNlw2JzHEAZhwRNN/Ybx/uo4z x+6go9Ij/cnrjxKebWTadh8= X-Google-Smtp-Source: ABdhPJyoI95cmUGK/SHTgeoy4AUqf/z5xjCWBJ2BUkvvLV0H+UuGu+1JYvF/ArmDD4zPjywBzBE0Kw== X-Received: by 2002:a5d:50c7:: with SMTP id f7mr23913441wrt.18.1615736722488; Sun, 14 Mar 2021 08:45:22 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:22 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 02/17] ASoC: tegra20: i2s: Add reset control Date: Sun, 14 Mar 2021 18:44:44 +0300 Message-Id: <20210314154459.15375-3-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" The I2S reset may be asserted at a boot time, in particular this is the case on Tegra20 AC100 netbook. Tegra20 I2S driver doesn't manage the reset control and currently it happens to work because reset is implicitly deasserted by the tegra-clk driver when I2S clock is enabled. The I2S permanently stays in a reset once tegra-clk is fixed to not touch the resets, which it shouldn't be doing. Add reset control to the Tegra20 I2S driver. Note that I2S reset was always specified in Tegra20 device-tree, hence DTB ABI changes aren't required. Tested-by: Paul Fertser # T20 AC100 Reported-by: Paul Fertser Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 31 +++++++++++++++++++++++++++++++ sound/soc/tegra/tegra20_i2s.h | 1 + 2 files changed, 32 insertions(+) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index d7a3d046c8f8..c0af5352b483 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,8 @@ static int tegra20_i2s_runtime_suspend(struct device *dev) { struct tegra20_i2s *i2s = dev_get_drvdata(dev); + regcache_cache_only(i2s->regmap, true); + clk_disable_unprepare(i2s->clk_i2s); return 0; @@ -47,13 +50,35 @@ static int tegra20_i2s_runtime_resume(struct device *dev) struct tegra20_i2s *i2s = dev_get_drvdata(dev); int ret; + ret = reset_control_assert(i2s->reset); + if (ret) + return ret; + ret = clk_prepare_enable(i2s->clk_i2s); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); return ret; } + usleep_range(10, 100); + + ret = reset_control_deassert(i2s->reset); + if (ret) + goto disable_clocks; + + regcache_cache_only(i2s->regmap, false); + regcache_mark_dirty(i2s->regmap); + + ret = regcache_sync(i2s->regmap); + if (ret) + goto disable_clocks; + return 0; + +disable_clocks: + clk_disable_unprepare(i2s->clk_i2s); + + return ret; } static int tegra20_i2s_set_fmt(struct snd_soc_dai *dai, @@ -339,6 +364,12 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) i2s->dai = tegra20_i2s_dai_template; i2s->dai.name = dev_name(&pdev->dev); + i2s->reset = devm_reset_control_get_exclusive(&pdev->dev, "i2s"); + if (IS_ERR(i2s->reset)) { + dev_err(&pdev->dev, "Can't retrieve i2s reset\n"); + return PTR_ERR(i2s->reset); + } + i2s->clk_i2s = clk_get(&pdev->dev, NULL); if (IS_ERR(i2s->clk_i2s)) { dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); diff --git a/sound/soc/tegra/tegra20_i2s.h b/sound/soc/tegra/tegra20_i2s.h index 628d3ca09f42..8233e5fa2eff 100644 --- a/sound/soc/tegra/tegra20_i2s.h +++ b/sound/soc/tegra/tegra20_i2s.h @@ -144,6 +144,7 @@ struct tegra20_i2s { struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; struct regmap *regmap; + struct reset_control *reset; }; #endif From patchwork Sun Mar 14 15:44:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400155 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 A3A3FC4332E for ; Sun, 14 Mar 2021 15:47:11 +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 533FA64EB3 for ; Sun, 14 Mar 2021 15:47:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 533FA64EB3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 95B401745; Sun, 14 Mar 2021 16:46:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 95B401745 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736828; bh=IxCjM6FpLQMmJ8e3A0t15J7rwJV/nDGQAr2vOD9Albk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OjzbCUyE5G28xRCo7kg95t/f8oGjWvSCEq5BkAZXy99fZTcKgs0kAt0/93+caidPt ybgnvUUWZ98HtzsAv1WFVZ3fBWKnXXQHOTOTrXd7h29jiel6ZHIykMocAZ8eUyucVu R6ntfZcQKACa0pyB4WyK5EBvyk0Ko/NLp65RV4Is= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 21003F80218; Sun, 14 Mar 2021 16:45:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 011A7F80272; Sun, 14 Mar 2021 16:45:28 +0100 (CET) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 A35EFF80100 for ; Sun, 14 Mar 2021 16:45:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A35EFF80100 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BAcofkLp" Received: by mail-wr1-x42d.google.com with SMTP id a18so7413027wrc.13 for ; Sun, 14 Mar 2021 08:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jtKR/4JVn6yx/XuU0tntwFP7lcedHE2V/O3j4vKQs0c=; b=BAcofkLpBVqClJbWenCsK37zvuwHpYUCtRAMipTF1ZFfV8xbbw2FzWy5r6jPqBWl70 g9CcWRDzX8dTSa1K9aVJ2QvgNhFRLIlHks/a7w8LuxXObfqWWqoFW9NWTd+sYf+aec/Q tSr8A1wP+qezUHSY4j117N0rupg47RHvCjlUSfYmbGTZJPggI+ppViZoWoCPnLw0yG8n GwBmrVBXKUvskz47SYfIfsu1FqSPmGljLXM/t4QZmPnd/xviKmDaF/1F3Z2udLn/YxUL 5aVuafMBKbECt1mhet7fJyaRrCVabbyG7VISG6VUp4MkuiSIZb7uVRR7BJBfCWVZ/HLY kIhA== 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=jtKR/4JVn6yx/XuU0tntwFP7lcedHE2V/O3j4vKQs0c=; b=nEq7kaEWiwa6n5/m6UcIzXFqHwIt1oFu/bLp/5zEQdMu1hBfc09cCai5iFm8k5v+yS CvC9pKpYKaqR7KwnwLBeckD36dU/HH/KHl3SskUOW1M3xO9HK/MoQ2bg0jxe7Y2k1/Rv sZ85bKLX07jVLx/WxgH83urJXZZWEFZRzB4pmT6abe3bU3mm4Knit/sYfgU1FbHvWl6n tz3Lke+UvxdGRBIYJZeg/K8dYyJGe+J+C0047++p5R89f8vRXvNIKdTGRIexFHTeRmqd +e83+uNCnHHLh06ZM5HZJ9j2ERWfURaaeLwQjEhPT3spfYvJIKduY7LfQt9r6BKP93Kg uk/w== X-Gm-Message-State: AOAM533pS0KpiznDBc8KwECfjV5PJNYSWp4CA2r0PoDd9ArN76oI95n3 NqFTDP3T+b97mYKHQukeMns= X-Google-Smtp-Source: ABdhPJwAdPZZkDkI3WDmf7HRnWoB6/a6rLAZYs+/kSq8ULgrEagkE3iJo2VjjuK5TrEdqm4M7tF/8A== X-Received: by 2002:a5d:6290:: with SMTP id k16mr22532255wru.177.1615736723601; Sun, 14 Mar 2021 08:45:23 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:23 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 03/17] ASoC: tegra30: i2s: Restore hardware state on runtime PM resume Date: Sun, 14 Mar 2021 18:44:45 +0300 Message-Id: <20210314154459.15375-4-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra30 I2S driver syncs regmap cache only on resume from system suspend, but hardware is reset across the runtime suspend because RPM of the parent AHUB driver resets the I2S hardware, hence h/w state is lost after each RPM resume. The problem isn't visible because hardware happens to be fully reprogrammed after each RPM resume. Move hardware syncing to RPM resume in order to restore h/w state properly. Fixes: ed9ce1ed2239 ("ASoC: tegra: ahub: Reset hardware properly") Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_i2s.c | 40 +++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 6740df541508..3d22c1be6f3d 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -58,8 +58,18 @@ static int tegra30_i2s_runtime_resume(struct device *dev) } regcache_cache_only(i2s->regmap, false); + regcache_mark_dirty(i2s->regmap); + + ret = regcache_sync(i2s->regmap); + if (ret) + goto disable_clocks; return 0; + +disable_clocks: + clk_disable_unprepare(i2s->clk_i2s); + + return ret; } static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, @@ -551,37 +561,11 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tegra30_i2s_suspend(struct device *dev) -{ - struct tegra30_i2s *i2s = dev_get_drvdata(dev); - - regcache_mark_dirty(i2s->regmap); - - return 0; -} - -static int tegra30_i2s_resume(struct device *dev) -{ - struct tegra30_i2s *i2s = dev_get_drvdata(dev); - int ret; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put(dev); - return ret; - } - ret = regcache_sync(i2s->regmap); - pm_runtime_put(dev); - - return ret; -} -#endif - static const struct dev_pm_ops tegra30_i2s_pm_ops = { SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend, tegra30_i2s_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(tegra30_i2s_suspend, tegra30_i2s_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver tegra30_i2s_driver = { From patchwork Sun Mar 14 15:44:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400151 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,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 87018C433DB for ; Sun, 14 Mar 2021 15:50:11 +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 0357264E51 for ; Sun, 14 Mar 2021 15:50:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0357264E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 8A5C01743; Sun, 14 Mar 2021 16:49:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8A5C01743 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737009; bh=O21MDu9vWeABZ1zDYGa5oliCMZMuWzSa/GJ05N3zad0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=twBCtAilpmEz4r90ZRac2uAxMuBVBP2OmpriNDbd2UtqzrrCb9WA1EBHiYb9PpJ3B YnwB5YYJSFKpbFqWg5Y63we6UZuQpaZJihpTXEfK61k98jWFdkJUQeKchGUkk0Glb4 v7WpPqw/5SAC63QrA+pSrRxzPd8d/bf4fCuv1J1E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E4D2FF80272; Sun, 14 Mar 2021 16:45:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 63E59F804C1; Sun, 14 Mar 2021 16:45:43 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 D96AFF80148 for ; Sun, 14 Mar 2021 16:45:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D96AFF80148 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n7VtDbNv" Received: by mail-wr1-x431.google.com with SMTP id f12so7421676wrx.8 for ; Sun, 14 Mar 2021 08:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZdTIRDoaPlOWWwv0Qgf3Qq32eiiQHqsaijH4CI5d9Og=; b=n7VtDbNvvPjiQItTbIG4RKelm9GwExEjDe+DRuCoI4iuuhUE16Upt5QslsOq63mwo3 DVow0xhoUzJC+v7/+3Q3RU4H0LjERMM03b1FPmfzInvk3SUWq2ZnCcl9E4IR4QT3VfBP rjfOUUSB0ocMHklLJL6hxacNZrnoYTwwQjQG461PG/g6uaPBnbW3OhMSoFnuPc4pEBe0 1Dk31H6W2f2lFYBABdOb+zepSc77Mc0AGVLyLtu8cvKfxFBzdujDfpALK+MgFRShDhqQ yfGJtdgozknd+Vtu1LCQ6B0txfGxLZoN6peFuFklNCcSnzsG868E8cnjswJyejlXcyoL zsWQ== 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=ZdTIRDoaPlOWWwv0Qgf3Qq32eiiQHqsaijH4CI5d9Og=; b=Nd3GPEWEKAnwSCst11ms13fychyeoAobapi8+h+SdusM8yTACV0mrrS2G5i4Ywakz+ gHTrhgbk1+jFUoxLL8g1Kxer3AY2xQPXBIq9NXC1DaiUaCMKYU34FH00eu481Et8kkT/ mCz+NOCTVmZZPNiqbgzll9mM/pgjeHkMrEPKrazU0I/f+nbbqTKQ3WUXwpWsqroXY8nu 7iDryj93Jf8nEwGd/FRXZ3oxT1+KpFaMTwuodAUcFKu1WfKdRg031SRzdNxS9GYwUMVR eByhbr8kwAIyMKe639mHo7xzxASLI7jTpO7x2Je8aKt7e2MdRdk8+1FNQzzY/a36qw9+ FxAg== X-Gm-Message-State: AOAM532knwFZvOVczQXttBTJaCIoLB9KKXi31WU0oVCvvjCxuX980R+H /CsKsU2kITMa2v41Q1fCFk5FvJCv2r0= X-Google-Smtp-Source: ABdhPJwqPUIM2dOCMNGKZaPx8G34BFX96nnSZ6KA3miGC7rIwE1Lyqv4Meu2IWoJqQrbNKKan0vVIA== X-Received: by 2002:adf:df10:: with SMTP id y16mr23538430wrl.372.1615736724705; Sun, 14 Mar 2021 08:45:24 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:24 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 04/17] reset: Add reset_control_bulk API Date: Sun, 14 Mar 2021 18:44:46 +0300 Message-Id: <20210314154459.15375-5-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" From: Philipp Zabel Follow the clock and regulator subsystems' lead and add a bulk API for reset controls. Signed-off-by: Philipp Zabel Tested-by: Dmitry Osipenko Signed-off-by: Dmitry Osipenko --- drivers/reset/core.c | 215 ++++++++++++++++++++++++++++ include/linux/reset.h | 315 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 530 insertions(+) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index dbf881b586d9..71c1c8264b2d 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -358,6 +358,30 @@ int reset_control_reset(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_reset); +/** + * reset_control_bulk_reset - reset the controlled devices in order + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + * + * Issue a reset on all provided reset controls, in order. + * + * See also: reset_control_reset() + */ +int reset_control_bulk_reset(int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + int ret, i; + + for (i = 0; i < num_rstcs; i++) { + ret = reset_control_reset(rstcs[i].rstc); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(reset_control_bulk_reset); + /** * reset_control_rearm - allow shared reset line to be re-triggered" * @rstc: reset controller @@ -461,6 +485,36 @@ int reset_control_assert(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_assert); +/** + * reset_control_bulk_assert - asserts the reset lines in order + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + * + * Assert the reset lines for all provided reset controls, in order. + * If an assertion fails, already asserted resets are deasserted again. + * + * See also: reset_control_assert() + */ +int reset_control_bulk_assert(int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + int ret, i; + + for (i = 0; i < num_rstcs; i++) { + ret = reset_control_assert(rstcs[i].rstc); + if (ret) + goto err; + } + + return 0; + +err: + while (i--) + reset_control_deassert(rstcs[i].rstc); + return ret; +} +EXPORT_SYMBOL_GPL(reset_control_bulk_assert); + /** * reset_control_deassert - deasserts the reset line * @rstc: reset controller @@ -511,6 +565,36 @@ int reset_control_deassert(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_deassert); +/** + * reset_control_bulk_deassert - deasserts the reset lines in reverse order + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + * + * Deassert the reset lines for all provided reset controls, in reverse order. + * If a deassertion fails, already deasserted resets are asserted again. + * + * See also: reset_control_deassert() + */ +int reset_control_bulk_deassert(int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + int ret, i; + + for (i = num_rstcs - 1; i >= 0; i--) { + ret = reset_control_deassert(rstcs[i].rstc); + if (ret) + goto err; + } + + return 0; + +err: + while (i < num_rstcs) + reset_control_assert(rstcs[i++].rstc); + return ret; +} +EXPORT_SYMBOL_GPL(reset_control_bulk_deassert); + /** * reset_control_status - returns a negative errno if not supported, a * positive value if the reset line is asserted, or zero if the reset @@ -588,6 +672,36 @@ int reset_control_acquire(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_acquire); +/** + * reset_control_bulk_acquire - acquires reset controls for exclusive use + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + * + * This is used to explicitly acquire reset controls requested with + * reset_control_bulk_get_exclusive_release() for temporary exclusive use. + * + * See also: reset_control_acquire(), reset_control_bulk_release() + */ +int reset_control_bulk_acquire(int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + int ret, i; + + for (i = 0; i < num_rstcs; i++) { + ret = reset_control_acquire(rstcs[i].rstc); + if (ret) + goto err; + } + + return 0; + +err: + while (i--) + reset_control_release(rstcs[i].rstc); + return ret; +} +EXPORT_SYMBOL_GPL(reset_control_bulk_acquire); + /** * reset_control_release() - releases exclusive access to a reset control * @rstc: reset control @@ -610,6 +724,26 @@ void reset_control_release(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_release); +/** + * reset_control_bulk_release() - releases exclusive access to reset controls + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + * + * Releases exclusive access right to reset controls previously obtained by a + * call to reset_control_bulk_acquire(). + * + * See also: reset_control_release(), reset_control_bulk_acquire() + */ +void reset_control_bulk_release(int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + int i; + + for (i = 0; i < num_rstcs; i++) + reset_control_release(rstcs[i].rstc); +} +EXPORT_SYMBOL_GPL(reset_control_bulk_release); + static struct reset_control *__reset_control_get_internal( struct reset_controller_dev *rcdev, unsigned int index, bool shared, bool acquired) @@ -814,6 +948,32 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id, } EXPORT_SYMBOL_GPL(__reset_control_get); +int __reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired) +{ + int ret, i; + + for (i = 0; i < num_rstcs; i++) { + rstcs[i].rstc = __reset_control_get(dev, rstcs[i].id, 0, + shared, optional, acquired); + if (IS_ERR(rstcs[i].rstc)) { + ret = PTR_ERR(rstcs[i].rstc); + goto err; + } + } + + return 0; + +err: + mutex_lock(&reset_list_mutex); + while (i--) + __reset_control_put_internal(rstcs[i].rstc); + mutex_unlock(&reset_list_mutex); + return ret; +} +EXPORT_SYMBOL_GPL(__reset_control_bulk_get); + static void reset_control_array_put(struct reset_control_array *resets) { int i; @@ -845,6 +1005,23 @@ void reset_control_put(struct reset_control *rstc) } EXPORT_SYMBOL_GPL(reset_control_put); +/** + * reset_control_bulk_put - free the reset controllers + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset controls set + */ +void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ + mutex_lock(&reset_list_mutex); + while (num_rstcs--) { + if (IS_ERR_OR_NULL(rstcs[num_rstcs].rstc)) + continue; + __reset_control_put_internal(rstcs[num_rstcs].rstc); + } + mutex_unlock(&reset_list_mutex); +} +EXPORT_SYMBOL_GPL(reset_control_bulk_put); + static void devm_reset_control_release(struct device *dev, void *res) { reset_control_put(*(struct reset_control **)res); @@ -874,6 +1051,44 @@ struct reset_control *__devm_reset_control_get(struct device *dev, } EXPORT_SYMBOL_GPL(__devm_reset_control_get); +struct reset_control_bulk_devres { + int num_rstcs; + struct reset_control_bulk_data *rstcs; +}; + +static void devm_reset_control_bulk_release(struct device *dev, void *res) +{ + struct reset_control_bulk_devres *devres = res; + + reset_control_bulk_put(devres->num_rstcs, devres->rstcs); +} + +int __devm_reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired) +{ + struct reset_control_bulk_devres *ptr; + int ret; + + ptr = devres_alloc(devm_reset_control_bulk_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = __reset_control_bulk_get(dev, num_rstcs, rstcs, shared, optional, acquired); + if (ret < 0) { + devres_free(ptr); + return ret; + } + + ptr->num_rstcs = num_rstcs; + ptr->rstcs = rstcs; + devres_add(dev, ptr); + + return 0; +} +EXPORT_SYMBOL_GPL(__devm_reset_control_bulk_get); + /** * __device_reset - find reset controller associated with the device * and perform reset diff --git a/include/linux/reset.h b/include/linux/reset.h index b9109efa2a5c..46e6372cb431 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -10,6 +10,21 @@ struct device; struct device_node; struct reset_control; +/** + * struct reset_control_bulk_data - Data used for bulk reset control operations. + * + * @id: reset control consumer ID + * @rstc: struct reset_control * to store the associated reset control + * + * The reset APIs provide a series of reset_control_bulk_*() API calls as + * a convenience to consumers which require multiple reset controls. + * This structure is used to manage data for these calls. + */ +struct reset_control_bulk_data { + const char *id; + struct reset_control *rstc; +}; + #ifdef CONFIG_RESET_CONTROLLER int reset_control_reset(struct reset_control *rstc); @@ -20,6 +35,12 @@ int reset_control_status(struct reset_control *rstc); int reset_control_acquire(struct reset_control *rstc); void reset_control_release(struct reset_control *rstc); +int reset_control_bulk_reset(int num_rstcs, struct reset_control_bulk_data *rstcs); +int reset_control_bulk_assert(int num_rstcs, struct reset_control_bulk_data *rstcs); +int reset_control_bulk_deassert(int num_rstcs, struct reset_control_bulk_data *rstcs); +int reset_control_bulk_acquire(int num_rstcs, struct reset_control_bulk_data *rstcs); +void reset_control_bulk_release(int num_rstcs, struct reset_control_bulk_data *rstcs); + struct reset_control *__of_reset_control_get(struct device_node *node, const char *id, int index, bool shared, bool optional, bool acquired); @@ -27,10 +48,18 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id, int index, bool shared, bool optional, bool acquired); void reset_control_put(struct reset_control *rstc); +int __reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired); +void reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs); + int __device_reset(struct device *dev, bool optional); struct reset_control *__devm_reset_control_get(struct device *dev, const char *id, int index, bool shared, bool optional, bool acquired); +int __devm_reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired); struct reset_control *devm_reset_control_array_get(struct device *dev, bool shared, bool optional); @@ -96,6 +125,48 @@ static inline struct reset_control *__reset_control_get( return optional ? NULL : ERR_PTR(-ENOTSUPP); } +static inline int +reset_control_bulk_reset(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ + return 0; +} + +static inline int +reset_control_bulk_assert(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ + return 0; +} + +static inline int +reset_control_bulk_deassert(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ + return 0; +} + +static inline int +reset_control_bulk_acquire(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ + return 0; +} + +static inline void +reset_control_bulk_release(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ +} + +static inline int +__reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired) +{ + return optional ? 0 : -EOPNOTSUPP; +} + +static inline void +reset_control_bulk_put(int num_rstcs, struct reset_control_bulk_data *rstcs) +{ +} + static inline struct reset_control *__devm_reset_control_get( struct device *dev, const char *id, int index, bool shared, bool optional, @@ -104,6 +175,14 @@ static inline struct reset_control *__devm_reset_control_get( return optional ? NULL : ERR_PTR(-ENOTSUPP); } +static inline int +__devm_reset_control_bulk_get(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs, + bool shared, bool optional, bool acquired) +{ + return optional ? 0 : -EOPNOTSUPP; +} + static inline struct reset_control * devm_reset_control_array_get(struct device *dev, bool shared, bool optional) { @@ -155,6 +234,23 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id) return __reset_control_get(dev, id, 0, false, false, true); } +/** + * reset_control_bulk_get_exclusive - Lookup and obtain exclusive references to + * multiple reset controllers. + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Fills the rstcs array with pointers to exclusive reset controls and + * returns 0, or an IS_ERR() condition containing errno. + */ +static inline int __must_check +reset_control_bulk_get_exclusive(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, true); +} + /** * reset_control_get_exclusive_released - Lookup and obtain a temoprarily * exclusive reference to a reset @@ -176,6 +272,48 @@ __must_check reset_control_get_exclusive_released(struct device *dev, return __reset_control_get(dev, id, 0, false, false, false); } +/** + * reset_control_bulk_get_exclusive_released - Lookup and obtain temporarily + * exclusive references to multiple reset + * controllers. + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Fills the rstcs array with pointers to exclusive reset controls and + * returns 0, or an IS_ERR() condition containing errno. + * reset-controls returned by this function must be acquired via + * reset_control_bulk_acquire() before they can be used and should be released + * via reset_control_bulk_release() afterwards. + */ +static inline int __must_check +reset_control_bulk_get_exclusive_released(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, false); +} + +/** + * reset_control_bulk_get_optional_exclusive_released - Lookup and obtain optional + * temporarily exclusive references to multiple + * reset controllers. + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Optional variant of reset_control_bulk_get_exclusive_released(). If the + * requested reset is not specified in the device tree, this function returns 0 + * instead of an error and missing rtsc is set to NULL. + * + * See reset_control_bulk_get_exclusive_released() for more information. + */ +static inline int __must_check +reset_control_bulk_get_optional_exclusive_released(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, false); +} + /** * reset_control_get_shared - Lookup and obtain a shared reference to a * reset controller. @@ -204,6 +342,23 @@ static inline struct reset_control *reset_control_get_shared( return __reset_control_get(dev, id, 0, true, false, false); } +/** + * reset_control_bulk_get_shared - Lookup and obtain shared references to + * multiple reset controllers. + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Fills the rstcs array with pointers to shared reset controls and + * returns 0, or an IS_ERR() condition containing errno. + */ +static inline int __must_check +reset_control_bulk_get_shared(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, false); +} + /** * reset_control_get_optional_exclusive - optional reset_control_get_exclusive() * @dev: device to be reset by the controller @@ -221,6 +376,26 @@ static inline struct reset_control *reset_control_get_optional_exclusive( return __reset_control_get(dev, id, 0, false, true, true); } +/** + * reset_control_bulk_get_optional_exclusive - optional + * reset_control_bulk_get_exclusive() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Optional variant of reset_control_bulk_get_exclusive(). If any of the + * requested resets are not specified in the device tree, this function sets + * them to NULL instead of returning an error. + * + * See reset_control_bulk_get_exclusive() for more information. + */ +static inline int __must_check +reset_control_bulk_get_optional_exclusive(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, true); +} + /** * reset_control_get_optional_shared - optional reset_control_get_shared() * @dev: device to be reset by the controller @@ -238,6 +413,26 @@ static inline struct reset_control *reset_control_get_optional_shared( return __reset_control_get(dev, id, 0, true, true, false); } +/** + * reset_control_bulk_get_optional_shared - optional + * reset_control_bulk_get_shared() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Optional variant of reset_control_bulk_get_shared(). If the requested resets + * are not specified in the device tree, this function sets them to NULL + * instead of returning an error. + * + * See reset_control_bulk_get_shared() for more information. + */ +static inline int __must_check +reset_control_bulk_get_optional_shared(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __reset_control_bulk_get(dev, num_rstcs, rstcs, true, true, false); +} + /** * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference * to a reset controller. @@ -343,6 +538,26 @@ __must_check devm_reset_control_get_exclusive(struct device *dev, return __devm_reset_control_get(dev, id, 0, false, false, true); } +/** + * devm_reset_control_bulk_get_exclusive - resource managed + * reset_control_bulk_get_exclusive() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_get_exclusive(). For reset controllers returned + * from this function, reset_control_put() is called automatically on driver + * detach. + * + * See reset_control_bulk_get_exclusive() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_exclusive(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, true); +} + /** * devm_reset_control_get_exclusive_released - resource managed * reset_control_get_exclusive_released() @@ -362,6 +577,26 @@ __must_check devm_reset_control_get_exclusive_released(struct device *dev, return __devm_reset_control_get(dev, id, 0, false, false, false); } +/** + * devm_reset_control_bulk_get_exclusive_released - resource managed + * reset_control_bulk_get_exclusive_released() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_get_exclusive_released(). For reset controllers + * returned from this function, reset_control_put() is called automatically on + * driver detach. + * + * See reset_control_bulk_get_exclusive_released() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_exclusive_released(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, false, false); +} + /** * devm_reset_control_get_optional_exclusive_released - resource managed * reset_control_get_optional_exclusive_released() @@ -381,6 +616,26 @@ __must_check devm_reset_control_get_optional_exclusive_released(struct device *d return __devm_reset_control_get(dev, id, 0, false, true, false); } +/** + * devm_reset_control_bulk_get_optional_exclusive_released - resource managed + * reset_control_bulk_optional_get_exclusive_released() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_optional_get_exclusive_released(). For reset + * controllers returned from this function, reset_control_put() is called + * automatically on driver detach. + * + * See reset_control_bulk_optional_get_exclusive_released() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_optional_exclusive_released(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, false, true, false); +} + /** * devm_reset_control_get_shared - resource managed reset_control_get_shared() * @dev: device to be reset by the controller @@ -396,6 +651,26 @@ static inline struct reset_control *devm_reset_control_get_shared( return __devm_reset_control_get(dev, id, 0, true, false, false); } +/** + * devm_reset_control_bulk_get_shared - resource managed + * reset_control_bulk_get_shared() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_get_shared(). For reset controllers returned + * from this function, reset_control_put() is called automatically on driver + * detach. + * + * See reset_control_bulk_get_shared() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_shared(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, false); +} + /** * devm_reset_control_get_optional_exclusive - resource managed * reset_control_get_optional_exclusive() @@ -414,6 +689,26 @@ static inline struct reset_control *devm_reset_control_get_optional_exclusive( return __devm_reset_control_get(dev, id, 0, false, true, true); } +/** + * devm_reset_control_bulk_get_optional_exclusive - resource managed + * reset_control_bulk_get_optional_exclusive() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_get_optional_exclusive(). For reset controllers + * returned from this function, reset_control_put() is called automatically on + * driver detach. + * + * See reset_control_bulk_get_optional_exclusive() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_optional_exclusive(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, false, true); +} + /** * devm_reset_control_get_optional_shared - resource managed * reset_control_get_optional_shared() @@ -432,6 +727,26 @@ static inline struct reset_control *devm_reset_control_get_optional_shared( return __devm_reset_control_get(dev, id, 0, true, true, false); } +/** + * devm_reset_control_bulk_get_optional_shared - resource managed + * reset_control_bulk_get_optional_shared() + * @dev: device to be reset by the controller + * @num_rstcs: number of entries in rstcs array + * @rstcs: array of struct reset_control_bulk_data with reset line names set + * + * Managed reset_control_bulk_get_optional_shared(). For reset controllers + * returned from this function, reset_control_put() is called automatically on + * driver detach. + * + * See reset_control_bulk_get_optional_shared() for more information. + */ +static inline int __must_check +devm_reset_control_bulk_get_optional_shared(struct device *dev, int num_rstcs, + struct reset_control_bulk_data *rstcs) +{ + return __devm_reset_control_bulk_get(dev, num_rstcs, rstcs, true, true, false); +} + /** * devm_reset_control_get_exclusive_by_index - resource managed * reset_control_get_exclusive() From patchwork Sun Mar 14 15:44:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400590 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 BE151C433DB for ; Sun, 14 Mar 2021 15:48:56 +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 3632F64E76 for ; Sun, 14 Mar 2021 15:48:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3632F64E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 C3C27175D; Sun, 14 Mar 2021 16:48:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C3C27175D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736934; bh=2o02kxObP8vZWJHIkqiH/XtK7iSbEQcwW9atlmEnfZk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=q5/Y4SeliMM6LYcdF4g7efEFByYPKHsPuwCeqxQrwf1evY8SiRYvrW8AyLft1QaGi NBsT76hE8iUDXSHApeil1EQZXVmGQZ8Dw1phBOam1RrGvBhaIGYLDUUdILvcrgLMQa doBOGlfCml/+/xANa+cbyY4b4k0seupmCntKgxjk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CBE46F804D8; Sun, 14 Mar 2021 16:45:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 885EFF8025E; Sun, 14 Mar 2021 16:45:40 +0100 (CET) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 ACCBBF8026F for ; Sun, 14 Mar 2021 16:45:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ACCBBF8026F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jJ/BZync" Received: by mail-wr1-x42f.google.com with SMTP id a18so7413051wrc.13 for ; Sun, 14 Mar 2021 08:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yo0DRyLfMdS/j9P7eQL+O2aT/Ez0SnRAKsDDApXEiOY=; b=jJ/BZyncJRfhKKmXkvgQNnLJIhU7RQvuOYo8shnDMWkOst4pPuAz7/cwnLTvm/+x0d D5wJz2mXi2BZwDuitPXCBp81gvW3yQov3x5XoDhX0mz/6QI21ZAllR8omHIbhmiZ3Nic vVF6syq/mGYb4ks1Yrk76ZgE55GWet3woJ+1OSADcvx0TktzevMArWfscNehin71Bah5 4NK2V8iobPoDO1Sbg1vUwvribZuVkQ+rVmfcP2PPuRyPdSR6N/AVuVi1pZNyE0DWjfsb 90KwtGxw/UNGQ+3nxVVcnBeBbfc27ItHNyipNm/cE5EDKozu+d+ASMf1QHPSfpR8chOE Blnw== 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=Yo0DRyLfMdS/j9P7eQL+O2aT/Ez0SnRAKsDDApXEiOY=; b=sDM9cP735FYHdaMy6YPbOhJTwn60t2Gmm+/ttJT+m5WgxNVuZlx45Kvxpdp7TXnA25 cUR2DNc/ttVoh2deJz2KcJh/0mBSry8G9TW8/FCTLpTZcOF30egjlwOstD2lgyQX2rzA 6pj+ZMgQhzCy+hErcqBsD+USdbcu16bRTnpCsQACJwLr8RllPgv3EJFKXm3kpQfNzw6b U7vtj9UrO6bJ/q0MGe4oe/0wTNWbaZVMqoz2/bjxM+vbIMTSLHtYDXmbB6L1jR3p0rRk El9YQCKUQL5AJoGuikqUygLUuPAaBSEeMZtWHAmiKDmDrwmWSA8ySOncNcVdnuk4DimG SMvA== X-Gm-Message-State: AOAM533X15G+bVvLKSP3o3zbLw3Yn3tecz/F10KMhhvbtyKcJyfwrml0 BKaCVxngcoDRYTqi7TqGPOY= X-Google-Smtp-Source: ABdhPJyDT4pLIsro6nojtW1e4VZkXzVxlPSeQv5ftQi+RThjBmmhYnd4RZTldwpotwuNfw1GuG4CKg== X-Received: by 2002:a5d:4ec5:: with SMTP id s5mr23840290wrv.168.1615736725669; Sun, 14 Mar 2021 08:45:25 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:25 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 05/17] ASoC: tegra30: ahub: Switch to use reset-bulk API Date: Sun, 14 Mar 2021 18:44:47 +0300 Message-Id: <20210314154459.15375-6-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Switch to use reset-bulk API in order to make code cleaner. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_ahub.c | 104 ++++++++++++--------------------- sound/soc/tegra/tegra30_ahub.h | 5 +- sound/soc/tegra/tegra30_i2s.c | 1 + 3 files changed, 40 insertions(+), 70 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 9ef05ca4f6c4..d24c26f4960d 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -65,7 +65,7 @@ static int tegra30_ahub_runtime_resume(struct device *dev) { int ret; - ret = reset_control_assert(ahub->reset); + ret = reset_control_bulk_assert(ahub->nresets, ahub->resets); if (ret) return ret; @@ -75,7 +75,7 @@ static int tegra30_ahub_runtime_resume(struct device *dev) usleep_range(10, 100); - ret = reset_control_deassert(ahub->reset); + ret = reset_control_bulk_deassert(ahub->nresets, ahub->resets); if (ret) goto disable_clocks; @@ -339,41 +339,28 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif) } EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); -#define MOD_LIST_MASK_TEGRA30 BIT(0) -#define MOD_LIST_MASK_TEGRA114 BIT(1) -#define MOD_LIST_MASK_TEGRA124 BIT(2) - -#define MOD_LIST_MASK_TEGRA30_OR_LATER \ - (MOD_LIST_MASK_TEGRA30 | MOD_LIST_MASK_TEGRA114 | \ - MOD_LIST_MASK_TEGRA124) -#define MOD_LIST_MASK_TEGRA114_OR_LATER \ - (MOD_LIST_MASK_TEGRA114 | MOD_LIST_MASK_TEGRA124) - -static const struct { - const char *rst_name; - u32 mod_list_mask; -} configlink_mods[] = { - { "d_audio", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "apbif", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "i2s0", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "i2s1", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "i2s2", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "i2s3", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "i2s4", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "dam0", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "dam1", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "dam2", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "spdif", MOD_LIST_MASK_TEGRA30_OR_LATER }, - { "amx", MOD_LIST_MASK_TEGRA114_OR_LATER }, - { "adx", MOD_LIST_MASK_TEGRA114_OR_LATER }, - { "amx1", MOD_LIST_MASK_TEGRA124 }, - { "adx1", MOD_LIST_MASK_TEGRA124 }, - { "afc0", MOD_LIST_MASK_TEGRA124 }, - { "afc1", MOD_LIST_MASK_TEGRA124 }, - { "afc2", MOD_LIST_MASK_TEGRA124 }, - { "afc3", MOD_LIST_MASK_TEGRA124 }, - { "afc4", MOD_LIST_MASK_TEGRA124 }, - { "afc5", MOD_LIST_MASK_TEGRA124 }, +static const struct reset_control_bulk_data tegra30_ahub_resets_data[] = { + { "d_audio" }, + { "apbif" }, + { "i2s0" }, + { "i2s1" }, + { "i2s2" }, + { "i2s3" }, + { "i2s4" }, + { "dam0" }, + { "dam1" }, + { "dam2" }, + { "spdif" }, + { "amx" }, /* Tegra114+ */ + { "adx" }, /* Tegra114+ */ + { "amx1" }, /* Tegra124 */ + { "adx1" }, /* Tegra124 */ + { "afc0" }, /* Tegra124 */ + { "afc1" }, /* Tegra124 */ + { "afc2" }, /* Tegra124 */ + { "afc3" }, /* Tegra124 */ + { "afc4" }, /* Tegra124 */ + { "afc5" }, /* Tegra124 */ }; #define LAST_REG(name) \ @@ -502,17 +489,17 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = { }; static struct tegra30_ahub_soc_data soc_data_tegra30 = { - .mod_list_mask = MOD_LIST_MASK_TEGRA30, + .num_resets = 11, .set_audio_cif = tegra30_ahub_set_cif, }; static struct tegra30_ahub_soc_data soc_data_tegra114 = { - .mod_list_mask = MOD_LIST_MASK_TEGRA114, + .num_resets = 13, .set_audio_cif = tegra30_ahub_set_cif, }; static struct tegra30_ahub_soc_data soc_data_tegra124 = { - .mod_list_mask = MOD_LIST_MASK_TEGRA124, + .num_resets = 21, .set_audio_cif = tegra124_ahub_set_cif, }; @@ -527,8 +514,6 @@ static int tegra30_ahub_probe(struct platform_device *pdev) { const struct of_device_id *match; const struct tegra30_ahub_soc_data *soc_data; - struct reset_control *rst; - int i; struct resource *res0; void __iomem *regs_apbif, *regs_ahub; int ret = 0; @@ -541,34 +526,16 @@ static int tegra30_ahub_probe(struct platform_device *pdev) return -EINVAL; soc_data = match->data; - /* - * The AHUB hosts a register bus: the "configlink". For this to - * operate correctly, all devices on this bus must be out of reset. - */ - for (i = 0; i < ARRAY_SIZE(configlink_mods); i++) { - if (!(configlink_mods[i].mod_list_mask & - soc_data->mod_list_mask)) - continue; - - rst = reset_control_get_exclusive(&pdev->dev, - configlink_mods[i].rst_name); - if (IS_ERR(rst)) { - dev_err(&pdev->dev, "Can't get reset %s\n", - configlink_mods[i].rst_name); - ret = PTR_ERR(rst); - return ret; - } - - /* just check presence of the reset control in DT */ - reset_control_put(rst); - } - ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub), GFP_KERNEL); if (!ahub) return -ENOMEM; dev_set_drvdata(&pdev->dev, ahub); + BUILD_BUG_ON(sizeof(ahub->resets) != sizeof(tegra30_ahub_resets_data)); + memcpy(ahub->resets, tegra30_ahub_resets_data, sizeof(ahub->resets)); + + ahub->nresets = soc_data->num_resets; ahub->soc_data = soc_data; ahub->dev = &pdev->dev; @@ -579,10 +546,11 @@ static int tegra30_ahub_probe(struct platform_device *pdev) if (ret) return ret; - ahub->reset = devm_reset_control_array_get_exclusive(&pdev->dev); - if (IS_ERR(ahub->reset)) { - dev_err(&pdev->dev, "Can't get resets: %pe\n", ahub->reset); - return PTR_ERR(ahub->reset); + ret = devm_reset_control_bulk_get_exclusive(&pdev->dev, ahub->nresets, + ahub->resets); + if (ret) { + dev_err(&pdev->dev, "Can't get resets: %d\n", ret); + return ret; } res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h index 3b85244f87f1..c9eaf4ec8f6e 100644 --- a/sound/soc/tegra/tegra30_ahub.h +++ b/sound/soc/tegra/tegra30_ahub.h @@ -491,7 +491,7 @@ void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg, struct tegra30_ahub_cif_conf *conf); struct tegra30_ahub_soc_data { - u32 mod_list_mask; + unsigned int num_resets; void (*set_audio_cif)(struct regmap *regmap, unsigned int reg, struct tegra30_ahub_cif_conf *conf); @@ -511,7 +511,8 @@ struct tegra30_ahub_soc_data { struct tegra30_ahub { const struct tegra30_ahub_soc_data *soc_data; struct device *dev; - struct reset_control *reset; + struct reset_control_bulk_data resets[21]; + unsigned int nresets; struct clk_bulk_data clocks[2]; unsigned int nclocks; resource_size_t apbif_addr; diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 3d22c1be6f3d..614b67be1dd9 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include From patchwork Sun Mar 14 15:44:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400153 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 A10A6C433DB for ; Sun, 14 Mar 2021 15:48:43 +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 B700264E51 for ; Sun, 14 Mar 2021 15:48:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B700264E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 51CB91745; Sun, 14 Mar 2021 16:47:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 51CB91745 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736921; bh=Gs2A0xvbc0is2i+qL5goMgUNCEHKAxmhf/EORe3JWok=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Hoz367FKN+HeAfzU7WF5ckObuz5j+KTEPpsJPk3OrsW4GH5V0okCQt47ItYNgLhqc 9BzQ/CxBy/UPTqln95SzQcNr3fQJqiCfPeKnE9yrCgbf5j3RvehVbT8ygl/3aO1LRt T3cI/FS81UclwXg6bZJRlgGMQNuXr7ad7VFB2S7w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 33119F804BD; Sun, 14 Mar 2021 16:45:44 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 095E3F804AE; Sun, 14 Mar 2021 16:45:40 +0100 (CET) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 0FDF6F8025E for ; Sun, 14 Mar 2021 16:45:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0FDF6F8025E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="neiMlt4a" Received: by mail-wr1-x42d.google.com with SMTP id x16so4459440wrn.4 for ; Sun, 14 Mar 2021 08:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/RPbfN09KLR8+OBhXwBaCOg2Gccjzu39uZXtdRMFwFs=; b=neiMlt4aIX9NcGRwB/ENW/+akFv1X4d1TxYysbGr4NzZLk8oYx98BAFtcEYdaJCY9F sqRjDeHMpQGAHxLXOP7yc6UrkgZy4msdycmGA4XP0aPnNLgbd4FXRcJVEry6RXFuXaKk oAIPqJETL11VPZF2UBZ7cqcbr8dWbHrJb2kuXrD/ZKVYGI6FfsqP34B1X2ati2S3XLSr 0Wtia/5TigctUVouMiPPNyLEPvX3pyJCYmcx256a/CpmNVWesjc3pxJJVDn1gDryaAPU TP9hH1wzCB0FD24SBIIyiJPCCN3SzmoiyTDLHF6ikb+9kzSGpD8CnUjI78v09z1TEK9v kzaA== 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=/RPbfN09KLR8+OBhXwBaCOg2Gccjzu39uZXtdRMFwFs=; b=FzmfJfWoLo9gzc9n3pWOmUQCxl0WjBl9qjStaslhH93zrDbgckIkR6HwwdWYBav85y AwYycpaBG+PIM+7ctjQLAJngW/7VoFvTCQZWkkkFntWGkIMEYIS2aF9+8O+OkCxjynyH 6LKqdij6HTgo8VnZkpJ3Tss5RdA65KZhADov96/YwqUlKWiCZkaw7swZQWRgibE2YHe/ 5NtcZI97ftscYsyM3qM5BPwf1jxZK1XXUKqoM/dGu3lor6icRIeXtiHDpYWXWhFxnVA9 t98naRQbbxByfvW6tUJluPC7AP67iCW1oTqCpDgdkXsHSkYL4Xqt9Ycd2CLnZkUkGAMP P4aQ== X-Gm-Message-State: AOAM532pzF4iQpkZBrpQ5xtoquN6bt+mKn6YGx3VblNxR92TYRe0bAmy yqd48LmdnzXKhSJzu+XESW4= X-Google-Smtp-Source: ABdhPJznbYoJP8rsmrWHGlDJ1JSSCuHBF0G1oJW1BSqcpXmNzWSGGJ5YBiDocMB3+D9Gtky4r6LvkQ== X-Received: by 2002:a5d:698e:: with SMTP id g14mr23119177wru.127.1615736726655; Sun, 14 Mar 2021 08:45:26 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:26 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 06/17] ASoC: tegra20: spdif: Correct driver removal order Date: Sun, 14 Mar 2021 18:44:48 +0300 Message-Id: <20210314154459.15375-7-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra20 SPDIF driver has a wrong driver removal order, which should be opposite to the registration order, but it's not. In particular the runtime PM is disabled in a wrong order. Fix the order. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c index 5839833e23a0..e48d332506a0 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -329,13 +329,13 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) static int tegra20_spdif_platform_remove(struct platform_device *pdev) { + tegra_pcm_platform_unregister(&pdev->dev); + snd_soc_unregister_component(&pdev->dev); + pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra20_spdif_runtime_suspend(&pdev->dev); - tegra_pcm_platform_unregister(&pdev->dev); - snd_soc_unregister_component(&pdev->dev); - return 0; } From patchwork Sun Mar 14 15:44:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400154 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 12B67C433E0 for ; Sun, 14 Mar 2021 15:47:54 +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 7A54B64E89 for ; Sun, 14 Mar 2021 15:47:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A54B64E89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 08CAD171F; Sun, 14 Mar 2021 16:47:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 08CAD171F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736872; bh=U5IMjyILfVOzG1qqR8+mgv2ghD2dKifB9XlpewxvE/M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Oi6MOu6aVc5Mx2kprdNnvG11uKKQHTzeENJ1ag0J4mAj6GlvGxmH7yiXcRm256wMk upgCClMxHuMd5IQQuI58HWje2qMTQsiFoMhSGMG7fArdmYEup7sZmZpv2yyLSvtRlR n/lEZKKc+XgIHhgmMoN58BZrJcefdH1WJUqspYXc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D63FEF804AA; Sun, 14 Mar 2021 16:45:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 03885F804A9; Sun, 14 Mar 2021 16:45:36 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 18EA0F8026A for ; Sun, 14 Mar 2021 16:45:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18EA0F8026A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R2KJrX5j" Received: by mail-wr1-x431.google.com with SMTP id b9so4456921wrt.8 for ; Sun, 14 Mar 2021 08:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iCLWBBqHBwluoiOOJDI5uMrTVFtzy0ArpO4aAlC/nzc=; b=R2KJrX5jiM5ZduJ6elrOV/mm2ZzDVmxC9t9WAmsRmyga5VvtJVcz7HJGwSvAta+XII 6o96r06jdZIFr1GjOIpus/TyOPmcBH4HkvO5OMzu9klUJ817u3lRezSilzmZL8uamtEE pO5PNFObIb9A595AWwP6spAQfX44z+LhnrPHjI4f+XZsGR3mHb86yD4U9Q6RKzaqIHeU GeTWbF4lvo5Z8eHueZTtBdjOONkmtODi202CTD+BRhIUJpU2cce+Tk8AeCjZGSpwTNFd rCSZy8nPJ7X2FhsOpX/QhgOFNQtiqGjKmrsN/EEAz4/C6XligZMICxE6zJTLfHqhpskf BA7g== 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=iCLWBBqHBwluoiOOJDI5uMrTVFtzy0ArpO4aAlC/nzc=; b=GpfsOynTnGyZ0VojkPFABrXZrg+yQ7axce0usgQKwC0vLxBsfrcLCG+cBFgSnujuna FxkvKtl+zphWBrQ4diTqhh744jiB6LIsyMPpuFNjLk1fTdIWIOOCz4uJRkwsLWtoBCQ7 Q27+UuBU5GLmCkwqwmmLg65CAWsnSTuqy2BipdpPpt/i+aONoQmRnVcU/nCV9TZqNPQA J8Xz/3qk+s6yAQy0etEgf5L8MTZr54AQpWIa9MR60tFlrYamlHznLXviHOVp1ChTS9Op apChh2zirVXuWXpUhZQlcRRZzh6pPKtNVcl1dNUXnfyouK9BkuxmJfbkGFWsdLPV/BGy rjnQ== X-Gm-Message-State: AOAM531aUoY38HCguytb3BWzqQT3hjTjHu8Wp8jgFIgQNyzuDAvAWdlV W0gEaRkS4RDPGzQuaBsM9vYz59Ab6+8= X-Google-Smtp-Source: ABdhPJzrCmAwXQXLkCinKkRoszXsLepF9evCyigdVm6SFGYqK4jTQojMCwnap9KNm9463wv78u6a7g== X-Received: by 2002:adf:9bce:: with SMTP id e14mr24516002wrc.29.1615736727677; Sun, 14 Mar 2021 08:45:27 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:27 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 07/17] ASoC: tegra20: spdif: Remove handing of disabled runtime PM Date: Sun, 14 Mar 2021 18:44:49 +0300 Message-Id: <20210314154459.15375-8-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Runtime PM is always available on Tegra since commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), hence there is no need to handle the case of a disabled RPM by Tegra drivers. Remove handing of a disabled runtime PM from Tegra20 SPDIF driver. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_spdif.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c index e48d332506a0..7b597ee63cb5 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -294,18 +294,13 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) spdif->playback_dma_data.slave_id = dmareq->start; pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { - ret = tegra20_spdif_runtime_resume(&pdev->dev); - if (ret) - goto err_pm_disable; - } ret = snd_soc_register_component(&pdev->dev, &tegra20_spdif_component, &tegra20_spdif_dai, 1); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); ret = -ENOMEM; - goto err_suspend; + goto err_pm_disable; } ret = tegra_pcm_platform_register(&pdev->dev); @@ -318,9 +313,6 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) err_unregister_component: snd_soc_unregister_component(&pdev->dev); -err_suspend: - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra20_spdif_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); @@ -333,8 +325,6 @@ static int tegra20_spdif_platform_remove(struct platform_device *pdev) snd_soc_unregister_component(&pdev->dev); pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra20_spdif_runtime_suspend(&pdev->dev); return 0; } From patchwork Sun Mar 14 15:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400149 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 9C9B8C433DB for ; Sun, 14 Mar 2021 15:51:54 +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 1589864E51 for ; Sun, 14 Mar 2021 15:51:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1589864E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 A41121745; Sun, 14 Mar 2021 16:51:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A41121745 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737112; bh=3exbRPU3vyjZG4OS8bm2QBQ39WjIaqaRHR7hZY11sI4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WDYwcIHOc9cHKi8BQwgUf9xVvHTsNMK3De6jbv4NRytj4u6h1795+Tc7QdCpz6lzp Cqeht/eaX7pP3BKRa3px6v2Awu6k4nVA41ERTVmTaTp/err5jzYlJO4Qa36e3LXR9a r8aMOHutbtE0CfYNnjh5w3GICctsR4YtDmTYZzmo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B883CF80519; Sun, 14 Mar 2021 16:45:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 71A23F804E4; Sun, 14 Mar 2021 16:45:52 +0100 (CET) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 6F76AF8042F for ; Sun, 14 Mar 2021 16:45:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F76AF8042F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KKfe44JV" Received: by mail-wr1-x432.google.com with SMTP id b9so4456937wrt.8 for ; Sun, 14 Mar 2021 08:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oD3FaI4IefheXyOruQTSZ8GPhKjZkAiPZDDxvon3Qf0=; b=KKfe44JVwuQ/IBwSvIg3rcroBJOZn6rWeUXbyoRs8WuIzwBr2SVINJDN4xhqpXSpQC 6rUZdgP/vS9Ok7xTyvcLS2Z6WjYgYF7lpIUa6URhis1da+S6ZVBRR8U0EHMyVZZ3YCx1 47PVHWWsiJZdFIkfqk48U+oVdRaafucgvDrdM0OtvuciQlPfuMI1+QcGF5RA02uJ2TAC lD2mjwiCeVk8WBmriPbIuSph0iDaYZMVl78ua5zuqENTJXFrEz6+FIcGVsYae+s31CuC +YNaXKPLeUY5Z55WMGTRfXMaMXKKdaTMS0Ja62pj0fFzj3mn3li2zc15e+N7z5j7I88g q6mA== 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=oD3FaI4IefheXyOruQTSZ8GPhKjZkAiPZDDxvon3Qf0=; b=Grng8I5nIjAr2Jt+D47nY+cvJ4tuP4tua8sh6EMl799GtNrsAPtgkl091/loFaLtTS hstT2WHq6FABOoUgoIipSJkIqEV2c2Ya7IZudXXnv770ugrtTc8pAhH1P1COKKyrAPLE nVTlRvMg0REtIim+FdccNrPjFyuPirglaBJ6RAMLhQX9f34iybQKzcpReMDmKHY0Gq9X xvlvZlaYCNhlgv8Lvoz0c6Wq8IUK8eNzs8VONM7ogGBDyXUjNvWQ3vc246aFHIuNdkiG Codq08egZM+Ir2vgU9KSGv42VL8u4BDuCq9rQfUdxmtN/YbSTaNPo9r0TdjD9DlYjsje wGZg== X-Gm-Message-State: AOAM530egOA23s20lUV9513UuWZSsCQfybdEPZOvSQ0kkKThK498BzfX RzXTit2FJMeU1ul10p5uABM= X-Google-Smtp-Source: ABdhPJzDp5zth7DowoByIIzbNFBq6dWh7HlXTtOifkclsw34ZZSdE40cm2y12jMfgTOfLaOfYumI7A== X-Received: by 2002:a5d:4203:: with SMTP id n3mr23094069wrq.116.1615736728700; Sun, 14 Mar 2021 08:45:28 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:28 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 08/17] ASoC: tegra20: i2s: Add system level suspend-resume callbacks Date: Sun, 14 Mar 2021 18:44:50 +0300 Message-Id: <20210314154459.15375-9-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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 system level suspend-resume callbacks in order to ensure that I2S is gated before system is suspended. This puts Tegra20 I2S driver on par with the Tegra30 I2S driver. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index c0af5352b483..267517446d27 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -460,6 +460,8 @@ static const struct of_device_id tegra20_i2s_of_match[] = { static const struct dev_pm_ops tegra20_i2s_pm_ops = { SET_RUNTIME_PM_OPS(tegra20_i2s_runtime_suspend, tegra20_i2s_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver tegra20_i2s_driver = { From patchwork Sun Mar 14 15:44:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400589 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 858EBC433DB for ; Sun, 14 Mar 2021 15:49:39 +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 A820F64E76 for ; Sun, 14 Mar 2021 15:49:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A820F64E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 411E417A3; Sun, 14 Mar 2021 16:48:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 411E417A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736977; bh=kPUUSenYzptj8r+Zf7M6AevhdBe4uyS7b1cOVopMf2M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IjmgILNAMrKaCVR860TY7awvDM1cUWSzJPG809HTr9KtYLhROHufbElBTc3QbpBwy nrOLicaW2c4yuYp+C6Uyjq+jOHmxn++bxJtY99AvnuPjoEssHqtz11ltKovhaO9EY2 CjLuE1on+tyn038zPFpeEa21lPN9i2EpOk6ctgIk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 29F33F804E3; Sun, 14 Mar 2021 16:45:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 131BDF804B2; Sun, 14 Mar 2021 16:45:42 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 BF9BAF8032D for ; Sun, 14 Mar 2021 16:45:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BF9BAF8032D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZYxiTzHu" Received: by mail-wr1-x42e.google.com with SMTP id e10so7428427wro.12 for ; Sun, 14 Mar 2021 08:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f6C5LnJcPjvrSoy/lW5/dsmp2Az/VjPBdQ0RoCAGgfc=; b=ZYxiTzHuyZcBK0UmcnUMMH2wRhTl8IC9KjHzV4UiQHTwXYXCQ4DuHAFmssHWQQe5Ep JKNxFfS+xnNMvxIlbXBKxXN4PO60R0jQOzt5KWqrk57csAkbqxsEF1I6Hg+Oxy8/Wrk5 mvaVKDn8I8nTuNJ+242qcfWHFmfwgJt0GRl8p3qqQjeIZY6/PaNzlzx8e3v7eIcVUGyn Ds0f1y3RimkVFewBa+h8AKsauiu2qsw4zlCV9AnORuNZS6VFp/XQ2EzbvngAhdH71MlV 0pXNKNDyZbZsrkQWMmybLEgakqVBJR2xGxQ6Hnq5nJg7y/eWQea0bnIoyky9kZfN+Z/N Nbqw== 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=f6C5LnJcPjvrSoy/lW5/dsmp2Az/VjPBdQ0RoCAGgfc=; b=hyRQU2FX/EpaT+OnOkNEv3AZa6C/oJtp0eIgUNCrrwAi+0vRzNqFrWiL8WPUomG+W6 MbFqOw+VDhtLhVW+u3R6gHw1jqReFQUnlJ2dfG72wJkIBnnJ5l4asB/uNHAlycXF2Qv+ WmICObZmUx6+zdEUBZY29VwIfUE71R71oTCYYBljATyYQ0P+SiTXBBev/+KpAjvVmB7p Set4fCxCuCCRLU4yzulGOCp4KLLAVlI5IKGpQGscKHLG2ZiYcfCJGApo6+xrMkJOHKXA +0gIPgPDniqHhdsHy11Lm71ZbSuW83Yns0A8xE3ibEMmqgxXSGyrzGFj4lfO/vmwELEc Zluw== X-Gm-Message-State: AOAM530uJIVslIlpttbDbdDTdpOKPNtYaT3jYNAMwUnWiYrm/30cn/fg s63Od24tWmsoHnNunhrUi5s= X-Google-Smtp-Source: ABdhPJxXAO+1FBI64G8zBdvT7vnz3Vqw9PUJEJpwZD9Nk01gBQn6RH3itOOLxfyExn9w7NOHrnJzhg== X-Received: by 2002:adf:a2c2:: with SMTP id t2mr23194274wra.47.1615736729659; Sun, 14 Mar 2021 08:45:29 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:29 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 09/17] ASoC: tegra20: i2s: Correct driver removal order Date: Sun, 14 Mar 2021 18:44:51 +0300 Message-Id: <20210314154459.15375-10-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra20 I2S driver has a wrong driver removal order, which should be opposite to the registration order, but it's not. In particular the runtime PM is disabled in a wrong order. Fix the order. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index 267517446d27..0f2bdc2e8598 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -440,13 +440,13 @@ static int tegra20_i2s_platform_remove(struct platform_device *pdev) { struct tegra20_i2s *i2s = dev_get_drvdata(&pdev->dev); + tegra_pcm_platform_unregister(&pdev->dev); + snd_soc_unregister_component(&pdev->dev); + pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra20_i2s_runtime_suspend(&pdev->dev); - tegra_pcm_platform_unregister(&pdev->dev); - snd_soc_unregister_component(&pdev->dev); - clk_put(i2s->clk_i2s); return 0; From patchwork Sun Mar 14 15:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400152 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 837DAC433DB for ; Sun, 14 Mar 2021 15:49:26 +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 ED13B64E51 for ; Sun, 14 Mar 2021 15:49:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED13B64E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 80E01171F; Sun, 14 Mar 2021 16:48:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 80E01171F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615736964; bh=bGLfxfoc97+Wm7TDtKJmLVizjezZOPD9Fy03oG8L+QA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YY+ErnwRx4jN6BIjyhURdoTQpNPCa3au0UXzIWADXjsmhFiwrUJ/JKrHs0ZgtFZAM 6TP68oIe+XugSgnWSQGDcvtBSyTs7yOST4FIa8eBPrj4MogPPs8tTmSeGPWlbwYrAv 2STAEci8FkBtHKWOs9ofmLXqJvh4gjTfvaf7DojM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F697F804E0; Sun, 14 Mar 2021 16:45:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1899DF804B0; Sun, 14 Mar 2021 16:45:41 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 7A746F8032C for ; Sun, 14 Mar 2021 16:45:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7A746F8032C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FricUU/Z" Received: by mail-wm1-x330.google.com with SMTP id g25so6681860wmh.0 for ; Sun, 14 Mar 2021 08:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uwOwpk83R+cdKaOIdKgxM+y8AmMlhEg4nEbu82oea8Y=; b=FricUU/Zao/xfxzFKTc/T0yHKvS5FKBGmCGggEL+kCVwYG10h72X7XZDuRwAeTS8ip 5F49BIStvN+EtFtHbcAWlS4gZAB1quwkgVHafSXe2mKDqSTnF/U9UPj27kcKuW49WYwY 8c+6lqTeuZJfDkrSIIUb4eeqbPQu44Z3d1cqOk/pODSIXib2UHUCO0/7ApureugiyYnT Q3An7Ku5jD4618Z1DIF3m3sxdxKiQTE3D7qZF+8Mxv+X/3NGj3eZQzF1pPS+uc0+IdKp 3feJFt+mpxCi3ZsYL7HFBiYYPTHAA7ewSEDHvjis31OEfWaAZXLqy9NbGgWqAwbTvniW gX5g== 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=uwOwpk83R+cdKaOIdKgxM+y8AmMlhEg4nEbu82oea8Y=; b=U9gElvZ+noEmxu3i28570HxbI6VAmelRBTVX7SL7G1G5dgQI22o+Or48tx9zwOvpim QVAMVNsIr/bGm9443Wfd6+IXit0ipOE3ClUi1z3szWrtwLn6Fk+M9K3m1zbG6UL0zPK+ tuv6UeBuJpqLbde78s7y9+KiuscEkgqOTgfErn9zcMj187Lei7+bdwaLWVp8B4xHZ10p dRuQKXMqFQ59xAJKTC9EyIl8bwr08kpZVn6p+4QAdfaZkabSOb4c32ioduacxAIakRwb JY8P7/A5770zTGZhIIYpvF24KDFsO9rTkzepsNgYz30f8ZhZ9TRX5X+dYIDP5RiRAy15 vrZw== X-Gm-Message-State: AOAM5339dagNiMR/H2Q3H9b28UpSfqAccWnBgzJ75dDfyYlyGmhK90Q1 iNAkTKSvN6xH2sEx4LZiMOg13q8B1dM= X-Google-Smtp-Source: ABdhPJz5OaywGExFLiRmwwnO3hyEECgOoB4oHGxY5YtIYXgA3PAkWwqN8R9YoMcN8/QUH/w8/RFJAA== X-Received: by 2002:a05:600c:22cd:: with SMTP id 13mr21770353wmg.90.1615736730659; Sun, 14 Mar 2021 08:45:30 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:30 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 10/17] ASoC: tegra20: i2s: Use devm_clk_get() Date: Sun, 14 Mar 2021 18:44:52 +0300 Message-Id: <20210314154459.15375-11-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Use resource-managed variant of clk_get() to simplify code. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index 0f2bdc2e8598..fe569198b17a 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -370,7 +370,7 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) return PTR_ERR(i2s->reset); } - i2s->clk_i2s = clk_get(&pdev->dev, NULL); + i2s->clk_i2s = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(i2s->clk_i2s)) { dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); ret = PTR_ERR(i2s->clk_i2s); @@ -381,7 +381,7 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) regs = devm_ioremap_resource(&pdev->dev, mem); if (IS_ERR(regs)) { ret = PTR_ERR(regs); - goto err_clk_put; + goto err; } i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -389,7 +389,7 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) if (IS_ERR(i2s->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(i2s->regmap); - goto err_clk_put; + goto err; } i2s->capture_dma_data.addr = mem->start + TEGRA20_I2S_FIFO2; @@ -430,16 +430,12 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) tegra20_i2s_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - clk_put(i2s->clk_i2s); err: return ret; } static int tegra20_i2s_platform_remove(struct platform_device *pdev) { - struct tegra20_i2s *i2s = dev_get_drvdata(&pdev->dev); - tegra_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); @@ -447,8 +443,6 @@ static int tegra20_i2s_platform_remove(struct platform_device *pdev) if (!pm_runtime_status_suspended(&pdev->dev)) tegra20_i2s_runtime_suspend(&pdev->dev); - clk_put(i2s->clk_i2s); - return 0; } From patchwork Sun Mar 14 15:44:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400585 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 28C11C433DB for ; Sun, 14 Mar 2021 15:52:51 +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 866C564E51 for ; Sun, 14 Mar 2021 15:52:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 866C564E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 131F917D8; Sun, 14 Mar 2021 16:51:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 131F917D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737169; bh=ZfEjQD6vml11tT8+GwfnTrPvotB2NMus3N7hexGM88E=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oKWT/AMzKYR6wkfRLwzuBLP2niYTSy0qRkSEEr3u36TjW0Li4H2+YUWlSvrxHwp+H 8rBKQvCxeWKP7VexLx11x5vcqnL0WxS8zKBlxWv4tguYiLJsKhld41o4SLg1HiNiMG MsC3JFGMPtcfXrV8BIAET6gQXk/4d83cEZE1AUZQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DAE1BF80528; Sun, 14 Mar 2021 16:46:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 09DDEF804AE; Sun, 14 Mar 2021 16:45:54 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 377B7F80430 for ; Sun, 14 Mar 2021 16:45:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 377B7F80430 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bRLNLTAB" Received: by mail-wr1-x42a.google.com with SMTP id k8so4445373wrc.3 for ; Sun, 14 Mar 2021 08:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QpHXgChknEzhzYi4Q8rqZSYE4y3Oym7aFx47bTQjCRA=; b=bRLNLTABvbDYFY599i2T//8iHkJMDYKj6tzFPHL5SRb7AcALZZ0tKjQ5HdxlWBKjWt SyQ8A7RJU2hkiRLLJtJhOPzsDbpsLT/2dkHYZfviDM5OBmhMUumILoFGotrAY8soWdmY iKzKwqaZgmgpZsx5W23qofLLZaie4fRDfIg01+S70kAdvLXNbGAfhkNN4dnyZehpkVYV nF8qR7+vHHQikU6mecPKMNDN5E/JQVnRhgn2B8c8Njs9BsUUJIR9PewiDzSTy3aUCMn2 1hmnjgAZXcjogfiAAxxCg4d3gfteOrRJuowIVdRkdmpzvi3bDsxpD9bUkaEDeAgVzEbc CMyg== 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=QpHXgChknEzhzYi4Q8rqZSYE4y3Oym7aFx47bTQjCRA=; b=RwH0eI4ZeKdjfPB5RxLTSRwEr32cp00OsgZbhQfiFuiSwxFyYXz6LpmgPdIps7yFAm ZlELEcplLBO17FCckdGZM+WlqStK8WFDk2T63HMlOXxKercFPWLnOyxdIhRmuUeqONCQ J+vEUISne3/08L7nMrkam0CRd2LE/jFbu9j4CjaDVYb17+clOBJEDdBCKL0aDvC/FgeM VvOm0RvFzchmek69DBrpysHVH3Ur0S6R3IM7BUdMVi2Ukc/L8xP5g/NDfZ2DkZ0L91bT yEy/nxGiiqRqgjgDnULTDVaLADonIZT4/8Ilx3JZDPAvpgG+FPF+OgCtptca/F1AjZwT S8wA== X-Gm-Message-State: AOAM530Hk8EBHESyIbTdglJRvIjMz38TELWCGo3qlT7TX6C8C7L5TnUj 3fo9BMwbTFVZsr6yuSdnkcI= X-Google-Smtp-Source: ABdhPJyd0+Gt/PLPpYiHZG8ky3XiLj8yZZzNOhE6OO/1QCc4KEUkdkf0+qyy74cpcV5yufuKG140NA== X-Received: by 2002:a5d:4b50:: with SMTP id w16mr22810754wrs.34.1615736731999; Sun, 14 Mar 2021 08:45:31 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:31 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 11/17] ASoC: tegra20: i2s: Remove handing of disabled runtime PM Date: Sun, 14 Mar 2021 18:44:53 +0300 Message-Id: <20210314154459.15375-12-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Runtime PM is always available on Tegra since commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), hence there is no need to handle the case of a disabled RPM by Tegra drivers. Remove handing of a disabled runtime PM from Tegra20 I2S driver. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra20_i2s.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c index fe569198b17a..1b27f81c10fe 100644 --- a/sound/soc/tegra/tegra20_i2s.c +++ b/sound/soc/tegra/tegra20_i2s.c @@ -401,18 +401,13 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) i2s->playback_dma_data.maxburst = 4; pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { - ret = tegra20_i2s_runtime_resume(&pdev->dev); - if (ret) - goto err_pm_disable; - } ret = snd_soc_register_component(&pdev->dev, &tegra20_i2s_component, &i2s->dai, 1); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); ret = -ENOMEM; - goto err_suspend; + goto err_pm_disable; } ret = tegra_pcm_platform_register(&pdev->dev); @@ -425,9 +420,6 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) err_unregister_component: snd_soc_unregister_component(&pdev->dev); -err_suspend: - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra20_i2s_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); err: @@ -438,10 +430,7 @@ static int tegra20_i2s_platform_remove(struct platform_device *pdev) { tegra_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra20_i2s_runtime_suspend(&pdev->dev); return 0; } From patchwork Sun Mar 14 15:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400588 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=-10.9 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,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 CE285C433DB for ; Sun, 14 Mar 2021 15:50:36 +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 38B7964E51 for ; Sun, 14 Mar 2021 15:50:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38B7964E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 C3BE0172C; Sun, 14 Mar 2021 16:49:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C3BE0172C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737034; bh=HX3mEOg9d3uCuZEy4E/mCTiWcus4ISkCH9Sdy4A9fp4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Q47cSLj+n1aWymZHKlJMoitNM7IX0ouJJWTv4yIYNk+qUsZWqOr0OXC5gObUqpU0C 8sIT6ZRBkN8Mq/TfTF3IpUxgrBO//EcijDz8tiFxpu1hPaHtSEjpbJNRcJLcG7dFBI D3CCTtLdMGBTPQe20NPNLC4g4vAiNvY6PRuhL4h8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 64B94F804F3; Sun, 14 Mar 2021 16:45:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BF872F804E0; Sun, 14 Mar 2021 16:45:48 +0100 (CET) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 B1381F8049C for ; Sun, 14 Mar 2021 16:45:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B1381F8049C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PqY8pspj" Received: by mail-wm1-x32f.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso18033320wmi.0 for ; Sun, 14 Mar 2021 08:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JzwcPFMRL4SCj5tKsLwkCgmRXrfYV7RwVK3lOrEUoZY=; b=PqY8pspjct7c05jJSezcs85mAeuYf73dp7Szi5jnqSaTZRKSiZUNhYfMKdF5y1XvR4 1youylwgU7aKIKRwIaJZyVOy7D7iOhp9YJHv8G7f1MsDhqkyhoNufh2qPNYtG9W1QV/x wTI6qZ8jUTyG0YGS+t2oedPd0Fw8jcBzeXi2uAzLZbFDYJsc5gROXXAv+6V0DRhTUfCc DE7Xz0bv9xUfThPlljFe7FMU9HUbO8DKBaDv+7Z2B21uRMPg2oD3HM2QRUVSeGRkyWts ibSxsGUX3q8o+4XtW/IikvjhDDEoOL0WHVYmTMoxIERpIs0ZPx5cRYKc6DACFm24dgs+ KYmQ== 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=JzwcPFMRL4SCj5tKsLwkCgmRXrfYV7RwVK3lOrEUoZY=; b=V4gHltoGYDPziuk7dhjignMkIcRQ8iqJPWnqLr/ZDuKA2u6NvCxqP8WyRIYLUvKkm4 E8wkgJdvR5Ou9Adxyxy0OLJt0GnXP/lI2w46xF6o2O5HNUxukvzvC3+7ytOwOIYr9/28 TDt7dBhCzaSouJsAUzGhhTXVarnlNLnMxD86QaeoxdJX/NmRHbEP9HTzxbnPOV/B8O7Q uCbvatcCSK53j8/x/+zUKpdEdvAdX3+QIWshDlbmZz/RPblNmtlt+G9WsBfrodPHC/vE yf2jMYseNZaR4gxiSxpgxPhLVEHVglK0sVZIBfnTPfaHC0idBSrSgB0MMRxRPlPkHEqP Sj/g== X-Gm-Message-State: AOAM533n7iYMyzfPWnSQ0X2RJcrcRPh1E3nUBN02Vc3GM/1MXnI80ll4 WI1+ZSX2MDa+Gvo08eQsAN8= X-Google-Smtp-Source: ABdhPJxAdO+J40W47Rep4O6fTXvR5JrD5THBQUw12KxSOR5d5ay1lUZWilaKKcsQK0emtmamSDHRtg== X-Received: by 2002:a05:600c:608:: with SMTP id o8mr22841970wmm.42.1615736733234; Sun, 14 Mar 2021 08:45:33 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:33 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 12/17] ASoC: tegra30: i2s: Correct driver removal order Date: Sun, 14 Mar 2021 18:44:54 +0300 Message-Id: <20210314154459.15375-13-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra30 I2S driver has a wrong driver removal order, which should be opposite to the registration order, but it's not. In particular the runtime PM is disabled in a wrong order. Fix the order. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_i2s.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 614b67be1dd9..31e08c5c1405 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -544,10 +544,6 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) { struct tegra30_i2s *i2s = dev_get_drvdata(&pdev->dev); - pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra30_i2s_runtime_suspend(&pdev->dev); - tegra_pcm_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); @@ -557,6 +553,10 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif); tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); + pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) + tegra30_i2s_runtime_suspend(&pdev->dev); + clk_put(i2s->clk_i2s); return 0; From patchwork Sun Mar 14 15:44:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400148 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 86265C433E0 for ; Sun, 14 Mar 2021 15:52:35 +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 F354164E89 for ; Sun, 14 Mar 2021 15:52:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F354164E89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 941FC17EF; Sun, 14 Mar 2021 16:51:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 941FC17EF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737153; bh=jD02L9qM2MLfjWUSakVEKqKuEtClODg2jSNGJnSyVg4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OiZVPLEpLrd3VUTrh0r4SlROpSQCqyylCA8DJQ4TFM4In8oNd+66z14sB1DpUJ1G1 q48iq8gbjhYSosHAeFbw9Dl8PwPtQppdiDN0z2Ob5yR5RpKWFUKf28fPLjUAMnWFIN Dl0UzKlyV/LnMB6fz4NG4u0OQOtCSbJB7br45bg8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E5571F8051E; Sun, 14 Mar 2021 16:46:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9706DF80431; Sun, 14 Mar 2021 16:45:52 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 A3B8CF80431 for ; Sun, 14 Mar 2021 16:45:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A3B8CF80431 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ba1bpP0/" Received: by mail-wm1-x330.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso18033334wmi.0 for ; Sun, 14 Mar 2021 08:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4FTy4HdwvhgNdRGZDpAPkP98g1TyRqgQ5LxuFhEMa4g=; b=ba1bpP0/mAHlNBan9GD+3oyEXBKINOceI57ZBmCCbORaKjcnzyOQrEEQYf09dwxyzk Z7o0qSPM12D3byFzGUElOlWVwv0ovqXSwVn8ShHn40XSRNTgx5L+ms2u0KEKqKHCg8pL A/qjIXti11h5hz8OU+raTh2TH+B7365cSHImfqY499XFzc777CpX2P4fmXFRlkrZGu0z 73PkLAOGpsR79OSK4com04hcorMPJ8x8uB3qZ2GE8LWlzLQ3m96lhgWZrfUw5z6E75Mw +VydNetkcUqBLQblOZEaxKQ+xoOhhUdLTeSQ7q9lVA2/UG7eVaqZ6XjNQZdgzvJUUFJw zD7g== 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=4FTy4HdwvhgNdRGZDpAPkP98g1TyRqgQ5LxuFhEMa4g=; b=pgJ49//xugHr3M6FwLtW8gBVm0brs6vmIa+lh2HgvUu4JfUUsz53CNKeWMf8rwBiKN My8QrQaG8W5SApi0mI1nv1qEeHdpeL95Ro7iLnS2D1GeGJ50CXyb4CZY9wRxwqFNe0Q9 O6AGdZzT4SwbVr6l8z+4DQRtAJYwXKE7tSPPnJgEfdlIESH3CwzkUqY8bqb9q4/eRIo8 ae1O3M4OoF6VSqk/BUykX5ZTf42799agw92PnmPBB4UUSUd4d8VSfi5ECBAFEmN8lXD6 vb9mj9OCEMUESbFkIrQxtNRazsC49Icl7JzgmZyhD18j6iXwxLbN3bx18PgPsDM2yYG4 l0cw== X-Gm-Message-State: AOAM533xAhbh/G9ZW3cCqROS2a1daI76UUztIDpyWBxF+obCGvHLWo/s ABQVdiHb33hrXA83XGixC5w= X-Google-Smtp-Source: ABdhPJzzZuvVT0073VQRrIVTiyLp5MTznkF2J2J6+GE3zGtOggeuoza+1fh4MaDq2voQWzJdMaAazw== X-Received: by 2002:a1c:bc8a:: with SMTP id m132mr21518896wmf.6.1615736734166; Sun, 14 Mar 2021 08:45:34 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:33 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 13/17] ASoC: tegra30: i2s: Use devm_clk_get() Date: Sun, 14 Mar 2021 18:44:55 +0300 Message-Id: <20210314154459.15375-14-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Use resource-managed variant of clk_get() to simplify code. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_i2s.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 31e08c5c1405..0ed982548ce4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -438,7 +438,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) i2s->playback_i2s_cif = cif_ids[0]; i2s->capture_i2s_cif = cif_ids[1]; - i2s->clk_i2s = clk_get(&pdev->dev, NULL); + i2s->clk_i2s = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(i2s->clk_i2s)) { dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); ret = PTR_ERR(i2s->clk_i2s); @@ -448,7 +448,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) { ret = PTR_ERR(regs); - goto err_clk_put; + goto err; } i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -456,7 +456,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) if (IS_ERR(i2s->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(i2s->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(i2s->regmap, true); @@ -534,8 +534,6 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) tegra30_i2s_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - clk_put(i2s->clk_i2s); err: return ret; } @@ -557,8 +555,6 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) if (!pm_runtime_status_suspended(&pdev->dev)) tegra30_i2s_runtime_suspend(&pdev->dev); - clk_put(i2s->clk_i2s); - return 0; } From patchwork Sun Mar 14 15:44:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400586 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 D51EBC433E0 for ; Sun, 14 Mar 2021 15:52:10 +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 53BDF64E76 for ; Sun, 14 Mar 2021 15:52:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53BDF64E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 DF2A3172C; Sun, 14 Mar 2021 16:51:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DF2A3172C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737129; bh=aNzIfJR+5Nmbpf5Ys3S6+buSZdGWkFg7hyGwkgiJ9sI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oHajOgNBHajw7Dz8DqKBOHy41QUgFGSYdjpLmznbRjQlOp9z9TYNf05FcvLW2AeVu ARgFgGGQSsKP6ilgUdJeSrDnE7Yr6/tHJ+blVQmGOdZxuFbUTHglmILn+4rzN0BSor qNNkI9Eie0LZiGJJohgF5vf1oHQdgMFaj7pCvFLs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B0124F8051D; Sun, 14 Mar 2021 16:46:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 89565F80272; Sun, 14 Mar 2021 16:45:52 +0100 (CET) Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 9F9A2F80272 for ; Sun, 14 Mar 2021 16:45:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F9A2F80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TTnxonYC" Received: by mail-wm1-x329.google.com with SMTP id m20-20020a7bcb940000b029010cab7e5a9fso18771181wmi.3 for ; Sun, 14 Mar 2021 08:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vFPZqRdZbdNHKEvFXCrSAmXDgJl8zams6Cvy18zeWXc=; b=TTnxonYC5VTIZ1twFzbPolp0axamF7Ut4IK5VEOEOuRvASyNVct3OOKrlmeruqncAk BRgL47uCsx9+kXls9oIR5ER/k71DFRKrzbzEOApyNrTGg1cfG0C2GYhdae5ahiQns5/1 xG08vaPmn/SAPoRpBgpsKMliBW5pHz5aG81Ih88IsgprrsemB79lZFNjl7qoPXXSQrMt 6I+LPfr0LqpG5+FHXFYDtiKX45Q1LkAPmty17W5slx/0I7EPlEbuTsweT5NFZoCEt3hg 5qPgX8e8uJBXS2D0mSmgvx/S/lZwI07xbo4VqIPnfjProyZIXVkFzkQLJ2W6/7kAgQXq UnHA== 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=vFPZqRdZbdNHKEvFXCrSAmXDgJl8zams6Cvy18zeWXc=; b=ieAEzSzkahuN8BcpjFvMCFMeQSgeWBbTjAzzQXn/yaW1hngSCG65idZNYHMdW52V1E +g33Y7wxAZY6jYa9sfaIk46tv/261iKhxnTJlXjsBXhkUAwBtVsI+tmxIXFbFWybxwCt xeKMdy7lSVtv0N5qWOtF7xy8BJpxOBDKRtIldxjBzsFi+wrAhQ3iB5M4FAhiu5TBUxYQ K4gOcif/o/Tdp5u+/LK+6BoWNr/bcWjE2BZ/qdXKG+sCuIExj9vC+KaN7IuDA8qeXC6g GWzbMzwZdR5pLqurLOBujru0GtHiaDxtnivPhz1ZqRdwhlHvMgSqQ8tynRAU4W+YOoBG 0+Rw== X-Gm-Message-State: AOAM532cIIKAOYbmwJNOVkDnQ0iID0O7zaJSrf0h9GaN94XixMQRJ3x7 PDqJuiJHEoyjeOHSo9khfEo= X-Google-Smtp-Source: ABdhPJyNAw8waaCEpxZTcM+qiZa+ugLC/FyHQNxJnz8ojqzssYLkm9hVtJkrv7mc8nkBCSex73XwKw== X-Received: by 2002:a1c:32ca:: with SMTP id y193mr22046494wmy.56.1615736735263; Sun, 14 Mar 2021 08:45:35 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:35 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 14/17] ASoC: tegra30: i2s: Remove handing of disabled runtime PM Date: Sun, 14 Mar 2021 18:44:56 +0300 Message-Id: <20210314154459.15375-15-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Runtime PM is always available on Tegra since commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), hence there is no need to handle the case of a disabled RPM by Tegra drivers. Remove handing of a disabled runtime PM from Tegra30 I2S driver. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_i2s.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 0ed982548ce4..8730ffa0f691 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -461,11 +461,6 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) regcache_cache_only(i2s->regmap, true); pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { - ret = tegra30_i2s_runtime_resume(&pdev->dev); - if (ret) - goto err_pm_disable; - } i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; i2s->playback_dma_data.maxburst = 4; @@ -475,7 +470,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) &i2s->playback_dma_data.addr); if (ret) { dev_err(&pdev->dev, "Could not alloc TX FIFO: %d\n", ret); - goto err_suspend; + goto err_pm_disable; } ret = tegra30_ahub_set_rx_cif_source(i2s->playback_i2s_cif, i2s->playback_fifo_cif); @@ -529,9 +524,6 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) tegra30_ahub_unset_rx_cif_source(i2s->playback_i2s_cif); err_free_tx_fifo: tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); -err_suspend: - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra30_i2s_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); err: @@ -552,8 +544,6 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) tegra30_ahub_free_tx_fifo(i2s->playback_fifo_cif); pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra30_i2s_runtime_suspend(&pdev->dev); return 0; } From patchwork Sun Mar 14 15:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400150 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 356D4C433E0 for ; Sun, 14 Mar 2021 15:51:01 +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 465D764E89 for ; Sun, 14 Mar 2021 15:51:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 465D764E89 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 D958B1776; Sun, 14 Mar 2021 16:50:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D958B1776 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737058; bh=o9/2WZdCaUa+QkYNEcg0Icl0y2lZcjRJFyiT8bFS5aM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lrL2O6usqXysoWHTXvMDI5dIz5lhCWP15caqYyPhu+y7jgjnvSymCTnGn/PNelHYT VaSNyNwrVeHTFW4fpYgBuKKo5io+rpuae9uwnuBmDoNYLcBJVQ5Ndh6ETriJo7tvlb nsWoJyFv0+cQu/pfrwIH9kZcXxqdgWzyQ6t4sG6s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 228A6F804FD; Sun, 14 Mar 2021 16:45:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 62596F804E4; Sun, 14 Mar 2021 16:45:49 +0100 (CET) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (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 85EF1F8026A for ; Sun, 14 Mar 2021 16:45:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 85EF1F8026A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TUB6ZqWK" Received: by mail-wm1-x332.google.com with SMTP id l19so6689589wmh.1 for ; Sun, 14 Mar 2021 08:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Po6yTPVbMrwXaB6ZlYM0aFdBrruf9pmKm6CRlvbqNmk=; b=TUB6ZqWKBf+vvC1EIslpgdFrBDvkkdqcaNjKoddwfk/Z9korua/YsHDelq9B0vAIVh e0KVXvCDTzkmH4JDFR+33V6hXGqF5rXQ0wT3EdLacm58cBVZi+hMeMWPmW4aSNm2Ka7r DF35QArb4r07vGxrk0JT9JzPNLshYDnPl0akdxz17EZWguwdNpHzUHDEXikilDqHyP7g 5vir1R2BSLApYX292BaXt2ah9bmtNwquLNxHrILvqPlB9hxd8pFCK5kRjrOyuNV5to7c C9ffX9oo1LkxzgXGmsLmeXrOLf7tfaPtr1q38PkzNK3AqVMPUxcnh9wi9fnzhUCDfXED Tz2A== 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=Po6yTPVbMrwXaB6ZlYM0aFdBrruf9pmKm6CRlvbqNmk=; b=IpmULaRe1fGbKpxs5zKjyRRyFwUs7UsflDqjzAS6bko93/0zcWFT6nknCO+8d8badC eqwvdsfF8fwg0mVDaXvOBXCOF9DgyYonhKbQWKobcrTKeU0R86N7gpFZNpqU/3h47Bf7 rX9hBu7wlccKpOotczEV2h08yRyLYNYvrs7eooJDZEmhJEZp5TDZPFl3TC+8rVlJiMbo SqJaQmYf+N9E8lRdu1CdGV9/tOQLCQSMt2gPpYzd3brxtRwEWirufUvmzpg1+vkQ/Xfk QwCe4WlZ7cKZsKWfSYQ3G+4osNj9ExW9xVe7tb9nMkbLxLTcwY2NB9/B8bVwA5I4L1TG gdKw== X-Gm-Message-State: AOAM5323Blp4urXV8SkPIFSFd4hBpxMVLJY4auzhBr4OfvbzrOScUpjP NezBt2M+SPlG60z86to6GNA= X-Google-Smtp-Source: ABdhPJw26GydCpYmCDmlt82Wx3Xvlld1x34VTdacYYDUaLUi/tUiYVWgRGR6xA14rPfuyNnhFg7Dpg== X-Received: by 2002:a05:600c:247:: with SMTP id 7mr22283600wmj.116.1615736736293; Sun, 14 Mar 2021 08:45:36 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:36 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 15/17] ASoC: tegra30: ahub: Reset global variable Date: Sun, 14 Mar 2021 18:44:57 +0300 Message-Id: <20210314154459.15375-16-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra30 AHUB uses global variable that is never reset by the driver on a probe failure and on driver removal, meaning that driver will never try to re-probe and can't be unbound. Make driver to reset the variable. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_ahub.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index d24c26f4960d..409a259e6343 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -518,9 +518,6 @@ static int tegra30_ahub_probe(struct platform_device *pdev) void __iomem *regs_apbif, *regs_ahub; int ret = 0; - if (ahub) - return -ENODEV; - match = of_match_device(tegra30_ahub_of_match, &pdev->dev); if (!match) return -EINVAL; @@ -544,19 +541,21 @@ static int tegra30_ahub_probe(struct platform_device *pdev) ret = devm_clk_bulk_get(&pdev->dev, ahub->nclocks, ahub->clocks); if (ret) - return ret; + goto err_unset_ahub; ret = devm_reset_control_bulk_get_exclusive(&pdev->dev, ahub->nresets, ahub->resets); if (ret) { dev_err(&pdev->dev, "Can't get resets: %d\n", ret); - return ret; + goto err_unset_ahub; } res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs_apbif = devm_ioremap_resource(&pdev->dev, res0); - if (IS_ERR(regs_apbif)) - return PTR_ERR(regs_apbif); + if (IS_ERR(regs_apbif)) { + ret = PTR_ERR(regs_apbif); + goto err_unset_ahub; + } ahub->apbif_addr = res0->start; @@ -565,20 +564,22 @@ static int tegra30_ahub_probe(struct platform_device *pdev) if (IS_ERR(ahub->regmap_apbif)) { dev_err(&pdev->dev, "apbif regmap init failed\n"); ret = PTR_ERR(ahub->regmap_apbif); - return ret; + goto err_unset_ahub; } regcache_cache_only(ahub->regmap_apbif, true); regs_ahub = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(regs_ahub)) - return PTR_ERR(regs_ahub); + if (IS_ERR(regs_ahub)) { + ret = PTR_ERR(regs_ahub); + goto err_unset_ahub; + } ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub, &tegra30_ahub_ahub_regmap_config); if (IS_ERR(ahub->regmap_ahub)) { dev_err(&pdev->dev, "ahub regmap init failed\n"); ret = PTR_ERR(ahub->regmap_ahub); - return ret; + goto err_unset_ahub; } regcache_cache_only(ahub->regmap_ahub, true); @@ -595,19 +596,20 @@ static int tegra30_ahub_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); +err_unset_ahub: + ahub = NULL; return ret; } static int tegra30_ahub_remove(struct platform_device *pdev) { - if (!ahub) - return -ENODEV; - pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra30_ahub_runtime_suspend(&pdev->dev); + ahub = NULL; + return 0; } From patchwork Sun Mar 14 15:44:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400147 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 05AFFC433E0 for ; Sun, 14 Mar 2021 15:53:29 +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 2766A64E51 for ; Sun, 14 Mar 2021 15:53:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2766A64E51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 986B11813; Sun, 14 Mar 2021 16:52:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 986B11813 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737206; bh=pbfmxMajxGv+lyHQTMVaQ4SRgFvlXILuf1dcbhvorTE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DXYDifLoTLEaI8yWYKdtF0tjIfi6wG6brcQSnJfX28IMktm1hHDjG5wI0k8nhsJGj 5oM+hJ2UYwM3PjZ0biKgxpp+g9pZUbl7zyks7F8KTZtpRoAr2+usd4BQCkxKUexCcI OvIUJx8mFGtOgPoic3slI/WhA5u6WFzHpxCJ5qKQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 381C3F80535; Sun, 14 Mar 2021 16:46:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6B03CF80510; Sun, 14 Mar 2021 16:45:58 +0100 (CET) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 E42A6F8049C for ; Sun, 14 Mar 2021 16:45:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E42A6F8049C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abtm9MxN" Received: by mail-wm1-x335.google.com with SMTP id l19so6689604wmh.1 for ; Sun, 14 Mar 2021 08:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1gWjZKVNCnhVgYQ/8NhksOw3cbjmVx93WVZKmCK3l6c=; b=abtm9MxNfLHcix+/FQw/rNeDglWV4BUl8lzzCjJFCMRtuhj/+6yel89bpO0ouFcki0 BXDiav8ardhQyt0WAoVbEzxFDuMxJoYJ6BTnM9MEKx5yaR/iFoRNgxUwbNTAiCe/6ZZI s9zdeYKz/v6b9syBmJB67b//GEPdvpm8gbVqivCXVG92zQz9UTIvDeX96+28pltUzA+X PJzyWrg+K4Zft4AGhFCpH45Mf1I38XJdojXiUqH7WkGyIGi0kCGtQeUo8LzJiCRV1S0X 3m/EGAv7qBwpPh+dgMvxIORFXx6M6caH7BIB8V4/c/bbfFQNCDnXHgCty4xKx8VhK0io ikow== 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=1gWjZKVNCnhVgYQ/8NhksOw3cbjmVx93WVZKmCK3l6c=; b=lsKiYyrZ9sFP4tHeF7cPBrafwgotHIJRbZHEojm1oPAh0v/e3Jcf1VizSg+4ypISoZ 34NzgaIb5cCI+7WSyvPE8HQ2+8BrwHKJXOhqQq2JOUIGh8nlcgKE2n9x3gMsQ2QzfW5t zWMjecSQ8WT1C5op7GOkE54fwYeqtLdpeqY9Gw8HJqiBSssFxQ5CWsu1ttYKIK9T1tWn 4pUWKmIkfhctf7KfzxpJxY/GWg0zwGMcT52ugQ+p85ntklvRl1R5kBR5Y0+ON6XOC60j jF0ORPB95dl+gwCJrREgyk6NC1f3QbvWCEY4vursmyNlg3PZvLn2U304qCTfm/KNZCTk auzA== X-Gm-Message-State: AOAM530kIANyYB6w3bWO72Uxivnju3nugU5nD7L/tE0fS4ABjsptJmwU 69GYX3Utd8yII9Jydvt4tQa+MJjYnlQ= X-Google-Smtp-Source: ABdhPJxgG1keItrwFks9hEM0/7+x4JA1tAmy+rjay3Yt2mmi5atU+WjDNSkfDgoSHCLjUmDzxJStqw== X-Received: by 2002:a05:600c:2d42:: with SMTP id a2mr22510522wmg.77.1615736737227; Sun, 14 Mar 2021 08:45:37 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:37 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 16/17] ASoC: tegra30: ahub: Correct suspend-resume callbacks Date: Sun, 14 Mar 2021 18:44:58 +0300 Message-Id: <20210314154459.15375-17-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Tegra30 AHUB driver always syncs hardware state on a runtime PM resume, hence there is no needed to re-sync the state on system resume. Replace the suspend-resume callbacks with a generic helpers which ensure that AHUB is suspended using RPM callbacks across system suspend-resume. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_ahub.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 409a259e6343..e64b41bc5fdf 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -613,36 +613,11 @@ static int tegra30_ahub_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tegra30_ahub_suspend(struct device *dev) -{ - regcache_mark_dirty(ahub->regmap_ahub); - regcache_mark_dirty(ahub->regmap_apbif); - - return 0; -} - -static int tegra30_ahub_resume(struct device *dev) -{ - int ret; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put(dev); - return ret; - } - ret = regcache_sync(ahub->regmap_ahub); - ret |= regcache_sync(ahub->regmap_apbif); - pm_runtime_put(dev); - - return ret; -} -#endif - static const struct dev_pm_ops tegra30_ahub_pm_ops = { SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, tegra30_ahub_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(tegra30_ahub_suspend, tegra30_ahub_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver tegra30_ahub_driver = { From patchwork Sun Mar 14 15:44:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400587 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 C145EC433DB for ; Sun, 14 Mar 2021 15:51:18 +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 294B564E76 for ; Sun, 14 Mar 2021 15:51:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 294B564E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 C1BC617C8; Sun, 14 Mar 2021 16:50:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C1BC617C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615737076; bh=1WHFvNA0wc7rqLRfOJ+5TuPs3ziUU1A1jZTl4Ri/kPk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=owFlQpizSnqGWvZzX7hR+b9PQj71dYM/XVigZHsjU173LQVbBmXio6T+pZauxZ3+6 bzVHkv+KmcPcUpin2+1t4vueiNOB78JdB1KI/B6NbJm0ou8dNPxrR7PDvc/oV5m9Wv wMYTX+SwYtYMLBOrr2zVUQW/CNBOSlKtmA1WVhNg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F2DF5F804FF; Sun, 14 Mar 2021 16:45:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 33A14F804E6; Sun, 14 Mar 2021 16:45:52 +0100 (CET) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 767D8F804AE for ; Sun, 14 Mar 2021 16:45:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 767D8F804AE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i/b/ENnV" Received: by mail-wm1-x32c.google.com with SMTP id g25so6681951wmh.0 for ; Sun, 14 Mar 2021 08:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q2VvKGS2IBfU/FyzkzlhapnFhEuPDgTyFY3A2pVCWuc=; b=i/b/ENnVfmEm7gJZEiJN2YTGqMz6qL70iprAM+NYUEEBXgzljDTTvb+IEgAQrdAlzw RRI/kUonxFW04TF69GppVa/5TpkFs5NyObtXDqlVb23mxcCNI0YRN647B/M6ANMtF6qd 1mWai9P7B6/XNLswXwsbfAjNZ6lEfjwmZrZEcC/zUm7M6D7OBaN+CfuQjAu/+mHcMEiI vEMgGMQotDEac0bFpZEG/2i6miMI9hZz5mCgwZuC2y4cXXm+49oxYO2YEDOdrh8Yu2Ep tfOqLmAAI2Z06dhzpWb84yxjGXkJ0ug9HBDC22uUwwFXyoVh0PQ+h1OMZ4EEQZQvImhr b77g== 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=q2VvKGS2IBfU/FyzkzlhapnFhEuPDgTyFY3A2pVCWuc=; b=Rz1g5gBFssG72v2vZHB1AEdTrP16jAZz5RiXcxSx9xltrrT8uIYeinqrP2NmNdvDq7 kB8elNe1M7thG9X815JtkddF5geMSueyXvBZPOavi0EJGTn81AU2W3eLSD+kHHsw8WYt T+5rgMAtI5awHpVu8W/hELGfFU852/xTm5Vyhwg4oZdCtrJzwJD4izZPW3B4mxRc6j+S oxU4qIVW94D63ljkpTZImKRwsaHyQ9Bp9gq2VqM0b79IFz8w+hs46dPCRqNIszQcYvGf SxZeTbJkQLlRKmrtUf48VwWUtcCng++DCYOMAH8OmIDPjXg0LRplcurXLOh4VuSKixWE plcA== X-Gm-Message-State: AOAM5303Q1l/ANlR+9/4aHu8n10lJwcKZ60R5vDrX7hVgTxUPNREOH/x yaOoQxTT/Y+rmWSDgVpg8HQ= X-Google-Smtp-Source: ABdhPJzPUOQiE4u6hODiaXeNZpPVy34v31wjC2p8noKP8thVkp98ivhkzcje9/QeTF2Dt9Lhmeo10Q== X-Received: by 2002:a05:600c:2301:: with SMTP id 1mr22842264wmo.36.1615736738237; Sun, 14 Mar 2021 08:45:38 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id f14sm9673507wmf.7.2021.03.14.08.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 08:45:38 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Philipp Zabel , Paul Fertser Subject: [PATCH v5 17/17] ASoC: tegra30: ahub: Remove handing of disabled runtime PM Date: Sun, 14 Mar 2021 18:44:59 +0300 Message-Id: <20210314154459.15375-18-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314154459.15375-1-digetx@gmail.com> References: <20210314154459.15375-1-digetx@gmail.com> MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Runtime PM is always available on Tegra since commit 40b2bb1b132a ("ARM: tegra: enforce PM requirement"), hence there is no need to handle the case of a disabled RPM by Tegra drivers. Remove handing of a disabled runtime PM from Tegra30 AHUB driver. Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_ahub.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index e64b41bc5fdf..d1718f3af3cd 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -584,18 +584,11 @@ static int tegra30_ahub_probe(struct platform_device *pdev) regcache_cache_only(ahub->regmap_ahub, true); pm_runtime_enable(&pdev->dev); - if (!pm_runtime_enabled(&pdev->dev)) { - ret = tegra30_ahub_runtime_resume(&pdev->dev); - if (ret) - goto err_pm_disable; - } of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); return 0; -err_pm_disable: - pm_runtime_disable(&pdev->dev); err_unset_ahub: ahub = NULL; @@ -605,8 +598,6 @@ static int tegra30_ahub_probe(struct platform_device *pdev) static int tegra30_ahub_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); - if (!pm_runtime_status_suspended(&pdev->dev)) - tegra30_ahub_runtime_suspend(&pdev->dev); ahub = NULL;