From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EBB12EDD40 for ; Sun, 14 Jun 2026 07:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781421283; cv=none; b=cN/bvPl2OMszxEN+qzZY/Jsru6l/KmhYSlfwcEOKNj0wnWvPrIPDtn3/itt5fLt8WGf+BoJgKQQB1eWnSq/wd32zGQ0m3ekc3LSDoSLIHvwD19f4MVNhjbRq0kVDcGALvuLuL4ZmHTk2x0QoUGk1PEIqlrUinnsVmLN+UnrolH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781421283; c=relaxed/simple; bh=tF9rAEVCV1Zmu19XOcuxYFCjGVU8FBzBnf639u/M6NE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N4Lq+NkYUANJI62YXL44G7xBUyoNMMkE7SIpHx/unE5oCK9kQitNStc24ZFKT6/aYw0nrpvN9aCFFP5NLm/AK8kSRUr00uchHF88ZpqBp7OGhDieLQG0mxRQ5cJ1wfnhCWUGL3hwz8yjPGzhQq+2ZqrMwVlfXU5VrPrTG11bfsI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CU9PZEK+; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CU9PZEK+" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-45ef4223be7so1214750f8f.2 for ; Sun, 14 Jun 2026 00:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781421281; x=1782026081; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=9nSQ+yfDg6eGkA3F5El5qmydZTplBrIuCCSHAiRy4+I=; b=CU9PZEK+UNt9MKRD4jCLvDGGBx0GfpBXYgfBBkvEl7NRvilZUhoDBi0nfo+ET+0lim kRPWwMSqe/lH4cgW3gunjCsN5+A3Axccx61N614kTcRPcFMNjLpxkNuUA4+p6caQY7GN b2HSA9yerDtds1CyuisDpXH+ui43lJ+v8ovn1rQdMplDnlQaF+5Ip9TyGaiNemQ25v4c mFwA2UxpqXTeLymNDQF8Zvuc3eKlWaZpVU/PFss108NfVlLC7VA7FmnmpXWyM3wTkQqJ ATq9DuuM6LL94MoRf61nqMhA4/UVxW47JkbLmbBJUGPOz3iZXXndOoXp58psnKriKypE VT0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781421281; x=1782026081; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9nSQ+yfDg6eGkA3F5El5qmydZTplBrIuCCSHAiRy4+I=; b=r74pKPvQWEYIa7ygdhQxt0+qXEUKFsSWFYXTcn2mezOdH33KEjjqJ2bJMriVRktk2I OVVJyQft7r8Dlzi9JVwmyofrTmDjm2D8PR1M3Hz/p7ApHxIHWY4MWdBOdn4ZWK3bPSP2 y/9shhpC4PAxm+y+JXE1nl44m/iG8FdbIwqU/Vpcen2wUGB7BxAEP6lcBxK+i+FX7fOB UohBwcw5yTmOVnw22c0C75kSB8+W86w36v01n2ZJmDT/TX7amtk42LL6HH5iwKezjW6M 9i4kS14HR+SyQsPoNFLLfKASTIa4dAvsuMCp6lc1l05dnHMkmgifxU5hh7iU/Rx+jQRk TamA== X-Forwarded-Encrypted: i=1; AFNElJ9UVCy1k6sPLIjgqLCy9Q/2wPyoAgND5ezmadHlRVtIVNd8VDKqFiOmpGG10+R3ftKWVdcX+ZCMWhFYVr0=@vger.kernel.org X-Gm-Message-State: AOJu0YxTEIlvHmBHHPPv57iIHXVtgA+TCUJ1ENXCyEONFWF8SN6qemkd 5uEpUNa0nBk6QymJLJvQuiq7bUcstigIdJmtlt/Ucz4PM5e3j/enY9yNUFKLQg== X-Gm-Gg: Acq92OGlLrNU9EVgnsZbaR85NZ12IRYrOMpNe1xQk5mtOmNnkb+O7RAhRN576IuM/lE gftpX9typAiU+Qp+FC5UME8esvSQt/wzdujZiPya+2+5NlsUN3Ru3Q5/ZM27U44FUIOfveSuoZw fLpRAK5rKIuIJxs8QfWMD95s/ecb+x5txPcjLHjeizqEQ3r0XCOekrfamtv5BmD6ixjxSmbcRF2 yVu2Nc+nM459yYmzr1KYOCsV4gmiRruvp1/ALVUSg2LvfDZPAD+cPe3JjH09vUjWw5A1JT1yTnC JOsrY/IpsK/fRY79SDrKb5Hcoh3rvhZGoe1K56D3n6LHy2dCF2ZX4MyfhowIAh/car8mR+UHNgx szitvpM+C1gqEqUom3ELLrSa60TlO4UpF1KhiUbDtwXr3Z52NhuL2ngVsxH+2n8Ci2sd4+u/cbg JKqzAEf5gBk85mDB1KWtb/aJQpcffGYncOw63nTfvuVRXuOiydXYS/NQ== X-Received: by 2002:adf:e003:0:20b0:45e:f672:40fb with SMTP id ffacd0b85a97d-4606db97637mr8781427f8f.22.1781421280445; Sun, 14 Jun 2026 00:14:40 -0700 (PDT) Received: from Ansuel-XPS. (93-34-88-103.ip49.fastwebnet.it. [93.34.88.103]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f2e592csm23787783f8f.36.2026.06.14.00.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2026 00:14:40 -0700 (PDT) Message-ID: <6a2e54e0.892a62f1.395abf.7552@mx.google.com> X-Google-Original-Message-ID: Date: Sun, 14 Jun 2026 09:14:38 +0200 From: Christian Marangi To: "Wayen.Yan" Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Lorenzo Bianconi , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] thermal/drivers/airoha: Fix FIELD_PREP using wrong mask for sensor interval References: <6a2df293.6b2684af.263065.81b4@mx.google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a2df293.6b2684af.263065.81b4@mx.google.com> On Sun, Jun 14, 2026 at 08:14:28AM +0800, Wayen.Yan wrote: > In airoha_thermal_setup_monitor(), the TEMPMONCTL2 register is > programmed with: > > writel(FIELD_PREP(EN7581_FILT_INTERVAL, 1) | > FIELD_PREP(EN7581_FILT_INTERVAL, 379), ...) > > Both FIELD_PREP calls target FILT_INTERVAL (GENMASK(25,16)), so the > second one overwrites the first. The sensor interval field > SEN_INTERVAL (GENMASK(9,0)) is never written and remains zero. > > The comment above states: "filt interval is 1 * 52.715us, sen interval > is 379 * 52.715us", confirming the second value should go into > SEN_INTERVAL. This matches the Mediatek auxadc_thermal.c reference > implementation which correctly writes FILTER_INTERVAL and > SENSOR_INTERVAL to their respective non-overlapping bit fields. > > Actual effect: FILT=379 (should be 1), SEN=0 (should be 379). > The filter interval runs 379x too long and the sensor sampling > interval is uninitialized, causing incorrect thermal monitoring timing. > > Fix by replacing the second FIELD_PREP's mask from FILT_INTERVAL to > SEN_INTERVAL. > > Fixes: 42de37f40e1b ("thermal/drivers: Add support for Airoha EN7581 thermal sensor") > Signed-off-by: Wayen > --- > drivers/thermal/airoha_thermal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c > index b9fd6bfc88..e8a33234e0 100644 > --- a/drivers/thermal/airoha_thermal.c > +++ b/drivers/thermal/airoha_thermal.c > @@ -403,7 +403,7 @@ static void airoha_thermal_setup_monitor(struct airoha_thermal_priv *priv) > * sen interval is 379 * 52.715us = 19.97ms > */ > writel(FIELD_PREP(EN7581_FILT_INTERVAL, 1) | > - FIELD_PREP(EN7581_FILT_INTERVAL, 379), > + FIELD_PREP(EN7581_SEN_INTERVAL, 379), > priv->base + EN7581_TEMPMONCTL2); > > /* AHB poll is set to 146 * 68.64 = 10.02us */ > -- > 2.51.0 > > Hi I already submitted the same patch in the AN7583 series. Can you review that patch so we can try to push this fix? -- Ansuel