From patchwork Fri Nov 14 17:03:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 40837 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38954244FC for ; Fri, 14 Nov 2014 17:03:59 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf10975081eek.4 for ; Fri, 14 Nov 2014 09:03:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=qCHZy2MJlZvIoNclEtkQ1sis5PCGykVMZVBFOHnqdso=; b=H1/c9F3wHFt4cnwRRInINBbndyXxOjiH75tF9H7E4fGomaxmlKJNzeNP3cvExBq06m l1pmn7+muDKe5MCNZzx8vli5VoO8syOuz71Zym9l0mB/OY+2c3U+ggZ20REP1X/1Odv8 sgNkARMopYZl5Lz8LcJUCd0iIyF+erJYAF5NM4Q8WGIoxsX03/N42TnwmWf1gTuXydnM ++YzM/R9ROPLbwEgzjc5Kn4qpckqmqxcP/kCmhpLC17AtMXro7pRL2zYzCSSJOQ2AAkn RBjSbhXGk1PyhKvPKqmXUUyOhYvGPIU5ypIeA3Nc1ciXNU8SDDXJQGsnB+ymh0v/HJ0P Q7pw== X-Gm-Message-State: ALoCoQloP57atQAC+yYdaBmivwrDHfTM4taS3Mh/axtKPfzgAaNDPqluw11w1p5y6m35rgfPI0Hb X-Received: by 10.112.162.6 with SMTP id xw6mr10690841lbb.4.1415984638414; Fri, 14 Nov 2014 09:03:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.129 with SMTP id t1ls1042016lag.53.gmail; Fri, 14 Nov 2014 09:03:58 -0800 (PST) X-Received: by 10.112.201.72 with SMTP id jy8mr9236595lbc.65.1415984638214; Fri, 14 Nov 2014 09:03:58 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id o6si21204747lao.129.2014.11.14.09.03.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Nov 2014 09:03:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so6267107lbi.22 for ; Fri, 14 Nov 2014 09:03:58 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr9235303laa.71.1415984638062; Fri, 14 Nov 2014 09:03:58 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp797254lbc; Fri, 14 Nov 2014 09:03:56 -0800 (PST) X-Received: by 10.70.23.163 with SMTP id n3mr11694441pdf.0.1415984635871; Fri, 14 Nov 2014 09:03:55 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ax2si28688566pbc.254.2014.11.14.09.03.55 for ; Fri, 14 Nov 2014 09:03:55 -0800 (PST) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935209AbaKNRDy (ORCPT + 5 others); Fri, 14 Nov 2014 12:03:54 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:59373 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933486AbaKNRDy (ORCPT ); Fri, 14 Nov 2014 12:03:54 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id sAEH3RNY029831; Fri, 14 Nov 2014 11:03:27 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAEH3Q7H027348; Fri, 14 Nov 2014 11:03:26 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 14 Nov 2014 11:03:26 -0600 Received: from [172.24.190.171] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id sAEH3Ncm025203; Fri, 14 Nov 2014 11:03:24 -0600 Message-ID: <546635DB.4020202@ti.com> Date: Fri, 14 Nov 2014 22:33:23 +0530 From: Sekhar Nori User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Daniel Mack , CC: , , , Subject: Re: [PATCH v9] ARM: omap: edma: add suspend resume hook References: <1409043173-24357-1-git-send-email-zonque@gmail.com> In-Reply-To: <1409043173-24357-1-git-send-email-zonque@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nsekhar@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Tuesday 26 August 2014 02:22 PM, Daniel Mack wrote: > This patch makes the edma driver resume correctly after suspend. Tested > on an AM33xx platform with cyclic audio streams and omap_hsmmc. > > All information can be reconstructed by already known runtime > information. > > As we now use some functions that were previously only used from __init > context, annotations had to be dropped. > > [nm@ti.com: added error handling for runtime + suspend_late/early_resume] > Signed-off-by: Nishanth Menon > Signed-off-by: Daniel Mack > Tested-by: Joel Fernandes > Acked-by: Joel Fernandes > --- > Changes from v8: > > * Drop the edma_suspend hook altogether. Even though back then > when I wrote the code I was sure disabling the interrupts > during suspend is necessary, tests now show it in fact isn't. > My test setup still works if that code is omitted. > * Use SET_LATE_SYSTEM_SLEEP_PM_OPS in the dev_pm_ops > declaration. > > Thanks to Sekhar for pointing out the above. > > arch/arm/common/edma.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 58 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c > index 485be42..c623dd0 100644 > --- a/arch/arm/common/edma.c > +++ b/arch/arm/common/edma.c > @@ -244,6 +244,8 @@ struct edma { > /* list of channels with no even trigger; terminated by "-1" */ > const s8 *noevent; > > + struct edma_soc_info *info; > + > /* The edma_inuse bit for each PaRAM slot is clear unless the > * channel is in use ... by ARM or DSP, for QDMA, or whatever. > */ > @@ -295,7 +297,7 @@ static void map_dmach_queue(unsigned ctlr, unsigned ch_no, > ~(0x7 << bit), queue_no << bit); > } > > -static void __init assign_priority_to_queue(unsigned ctlr, int queue_no, > +static void assign_priority_to_queue(unsigned ctlr, int queue_no, > int priority) > { > int bit = queue_no * 4; > @@ -314,7 +316,7 @@ static void __init assign_priority_to_queue(unsigned ctlr, int queue_no, > * included in that particular EDMA variant (Eg : dm646x) > * > */ > -static void __init map_dmach_param(unsigned ctlr) > +static void map_dmach_param(unsigned ctlr) > { > int i; > for (i = 0; i < EDMA_MAX_DMACH; i++) > @@ -1762,15 +1764,69 @@ static int edma_probe(struct platform_device *pdev) > edma_write_array2(j, EDMA_DRAE, i, 1, 0x0); > edma_write_array(j, EDMA_QRAE, i, 0x0); > } > + edma_cc[j]->info = info[j]; > arch_num_cc++; > } > > return 0; > } > > +static int edma_pm_resume(struct device *dev) > +{ > + int i, j, r; > + > + r = pm_runtime_get_sync(dev); I think I have asked this before, and I am still not sure why this call to pm_runtime_get_sync() is needed here. From my testing today, this does seem to be a a no-op and this call returns from rpm_resume() because of this check: else if (dev->power.disable_depth == 1 && dev->power.is_suspended && dev->power.runtime_status == RPM_ACTIVE) retval = 1; So, AFAICS, the net effect is an increment of dev->power.usage_count (which is already greater than 0) and its subsequent decrement at the end of the function. After removing this call I did not see any EDMA malfunction as well (can access MMC/SD just fine after suspend/resume cycle). So, any objections to merging this patch with the attached hunk applied? Thanks, Sekhar ---8<--- --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 1f492d5be9c0..79de6a23047b 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -1803,13 +1803,7 @@ static int edma_probe(struct platform_device *pdev) static int edma_pm_resume(struct device *dev) { - int i, j, r; - - r = pm_runtime_get_sync(dev); - if (r < 0) { - dev_err(dev, "%s: get_sync returned %d\n", __func__, r); - return r; - } + int i, j; for (j = 0; j < arch_num_cc; j++) { struct edma *cc = edma_cc[j]; @@ -1844,8 +1838,6 @@ static int edma_pm_resume(struct device *dev) } } - pm_runtime_put_sync(dev); - return 0; }