Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1835808rwb; Fri, 5 Aug 2022 08:33:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR7JB6p2FoezXSi7n8E7cPL2KAASltgoM1gmGOB0f74AEEETABALSluwqdgkCXRktHMgkr+u X-Received: by 2002:a17:907:a05b:b0:730:9fce:30c1 with SMTP id gz27-20020a170907a05b00b007309fce30c1mr5758297ejc.197.1659713604346; Fri, 05 Aug 2022 08:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659713604; cv=none; d=google.com; s=arc-20160816; b=beVBgCx09AmvBr1Afq24m7UxDlSlDTNE3t6YUB3kI1qmEos1nfaar6KLCjbu6G5WmV dCuI6yRvYg5pRH9uua4Ydo2EODYiZdLC9iBMSw32fgvAfv38mUVyQkKQ3s2SHFf1M24A p6EJSNiV7Qi4AeGzCdGdRBIWCDhb7AEifXuELDGpMsNUVWvMYKZ0g8ORUmAhJ2aoqv1l ZUADbzSuIW1gkpYR3jPsy/6Ges06Uweu4JJ3juFyosjUWSHu+/ri4XV/gn6LagDiI1Rb tKGinGClvwsnOvm584Y/G5oSMyMwYl1rCFlBEhhJtuYADz6VQ8XFQDA2jUJlqGuKnqWf G4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GJHrM3mRNfm2Fw4mvFuPXn+K83vBpcquJGGtExdSo04=; b=jJ7ohkO33V/LhnGGyh1AtcdFJjQMc8ud/fumCnMlw8X1xsPiRGT7TfQUMMiUPpjmQI m5l71fd7d+IxwHkHpkchVPVeSf3cgseuxD7po2xcA9faZE/2M5mo9S+BSrE3q+Xr5HaF h3c9lkcByLOb3QMArklHZbzE0yVSQVJSY60RbPtLzhKNL/71InLs6JIUy+CaX5T0i/LE HaIM/NIJohxyXWfM54t3097j8NGTpLsQJdOfXC1pVWaiLBtWL+A4CS5GRv7kHpqZ5TR+ 7vPAgeKu36Ow1BuKM7bLJJLKL/kFsbSSBpPvFIzjjgdYxUEIYveuqdMqAFSzfiJSUbxI 6fzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TKJwHpX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd15-20020a1709069b8f00b0072eece129b1si4445017ejc.753.2022.08.05.08.32.59; Fri, 05 Aug 2022 08:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TKJwHpX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240979AbiHEO6Z (ORCPT + 99 others); Fri, 5 Aug 2022 10:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241007AbiHEO6F (ORCPT ); Fri, 5 Aug 2022 10:58:05 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FCE56580E for ; Fri, 5 Aug 2022 07:57:56 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id z16so3494144wrh.12 for ; Fri, 05 Aug 2022 07:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=GJHrM3mRNfm2Fw4mvFuPXn+K83vBpcquJGGtExdSo04=; b=TKJwHpX2DyI4H6jX09OkDPVlsMGSW8fVCRwhGUOfqYJ8D8pgeFaGzKnJjFzc32KUks sgQsnpx4borJB1YOxqufbSQbpvE6BQCbNYffTZt/Qn2Ij4tswGaYjcCH7KKrEvhhhoe0 HBAa7FeDD5ZkH3F98qYzHyOmrvPeSv3V2CShVS+mwXhywWz5mPEGT+KEam7ftkvjtwMi sMsMe+UN+ezytK80A6bYMaLLQScN1iIqwLzXAuDHOj3FqSiEwFHyOintrub8k69vr2Uq eFThB252O2yx9WZOZ6c5dScQ0sHskTqRJKBQP05K1gGl4sBBet3Gxb6ktSuuX02Zoqai rhfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=GJHrM3mRNfm2Fw4mvFuPXn+K83vBpcquJGGtExdSo04=; b=LpOV2L53IsMx+id4Vikxo2FDTw5ZuwDBS6J3r7nBx0cMiOdwLCVl5RgwxOyFi48014 uVVvAymZPZDd6jPxRs8Xm207MXdEv/26EtmZt4Qzk4O1M+InjHWmT3BozTYOVI8O6KAG GkpE724CBijbd08GQf4k4iAT0rssGh3xtX/qjPstLVDRv6q/14MIXLtXAoifW8SkglDj 7KGTun0zmX4baZekQuMBqrUHBSDhXZVsaXgfYpkS5YEnq0nsRojwJY0PbuRgsopQTNYe ecuMVsEmfJsthtksJ5kStBRK8Ou11F67Y3Ec4yG01rvOo7hxb+pldHShZ09cW5XQAwu+ ZbJQ== X-Gm-Message-State: ACgBeo0F2z6abdWzVHcN6pUtZSwSJpNdi84xqkBqoo48N2hdHdIa/RbE ykWkpDd15AFiAUNK7Sp1Gp+mEw== X-Received: by 2002:a05:6000:812:b0:220:5a66:ebd0 with SMTP id bt18-20020a056000081200b002205a66ebd0mr4695337wrb.519.1659711475380; Fri, 05 Aug 2022 07:57:55 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:aef0:8606:da6b:79ef]) by smtp.gmail.com with ESMTPSA id y1-20020adfd081000000b0022159d92004sm3102448wrh.82.2022.08.05.07.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 07:57:55 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Amit Kucheria , Alim Akhtar , linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES) Subject: [PATCH v1 07/26] thermal/drivers/exynos: Use generic thermal_zone_get_trip() function Date: Fri, 5 Aug 2022 16:57:10 +0200 Message-Id: <20220805145729.2491611-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220805145729.2491611-1-daniel.lezcano@linaro.org> References: <20220805145729.2491611-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The thermal framework gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano --- drivers/thermal/samsung/exynos_tmu.c | 41 ++++++++++------------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 51874d0a284c..5204e343d5b0 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -260,16 +260,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct thermal_zone_device *tzd = data->tzd; - const struct thermal_trip * const trips = - of_thermal_get_trip_points(tzd); unsigned int status; - int ret = 0, temp, hyst; - - if (!trips) { - dev_err(&pdev->dev, - "Cannot get trip points from device tree!\n"); - return -ENODEV; - } + int ret = 0, temp; if (data->soc != SOC_ARCH_EXYNOS5433) /* FIXME */ ret = tzd->ops->get_crit_temp(tzd, &temp); @@ -303,19 +295,16 @@ static int exynos_tmu_initialize(struct platform_device *pdev) /* Write temperature code for rising and falling threshold */ for (i = 0; i < ntrips; i++) { - /* Write temperature code for rising threshold */ - ret = tzd->ops->get_trip_temp(tzd, i, &temp); - if (ret) - goto err; - temp /= MCELSIUS; - data->tmu_set_trip_temp(data, i, temp); - /* Write temperature code for falling threshold */ - ret = tzd->ops->get_trip_hyst(tzd, i, &hyst); + struct thermal_trip trip; + + ret = thermal_zone_get_trip(tzd, i, &trip); if (ret) goto err; - hyst /= MCELSIUS; - data->tmu_set_trip_hyst(data, i, temp, hyst); + + data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS); + data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS, + trip.hysteresis / MCELSIUS); } data->tmu_clear_irqs(data); @@ -360,21 +349,21 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) } static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip, u8 temp) + int trip_id, u8 temp) { - const struct thermal_trip * const trips = - of_thermal_get_trip_points(data->tzd); + struct thermal_trip trip; u8 ref, th_code; - ref = trips[0].temperature / MCELSIUS; - - if (trip == 0) { + thermal_zone_get_trip(data->tzd, 0, &trip); + ref = trip.temperature / MCELSIUS; + + if (trip_id == 0) { th_code = temp_to_code(data, ref); writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); } temp -= ref; - writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip * 4); + writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); } /* failing thresholds are not supported on Exynos4210 */ -- 2.25.1