From patchwork Wed Oct 30 18:21:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219915 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB24514DB for ; Wed, 30 Oct 2019 18:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7C1B2067D for ; Wed, 30 Oct 2019 18:21:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AJmJh+mW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727917AbfJ3SVw (ORCPT ); Wed, 30 Oct 2019 14:21:52 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39362 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfJ3SVv (ORCPT ); Wed, 30 Oct 2019 14:21:51 -0400 Received: by mail-pg1-f195.google.com with SMTP id p12so2010511pgn.6; Wed, 30 Oct 2019 11:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I6P5H/5uV7JacgxYkaFeE2k/FEa8xgvahkSEI1tPpC4=; b=AJmJh+mWDb0JsKw8h0qqyPLlnyvhhllDzfwONbL/lWjh03d2I/+24d6dCsaPEnkWel 6n8KRJYnHfGrE+9DyTj7Y/Za63OHx7Pg9gg3rx7JlrAUCmLQSixoYvnXB5Ksv5j1zgEM /GgskK1TI4aXZs/B79FXMWWANtjAxwGekTHXlSmt8PamTkLU/2UCKeI2X+wZVRluBsnT oez67NfdmkJ6UHYoDiI/EJsRALrPV/7asy6s+OPN/9+4NsqO8KdseLSjYjfPFPH4rBhd KNqmoHJZZ6DxhSN9B4z+3x0jjqLDEv0X9Hs162pRRx51bc0SM3+UjmMaNbM5h4kRLF1J KI9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I6P5H/5uV7JacgxYkaFeE2k/FEa8xgvahkSEI1tPpC4=; b=QRmzCFpjS5p8G+CBGLA5MBucFDpwQLHc+I4pbfiCB/nVvGW8PlgaAQd3Z5jK9l/F+S sIaqRGsX96BQYaATmDdKAwaNI7mZ6zIRfZTschpwkxB0X1pj/zC9273WM+pZEgh48fze Vr/WxlLpBhNfTrxR1FBfFUeNoewdkxaKOjqmNGohrnPjZ4wkpxsrI9jQfWaUDh/31k1h Rgxc95UsSs+4To25A0ZqIlrJBBvk4X6KwLId8ZuG71bpaPRdfI5mdjXyt+E1YvUsiPRf j3tYtofY218osgnzehSeOt0pKxU36yYI20o2VNcn+Zexucm4V2SxiQPF1WMXgl9D8DJI YBVg== X-Gm-Message-State: APjAAAWh3pTfEyxxZyVaIZXBOf9FvEWyVfleXqTykYgaXPgl6Fz0RIAD CRpfLFrkibxxvgbXOU50GwEfRNeI X-Google-Smtp-Source: APXvYqw6qm/6KxOPBYJT/5NALIlwWu5lWetRg4AhEbAVKFFHyKHBtdirXo9dY9wHdGsKgzRFzc/UJA== X-Received: by 2002:a62:4d04:: with SMTP id a4mr764111pfb.60.1572459710934; Wed, 30 Oct 2019 11:21:50 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:21:50 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 1/6] thermal: brcmstb_thermal: Do not use DT coefficients Date: Wed, 30 Oct 2019 11:21:27 -0700 Message-Id: <20191030182132.25763-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org At the time the brcmstb_thermal driver and its binding were merged, the DT binding did not make the coefficients properties a mandatory one, therefore all users of the brcmstb_thermal driver out there have a non functional implementation with zero coefficients. Even if these properties were provided, the formula used for computation is incorrect. The coefficients are entirely process specific (right now, only 28nm is supported) and not board or SoC specific, it is therefore appropriate to hard code them in the driver given the compatibility string we are probed with which has to be updated whenever a new process is introduced. We remove the existing coefficients definition since subsequent patches are going to add support for a new process and will introduce new coefficients as well. Fixes: 9e03cf1b2dd5 ("thermal: add brcmstb AVS TMON driver") Signed-off-by: Florian Fainelli --- drivers/thermal/broadcom/brcmstb_thermal.c | 37 ++++------------------ 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 5825ac581f56..42482af0422e 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -48,15 +48,6 @@ #define AVS_TMON_TEMP_INT_CODE 0x1c #define AVS_TMON_TP_TEST_ENABLE 0x20 -/* Default coefficients */ -#define AVS_TMON_TEMP_SLOPE -487 -#define AVS_TMON_TEMP_OFFSET 410040 - -/* HW related temperature constants */ -#define AVS_TMON_TEMP_MAX 0x3ff -#define AVS_TMON_TEMP_MIN -88161 -#define AVS_TMON_TEMP_MASK AVS_TMON_TEMP_MAX - enum avs_tmon_trip_type { TMON_TRIP_TYPE_LOW = 0, TMON_TRIP_TYPE_HIGH, @@ -108,23 +99,11 @@ struct brcmstb_thermal_priv { struct thermal_zone_device *thermal; }; -static void avs_tmon_get_coeffs(struct thermal_zone_device *tz, int *slope, - int *offset) -{ - *slope = thermal_zone_get_slope(tz); - *offset = thermal_zone_get_offset(tz); -} - /* Convert a HW code to a temperature reading (millidegree celsius) */ static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz, u32 code) { - const int val = code & AVS_TMON_TEMP_MASK; - int slope, offset; - - avs_tmon_get_coeffs(tz, &slope, &offset); - - return slope * val + offset; + return (410040 - (int)((code & 0x3FF) * 487)); } /* @@ -136,20 +115,16 @@ static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz, static inline u32 avs_tmon_temp_to_code(struct thermal_zone_device *tz, int temp, bool low) { - int slope, offset; - - if (temp < AVS_TMON_TEMP_MIN) - return AVS_TMON_TEMP_MAX; /* Maximum code value */ - - avs_tmon_get_coeffs(tz, &slope, &offset); + if (temp < -88161) + return 0x3FF; /* Maximum code value */ - if (temp >= offset) + if (temp >= 410040) return 0; /* Minimum code value */ if (low) - return (u32)(DIV_ROUND_UP(offset - temp, abs(slope))); + return (u32)(DIV_ROUND_UP(410040 - temp, 487)); else - return (u32)((offset - temp) / abs(slope)); + return (u32)((410040 - temp) / 487); } static int brcmstb_get_temp(void *data, int *temp) From patchwork Wed Oct 30 18:21:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219919 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41EE514DB for ; Wed, 30 Oct 2019 18:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14F212080F for ; Wed, 30 Oct 2019 18:22:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U6u7pFKL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbfJ3SWC (ORCPT ); Wed, 30 Oct 2019 14:22:02 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37426 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfJ3SWC (ORCPT ); Wed, 30 Oct 2019 14:22:02 -0400 Received: by mail-pf1-f195.google.com with SMTP id u9so2157642pfn.4; Wed, 30 Oct 2019 11:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pa+oF3hZUeqW4RFci5wsFzOB4YnQ5ce9tEfET98r1hc=; b=U6u7pFKLSGa+JRMgqp9kblGervY+IyWiO4wkunKZZffv48BI4ukJQ0upxCU7W7V0vS rUEBcdhd1VLbIROucxSZkiAYojKyNSaHvFhzi8C+kM1n1yZEzD7wvq/gUdwdxZzF9HEz rZyyiky/nP14K16AaM+Fsn37480Gehzpy5UWbnHUCTzx59BcWb5eo9BG0obS8Uda52ye wDUjb3ICAFs/9WtQh3wSF75fq79usIy807BBD26bbPNi/jjpi8lbc0E8c6mK70f3IcGH JdZ92gch8Q0y6UKW3K0mZO3ofEFxDeeZn/KGOd/IMCfcHr4gdWPbeMX9AKcrmEmHgPgm IZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pa+oF3hZUeqW4RFci5wsFzOB4YnQ5ce9tEfET98r1hc=; b=NKVDZP8b6ZkWMfLc+JhvQoz+AmX70D2DEwGARlCkc7mOyczf33SkGBL8Sd64HjA/Kj porMiGUNnS6kXDhJ/ekszS+gZQU4fHOGYscpiNTndK5E+NLURyXSsuR9Y3JgxfyqAK4h qJCvptes+bMYMC5LNKqR5x7CQ1ydIurNcDgytNh6hhJ72bTwC43VtcjYtXScpaz7XVN7 b4DFkbZHB+WAVI6ldq/raWAXYh2IWZBm8r8lJFGkggM4UYMMXBVKZItkNOHuu2wd/f3t C7kb18UyoyIuDqN+CV6qJtf73aG9Ww2BoB7nG6VubIkVNf6Xlc533fTJGSKkMh1maqAr sbuw== X-Gm-Message-State: APjAAAVaxDno1rTAMMJ1o4TATJK7Nzt7USeqD0+lJGozC263b8K//GjB tVxzyKuawETiXO8vt+pnngiLqAf0 X-Google-Smtp-Source: APXvYqxSBks/kNKPqH1UTcXtmYr83X3kp7jWIIIyY0d24Kn7LnwX7gSlsY6ZvmhmTYMDEBWihXEkKw== X-Received: by 2002:a17:90a:a00e:: with SMTP id q14mr795480pjp.132.1572459717112; Wed, 30 Oct 2019 11:21:57 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:21:56 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 2/6] thermal: brcmstb_thermal: Prepare to support a different process Date: Wed, 30 Oct 2019 11:21:28 -0700 Message-Id: <20191030182132.25763-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The driver is currently assuming that it is operating with a 28nm process chip, which has a specific formula to convert temperature to a code and vice versa. Update the code to support providing two key values: offset and multiplier to derive the correct formulas. Signed-off-by: Florian Fainelli --- drivers/thermal/broadcom/brcmstb_thermal.c | 49 +++++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 42482af0422e..2ad4eeb79f9c 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -93,17 +93,27 @@ static struct avs_tmon_trip avs_tmon_trips[] = { }, }; +struct brcmstb_thermal_params { + unsigned int offset; + unsigned int mult; +}; + struct brcmstb_thermal_priv { void __iomem *tmon_base; struct device *dev; struct thermal_zone_device *thermal; + /* Process specific thermal parameters used for calculations */ + struct brcmstb_thermal_params temp_params; }; /* Convert a HW code to a temperature reading (millidegree celsius) */ -static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz, +static inline int avs_tmon_code_to_temp(struct brcmstb_thermal_priv *priv, u32 code) { - return (410040 - (int)((code & 0x3FF) * 487)); + int offset = priv->temp_params.offset; + int mult = priv->temp_params.mult; + + return (offset - (int)((code & 0x3FF) * mult)); } /* @@ -112,19 +122,22 @@ static inline int avs_tmon_code_to_temp(struct thermal_zone_device *tz, * @temp: temperature to convert * @low: if true, round toward the low side */ -static inline u32 avs_tmon_temp_to_code(struct thermal_zone_device *tz, +static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv, int temp, bool low) { + int offset = priv->temp_params.offset; + int mult = priv->temp_params.mult; + if (temp < -88161) return 0x3FF; /* Maximum code value */ - if (temp >= 410040) + if (temp >= offset) return 0; /* Minimum code value */ if (low) - return (u32)(DIV_ROUND_UP(410040 - temp, 487)); + return (u32)(DIV_ROUND_UP(offset - temp, mult)); else - return (u32)((410040 - temp) / 487); + return (u32)((offset - temp) / mult); } static int brcmstb_get_temp(void *data, int *temp) @@ -142,7 +155,7 @@ static int brcmstb_get_temp(void *data, int *temp) val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; - t = avs_tmon_code_to_temp(priv->thermal, val); + t = avs_tmon_code_to_temp(priv, val); if (t < 0) *temp = 0; else @@ -176,7 +189,7 @@ static int avs_tmon_get_trip_temp(struct brcmstb_thermal_priv *priv, val &= trip->reg_msk; val >>= trip->reg_shift; - return avs_tmon_code_to_temp(priv->thermal, val); + return avs_tmon_code_to_temp(priv, val); } static void avs_tmon_set_trip_temp(struct brcmstb_thermal_priv *priv, @@ -189,7 +202,7 @@ static void avs_tmon_set_trip_temp(struct brcmstb_thermal_priv *priv, dev_dbg(priv->dev, "set temp %d to %d\n", type, temp); /* round toward low temp for the low interrupt */ - val = avs_tmon_temp_to_code(priv->thermal, temp, + val = avs_tmon_temp_to_code(priv, temp, type == TMON_TRIP_TYPE_LOW); val <<= trip->reg_shift; @@ -206,7 +219,7 @@ static int avs_tmon_get_intr_temp(struct brcmstb_thermal_priv *priv) u32 val; val = __raw_readl(priv->tmon_base + AVS_TMON_TEMP_INT_CODE); - return avs_tmon_code_to_temp(priv->thermal, val); + return avs_tmon_code_to_temp(priv, val); } static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data) @@ -270,19 +283,32 @@ static const struct thermal_zone_of_device_ops of_ops = { .set_trips = brcmstb_set_trips, }; +static const struct brcmstb_thermal_params brcmstb_28nm_params = { + .offset = 410040, + .mult = 487, +}; + static const struct of_device_id brcmstb_thermal_id_table[] = { - { .compatible = "brcm,avs-tmon" }, + { .compatible = "brcm,avs-tmon", .data = &brcmstb_28nm_params }, {}, }; MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table); static int brcmstb_thermal_probe(struct platform_device *pdev) { + const struct brcmstb_thermal_params *params; + const struct of_device_id *of_id = NULL; struct thermal_zone_device *thermal; struct brcmstb_thermal_priv *priv; struct resource *res; int irq, ret; + of_id = of_match_node(brcmstb_thermal_id_table, pdev->dev.of_node); + if (!of_id || !of_id->data) + return -EINVAL; + + params = of_id->data; + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -292,6 +318,7 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) if (IS_ERR(priv->tmon_base)) return PTR_ERR(priv->tmon_base); + memcpy(&priv->temp_params, params, sizeof(priv->temp_params)); priv->dev = &pdev->dev; platform_set_drvdata(pdev, priv); From patchwork Wed Oct 30 18:21:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219923 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 015A01599 for ; Wed, 30 Oct 2019 18:22:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2CBA208C0 for ; Wed, 30 Oct 2019 18:22:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VCaF9euf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbfJ3SWF (ORCPT ); Wed, 30 Oct 2019 14:22:05 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41111 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfJ3SWE (ORCPT ); Wed, 30 Oct 2019 14:22:04 -0400 Received: by mail-pf1-f193.google.com with SMTP id p26so2142133pfq.8; Wed, 30 Oct 2019 11:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qs16A5XyOAvgOkcD2b8j2UzYSbjI5cdVJZowNpSGRxs=; b=VCaF9eufWMcvjXboob2XP8nc+6A40oSy1ga0OjH59Joe+C6zRTYakwyuFGcY9kkPBq Em9YGm8M5lYuzsgBne1SD+GuPLDjHsn7IjqI7+LWZaFd3gP6RG/nwdvS2jqMcEcL5gQa yVYQUQZ18//BhVG03Ee0b++GrI7BVRpPnBZwK71ksvqNKefdZ6GTGE/dpfjerF52lU9d lUetRBA5v28fErEpZHzuowK3loVssYtyCW1GCCX6xgimut/cToiDHsutQ9IHU9A1uR9+ im2vtSCaFSpIBsBJa/yjjq6gsbvyoHPf/P2mmox514K9tyXPKinubsdPg8M6WloolGe6 wqzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qs16A5XyOAvgOkcD2b8j2UzYSbjI5cdVJZowNpSGRxs=; b=JhaFXkWvvMRk5v5etwCKN0cMhcjLXD7WsEKy2dCQpFmSltMOZWbgWwnddO63j2iqTu Z6UwQglYxupLcH3Qtyis3o+nTt6KaoYVfKcDZfk7M7kBahGJLKiDKcat00P+dM/3sScs S/Kxbh2Sa+Kos3MuYCmIvwOgjB8F+nJuDjX80LbXUKowSLNEi7jxWN6QzqaFWs+kzl2x IBTeK68h4csmkEuw9FNfDbmjni7DEndbwr21OrhRG/WJ67Imon8qgw7I/rqdPuzM5HS6 zX94xZkhLGK8jShifFOm5s4dYWGEXw2dt/tJlA4uGZAeBfDV4AVuze+T4G4SaUIZuCIm jiRA== X-Gm-Message-State: APjAAAWUeQ60deXZnPpvv88tJ7dM+mPWJBywhUo6Y7R6k08v4/kYFuJN On4uu3zZUlVNSzOosV8BWnS0Obcr X-Google-Smtp-Source: APXvYqwvjX/ThoRXznb5SgYpZuHrY59zaN3xyWXKgjoQvOXAPltKe0a3xjdBk/FnBbZsK4E9peBmXw== X-Received: by 2002:a62:5216:: with SMTP id g22mr750778pfb.78.1572459723302; Wed, 30 Oct 2019 11:22:03 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:22:02 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 3/6] dt-bindings: thermal: Define BCM7216 thermal sensor compatible Date: Wed, 30 Oct 2019 11:21:29 -0700 Message-Id: <20191030182132.25763-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org BCM7216 is a 16nm process STB chip, which requires a different compatible string to differentiate different temperature formulas. Signed-off-by: Florian Fainelli Reviewed-by: Rob Herring --- .../devicetree/bindings/thermal/brcm,avs-tmon.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt b/Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt index 43a9ed545944..74a9ef09db8b 100644 --- a/Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt +++ b/Documentation/devicetree/bindings/thermal/brcm,avs-tmon.txt @@ -3,9 +3,13 @@ Thermal management core, provided by the AVS TMON hardware block. Required properties: -- compatible: must be "brcm,avs-tmon" and/or "brcm,avs-tmon-bcm7445" +- compatible: must be one of: + "brcm,avs-tmon-bcm7216" + "brcm,avs-tmon-bcm7445" + "brcm,avs-tmon" - reg: address range for the AVS TMON registers -- interrupts: temperature monitor interrupt, for high/low threshold triggers +- interrupts: temperature monitor interrupt, for high/low threshold triggers, + required except for "brcm,avs-tmon-bcm7216" - interrupt-names: should be "tmon" Example: From patchwork Wed Oct 30 18:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219925 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B45114DB for ; Wed, 30 Oct 2019 18:22:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDAF32067D for ; Wed, 30 Oct 2019 18:22:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NsVh2jqs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfJ3SWL (ORCPT ); Wed, 30 Oct 2019 14:22:11 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45806 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfJ3SWL (ORCPT ); Wed, 30 Oct 2019 14:22:11 -0400 Received: by mail-pg1-f193.google.com with SMTP id r1so1990118pgj.12; Wed, 30 Oct 2019 11:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3+WJZITHEScydX2UgU8wnfwVYy4vjzlr7uIujJK9hic=; b=NsVh2jqs6cpcVXqN9XUwDu1LIbUb3xENxLQxoDG8mViO2A+agXwhe3aS8BkRHjsJXB 4KBEsZpbOHk1zIGNcYVbmNNGZr8XnI40pHE1AXOSFZ/OO/cILBs3zRmRjrdj1JBaRgqs E0jA2lh0I+mjtxSUWzDmaEh650tqvNt2nx1bmPhuZ0zGXYNNzLLFi7P8tEqFbzKjdFPd BUenvIwxxSjReMry8lJXaZVnQ7SxX8m0ZMXgYxA/NuKokUCbG+Jx9ajKgtRvtqkRBWOZ //Vp4Bk0EmsPOum7+O3P61sILtb/8fvCqYP1tkAnDGqqKIItX8Sobqbdld7o4Wc+s9Z7 fhkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3+WJZITHEScydX2UgU8wnfwVYy4vjzlr7uIujJK9hic=; b=HbUi9J9m/or94Z8pH1Xwklo5UYkc7suhmnanlK2Rr+G51ZHNjS53l/d9RBdDP13yph 3GnOVsdblnNL+f7p3eX+SsnbDW/CeaG9rkJDiCtSt2uwlFyzdPcGJq1w3Bgyo3uYSs1U SiWjLNMEY8TL3YagVdqfK/0gtkJtbBp7/eexjHDS6nKZyYFcG22frsenFkYWGgOGXc+U dI9DvylqmUQ5V6THN5KdfYwHwYUHCQBh0ne00YcJySX4tme5alHDcLpvikNhEuAFhAij zrZnTntCU1sUE4UfhNBSd0wf/louN378BAVNs3x1Et0C9OBvkCjAtHYuPRvjQEay1wkp YOWQ== X-Gm-Message-State: APjAAAV/S9fadddL6f4KRhOw5lvt7KIUa1dEFb4Jr7Rp69Z0YeMRM9QT 1wYsNRI1JwyNYRg7e/zTl5K9yZj5 X-Google-Smtp-Source: APXvYqzEOJDvlRsEdpaIpz0TiH5s2gJTnqNYLuN/D1JJ4h+Rh3lygNNSMKzWVm0azoAsKFm3sj/ubg== X-Received: by 2002:a65:628e:: with SMTP id f14mr943359pgv.114.1572459729662; Wed, 30 Oct 2019 11:22:09 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:22:09 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 4/6] thermal: brcmstb_thermal: Add 16nm process thermal parameters Date: Wed, 30 Oct 2019 11:21:30 -0700 Message-Id: <20191030182132.25763-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Match the 7216 compatible string in order to derive the correct 16nm process thermal parameters to obtain correct readings. Signed-off-by: Florian Fainelli Reviewed-by: Amit Kucheria --- drivers/thermal/broadcom/brcmstb_thermal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 2ad4eeb79f9c..41d4a142707c 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -283,12 +283,18 @@ static const struct thermal_zone_of_device_ops of_ops = { .set_trips = brcmstb_set_trips, }; +static const struct brcmstb_thermal_params brcmstb_16nm_params = { + .offset = 457829, + .mult = 557, +}; + static const struct brcmstb_thermal_params brcmstb_28nm_params = { .offset = 410040, .mult = 487, }; static const struct of_device_id brcmstb_thermal_id_table[] = { + { .compatible = "brcm,avs-tmon-bcm7216", .data = &brcmstb_16nm_params }, { .compatible = "brcm,avs-tmon", .data = &brcmstb_28nm_params }, {}, }; From patchwork Wed Oct 30 18:21:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219927 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 209FC1515 for ; Wed, 30 Oct 2019 18:22:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2D27208E3 for ; Wed, 30 Oct 2019 18:22:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pEEW2f30" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727983AbfJ3SWR (ORCPT ); Wed, 30 Oct 2019 14:22:17 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45819 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfJ3SWR (ORCPT ); Wed, 30 Oct 2019 14:22:17 -0400 Received: by mail-pg1-f196.google.com with SMTP id r1so1990304pgj.12; Wed, 30 Oct 2019 11:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=otlqAInALZr2P9dty8XUUL6zB6HI1wPTVfKnXgrgDz0=; b=pEEW2f30nRHch1s2EgqqRpTUyvDRjLA9w9GBytO7Iw7WGg74ykAWtVnXm+1cP6BNtm 1mZF181hfY9IbKuci1v4a3VeACfmv4FpXcXMcwSypF1tBsNJWotuP7sN+4Wdojq3NzFM lkGzXXf5YVCclaf7qH/X2d2FAFMTbvvJD7hCPoZnx6o8FzriL3hBjpsiEO1a/bXJKcG+ s5kFzBta7vgBbyXUtBcw2om6ScDUWrSGvn2l+eKVoMlBYEg+OVu9h30wNIM2EdTZq1Vw ISn/w/OD8N0iGySp/i2MduBFT/UipcSQXv80fKEpxchF7keX0MXQ7ricV0tlvH5gyYmd mdpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=otlqAInALZr2P9dty8XUUL6zB6HI1wPTVfKnXgrgDz0=; b=ZqGbI16HhNlUBdISNq+BfewS/TcYIDMyy1S4UfqTcDyDBbXp/Ts6hP904SffOtm8aC XmNkZGyHpNAnbAUP7TAeJ+6j7y1TZLytodRmmEcgx+EBrSs6BspReLT6a5U5CE58k0Sj raTg0y5nKfmvR9PtxKL36bjXV+KiwpFI6LW0D0xSCsVKekFs0ikpIOm13Pfh5zypqGY7 M25MjCtaRlMucjXT3IQaxtCmHISfbdD5fNWU49Z+uD367w5tPzjGn2GR1EplU89Gq002 EOCJ4AtNlMc6wBR5fRknOaWTz85Z6snVw5yq80/5WEG1Jix3QZ/4jguaGSWlryjYxKO6 m2uw== X-Gm-Message-State: APjAAAUmfL97ZUXKILi5PxfZKSRBSykvBuH4Oedg+B6hmr2Bd7eQHz07 90geYE4aBwXk69MMqywtktbBWIis X-Google-Smtp-Source: APXvYqxk/HB2PwWsDYa2sz7k6NPxepTRZ9yjvxvqoyqYJW22soLktVzEJMlRx6lO+FPLQKHqV+cFoQ== X-Received: by 2002:a63:4081:: with SMTP id n123mr888165pga.444.1572459735810; Wed, 30 Oct 2019 11:22:15 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:22:15 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 5/6] thermal: brcmstb_thermal: Restructure interrupt registration Date: Wed, 30 Oct 2019 11:21:31 -0700 Message-Id: <20191030182132.25763-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If we are successful grabbing the interrupt resource, then register an interrupt handler, this makes it easier to support the interrupt as being optional, which is it for 7216. Signed-off-by: Florian Fainelli Reviewed-by: Amit Kucheria --- drivers/thermal/broadcom/brcmstb_thermal.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 41d4a142707c..64f715053ce9 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -339,16 +339,15 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) priv->thermal = thermal; irq = platform_get_irq(pdev, 0); - if (irq < 0) { - dev_err(&pdev->dev, "could not get IRQ\n"); - return irq; - } - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - brcmstb_tmon_irq_thread, IRQF_ONESHOT, - DRV_NAME, priv); - if (ret < 0) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); - return ret; + if (irq >= 0) { + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, + brcmstb_tmon_irq_thread, + IRQF_ONESHOT, + DRV_NAME, priv); + if (ret < 0) { + dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); + return ret; + } } dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); From patchwork Wed Oct 30 18:21:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11219931 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6479414DB for ; Wed, 30 Oct 2019 18:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42B012173E for ; Wed, 30 Oct 2019 18:22:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NS0T9NTn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727999AbfJ3SWX (ORCPT ); Wed, 30 Oct 2019 14:22:23 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37063 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726979AbfJ3SWX (ORCPT ); Wed, 30 Oct 2019 14:22:23 -0400 Received: by mail-pg1-f194.google.com with SMTP id p1so2025194pgi.4; Wed, 30 Oct 2019 11:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RMrszFJgqQZnz4BQZjFom+3bPfD40qA/+5eRpXchJeY=; b=NS0T9NTn2sGO0rWBgW+4jVzupq39TCXDMIQTAD01DlJUEUxJasNRvYxTN7lhEcBxAO MJnXnU2YnlB5hJLWIYhhQJPobtXE07VNl3h8cPpZX3RaQK2Pqvysp1i2oTAKqoR3uMdB f74lLKWqLpqaNrN2EaQK/FTBSE2S4Qv2LdoxZObnuHBUKJCh31lwglekb9hOGGovtoVY W3N8p/9IH+gPHj8dmWQ0VB+tMf4EwMbPdE1UrNf6MUdlk3VrGn2jM11wUEeN7LnpIuAv MI2oK0TN/QUT5PpN2X0uZKU1TKX2+lL87m6iXHXsAGNam2rQmBqKAl9+YixKSr966MBy 6BUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RMrszFJgqQZnz4BQZjFom+3bPfD40qA/+5eRpXchJeY=; b=NPCYaMQfY34Vx4j63qVjirfOVw/pUqqpcXuoxMi0keLQp4pQ1Y8VDwtSL/fsd1veSv PSwNpljDVgfDe6ruv9sPJf6yAhvJBvRbyZcd2JggHwVQyfg4cfMO5VQ+71faau1H2VWx oK9ZQL+ZqD8X4yO32C1Y//tvyp64+kORw125TsQ+miQxftSmcfHKnHVhXQ6GoB93G3HS q/r5VXtwpt8VljHbF0N8bB3ANfJ+94nKkYoctwgJIxdtZoYke5o9HMnAIfDow4V6mFW0 F5IGPuFrHicQ9ifhiMGisz6dUX7in7hn5voVQ5Ft+3slDRMu8NmGiu2FWmO+V8YLBh2Y WQPg== X-Gm-Message-State: APjAAAXCbMGqaWhNb4jbdW2C7SwulJvr5F8Y2HVQCEsRt1l/Gdh0Ud0L Xci40t4oANxmw0j+0ziinrgPnFgC X-Google-Smtp-Source: APXvYqx5ES4peqb/VFYaSUgBoAeQE3RpPCPQ5SNkOCGGUcY1JED3KHtlljdhgijC8J6e++KDRJUf4A== X-Received: by 2002:a17:90a:d58f:: with SMTP id v15mr767564pju.17.1572459741909; Wed, 30 Oct 2019 11:22:21 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id z5sm521637pgi.19.2019.10.30.11.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 11:22:21 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org (open list:BROADCOM STB AVS TMON DRIVER), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 6/6] thermal: brcmstb_thermal: Register different ops per process Date: Wed, 30 Oct 2019 11:21:32 -0700 Message-Id: <20191030182132.25763-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191030182132.25763-1-f.fainelli@gmail.com> References: <20191030182132.25763-1-f.fainelli@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Since we do not have interrupts on BCM7216, we cannot have trip point crossing, the thermal subsystem expects us to provide a NULL set_trips operation in that case, so make it possible to provide per-process thermal_zone_of_device_ops Signed-off-by: Florian Fainelli Reviewed-by: Amit Kucheria --- drivers/thermal/broadcom/brcmstb_thermal.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 64f715053ce9..a75a335d1bb3 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -96,6 +96,7 @@ static struct avs_tmon_trip avs_tmon_trips[] = { struct brcmstb_thermal_params { unsigned int offset; unsigned int mult; + const struct thermal_zone_of_device_ops *of_ops; }; struct brcmstb_thermal_priv { @@ -278,19 +279,25 @@ static int brcmstb_set_trips(void *data, int low, int high) return 0; } -static const struct thermal_zone_of_device_ops of_ops = { +static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops = { .get_temp = brcmstb_get_temp, - .set_trips = brcmstb_set_trips, }; static const struct brcmstb_thermal_params brcmstb_16nm_params = { .offset = 457829, .mult = 557, + .of_ops = &brcmstb_16nm_of_ops, +}; + +static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops = { + .get_temp = brcmstb_get_temp, + .set_trips = brcmstb_set_trips, }; static const struct brcmstb_thermal_params brcmstb_28nm_params = { .offset = 410040, .mult = 487, + .of_ops = &brcmstb_28nm_of_ops, }; static const struct of_device_id brcmstb_thermal_id_table[] = { @@ -329,7 +336,7 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, - &of_ops); + priv->temp_params.of_ops); if (IS_ERR(thermal)) { ret = PTR_ERR(thermal); dev_err(&pdev->dev, "could not register sensor: %d\n", ret);