From patchwork Sun Mar 15 15:06:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 6013341 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DFBE89F2A9 for ; Sun, 15 Mar 2015 15:08:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F91920268 for ; Sun, 15 Mar 2015 15:08:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D8A72024F for ; Sun, 15 Mar 2015 15:08:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YXA9M-0007re-Rw; Sun, 15 Mar 2015 15:08:20 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YXA9L-0007jY-Fj for ath10k@lists.infradead.org; Sun, 15 Mar 2015 15:08:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1426432099; x=1457968099; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=0WRKVjQ+IVyT4IaSbu3ixTtTeK4m4WijL5XvSky6Pak=; b=dEjFd6UuU3pf2Vd8Z4Kxhlvr5Lbzry9VlvV078rPojCqlcJ4lcPi9Pkx tlBeYFC3o82Fs/C52vEmns16bF/b7BvO48rAn+5lI5j2K7Y/M90vLQ5mI Ta9MvKKkBHEMS7sq3pDqilz+aefVkwPuy/AdqWu74DSM6ScvCA2W0I3pk c=; X-IronPort-AV: E=McAfee;i="5600,1067,7740"; a="108450507" Received: from ironmsg03-l.qualcomm.com ([172.30.48.18]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Mar 2015 08:07:59 -0700 X-IronPort-AV: E=Sophos;i="5.11,404,1422950400"; d="scan'208";a="862709246" Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by Ironmsg03-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 15 Mar 2015 08:07:58 -0700 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.995.29; Sun, 15 Mar 2015 08:07:57 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.995.29; Sun, 15 Mar 2015 08:07:49 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Sun, 15 Mar 2015 20:37:41 +0530 From: Rajkumar Manoharan To: Subject: [PATCH 5/6] ath10k: cache throttle state when device is down Date: Sun, 15 Mar 2015 20:36:24 +0530 Message-ID: <1426431985-16332-6-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1426431985-16332-1-git-send-email-rmanohar@qti.qualcomm.com> References: <1426431985-16332-1-git-send-email-rmanohar@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To aphydexm01b.ap.qualcomm.com (10.252.127.11) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150315_080819_628013_11601DCE X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -5.1 (-----) Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow driver to cache the throttle state when the devie is not yet started. Configure the cached throttle state while powering up the device. Since thermal daemon is unaware of the up/down cycle, it assumes that device is throttled. Reported-by: Matthias Kaehlcke Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath10k/thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c index 604ea00..0b4cd3f 100644 --- a/drivers/net/wireless/ath/ath10k/thermal.c +++ b/drivers/net/wireless/ath/ath10k/thermal.c @@ -52,19 +52,19 @@ ath10k_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev, struct ath10k *ar = cdev->devdata; int ret = 0; + if (throttle_state > ATH10K_THERMAL_THROTTLE_MAX) { + ath10k_warn(ar, "throttle state %ld is exceeding the limit %d\n", + throttle_state, ATH10K_THERMAL_THROTTLE_MAX); + return -EINVAL; + } mutex_lock(&ar->conf_mutex); + ar->thermal.throttle_state = throttle_state; + if (ar->state != ATH10K_STATE_ON) { ret = -ENETDOWN; goto out; } - if (throttle_state > ATH10K_THERMAL_THROTTLE_MAX) { - ath10k_warn(ar, "throttle state %ld is exceeding the limit %d\n", - throttle_state, ATH10K_THERMAL_THROTTLE_MAX); - ret = -EINVAL; - goto out; - } - ar->thermal.throttle_state = throttle_state; ath10k_thermal_set_throttling(ar); out: mutex_unlock(&ar->conf_mutex);