Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2015175imu; Fri, 14 Dec 2018 04:32:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ueg8stWaodT807FWo5K8CEnh9gDKRvR4Ko/eHW1BDYAGkhjuhmB5qtvR+9IH4bIJ5kgiJm X-Received: by 2002:a62:4587:: with SMTP id n7mr2670981pfi.118.1544790748777; Fri, 14 Dec 2018 04:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544790748; cv=none; d=google.com; s=arc-20160816; b=LmXvVWxT+O9lz+FeVucchM+49SV4DFjlDO+/2FEXrIpLp4qgvNMG8Dt8LgrnzNpHrC HfHEkGQyEA/aNtE2knL8YcH3EjFjxf7GcSQy1ZMkg1nnE1GcB/RVc5gMZKolvWFVk8ac sOGnJcu+K0HJ2mvzPP/Qsozb0gnE6WZlsH7In3S/jt11T6+mptzlMPPvcW0OGA2Efko3 GQ2AB7Y8k0M/IGSCnv9glNKXjjBT+TfoNVnRpD4EsunDrh8YSBxh4ubLAoy3Oty+78YJ Hmj2LSdGw7d6GgzoiQy25o58SlqQR8XzQp96hzTLJBblPDm2NKkELLmMU+0HvqTbQCy+ PDZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1sBGPJqbUpR7LqY9cQL9GmwxumNn+pKMl6DyvlUTMH0=; b=pZVrEA9bykKka4NI4FJx5oWxNO+ilwvlvU9xo3hIFJ4HYVz3Mfz7bK4n2wvrh29zaj NkrIYgaREWykPfpVrtMtSSD9qy3B0Y8UzVkcGPF2153XGoE60hod3R1J1FA0EJzCigAc UnzeJY1QcO9UQ5XXaIidTgV4UD/kM1JbxphgBL0u4LU2EoQnL4QAtpGeKUFkIXn5o0XI 5WVWbWU5S9qSwQ/kPNV0oJCy/o0pelAPf2rcPZOw8jXU3X+YWP0znhzasLv0X7K56ZU8 JyHjjpWHsCyskYnM7eeFt9YfzKo2JDfTRmUQhUDOdRZdwiKjd6mYous1MJQQryZeRQuv DSVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eG9hY1BE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si3994724pga.328.2018.12.14.04.32.14; Fri, 14 Dec 2018 04:32:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eG9hY1BE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731592AbeLNMbH (ORCPT + 99 others); Fri, 14 Dec 2018 07:31:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:55672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730041AbeLNMJz (ORCPT ); Fri, 14 Dec 2018 07:09:55 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A8402148E; Fri, 14 Dec 2018 12:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789395; bh=gevDAJjBzvl81+N7ZgWAKlccE2YfNzgh65hUpZqnZpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eG9hY1BEpE81ma1d9sbnM8WGm+V2NC4OvoJAzuoPeVQL2/wUBraPEwErx1fG2naaL xUvyG9Gs+NLLkQzZwXekv6+ppvcGThBgopPPmCHV8Od5jOA2zFibLq8t9JOdrEC0QD 0FKnphhwiGilPQ1EZ/7PrWOM+skfNp76ghtJqODg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Jarkko Nikula , Mark Brown , Sasha Levin Subject: [PATCH 4.14 43/89] ASoC: omap-dmic: Add pm_qos handling to avoid overruns with CPU_IDLE Date: Fri, 14 Dec 2018 12:59:56 +0100 Message-Id: <20181214115731.799976813@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115729.658859279@linuxfoundation.org> References: <20181214115729.658859279@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit ffdcc3638c58d55a6fa68b6e5dfd4fb4109652eb ] We need to block sleep states which would require longer time to leave than the time the DMA must react to the DMA request in order to keep the FIFO serviced without overrun. Signed-off-by: Peter Ujfalusi Acked-by: Jarkko Nikula Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/omap/omap-dmic.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 09db2aec12a3..776e809a8aab 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -48,6 +48,8 @@ struct omap_dmic { struct device *dev; void __iomem *io_base; struct clk *fclk; + struct pm_qos_request pm_qos_req; + int latency; int fclk_freq; int out_freq; int clk_div; @@ -124,6 +126,8 @@ static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream, mutex_lock(&dmic->mutex); + pm_qos_remove_request(&dmic->pm_qos_req); + if (!dai->active) dmic->active = 0; @@ -226,6 +230,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, /* packet size is threshold * channels */ dma_data = snd_soc_dai_get_dma_data(dai, substream); dma_data->maxburst = dmic->threshold * channels; + dmic->latency = (OMAP_DMIC_THRES_MAX - dmic->threshold) * USEC_PER_SEC / + params_rate(params); return 0; } @@ -236,6 +242,9 @@ static int omap_dmic_dai_prepare(struct snd_pcm_substream *substream, struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); u32 ctrl; + if (pm_qos_request_active(&dmic->pm_qos_req)) + pm_qos_update_request(&dmic->pm_qos_req, dmic->latency); + /* Configure uplink threshold */ omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold); -- 2.19.1