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: 6013311 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 190059F2A9 for ; Sun, 15 Mar 2015 15:08:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54A7620268 for ; Sun, 15 Mar 2015 15:08:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FD9B2024F for ; Sun, 15 Mar 2015 15:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbbCOPIA (ORCPT ); Sun, 15 Mar 2015 11:08:00 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:62771 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbbCOPH7 (ORCPT ); Sun, 15 Mar 2015 11:07:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1426432079; x=1457968079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=0WRKVjQ+IVyT4IaSbu3ixTtTeK4m4WijL5XvSky6Pak=; b=XT8lx0wy0uDTICFZ2bgZTpJm5CBVGJl8CDB1U8hOAbm7IzL5BZGKYz+Y uva0wuwrBniSD1+IwBL32LSeBFwJ3nyLxzsChgyXLKAkrESuKvaL8h6vF jeS4DkzW5ZUpNJALAtnnnzRMnckf87coezA+Nknc8gNfGYo/DYlh3KJ1j 4=; X-IronPort-AV: E=McAfee;i="5600,1067,7740"; a="200562452" Received: from ironmsg03-l.qualcomm.com ([172.30.48.18]) by wolverine02.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: CC: , Rajkumar Manoharan 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) 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 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);