From patchwork Sat Mar 7 08:03:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 5958891 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 5B6299F373 for ; Sat, 7 Mar 2015 08:04:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 863C1203B6 for ; Sat, 7 Mar 2015 08:04:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F172203B4 for ; Sat, 7 Mar 2015 08:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756864AbbCGIEI (ORCPT ); Sat, 7 Mar 2015 03:04:08 -0500 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:33876 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752022AbbCGIEG (ORCPT ); Sat, 7 Mar 2015 03:04:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1425715446; x=1457251446; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=MoJMeFaSL5f7AOFQXt9Y5aHkl9jfYYB2fVxkP717gcQ=; b=gKt/65ctazDHcL624iNPs1trMgIEXqHun8wgmg31Gw5cEdRDYbN3tE75 Gyh1z3eX005od7GdCABYpAxYL9Hdwo9d/wotFizt79JtlMUR+x2oRM3Rm gsSx/FzvWsAJsuyl/Eer4ehnPpSW02bAMoCH7o76QB1KjngnE6dqomUQA k=; X-IronPort-AV: E=McAfee;i="5600,1067,7732"; a="85272588" Received: from ironmsg03-l.qualcomm.com ([172.30.48.18]) by sabertooth02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Mar 2015 00:04:06 -0800 X-IronPort-AV: E=Sophos;i="5.11,357,1422950400"; d="scan'208";a="855941544" Received: from nasanexm01g.na.qualcomm.com ([10.85.0.33]) by Ironmsg03-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 07 Mar 2015 00:04:06 -0800 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by NASANEXM01G.na.qualcomm.com (10.85.0.33) with Microsoft SMTP Server (TLS) id 15.0.995.29; Sat, 7 Mar 2015 00:04:04 -0800 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; Sat, 7 Mar 2015 00:03:56 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Sat, 07 Mar 2015 13:33:47 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH 4/4] ath10k: cache throttle state when device is down Date: Sat, 7 Mar 2015 13:33:00 +0530 Message-ID: <1425715380-11200-4-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1425715380-11200-1-git-send-email-rmanohar@qti.qualcomm.com> References: <1425715380-11200-1-git-send-email-rmanohar@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01C.na.qualcomm.com (10.85.0.83) To aphydexm01b.ap.qualcomm.com (10.252.127.11) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 7aef064..3720c86 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);