From patchwork Tue Jan 14 19:06:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332783 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 959BC13B4 for ; Tue, 14 Jan 2020 19:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73E1D24673 for ; Tue, 14 Jan 2020 19:06:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H9zkXg6j" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbgANTGZ (ORCPT ); Tue, 14 Jan 2020 14:06:25 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45731 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728734AbgANTGZ (ORCPT ); Tue, 14 Jan 2020 14:06:25 -0500 Received: by mail-pl1-f193.google.com with SMTP id b22so5586242pls.12; Tue, 14 Jan 2020 11:06:24 -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=H9zkXg6jxTLY3Zf994WcfVL5r28Y6dR2Q/ybE2c3Pi4qGR4BhL9EQpP7HqLnUNzOYC FLZAhk3XvPUAy9TUjqZvHJH2n55NqnaycqLyKThGj7c6im+6KTrl0Z6OG3xIRZPfrVKn nx84xIZWKJQeOS3ysCePa31x+8S3tqikkbkAksyShUdp/TnewAhU74/OfhbPbWXYd3a0 vfLOeFtIrTCcU1CaxH9/s30yHznb3jZQOlv4BNqipoJ/R7SasP5dZxbsluPD9yzZjH9f cl/WuLgExWG9lJf1Jpf4pTm4ZsIZjpemmYa2Bi/9No866yj+TzOSHlQHe2LVMTmU7Uif 5ySg== 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=p70jvMQf5gWtaXWNadH0b12piZ4v5DmF1rEMkNx8uNw8pw7Bm5uqjd5usmVEqK8Q/P zLbqpN3nVVrCVLTw0FIbeX9y3TzxOw3DxHx4D0eWnN7C0kKg8bMOZbzdrCi2krfTuNf7 dpT6q74d+r0IOONwV5q76rzOknJEKBv3SaI7hIjUY6Ek5S2UbMwZORw5dy5y/cqlBmUL rzu+hNDNFlDx0QohEfY1HmXz+IH2ZfwV78OWOxaQ3s2tMyE/c3rEiMvhxTaWHP311/oZ 2lYUCl0YuaGe9R8CtfZ7tJ4kNKRcEFtUgilcTBWKAVASjQT7gFrI6TGTBZ9ok4ZrY/h/ Jwcg== X-Gm-Message-State: APjAAAV8AOMIYJncyww7OP5fAg5e2GCoxm2WtbJOSWz3tPJEdFk8yLdk r1dsZtOJL64G1fKqRBFjpJlfOZOg X-Google-Smtp-Source: APXvYqzaeyStl5zxy5XUEqSmclev0JfVwR009tJs/43CxE4oEzpicozRzjtH2tejfJTVfAa+Osvy/w== X-Received: by 2002:a17:90b:30c8:: with SMTP id hi8mr30814632pjb.73.1579028784213; Tue, 14 Jan 2020 11:06:24 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:23 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 1/6] thermal: brcmstb_thermal: Do not use DT coefficients Date: Tue, 14 Jan 2020 11:06:02 -0800 Message-Id: <20200114190607.29339-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 Reviewed-by: Amit Kucheria --- 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 Tue Jan 14 19:06:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332779 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 319E21398 for ; Tue, 14 Jan 2020 19:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0676C2467A for ; Tue, 14 Jan 2020 19:06:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FSwE2eZh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728835AbgANTG1 (ORCPT ); Tue, 14 Jan 2020 14:06:27 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44834 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728810AbgANTG0 (ORCPT ); Tue, 14 Jan 2020 14:06:26 -0500 Received: by mail-pg1-f193.google.com with SMTP id x7so6806789pgl.11; Tue, 14 Jan 2020 11:06:25 -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=Bf0QfjjCsEX6qf2wgGfocQt3AiGtxcihlNrld2yiLRI=; b=FSwE2eZhaM7nJ7cTgrrBAV6iKrrO/hGwchd/X7aWSYE2ukOUFyVX655ZvOD15Z+Hmp T91KugPoI8ZJ/ViKtd5gHA74xwYojhutrSgCUx31ZArAOd37a/2iwEw+blOhxOg1+RIZ pSAuHklHQku2gfAbnAN0TomOhoMfbK26PxKtLk0bDEVqkGXc2SS7CKiD2h6NQDC6XXk1 C4FsSEgU3pq9bMfDV0Ii4eHpAVI03rm/xMNWEqj8jLLtZ5eNPOOw3pLWvL/elZ1OSic1 cz5Br4dWgqteE8oBdldD2wWlfJzsS1IiEihJfp2cQUaOizLplbRvaGSJPeo4AE+/e9Oo M5wQ== 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=Bf0QfjjCsEX6qf2wgGfocQt3AiGtxcihlNrld2yiLRI=; b=Ak2HE6O2dEwmmBC7NuZkIB/OGCqXKFptwyaN2BL0U1I+NdS6Bdo9Uto1Vxni7zHUJC QiR41iWPV+dV+dJTfe03igNQ1R179J/o7/CxtZSKG4W/z2arL7bwcjYJLhXqAM4BTWVu +VmbzqGt1L61DLAKQ/P7npNiGJACbHHyPjxyXd6ET7cyWVNvZ2sQIhnPNIJnrT6OYe20 sguz7ghCbRFFcBj0Qr91PNpRxWeHhpFpvlXbedUtTkr8E96GAZuEvmURPApIluckrC3X 8wbX1XeW4h1KCy20LUSt0UUn+xp8MoULB272orvfrRVDEMIfK5r4ZQOeBGp9e8Yv3AkE EuPQ== X-Gm-Message-State: APjAAAWVPwEIOaYFikt0fs9nYWFa6FYJQMKdcMB5HoLl8Bge6G+4Oz4C 7fETVQqEWS/sA64YxyFUK0yJwFpq X-Google-Smtp-Source: APXvYqynKjbTkRhlt7ZhyxsnDVhelk0OAduVnKYo4JAVKCKxwfB13+aOcP4ENHL5soycSATHTCi7Aw== X-Received: by 2002:a63:d00f:: with SMTP id z15mr28363045pgf.143.1579028785296; Tue, 14 Jan 2020 11:06:25 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:24 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 2/6] thermal: brcmstb_thermal: Prepare to support a different process Date: Tue, 14 Jan 2020 11:06:03 -0800 Message-Id: <20200114190607.29339-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 Reviewed-by: Amit Kucheria --- drivers/thermal/broadcom/brcmstb_thermal.c | 47 +++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 680f1a070606..2d555e7b884a 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 */ + const 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 */ - 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,8 +292,13 @@ 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); @@ -299,6 +314,10 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + priv->temp_params = of_device_get_match_data(&pdev->dev); + if (!priv->temp_params) + return -EINVAL; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->tmon_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(priv->tmon_base)) From patchwork Tue Jan 14 19:06:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332781 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 9E08B13BD for ; Tue, 14 Jan 2020 19:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D1082467D for ; Tue, 14 Jan 2020 19:06:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qm5G9CSi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728944AbgANTGs (ORCPT ); Tue, 14 Jan 2020 14:06:48 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:38633 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728844AbgANTG1 (ORCPT ); Tue, 14 Jan 2020 14:06:27 -0500 Received: by mail-pg1-f194.google.com with SMTP id a33so6818657pgm.5; Tue, 14 Jan 2020 11:06:27 -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=Qm5G9CSi8hE6nPnKB0JHoF1ksIp45JPX3HX9vssDTwlZF4Rfy8IWq8WZsIfGUaH9sv ZcXt/RoOwAMNw0W+DBimcFz0NHHlEnQjS7yrOba4yZe20ynilMcPvk5aqRF45lXWLZqy jZtMMYTV6PHX4WUY+frShmcXUven7WUPwoW36tLU8UVW3noBGff2vxG63s5XrjaXppnB hXlqvCjH16cL+ouJBOc87NujrFKXlQ68QlCGDNesz8niUqRtCESi7BQQlwQmEoGdBbSt t5iCHJ/WDcw1FOO7PnDvGne5r9CkWnWxx2KVeS9GKtLAwFnYjmfcGyJxkodCXdiJaIhn /cFQ== 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=e+Mh/RW+T5UGSV5vs9aDsOyszlS7OeO+W3/bSoRWnskyT5fcTULO3fm+Ea+faNHb7P Z5y/3dXFzPMRkNGHBhY30ekaoEPZ/L7EoOHHzomE/it5p0JL9D7rfRrfTkAWUzCtP4P2 qHMaoyThx2hQ7KQrdCF1XpEy+NgRly3jIuFTgAx512NzwpXTaOWqUrwswFOHSCe6uuk6 bW21n880DWabTyy4ABaECxYI1uMMPZJ0Z94FXBhqjX9zh8QOC+PM/QAcOP9mU7X/6lLf e6fpV6JqZ0KUik/v5pATuBOAsvvVbpWaEKs3OEGCsQEHBYumvQI3U1JUcc4amEtLx8ob 6TKA== X-Gm-Message-State: APjAAAWU3fESTS7olFeeA3zQG/YQLMhB/k5uigcRE0BJkLj632SUo7Np Rlz7T9MXU9uuk7sjh2oQ+TTt0Xam X-Google-Smtp-Source: APXvYqxW4WEv33MceQhvOoDvCOyqNa0lcjz4YBr8Xi3MM+oBNXj+5uUCXiO6j87tYXtC2qT/dxYIrw== X-Received: by 2002:aa7:8a99:: with SMTP id a25mr26927807pfc.42.1579028786488; Tue, 14 Jan 2020 11:06:26 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:25 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 3/6] dt-bindings: thermal: Define BCM7216 thermal sensor compatible Date: Tue, 14 Jan 2020 11:06:04 -0800 Message-Id: <20200114190607.29339-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 Tue Jan 14 19:06:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332773 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 D064B1398 for ; Tue, 14 Jan 2020 19:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE24624676 for ; Tue, 14 Jan 2020 19:06:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sRB5dAWc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728865AbgANTG3 (ORCPT ); Tue, 14 Jan 2020 14:06:29 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46657 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728853AbgANTG2 (ORCPT ); Tue, 14 Jan 2020 14:06:28 -0500 Received: by mail-pg1-f194.google.com with SMTP id z124so6804341pgb.13; Tue, 14 Jan 2020 11:06:27 -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=vD4wTJSOL9eulpsTOv7Le84ncUzkM09cyPSOhtdnfmU=; b=sRB5dAWcX/qUSYqbrlWhiWc0MnbvpoatmZ6LCpB0UwOkZrtsYHqNLBFUVULx4jVB1h yzSnkzLcqPStLhkUXefgdfCUNhyhmMU7OVnpe7kimMEjwIOAxXVt06nuJ/SH3MyNhDsG gpEXvDKXO3QEkIDdR518cafxevtrh4gXvsAAYp8oLHNwvuOTsyijwX9qstj/kSBzYDh3 j4YPo83hJw4RNS3iqKSBngW7p2yQRuiEU5Wv6f7Qc3GhmjQR/TsfS8EFEVn5ezuPOGfO SKoxuyzlOjbR1H0EIMHWm17hUa91GfSalnFWWkiK7XQNcU185sOSEM7qofNsbaRGyh6f 7CBA== 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=vD4wTJSOL9eulpsTOv7Le84ncUzkM09cyPSOhtdnfmU=; b=sgxaJvuyBwgJ/0/pfFRj8WgO3oVm4n2hZX3BsMtTYlW/QVWH5TrF3SNGCxW7opE8pu lpCR2436izLNHeD0zYcv2UMbedBgxvI7Kj80p/eFVVoEo6yqky5GOBaiVd7Y3GwNpX/c QFLna1Gs9QN7GFvfMoKqktPHrBeItPgCpzIx8/VfalHDTVfuFWPNu9IRc9IH6k7YJ2x9 fgrlxLAOXtzvqArsY96E8r1bgctbwxJaZRgzJD9a3FJmKx+IxwdHqAa2Oso2TmL53WqK f8aXE/fT3+nqRSPrphGitiEyUyFhtmgqbazaMlOF2u9Dnk0M+y1OwNYPC2+1prTwBsl2 2DgQ== X-Gm-Message-State: APjAAAVuczivlVB6mdDoz2iyrZwj0bY7aWupXUv5rzHlwKQ7DG5A14Ml expvc7nu5uz7tvn+YlrlGXSm8ENL X-Google-Smtp-Source: APXvYqwCWirANusXlzS5wVKhPR+K7LLYkWVsiIK/0rFOHoFwJJOpRuMfg3cj6pr0b/4klXZYXW5G/Q== X-Received: by 2002:aa7:9306:: with SMTP id 6mr26753037pfj.36.1579028787478; Tue, 14 Jan 2020 11:06:27 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:27 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 4/6] thermal: brcmstb_thermal: Add 16nm process thermal parameters Date: Tue, 14 Jan 2020 11:06:05 -0800 Message-Id: <20200114190607.29339-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 2d555e7b884a..4b328586959f 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 Tue Jan 14 19:06:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332777 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 7B3C113BD for ; Tue, 14 Jan 2020 19:06:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A0D424679 for ; Tue, 14 Jan 2020 19:06:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b1oRWQ+o" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728872AbgANTGn (ORCPT ); Tue, 14 Jan 2020 14:06:43 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:44985 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728863AbgANTG3 (ORCPT ); Tue, 14 Jan 2020 14:06:29 -0500 Received: by mail-pf1-f195.google.com with SMTP id 62so382381pfu.11; Tue, 14 Jan 2020 11:06:29 -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=4vSJnMnRQY5K8VIAp/CMpFrjM8LQtV7YQuTT5kLVa2Q=; b=b1oRWQ+ofqnyI9P+5iPLK8xjCoJZqwsNkEhaJlpnvxZb+H/Q+SE4o8hARWqr6XiIYX ip7DfS9hlMSocjKd8dd02V+XeGog6u8mDa4sJH6+/wlbZrLaYIy1hPaTiz0mZjP+PPTS QAsPrC4tcJzFiURmrG9Qp55ycpqJfuSfa4q342neqf72FaJeb4YvFPyxZ3szZppoLjNA oGjp1RysfqC5G4aJZiDgRwJ7uws+3jQhNNXa6WQcvu4NTfI9hZTHi9UwIuLjGeCLMEiO V7ytPmFE3PF7HATjoX7+Jd8kgl5lfjr7hstsADOOdZ/d9c7obW2YjcE0asOP6EEtV3hB C84g== 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=4vSJnMnRQY5K8VIAp/CMpFrjM8LQtV7YQuTT5kLVa2Q=; b=ebVd1wEA6gAqj093wb+uEutqes4PjFdIhg78ZrVe6wJSU0P7GwELam6CyRRAnv2V2R OD5MJMdSmJrlRmLKKiBEWpQgkdj6xwXNUTJWKrshltdoSE0QLF+Et59r5hoZbyxhm2qA QEFFJuRNnBdR1xxQaO04+5VVITqg2Q6e48Jgm6lKmJ2l/+M2JtCQawG5WYm2QfQHJKVo 0LM84XuQZKdJNSTpbpw1pSL8+2Bdhkv2xRqkFra7I2gie1O1JWjzqaEsRfayAyflq2MP 0kK1+SSckADOliXPSFwIS7WqriRgl18p6qY7dbQWzAjfP/U7kX8uNlr1rGw9K9wfZNDQ Muaw== X-Gm-Message-State: APjAAAW/rKG3Q5Lr4PI9WJqnn7OTfx2ibQoWvhdRZUXJD0P4XXQxFjXc l5FINgdKJ8Naxw1FpQ+LvwMxSmnZ X-Google-Smtp-Source: APXvYqxs2+XlUU2WqQPZYVIaJ6IXhF2aeaBA+8K/Ho1GQddwh7hY3UO+5LROxkyrOAxroGfhjjTbSw== X-Received: by 2002:a63:f901:: with SMTP id h1mr28558196pgi.445.1579028788518; Tue, 14 Jan 2020 11:06:28 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:28 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 5/6] thermal: brcmstb_thermal: Restructure interrupt registration Date: Tue, 14 Jan 2020 11:06:06 -0800 Message-Id: <20200114190607.29339-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 4b328586959f..6ded4b9c53be 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -343,16 +343,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 Tue Jan 14 19:06:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 11332771 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 C75C313B4 for ; Tue, 14 Jan 2020 19:06:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A58A724676 for ; Tue, 14 Jan 2020 19:06:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XICSL1Rk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728914AbgANTGi (ORCPT ); Tue, 14 Jan 2020 14:06:38 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34379 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728872AbgANTGa (ORCPT ); Tue, 14 Jan 2020 14:06:30 -0500 Received: by mail-pf1-f193.google.com with SMTP id i6so7029030pfc.1; Tue, 14 Jan 2020 11:06:30 -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=pdqFhCoobMXuCQErm2fyAM9nvtAnhN2zKc0BHszTXso=; b=XICSL1Rk08ZtNKUFEan9CneKTurtx+KU4l8I9KYCJJvel3de5/tnLtPzCWmhy5tWuS zVJOubUDyYYgFfZMSuVu6UORRh4R0C8s21pJ1m/QNOMDcN3ZLNKu/6MtF1C9jqskKbOZ zQLTmkbcdraiIGNfhTHDULSOzrM2hc1dNAwqe4eEVeDCY8lkA9HxRZe0yO31aeVjm+oh oi+SZ1Q/rG55ihhOiS8a/ZCTXezKkZLpDbz5NYUpjM3zWRQKgzd88Ppyk0X1fuc5uiLC 06SOKTxr+xAuXG8NScl6LMDuQXAeHzzqiG27mfSvgm80c77vroHU+MzrVg/XPZE4V+Ic s1SQ== 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=pdqFhCoobMXuCQErm2fyAM9nvtAnhN2zKc0BHszTXso=; b=f1bZ1wwMLn2pzOe4RhV0TsePdFy+NF4MCUOZN2p8KSiZ6jp1nkpQ5vlXyP95gUBEKr 8bMkZc2KotIaZrLUhiZ70Trx8zZbVOKZRXFCm1/3GyUGmvv2rEEUkP8Oq2eZcmmOZEUB L0+BI6G8eXhhL+J7Yecoz1qazp64N8M2K29oqQhoHQZqWvKCKIfRnBbBWLdbgdv1s89+ 2jrCASlWdiyt5+3g6P4yjCFV1Bpg7+I/3LVzmw9z1cnwzN1n7di50zmusG9iv1AGHk87 A878ZP4BNd9CgFrWz/6E3YkamVdvyBkcPPfvI4/jt7Xz0aR0wRxVeRobL7Jlx6w6E9/F OPHg== X-Gm-Message-State: APjAAAWLBBgZ2EW2h9qC17ozmZFIs5SE5GoewH6kIpHqR463GtYYRLlr m55QwQ780y7zmIRpmpqeUkN07JRH X-Google-Smtp-Source: APXvYqzRroJjj7y1B13WecukIAzkgxjPBRhiKYGRxVC0DQon8cavTK407Wh+9iS54uf7EUBtSdwnPg== X-Received: by 2002:aa7:9111:: with SMTP id 17mr27652957pfh.163.1579028789694; Tue, 14 Jan 2020 11:06:29 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a195sm19284528pfa.120.2020.01.14.11.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 11:06:29 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org Cc: Florian Fainelli , Markus Mayer , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM STB AVS TMON DRIVER), Zhang Rui , 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 v3 6/6] thermal: brcmstb_thermal: Register different ops per process Date: Tue, 14 Jan 2020 11:06:07 -0800 Message-Id: <20200114190607.29339-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200114190607.29339-1-f.fainelli@gmail.com> References: <20200114190607.29339-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 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 6ded4b9c53be..8df5edef1ded 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[] = { @@ -311,6 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table); static int brcmstb_thermal_probe(struct platform_device *pdev) { + const struct thermal_zone_of_device_ops *of_ops; struct thermal_zone_device *thermal; struct brcmstb_thermal_priv *priv; struct resource *res; @@ -331,9 +339,10 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) priv->dev = &pdev->dev; platform_set_drvdata(pdev, priv); + of_ops = priv->temp_params->of_ops; thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, - &of_ops); + of_ops); if (IS_ERR(thermal)) { ret = PTR_ERR(thermal); dev_err(&pdev->dev, "could not register sensor: %d\n", ret);