Message ID | 20231020081337.3141488-1-peng.fan@oss.nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp898762vqb; Fri, 20 Oct 2023 01:09:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxfah1Uohfj8ccljoXZv92SI8AeACqmd7A+jym7QHi4SOkc7T2syjVcQP6XoVUuvuPAMCB X-Received: by 2002:a17:90a:70f:b0:278:fa86:13d8 with SMTP id l15-20020a17090a070f00b00278fa8613d8mr1065274pjl.41.1697789363192; Fri, 20 Oct 2023 01:09:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697789363; cv=pass; d=google.com; s=arc-20160816; b=d/Aerc4rC62RRYrktIYaP/nDN2PTyudvVB9j+gxIkHmkfcpSlG8A4136EZIzM2nnTn FtwyRxBPbdI7wY3buW0/nJNsjwhCTE6qU3wbTYWV2Vlzlg8Hd2zo51OjXt9ArGZLtA9N /9yQky0Suus749d41dua3O3aYnqr2uyA8niTNVMW2lUhNc4TQSJ17UxPonBN5pCMWi3C 40+dgucS4kMrOuq1NEwtW+IvhL1k8KgEjgeV3ZOBOxbr8P7Bwb8vplRBTlUIDyJkEkTz 7ku9HgKWOhX0z6ViD26ThC2an348jFiEA3e+n3AzEnYhLNtr4Llfu93K/I/pOhcYa9Sf UftA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=8seKGxRjDiE4b+l1Latozxzp+3IhrF1f8+q3TByBFIQ=; fh=EkQ7dNs+LSRDD/gMamVYRIN+vV/jo7IWBsGdO2VpKOk=; b=STY56k7qfzee6+TMCr28MgUp9MR7ego1ft6FM/S7sOhLAFAwOMMFmks8pB4q5+n5Y4 zVrSs5lvpkNiJfJXISS7VEmRWJQ/X8jbevumFcZPWsDPwn4AehNSWPFlVUNccmpOpqgR 5n4usCHNj2Zm7K+lSSzgFJLXHrQ1G/W1B9zcDbiLwB+8Jq0RgNo3QbI8huhVueWvm1Yo WTddU8P3Thb+bgFeZX0QdT7WRDGyp+lPXxUhvrcDlw/Bqvxo921h51eNOhiX8pnY9hxB 2E2BO7O7N9aNsQ5HVquIOP9KvfX6mjm41aT3X7Fx+VXh+mpB9N6Xiw/es1bV5SvuNHee I+LQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=F+SG6wC+; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ip8-20020a17090b314800b002776a60ea68si1533128pjb.1.2023.10.20.01.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 01:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=F+SG6wC+; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BAF2682DFD3C; Fri, 20 Oct 2023 01:09:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235637AbjJTIJO (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Fri, 20 Oct 2023 04:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235660AbjJTIJL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Oct 2023 04:09:11 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2070.outbound.protection.outlook.com [40.107.22.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E92118F; Fri, 20 Oct 2023 01:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M9kEuwVwPI/ILynqjT/XUKLdTq3INc3SfPtXPN6vflB8xbzvCTxJ/XIAih1rPFJkF5WGM3rV3NJPeb9+fq+1e+ml67QZskSW5/Rmyw2ZQd9OQqrUugpLoqTdR2wjpYJnZlwe/4GMUivpVd1+LLYQRQFZeUpAZImmx8oTXBgTjlDBBjqpggLG4OWAhdwKIKUxmTmCOYl1laIHWJWhImo1nQdA+8v74xBK5doorjJsQEtxTnldQLrZVplgLA5Pw3WIRFcRHQnQ5Eshd/Xjf+UJlEl2B27f6utmhM8fN5sLRDpiw3GPiYXExonqvWuc03xRKfcfGEC/DfQNYbL5MF3VHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8seKGxRjDiE4b+l1Latozxzp+3IhrF1f8+q3TByBFIQ=; b=AH+89Slm+8LVffnovFWed6Reyls1ZTlcTiAlhn6n6lDP19eeHHV6eUamxZW297/qqejgJabJoc+GiE/oF7VSnTtknl5HVE/gaIxpgzfxJvGHdXObkKJrOJ8xBG35bvQZtXRjB1xazZSyy7y2ocIROn5HOgyimLvn/N7WSp1ZWmMQCfWwHI8Gfo33w5BZe5A+yg6mOZP+Gze7XEHa8onkHTBrptUfRtz7JIllBR0EpAw0vBtFSGPnStGJFdi2BMaT4RmF//dFXoqfmUXXqZN/pDobcgtXj5P168cdEag8D7Oi1psQo1q6zARcMA07LcKXSucXHMiUwcUKVmnUI0qN0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8seKGxRjDiE4b+l1Latozxzp+3IhrF1f8+q3TByBFIQ=; b=F+SG6wC+HV2AC1CxlTUoYms680skYyUp0n+SNi2eotVBsUbWlCQYLNwoD5aH71Hz+0tdW9uukuBKR/K0hXsV8EEMMLiMDI/2d6l1ZmolErLIGPBX4flgz1LYL4aKO/3sDSVuy5G0Gaf97Kylb/EHOE+EBJ3dJaVmqmadb6J7f+s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PA4PR04MB7678.eurprd04.prod.outlook.com (2603:10a6:102:ec::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.9; Fri, 20 Oct 2023 08:09:06 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::b9ee:e067:5935:4965]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::b9ee:e067:5935:4965%4]) with mapi id 15.20.6907.022; Fri, 20 Oct 2023 08:09:06 +0000 From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com> To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com> Subject: [PATCH] thermal/drivers/qoriq: fix getting tmu range Date: Fri, 20 Oct 2023 16:13:37 +0800 Message-Id: <20231020081337.3141488-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0005.apcprd06.prod.outlook.com (2603:1096:4:186::12) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PA4PR04MB7678:EE_ X-MS-Office365-Filtering-Correlation-Id: b50d1137-1a17-48e1-4a23-08dbd143d44e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q0ML1UHsaG6uWwrrenpUyWJbe0dbExr+tpiitP/Pt28FqjnAXVkguWLIiQGn18yWrOHvF/qk3VIBIV6VVs5TGRYGMErNh/MDiekVtRnIZ/ibpYKdZseKbAXZENXAUfAd2w2yuvWbtEisF1S2Hnmnrc6zztIHBnBBaoMO0cOXYDaLvZKEcqyB6ZG0TvrdLkSeQMSsOSA1BWoPmAXL0K4gge/4HZ81MQUY/jJtZyE4Wsl1M2bDwW5DDA3bqmTMtlXu3i9xnlHGrjmxSci2MQooMuHKQtrIMPwKvAA4CHmfWiIDI94Tvq26cPr0zXViZKKqAszpJjIKhN7OjmUGdKQoKhxiNFmf85KvYSSfiDZbH9C42WyoakiaUwW4k/0ZzyF69OGYitPan5xZ/KCYVduk2/JEsZNJAUVgNim4V6J63j3C3UAOBAs64yKk4KPeErUsUGqoUEGrzoUAUzeysUrs1rq89KV8CMtTiY621awF1aUsulNxFL1g1GMw2TU5+XDj3p+/lgEH7Tvsb2rYRIeAD5amLk4AED/xgsGK7RxWy9EmCyO8xgO0QYeJZQTDLfQlz6GKMDLMj4rTigjKi6wJhz96xzR8AT1OQGt6yKOJXQ1f4r0amsQzKo9oOjEMGdfb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(136003)(396003)(346002)(366004)(376002)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(86362001)(4326008)(38100700002)(316002)(66946007)(66476007)(478600001)(6666004)(8676002)(66556008)(8936002)(6486002)(41300700001)(2906002)(6506007)(2616005)(5660300002)(26005)(52116002)(1076003)(6512007)(83380400001)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rvtxESq5RKIE1Z60Y3LrLQxJLpOxGpbcmiPspRTehbS3opQwUhVSld2DRVbN9XKuJDPAiwDK89z4WSJCmOmUXruHv8uvNWEQ8A2qXiEEPogGkNySRrnd5pSaoxDESTi1CoI2DZ/ycVx9LDcPBklLocH2czW1hHLKywVPCds0AjVrR78lZTG2U0Ta4X6wtLz2w8aZu8A7mvTU0Gp66H694gLn8X6ne3yky6TD/3lvSlb02rh4iW5cp1GOSDJNLHv+3jTmvVQMGxqItFlNkZ/rnGz5fATS2PBfsNXWCInm65YXdPBYevbS7ExyOD9YIxXtYyhwOj5JAgkZMo0XpIkkPmdkmVcRtwMT7Cj8lWg1kTqXD2hbcHDTVa1j6EzPlcWUXAmW7+3mJzE0GpH8+XHFj5NBDlaj0q8QSTBDHblSBC2X/r+4UNPgNW28hD2OEajEwP2uQM6z5Ou3KYnfEkfuJmiWC52Ijt0TMTylYSsNXg7Sc/w2frnjaMVRWf5LHEBdtEcTT5pxeK+oQH+czKski8wrc/9qsbO4SCX/hYSixKUEVhFRUjvccLP6mvXD+DfmJ4NoQVRo12d1mYWzsR9+71bIGmo/bhAA7GoA8MVe1sghTo5rrAF9Eb+CauBTiPwmHeawBwq1dTRHMi+PrhQXRFaHllMcUQGhMpkCC6pN0y3MW1VKRvcA/BZW5qQCmrAz5fqqgW3HXjwFqgvGkqE0etXytUhCrwZ/uBPuPfDB1HCGXh9kQMHo62v8Iz5UpV+crTAv0GtwW4Pc8TW/2U4mL1USnC7pnJsc9SH6f7DSdm8nt/IUkp4wlyqrursfV2gZSPLM0mc2jLsxDo/MONCr2Zrw/4bucOulzWBAVK7EXRH1kF2Mau2hJEnEW1EEWZuQdboDrzy16oJDeFJnrffvQTmXw2mLtdhHZlnfLY4KhoS1SFT8ew0JlF+gC890nxNR0vppf67qDGwXethqwCRwKCweVhFjNTiUIt/LYznz3xP+0kpXQS+QMyfH9hvS474Xd+7ZWwT1pvL3cmq52v6p3OX0L7RgHiv5QVZUX8hoNNQs4R8Yr0XOBdgL+5TkF3pehev1rMBvmiyIIT2aXACoDYbDE+MDlhADARWf44g1MjXYbEMrnyVbwzuEP8HvW4BUgj+lvlExPBfKqO922w2J21bByctJdNzHPtfkWeryQFUz6j3h3p+rvj0OhEx/bHuK6mwSD8LjUiflMs6pFcAjcRjbT1XKapPJfTUeKEf7b6IJv6sOHfgFQyqmdme2zyajm8hLGUdQrHX+V5m0D9ao+0NtkDnJtQHj9U4ZGOTZfax7/UFpxMKoFYUDeo0U8SMSJeWk8d7bR/ioMiOxXfgn7bprrlLQFyIWHwSwal3DVNHkE4sBC1nxUCkO7UU57OP5+xyp7Lh0/ODhUijVRUpnvkUt8q889DxNQ8qc7bPDUUqib8MBVVCCea38YZZS/FGV6FXo/3zrD0qGeu1ipJLbB3BRZRKuo7XOubvAntPha1bNqPy4ZRBNzK+iecBUxcjEZFCm/9ZkYJFEgQt14RTbBytN+tNlTeOgEkPAr5yttvdGAseubfYkjutYBiq8ThQ4 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b50d1137-1a17-48e1-4a23-08dbd143d44e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2023 08:09:06.1556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x8GcMLkqpXNnLYccR3AP96AjX6iNrLtSXJRwyngrbspG+MOn62VZgqzrKhDcj/PIt23+3mpe/HZRU/oApPPypg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7678 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 01:09:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780261179231602568 X-GMAIL-MSGID: 1780261179231602568 |
Series |
thermal/drivers/qoriq: fix getting tmu range
|
|
Commit Message
Peng Fan (OSS)
Oct. 20, 2023, 8:13 a.m. UTC
From: Peng Fan <peng.fan@nxp.com> TMU Version 1 has 4 TTRCRs, while TMU Version >=2 has 16 TTRCRs. So limit the len to 4 will report "invalid range data" for i.MX93. This patch drop the local array with allocated ttrcr array and able to support larger tmu ranges. Fixes: f12d60c81fce ("thermal/drivers/qoriq: Support version 2.1") Signed-off-by: Peng Fan <peng.fan@nxp.com> --- drivers/thermal/qoriq_thermal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Comments
Hi Peng, On Fri, Oct 20, 2023 at 04:13:37PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan <peng.fan@nxp.com> > > TMU Version 1 has 4 TTRCRs, while TMU Version >=2 has 16 TTRCRs. > So limit the len to 4 will report "invalid range data" for i.MX93. > > This patch drop the local array with allocated ttrcr array and > able to support larger tmu ranges. > > Fixes: f12d60c81fce ("thermal/drivers/qoriq: Support version 2.1") > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/thermal/qoriq_thermal.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c > index ccc2eea7f9f5..404f01cca4da 100644 > --- a/drivers/thermal/qoriq_thermal.c > +++ b/drivers/thermal/qoriq_thermal.c > @@ -57,6 +57,9 @@ > #define REGS_TTRnCR(n) (0xf10 + 4 * (n)) /* Temperature Range n > * Control Register > */ > +#define NUM_TTRCR_V1 4 > +#define NUM_TTRCR_MAX 16 > + > #define REGS_IPBRR(n) (0xbf8 + 4 * (n)) /* IP Block Revision > * Register n > */ > @@ -71,6 +74,7 @@ struct qoriq_sensor { > > struct qoriq_tmu_data { > int ver; > + u32 ttrcr[NUM_TTRCR_MAX]; > struct regmap *regmap; > struct clk *clk; > struct qoriq_sensor sensor[SITES_MAX]; > @@ -182,17 +186,17 @@ static int qoriq_tmu_calibration(struct device *dev, > struct qoriq_tmu_data *data) > { > int i, val, len; > - u32 range[4]; Why don't you keep the array locally on the stack? Will it be needed elsewhere later? Other than that: Tested-by: Sascha Hauer <s.hauer@pengutronix.de> Would be great if this could be picked up anytime soon. Sascha
Hi Sascha, > Subject: Re: [PATCH] thermal/drivers/qoriq: fix getting tmu range > > Hi Peng, > > On Fri, Oct 20, 2023 at 04:13:37PM +0800, Peng Fan (OSS) wrote: > > From: Peng Fan <peng.fan@nxp.com> > > > > TMU Version 1 has 4 TTRCRs, while TMU Version >=2 has 16 TTRCRs. > > So limit the len to 4 will report "invalid range data" for i.MX93. > > > > This patch drop the local array with allocated ttrcr array and able to > > support larger tmu ranges. > > > > Fixes: f12d60c81fce ("thermal/drivers/qoriq: Support version 2.1") > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > drivers/thermal/qoriq_thermal.c | 12 ++++++++---- > > 1 file changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/thermal/qoriq_thermal.c > > b/drivers/thermal/qoriq_thermal.c index ccc2eea7f9f5..404f01cca4da > > 100644 > > --- a/drivers/thermal/qoriq_thermal.c > > +++ b/drivers/thermal/qoriq_thermal.c > > @@ -57,6 +57,9 @@ > > #define REGS_TTRnCR(n) (0xf10 + 4 * (n)) /* Temperature Range n > > * Control Register > > */ > > +#define NUM_TTRCR_V1 4 > > +#define NUM_TTRCR_MAX 16 > > + > > #define REGS_IPBRR(n) (0xbf8 + 4 * (n)) /* IP Block Revision > > * Register n > > */ > > @@ -71,6 +74,7 @@ struct qoriq_sensor { > > > > struct qoriq_tmu_data { > > int ver; > > + u32 ttrcr[NUM_TTRCR_MAX]; > > struct regmap *regmap; > > struct clk *clk; > > struct qoriq_sensor sensor[SITES_MAX]; > > @@ -182,17 +186,17 @@ static int qoriq_tmu_calibration(struct device > *dev, > > struct qoriq_tmu_data *data) > > { > > int i, val, len; > > - u32 range[4]; > > Why don't you keep the array locally on the stack? Will it be needed > elsewhere later? Because max 16 as of now, it will consume 64bytes in stack, so I move it out. > > Other than that: > > Tested-by: Sascha Hauer <s.hauer@pengutronix.de> > Thanks for testing this patch. Thanks, Peng. > Would be great if this could be picked up anytime soon. > > Sascha > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | > http://www.p/ > engutronix.de%2F&data=05%7C02%7Cpeng.fan%40nxp.com%7C227277d8c0 > 20468aaf6e08dc128ba2ab%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0% > 7C0%7C638405638133353126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC > 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000% > 7C%7C%7C&sdata=ilwPz4Bs6f7CLf2snic7S%2FUsff0AYCgsFuZP9d2UExo%3D& > reserved=0 | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Hi Daniel, > Subject: [PATCH] thermal/drivers/qoriq: fix getting tmu range > Would you pick up this patch? Thanks, Peng. > From: Peng Fan <peng.fan@nxp.com> > > TMU Version 1 has 4 TTRCRs, while TMU Version >=2 has 16 TTRCRs. > So limit the len to 4 will report "invalid range data" for i.MX93. > > This patch drop the local array with allocated ttrcr array and able to support > larger tmu ranges. > > Fixes: f12d60c81fce ("thermal/drivers/qoriq: Support version 2.1") > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/thermal/qoriq_thermal.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/thermal/qoriq_thermal.c > b/drivers/thermal/qoriq_thermal.c index ccc2eea7f9f5..404f01cca4da > 100644 > --- a/drivers/thermal/qoriq_thermal.c > +++ b/drivers/thermal/qoriq_thermal.c > @@ -57,6 +57,9 @@ > #define REGS_TTRnCR(n) (0xf10 + 4 * (n)) /* Temperature Range n > * Control Register > */ > +#define NUM_TTRCR_V1 4 > +#define NUM_TTRCR_MAX 16 > + > #define REGS_IPBRR(n) (0xbf8 + 4 * (n)) /* IP Block Revision > * Register n > */ > @@ -71,6 +74,7 @@ struct qoriq_sensor { > > struct qoriq_tmu_data { > int ver; > + u32 ttrcr[NUM_TTRCR_MAX]; > struct regmap *regmap; > struct clk *clk; > struct qoriq_sensor sensor[SITES_MAX]; > @@ -182,17 +186,17 @@ static int qoriq_tmu_calibration(struct device *dev, > struct qoriq_tmu_data *data) > { > int i, val, len; > - u32 range[4]; > const u32 *calibration; > struct device_node *np = dev->of_node; > > len = of_property_count_u32_elems(np, "fsl,tmu-range"); > - if (len < 0 || len > 4) { > + if (len < 0 || (data->ver == TMU_VER1 && len > NUM_TTRCR_V1) || > + (data->ver > TMU_VER1 && len > NUM_TTRCR_MAX)) { > dev_err(dev, "invalid range data.\n"); > return len; > } > > - val = of_property_read_u32_array(np, "fsl,tmu-range", range, len); > + val = of_property_read_u32_array(np, "fsl,tmu-range", data->ttrcr, > +len); > if (val != 0) { > dev_err(dev, "failed to read range data.\n"); > return val; > @@ -200,7 +204,7 @@ static int qoriq_tmu_calibration(struct device *dev, > > /* Init temperature range registers */ > for (i = 0; i < len; i++) > - regmap_write(data->regmap, REGS_TTRnCR(i), range[i]); > + regmap_write(data->regmap, REGS_TTRnCR(i), data->ttrcr[i]); > > calibration = of_get_property(np, "fsl,tmu-calibration", &len); > if (calibration == NULL || len % 8) { > -- > 2.37.1
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index ccc2eea7f9f5..404f01cca4da 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -57,6 +57,9 @@ #define REGS_TTRnCR(n) (0xf10 + 4 * (n)) /* Temperature Range n * Control Register */ +#define NUM_TTRCR_V1 4 +#define NUM_TTRCR_MAX 16 + #define REGS_IPBRR(n) (0xbf8 + 4 * (n)) /* IP Block Revision * Register n */ @@ -71,6 +74,7 @@ struct qoriq_sensor { struct qoriq_tmu_data { int ver; + u32 ttrcr[NUM_TTRCR_MAX]; struct regmap *regmap; struct clk *clk; struct qoriq_sensor sensor[SITES_MAX]; @@ -182,17 +186,17 @@ static int qoriq_tmu_calibration(struct device *dev, struct qoriq_tmu_data *data) { int i, val, len; - u32 range[4]; const u32 *calibration; struct device_node *np = dev->of_node; len = of_property_count_u32_elems(np, "fsl,tmu-range"); - if (len < 0 || len > 4) { + if (len < 0 || (data->ver == TMU_VER1 && len > NUM_TTRCR_V1) || + (data->ver > TMU_VER1 && len > NUM_TTRCR_MAX)) { dev_err(dev, "invalid range data.\n"); return len; } - val = of_property_read_u32_array(np, "fsl,tmu-range", range, len); + val = of_property_read_u32_array(np, "fsl,tmu-range", data->ttrcr, len); if (val != 0) { dev_err(dev, "failed to read range data.\n"); return val; @@ -200,7 +204,7 @@ static int qoriq_tmu_calibration(struct device *dev, /* Init temperature range registers */ for (i = 0; i < len; i++) - regmap_write(data->regmap, REGS_TTRnCR(i), range[i]); + regmap_write(data->regmap, REGS_TTRnCR(i), data->ttrcr[i]); calibration = of_get_property(np, "fsl,tmu-calibration", &len); if (calibration == NULL || len % 8) {