From patchwork Wed Jan 25 09:50:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amjad Ouled-Ameur X-Patchwork-Id: 13115394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 434ACC61D9D for ; Wed, 25 Jan 2023 09:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Bdx21Xip+lrsv5LLcOI1VJeqyl5CFmTf3AV8EAP7M18=; b=Soda2SH5dBiBDr rKurVfliAp1l+rRzluBGV4+wlk+JWIbGiwtGWuy8kZeF2srZoxVtaf+1NTBhytLxYVSnDe8PyDnt9 Qf/O/Xoi5n0j1jgAQH60fZUxG0uiZj/a5ViqlQxaeFLCWGryvR/112ajNl/o0fE4C1xGWoJbFj9Sh eyqsIANGAWwMWU89j/9rkIVWOaNeYmVM/HDXa9XAfrpF+/1/QhpGaTSYWgi8qHwaTxWDnVKnfnvSo YLrl7umq98ZuNnZLN9hHDsVqh/NxV2SW1PrVd7U+oB5K57mJz71tmdRCzM2QZ3Hf7XZnLEK5r0Yh0 kLy9dantzMg5ZmnqT0vA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKcTl-006kAk-Fu; Wed, 25 Jan 2023 09:54:06 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKcQu-006j2N-7T for linux-arm-kernel@lists.infradead.org; Wed, 25 Jan 2023 09:51:15 +0000 Received: by mail-wr1-x436.google.com with SMTP id e3so16420807wru.13 for ; Wed, 25 Jan 2023 01:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=nCD+Tet020QcCYVXiaAHhZ6T43mxf9NGXvGcAhM5Bko=; b=evdFUzWQ1Z6fmorAAHX/2rx1JsI1ucqR/2YMkGAAzJFPBQG40c0oaoquu3sfWeDTD9 3bbW4b1CwJW2ZtdWk1rskgF9jbFqKw3nADhOCTcIMfnjYXu6ZIy189AvlcMMHgvDfJzY 9afQYjTJqO9rdAxD9pEToliDpS2q7owdH91h9+JBz1LbNAll9s6Hgdia7e+DWdO+w3y4 Sa0NSD8NOfnnL+oK/62NjEgHOpuCEJCGAlnK5JxTKv14/TerzMWhOLbvVwhYti7mQztX CFEwt9AP2Kw+GhKwzuBAxI734uWRGbh4f9+9kYKnBVb02juwMrhdxeOFZh5DSK7RuYiZ KJlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nCD+Tet020QcCYVXiaAHhZ6T43mxf9NGXvGcAhM5Bko=; b=GP5hH77ePRdp6Nerc+XtpLYs4oXcmgsGbjM0VL12Jhd/+AnNLmuEjwyserjkjzQiSp c8RMb3IUc3SQnB8zfCx0xwXniozFRo/deE+aKE7g5I3wXJ/0VGKVIz3Jl6FG6YgnZd9H WUKRh7k9CPWr861lIxulwRC5UkRuoJrcLULxdWTzZLAwTJONIU5zx64k/G+KAeurW274 cjKScmc0USsiLbT6RvRBBAF1ewjy/oXfCfKroIL2BnjetqCRknQiqOUSV4xZhzghB6+Y EiJp5rsfkRUHaOb3e1YrJEY3j2J8XPi1tyMfqcFreaN8ijSblt5k8XPYoU6Utf9NNgHB UzQg== X-Gm-Message-State: AFqh2koD0YpkCwqhcBg4Wsbcb4F3Mcwa+4NKdBrLamTvBLaW19WDKmIM 4y1cDXXupF8qVmvzqIPj48QOg1n8h/fGuiv5 X-Google-Smtp-Source: AMrXdXtW4LbC59RXC+dBFm0EBBki8tu4RWZohenwoLSN2vVO4YuGlip37uSG6yoG1MbxuFzynf8qPw== X-Received: by 2002:a05:6000:1e18:b0:2bc:846a:8ead with SMTP id bj24-20020a0560001e1800b002bc846a8eadmr29665011wrb.37.1674640266621; Wed, 25 Jan 2023 01:51:06 -0800 (PST) Received: from [127.0.1.1] (62.213.132.195.rev.sfr.net. [195.132.213.62]) by smtp.googlemail.com with ESMTPSA id j26-20020a5d453a000000b002bdf3809f59sm3955072wra.38.2023.01.25.01.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 01:51:06 -0800 (PST) From: Amjad Ouled-Ameur Date: Wed, 25 Jan 2023 10:50:33 +0100 Subject: [PATCH v8 5/5] thermal: mediatek: try again if first temp read is bogus MIME-Version: 1.0 Message-Id: <20221018-up-i350-thermal-bringup-v8-5-23e8fbb08837@baylibre.com> References: <20221018-up-i350-thermal-bringup-v8-0-23e8fbb08837@baylibre.com> In-Reply-To: <20221018-up-i350-thermal-bringup-v8-0-23e8fbb08837@baylibre.com> To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Rob Herring , Krzysztof Kozlowski Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Fabien Parent , Matthias Brugger , AngeloGioacchino Del Regno , Rob Herring , Markus Schneider-Pargmann , Hsin-Yi Wang , Amjad Ouled-Ameur , Michael Kao X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1674640259; l=905; i=aouledameur@baylibre.com; s=20220920; h=from:subject:message-id; bh=SvQ8R3apCWGsjdAHgfNQVmNogbxTjihw270BNNJBqk0=; b=pkHFI5a45MlA9rGXHv3vKkA9DV+cFpeLSRC2m5W4FWHIP47gcqAI0gZg8YNrfVLt5u+BTkZkthhA AcisRwV0A8EpqInMTUpFXoe4B4+xb7FfJNqyqIZ9hzAgaCL0DM3w X-Developer-Key: i=aouledameur@baylibre.com; a=ed25519; pk=HgYWawSL4qLGPx+RzJ+Cuu+V8Pi/KQnDDm1wjWPMOFE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230125_015108_417103_009A890F X-CRM114-Status: GOOD ( 13.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In mtk_thermal_bank_temperature, return -EAGAIN instead of 0 on the first read of sensor that often are bogus values. Signed-off-by: Michael Kao Signed-off-by: Hsin-Yi Wang Signed-off-by: Amjad Ouled-Ameur Reviewed-by: AngeloGioacchino Del Regno --- drivers/thermal/mtk_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index b8e06f6c7c42..e7be450cd40a 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -736,7 +736,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) * not immediately shut down. */ if (temp > 200000) - temp = 0; + temp = -EAGAIN; if (temp > max) max = temp;