From patchwork Wed Dec 11 20:31:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286263 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 5706815AB for ; Wed, 11 Dec 2019 20:32:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 338822467B for ; Wed, 11 Dec 2019 20:32:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ru6rpApk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727548AbfLKUcA (ORCPT ); Wed, 11 Dec 2019 15:32:00 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38436 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfLKUb6 (ORCPT ); Wed, 11 Dec 2019 15:31:58 -0500 Received: by mail-pg1-f195.google.com with SMTP id a33so11085378pgm.5; Wed, 11 Dec 2019 12:31:57 -0800 (PST) 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=bUI3dxAJmLbR2verpuQbHht/NnNgFc4Xm8emQetKLeY=; b=ru6rpApkxWfLsDVpgRwLBm4hAo2TQvM8KsODhFgI3HwZBxEcNZ5tUFLlmKttn5uwFM 2BnIPYTi5ylFrBcB8s09BZOmdUoYAJ7SQzUX7QqXg/iBpnqnloIPazKEXMdqVc4bujlN Kq08lbQl1wloiSnT8//5Ag0zpIfIBzeqVEgLpz1nNeQTUIRLw3+D+S+CKMEDBPezdokE wXLoS6KpgtIHgCaFUTTsBCmQ91mSWrWmkDuIQZR733e6sYdfmrrN10bGqqEW7+OAdsJ1 ZzuGjMwRMEJfX9r8syaV0xN1yskgFxDejnGZ80dv7+agP88A7BjgumoMFyKNc9Fi3nvt pH9g== 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=bUI3dxAJmLbR2verpuQbHht/NnNgFc4Xm8emQetKLeY=; b=cspYKXoO6shyhttB2xZALawBc8C5YfnJmVIZitowV3MtU3lNtAYyDYWWBFDgvCizb3 yp9ziszzUGWgP4uhQAWaRRxEJxmV29z6/p33WsjDOM6o8IOxg6uxcn5rOpHwxMy1SL/1 ndm+6Gi9/vIi8LtJZPsTIFlcT+yx5NQpR4SnRJV99Qm9HBCWAGvkbNe9TtFakvD9iJ8M 5N09TqNI5SnEpAFq2ccarW6eyx4XITDjnesKIxupIW+n9r8aggS1XHmfn8TEtmpi7+oI VcnTwy6IVkl4yALWaNN6mqsSitpOqA0VOtKI8t9Am1QiOZ7uqsXEe3VVZ54avEPjwntg xN9w== X-Gm-Message-State: APjAAAXYYhW2LWJdLqI7CYbq3mPBFsBa7OeXhdD8W8/n6GvyfMQAL7lZ GYRA0ZWL0g147UhWLCDgJiI= X-Google-Smtp-Source: APXvYqyQ8PN4Yo0D5f0TxdtgaqutssAvFXy5lB6UXK07VypUBLW+9PLuwlCGTEr6LBLosXGwZ9rWLA== X-Received: by 2002:a63:214e:: with SMTP id s14mr6207807pgm.428.1576096317292; Wed, 11 Dec 2019 12:31:57 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:31:56 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/6] thermal: brcmstb_thermal: Do not use DT coefficients Date: Wed, 11 Dec 2019 12:31:38 -0800 Message-Id: <20191211203143.2952-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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 | 31 +++++++--------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 5825ac581f56..680f1a070606 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -49,7 +49,7 @@ #define AVS_TMON_TP_TEST_ENABLE 0x20 /* Default coefficients */ -#define AVS_TMON_TEMP_SLOPE -487 +#define AVS_TMON_TEMP_SLOPE 487 #define AVS_TMON_TEMP_OFFSET 410040 /* HW related temperature constants */ @@ -108,23 +108,12 @@ 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 (AVS_TMON_TEMP_OFFSET - + (int)((code & AVS_TMON_TEMP_MAX) * AVS_TMON_TEMP_SLOPE)); } /* @@ -136,20 +125,18 @@ 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); + return AVS_TMON_TEMP_MAX; /* Maximum code value */ - if (temp >= offset) + if (temp >= AVS_TMON_TEMP_OFFSET) return 0; /* Minimum code value */ if (low) - return (u32)(DIV_ROUND_UP(offset - temp, abs(slope))); + return (u32)(DIV_ROUND_UP(AVS_TMON_TEMP_OFFSET - temp, + AVS_TMON_TEMP_SLOPE)); else - return (u32)((offset - temp) / abs(slope)); + return (u32)((AVS_TMON_TEMP_OFFSET - temp) / + AVS_TMON_TEMP_SLOPE); } static int brcmstb_get_temp(void *data, int *temp) From patchwork Wed Dec 11 20:31:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286265 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 E88D314B7 for ; Wed, 11 Dec 2019 20:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD76B21556 for ; Wed, 11 Dec 2019 20:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B+s5PbZT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbfLKUcA (ORCPT ); Wed, 11 Dec 2019 15:32:00 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42284 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727223AbfLKUb7 (ORCPT ); Wed, 11 Dec 2019 15:31:59 -0500 Received: by mail-pg1-f195.google.com with SMTP id s64so4580615pgb.9; Wed, 11 Dec 2019 12:31:59 -0800 (PST) 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=nAMyfH4P60dFRDU7m+hosqMx6pv601HbAJ1pQGyNcMg=; b=B+s5PbZT4Zv9XI0AjaTATaBNhgYdHqBe7Fe7Fgk6Gne3AfcV6tuqSt2zTuOKkdpzGC dWt4Srz4rqMCpUQHt1SNCub76Jw4jI1uspbhQmdK19gtgOt8aLASF+eY4XxtuJ/D9cEF bigPSiDXbdFkXCZU9wq2ctSA4B3zePmC56PxF8jVdbfEsZ/e9xzLnSkYdpNBCWQ8FkEU c9l2+prZDlmxmUpMzrCUGeVxqvGBVNy2f4BESOpRxkOhb0iGulRPcnqXSTGp3yRw5IYm GoEtJlKtZR6oLs6rUesOmwDWLxwy0yk6zmH6Vw8dp/nCpSLBUpJ7kMKCdl+85uanBSvv Emxg== 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=nAMyfH4P60dFRDU7m+hosqMx6pv601HbAJ1pQGyNcMg=; b=UJrodp+D29mayWZGLPNedrPVjuL5dNYnMExG80tpgj80RawcQr6d1Cp2s8R8rdCbO+ qloYvSPHiHKOBxXHTj9LhI3B8JbW6tR54KSDjSNMCRofY5cusQFrYwdtKXH55tnVepC+ 9htaiNxMKBTLUzbLALcAEyCrUpwjU1s3DoIeq5aebpNjzXjBqMS5xGNzCsg5Db18frcT ol1+6PQriLrwYPZ5Ix5f1PJ7jbIC7Md90C0vEGQDmpc6JrVKzNKJAzWeGM+3WLVo5xWP EXbZw630shfVluUssYMjEF2ZiQ8RkWyxq+99yR6f1bN9GJZeCpecYJRhc3Nts/NOi9w/ ZNTg== X-Gm-Message-State: APjAAAUJjHzILDFKVbDwXp49JNTfUw6EQo/ANQQNP7DyCJ63Ylkq5o4q CcW6NI6lt8wLF3/Il6Xs0ug= X-Google-Smtp-Source: APXvYqw905t0OmMYtvu4Tzun1VIheUVmOA2Ss2518GBDlhcYIjEyhuan6FZ4Ec2WugUBJLN5NY8CXg== X-Received: by 2002:a63:5b0a:: with SMTP id p10mr6243248pgb.228.1576096318549; Wed, 11 Dec 2019 12:31:58 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:31:57 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/6] thermal: brcmstb_thermal: Prepare to support a different process Date: Wed, 11 Dec 2019 12:31:39 -0800 Message-Id: <20191211203143.2952-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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 | 54 ++++++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 680f1a070606..68f89f7c7e7f 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -102,18 +102,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 (AVS_TMON_TEMP_OFFSET - - (int)((code & AVS_TMON_TEMP_MAX) * AVS_TMON_TEMP_SLOPE)); + int offset = priv->temp_params.offset; + int mult = priv->temp_params.mult; + + return (offset - (int)((code & AVS_TMON_TEMP_MASK) * mult)); } /* @@ -122,21 +131,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 < AVS_TMON_TEMP_MIN) - return AVS_TMON_TEMP_MAX; /* Maximum code value */ + return AVS_TMON_TEMP_MASK; /* Maximum code value */ - if (temp >= AVS_TMON_TEMP_OFFSET) + if (temp >= offset) return 0; /* Minimum code value */ if (low) - return (u32)(DIV_ROUND_UP(AVS_TMON_TEMP_OFFSET - temp, - AVS_TMON_TEMP_SLOPE)); + return (u32)(DIV_ROUND_UP(offset - temp, mult)); else - return (u32)((AVS_TMON_TEMP_OFFSET - temp) / - AVS_TMON_TEMP_SLOPE); + return (u32)((offset - temp) / mult); } static int brcmstb_get_temp(void *data, int *temp) @@ -154,7 +164,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 @@ -188,7 +198,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, @@ -201,7 +211,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; @@ -218,7 +228,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) @@ -282,19 +292,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; @@ -304,6 +327,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 Dec 11 20:31:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286261 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 0D53C6C1 for ; Wed, 11 Dec 2019 20:32:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE724214AF for ; Wed, 11 Dec 2019 20:32:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b7yOoaL4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728401AbfLKUcW (ORCPT ); Wed, 11 Dec 2019 15:32:22 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:45791 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727466AbfLKUcA (ORCPT ); Wed, 11 Dec 2019 15:32:00 -0500 Received: by mail-pj1-f66.google.com with SMTP id r11so24632pjp.12; Wed, 11 Dec 2019 12:32:00 -0800 (PST) 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=/SGLTAdZJn5EJy2JzHgzjK5/AJ+qkCVgDvB3ahQxnHQ=; b=b7yOoaL4G/ALvz/vNUlr2OeqNIasR8tlfumfduHUCFAHMOnxwtwF3SoUwldWsEaQ4R LvW812GkycQioVyIoAeViSehBhLN1Q1fYMklkMS1CLAqfAfhQa7oJFT7DMvMrZaKAb7j NmDSJEeyjRRMw6m2gmWMK31DqM0KmM1u85/KojBSQKtdXCVhFcQZgfC3jqKuJ9EC8KLf eG1TR6a96w3YAz3FtgejTRo7Cs4j71tlDnUpbI3criKCOOGkRDoPZfN/+hysMy4D7IAw CMLHltGp9hLhs0O75keqJ074R+i9CYm6esB68cymsYt+Q3mKtu4NS5r/EJ7VPoC6ETh0 o+og== 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=/SGLTAdZJn5EJy2JzHgzjK5/AJ+qkCVgDvB3ahQxnHQ=; b=XrV+3/Vjv1pkCrXwkh7VBg+albzzbjnqI07I7IjDCW55euM8UceZz+CuYtItB7+cG2 vPlaNjxZqHfF04DR24FOAKsumcFHef1vZtqk/UuevC5u5mXkXG6gZU7GXdXZ/6wEMQZP 4zNpCV+/mYJq4NNNqGaAtGfpHIUvkDq87Wg3rXA1ZpGSvBUVUSksv6tc1d3NBCm+v3GF Y52LPgtYGPJhDDMvHvp6YjAD/FvCNFKyJA1RWZTT9Wk2W342WS22x8ITHZ2aqnIX4S9z kDG31OlU0t0LX16uibTJYkqzgKhkxbbGbq5Vs9koqSepCoIaETq1YpPPZuy/HfPBIZGt 7Tfw== X-Gm-Message-State: APjAAAUdPsOvitz4tJnF654uN9BRwEgDT8175wjEizA7GOxaRMM5NYC/ y/T1Ipltx+njiVNv1baGXOg= X-Google-Smtp-Source: APXvYqx/G7SPF+0fLJkFR2jINi/QVILifYW6VvhXLrfs0TC+JDl93K7sIkMmJpc9bSFgNrKj/zRX8g== X-Received: by 2002:a17:90a:7bc3:: with SMTP id d3mr5804634pjl.86.1576096319788; Wed, 11 Dec 2019 12:31:59 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:31:59 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 3/6] dt-bindings: thermal: Define BCM7216 thermal sensor compatible Date: Wed, 11 Dec 2019 12:31:40 -0800 Message-Id: <20191211203143.2952-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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. Reviewed-by: Rob Herring Signed-off-by: Florian Fainelli --- .../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 Dec 11 20:31:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286259 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 CF36615AB for ; Wed, 11 Dec 2019 20:32:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD6862077B for ; Wed, 11 Dec 2019 20:32:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d3b4d/7L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbfLKUcC (ORCPT ); Wed, 11 Dec 2019 15:32:02 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:46981 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbfLKUcB (ORCPT ); Wed, 11 Dec 2019 15:32:01 -0500 Received: by mail-pj1-f68.google.com with SMTP id z21so22169pjq.13; Wed, 11 Dec 2019 12:32:01 -0800 (PST) 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=0+ZNbiTOOC7n+yoMJbbexSm1sD8dYoDxAphQh0Gx9Wk=; b=d3b4d/7L2CRwAcKwGLpCgZrLZuRldlGySqCDYcmTnmibFchSRNNwAe7x7V6NddqiPJ 5NFe62AAv65r+m12799xKg1D3Mh1FE8rlX4zHOv20aiXeTHZY/+33M1hdRr2WOaty65b qG/302JAWhNiUoRLmvPzejIC/SGjfeTnftDEdJ9BRtM20rdVBgdoa1DBS3rozw64+JXa pfkfOB7g4AeaG3GkIwCswaU2qGHUQDzfe374bAtDVaTfsRQeE68qBUYVKjvyvy/VzRC2 EdiqMeu8hGJXgENSI31l/9Ihsh05XnY6GJ8GF8C4xaNoVqIE2S+r3H06obBppYHud4G+ nTtg== 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=0+ZNbiTOOC7n+yoMJbbexSm1sD8dYoDxAphQh0Gx9Wk=; b=nMLv6gYP+ctXF6sF5tfYqrbzhaFcYUcBQuqgMSnUHRmhaGlu/2LRBL/I55sIjgBS9j Rfm+YjqsULDoYMOqCUxDQvvdkBleKOF/Km1XNQFk3YEumIwe/m8Ta339Cz//U5yAXaPF U44P/EGHNVRobsK0uCTZnM0Ze3peQeuW07gdJrXb/iV2LrGTca8iH+9yz8Pl7DcwLGdZ 4JYtBE2gT7WD63vFbyqpUrmcDnknvKjciG3HS/otjzJqcDY1TtBtW+kYtixMgcYiJKCd dy4Gvjk7uWrRttpNteVaVHRaLodSoN2F7U1RV+QvL0xqNdunZCu6f7zU/ms31Na1428J TsuA== X-Gm-Message-State: APjAAAWAKhIeYlsvf8bFsfb8OP88W+/5eF/podyKMDq/5wuc3qDjgXMp LSqFC4uS0pZ4c011uNO41/k= X-Google-Smtp-Source: APXvYqwoG0SV8AaTyS0uTCKYn3q7bdAhdrRAzF28+g5XNW0W8G5/JNPvA8EVwJ6sRjadcY5I6QQaSA== X-Received: by 2002:a17:902:222:: with SMTP id 31mr5308114plc.117.1576096321068; Wed, 11 Dec 2019 12:32:01 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:32:00 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 4/6] thermal: brcmstb_thermal: Add 16nm process thermal parameters Date: Wed, 11 Dec 2019 12:31:41 -0800 Message-Id: <20191211203143.2952-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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. Reviewed-by: Amit Kucheria Signed-off-by: Florian Fainelli --- 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 68f89f7c7e7f..74d94f01b1b9 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -292,12 +292,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 Dec 11 20:31:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286253 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 ECDFB6C1 for ; Wed, 11 Dec 2019 20:32:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC58222527 for ; Wed, 11 Dec 2019 20:32:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WQFmipXr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbfLKUcE (ORCPT ); Wed, 11 Dec 2019 15:32:04 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37527 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727890AbfLKUcD (ORCPT ); Wed, 11 Dec 2019 15:32:03 -0500 Received: by mail-pl1-f195.google.com with SMTP id c23so41167plz.4; Wed, 11 Dec 2019 12:32:02 -0800 (PST) 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=afURWFdN1dU/KLmm8O/X/Jsvd7WfBwUp3PbxBXxbEO8=; b=WQFmipXruI1fTRuJSFGA+UtCvg+t0311Lztvvzz25V1GaOT4jVXqbMxAyysv9OySUw +9/7WI7+1RxSFI33RYHQoPAqQh5XAaPGfMu3YtTBLXVGRu7k8WQ4COQ06ahaIoVgih8/ vz/1vVaDWE/4sgwwZZfbXOoBD1eYiG15pgQJzhG29xp3jbQrfrj86j8okGfVlpyuayaf DfGm7gN6BOebb9VuiwqOzjDCIb1TUmsUkLZZReSofeOeD7z7UVyI+mNOj9fXp9rO2wz/ jwkW1lQx5uNhpKixZxW499CvK54iXIorUAuS2+PaBbNf4yB3J28mq3eVxcJIBlUN+HHu butA== 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=afURWFdN1dU/KLmm8O/X/Jsvd7WfBwUp3PbxBXxbEO8=; b=AtSg19HVcrE3XZj7a4sTaFttsV4/kBbzVX6UUp4pOyuy1k3SghLrmBnBwoXDtzxrP4 IYFj5Lqw1e4wVRC954xPoZsGiIhOVOG9idjxT13CwA8slnldqiuN4Q2LgXAKxN+lBPuK hJVRt+l1P+btQhxhhUEXMeC6VMa8HTPnUgPw0uUzPltt4AwRIr9og08uU2nU0/p/zjeL 8978U2szPp/2s6jM4OQeYOyLfnx6JXJXOtzr9Rqd29IgjLImzVBuMO27Bh19Vl7k8fhx rGPCkoq28FELa4OXqHCWHD3pBKbXiiFeAA7nTOyaP7GBmXI6yS/5SRODmHlJMo74GHIT KcwA== X-Gm-Message-State: APjAAAXiMCTarb2mdMMmqXi+smJN+fHewBj/Vxa7uebeB61IHZENIyLm zn/KhGywLjElSwCPVkIMCBk= X-Google-Smtp-Source: APXvYqxGSB+7FmWepthU7M3pDNil4kYRJ30rzs2NUAnzV5QbV9rl9uHOAx0+aLP5WZBmSwJeGCpilA== X-Received: by 2002:a17:90a:b301:: with SMTP id d1mr5568198pjr.20.1576096322353; Wed, 11 Dec 2019 12:32:02 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:32:01 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 5/6] thermal: brcmstb_thermal: Restructure interrupt registration Date: Wed, 11 Dec 2019 12:31:42 -0800 Message-Id: <20191211203143.2952-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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. Reviewed-by: Amit Kucheria Signed-off-by: Florian Fainelli --- 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 74d94f01b1b9..47b622f33900 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -348,16 +348,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 Dec 11 20:31:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11286255 X-Patchwork-Delegate: daniel.lezcano@linaro.org 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 7429315AB for ; Wed, 11 Dec 2019 20:32:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5047524680 for ; Wed, 11 Dec 2019 20:32:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lf3l10Nj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbfLKUcF (ORCPT ); Wed, 11 Dec 2019 15:32:05 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35883 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbfLKUcE (ORCPT ); Wed, 11 Dec 2019 15:32:04 -0500 Received: by mail-pf1-f194.google.com with SMTP id x184so2372102pfb.3; Wed, 11 Dec 2019 12:32:04 -0800 (PST) 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=g7cIIA2fUKT3XoPncLJ8inchwLvzx7zJ6yCBfGCD0Kk=; b=Lf3l10NjokJTOzULJqrys4crSiRGGaVRpF7yZSm4XkNOqQe3ZXMy/OBLaU2AkIzQBz L1GSLt1JIzu38qUN8fPnPaCBzk5AgHB4zYdBaDOVdrzbI86OJfV6S4rX2VcS300Jj+DI psuofx1zEr4mAmM4/Lvsp6WseLe6l2f7gvIE86l1btmXTpcHiDrUgo0iGE5ekdnUjHwm i1NKzWzJMEM+C1Ar0EEAWSA5wKfkE/fNNnX/oL8MMgB/DIxnpCwvaASxofXFd8m5WiFv fNKjhV0ECWLPHiP/hfNOrr/Y6R6KJiemIrt2BuwGfXMFGPrQuFnlU02QJsBcR2KY+c+2 iOHQ== 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=g7cIIA2fUKT3XoPncLJ8inchwLvzx7zJ6yCBfGCD0Kk=; b=ocZDwB3mEGFWCdfqlil8h3Y9TpNuGNc/3nO6Pf0aS8OemgchQAbPJnt25C3os0pVLy UH+hrH9okTLsHhRdTsO6gbO++qYDfeM1CrGIiVieMvR11n2UjHFVGZeDu+4Ck0HcluPb f5EwRIqTdUS0bgkWgn1WlJBDcSGcxV/Kl1cCZvsqZrrPFTxi0eI0krOjfG1qqkXpgYLm 5/e+sABUzgeQp75tY55iPHa7XdL/aXsSkwUP8n57wfn/SUJmItKGodbcrjocsEmaEHUt TOKp59AQaydQ94FJHp3vzpQWZpHu9rg+GyaxDyYJ43qc1oCMix+i+bGc3tolGjrF/y78 vhOQ== X-Gm-Message-State: APjAAAWdc4qc9JqZ+aG70SHa6jJsvPQ8YCdqLp+w4yPiKqpDO+p+HI3q CBqhjrI1gdHdXACiwY2YAqs= X-Google-Smtp-Source: APXvYqwprBE2vLChSP+ukiV9PRJ5kqS/aFkDnKefJvtf8znhGjt+UG4gh9WbCvcxO9Ut62p6AUXuvw== X-Received: by 2002:a63:5801:: with SMTP id m1mr6150099pgb.139.1576096323582; Wed, 11 Dec 2019 12:32:03 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a19sm917570pju.11.2019.12.11.12.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 12:32:02 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , Eduardo Valentin , 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-kernel@vger.kernel.org (open list) Subject: [PATCH v2 6/6] thermal: brcmstb_thermal: Register different ops per process Date: Wed, 11 Dec 2019 12:31:43 -0800 Message-Id: <20191211203143.2952-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191211203143.2952-1-f.fainelli@gmail.com> References: <20191211203143.2952-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 Reviewed-by: Amit Kucheria Signed-off-by: Florian Fainelli --- 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 47b622f33900..8170ea1b8227 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -105,6 +105,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 { @@ -287,19 +288,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[] = { @@ -338,7 +345,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);