Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4010719iog; Tue, 28 Jun 2022 07:18:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNzhKSzU3U3QWVTz+L/l9Hl6pTwfCZyheI0V8giftLhYBlPcvH+PntbGgSHTp0g0+opsh0 X-Received: by 2002:a17:90b:1e0e:b0:1ec:ac5b:ddca with SMTP id pg14-20020a17090b1e0e00b001ecac5bddcamr21704593pjb.97.1656425938717; Tue, 28 Jun 2022 07:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656425938; cv=none; d=google.com; s=arc-20160816; b=r0aGxWEHu7v3c4Y+Vn9yxLkEARHU88XqbeLVe4ghPCyh9F6OA9LXLY8r3bmcdZvqGl Sd5/jamEaNw2V9BZhI/ThnHFbpCv3rUB3B+THKmFau0My9eOJiTZd1ojbm+lchM5dZs2 M9RrYyrAANc+qtahUzxRPc7jw0IKCV7D67cMq1Ez7qTT/et2hZaVf+4eQ67FiR2gcxZ7 ogwfYIynHR5ejp/hU/YTAFdSn1UdedLBmlSN4MeOgLZ6FmRbi0CCzol2C3cHghhX7Wg2 CvYSlerzJ9U5/2DOePVku30U3AJ/uFqZwxWOd9XSbTexxb0Gy4yPPzo9kTeIL/jwpyaP ss+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0aMNqmnMIKi7I+oM6Vp8+9eJ8fBtT2TW4TZeFgJi3fQ=; b=LPeAoaqMthM/Fw0BRHBKYyTsMjFotQ0ese6MYmH6gDmJ/8jZlqH3JF300QaXR0aOB9 oN1HI/O90yZYSNS228naHlX2X+aeCYCYsAE1/P5A8rU4h2NUWuTUW05CaAxnsRupGcIX J1AeXP4gGDDLImkzVJ4dOGYFk3q82Y7rBB74ePG57N5w7+hi9/s9Onx2VtTvjrH6U6ye AHZIiKS+nPNiEyH+/rOHmg1CkhlgHlGGTtm+kYWwEdkjjaSCrSkIvHRADYpSmGWB7/nx YleqkXjBNaHuCE+vL0h0lnzs/V+jqrqqNwePEleFEjcFL4UPJyuzdfKQadxG/oB1B9P9 cfaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ic/oVE++"; 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 k11-20020a056a00168b00b0051b904d9c7csi17713416pfc.251.2022.06.28.07.18.39; Tue, 28 Jun 2022 07:18:58 -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="ic/oVE++"; 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 S1345822AbiF1N3d (ORCPT + 99 others); Tue, 28 Jun 2022 09:29:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345807AbiF1N2J (ORCPT ); Tue, 28 Jun 2022 09:28:09 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF779FCF for ; Tue, 28 Jun 2022 06:27:52 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id k20so9584438qkj.1 for ; Tue, 28 Jun 2022 06:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0aMNqmnMIKi7I+oM6Vp8+9eJ8fBtT2TW4TZeFgJi3fQ=; b=ic/oVE++fn5k1NV7kQALi6XGEpYofohGQkFZG9DwgUaJuJfylrH3XxlNM0cQoCbBIM DJuuAsQ5Gk/2EnAlJY0qf7tzNZbUlrKFJvDBUU9Ag9q6KPMK7EkBTYsak4Bs76iy+AGB e66nvxfFyt+p79zKrFPOZfTlYpbAn980ykkGl0wvQnuqLdbPXagmadFuojAFaZJaPeaP 7yEMArdWzAixYfuCI9fh5RrBzmngWSZSi5SsRevJUbw9BopMWgqDXDfuoLY7OA7JRg4H PUa2/HyC9B1TSFeX1zUowg0zCkBFMh4m+mqi4ZT/B3ddtGlbcAZWgGkFIuvsOCdZjw5R 8p0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0aMNqmnMIKi7I+oM6Vp8+9eJ8fBtT2TW4TZeFgJi3fQ=; b=a4ULLqrz9cxTaMhqsrnxdwJLyGmQDUZ5voAdVotHuh/JpclgysKza8n6A/+E/xhdgh qQ7xFjYHb5vidGVJCiwJUdH82a6DjJZ31x7pCnvVPUW8YEgQWTgYdQBrse9nPSS3Guxa kegblJPIOmBeB4perGWypOSvRKYiDPGImcBxjFGgs24Z69DOr3OU5bgyGWBYogyyP8OA E6u8peJ3/rtq8g9ogFcWRGB2erDLWHWNMQQA+m0lxmQC1ivCsKsCt4f9YThP2W46huC8 lR5vseM7Pvw05GevBvMwkih/QrCa+BKOR20LhW1tWNk6IqEgdGQNXapqlHeopPUua0RI k/2w== X-Gm-Message-State: AJIora9koiUOSMYqgDBKunTsJUcoZgdMBQOpZJzwZDvjhjile7mm1/uP ho1LJFF6evSmFbY6ocyhRGpO21htUt+otGZ2FW//Qw== X-Received: by 2002:a05:620a:2a0e:b0:6a7:8346:1601 with SMTP id o14-20020a05620a2a0e00b006a783461601mr11247731qkp.593.1656422871286; Tue, 28 Jun 2022 06:27:51 -0700 (PDT) MIME-Version: 1.0 References: <20220501202025.211567-1-konrad.dybcio@somainline.org> <20220501202025.211567-2-konrad.dybcio@somainline.org> In-Reply-To: From: Dmitry Baryshkov Date: Tue, 28 Jun 2022 16:27:40 +0300 Message-ID: Subject: Re: [PATCH v3 2/2] thermal: qcom: tsens-v1: Add support for MSM8992/4 TSENS To: Konrad Dybcio Cc: ~postmarketos/upstreaming@lists.sr.ht, martin.botka@somainline.org, angelogioacchino.delregno@somainline.org, marijn.suijten@somainline.org, jamipkettunen@somainline.org, Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 On Tue, 28 Jun 2022 at 16:19, Konrad Dybcio wrote: > > > > On 27.06.2022 17:15, Dmitry Baryshkov wrote: > > On Sun, 1 May 2022 at 23:21, Konrad Dybcio wrote: > >> > >> MSM8994, despite being heavily based on MSM8974, uses the > >> 1.2 version of TSENS. Also, 8994 being 8994, it has a custom > >> way of calculating the slope. > >> > >> MSM8992 in turn is a cut-down version of MSM8994 and uses > >> the same TSENS hardware, albeit with a different set of sensors. > >> > >> Also tested on 8976 (by a person who didn't want to be named) > >> to make sure the 11->16 max_sensors changes didn't break anything. > >> > >> Signed-off-by: Konrad Dybcio > >> --- > >> Changes since v2: > >> > >> - don't use slope before it's initialized (whoops!) > >> - don't re-assign the same value to p[0..15] > >> - free calib_rsel > >> - use the same ops for 8992 and 8994 > >> > >> drivers/thermal/qcom/tsens-v1.c | 293 ++++++++++++++++++++++++++++++-- > >> drivers/thermal/qcom/tsens.c | 6 + > >> drivers/thermal/qcom/tsens.h | 2 +- > >> 3 files changed, 288 insertions(+), 13 deletions(-) > >> > >> diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c > >> index 573e261ccca7..58864962f370 100644 > >> --- a/drivers/thermal/qcom/tsens-v1.c > >> +++ b/drivers/thermal/qcom/tsens-v1.c > >> @@ -142,6 +142,99 @@ > >> #define CAL_SEL_MASK 7 > >> #define CAL_SEL_SHIFT 0 > >> > >> +/* eeprom layout data for 8994 */ > >> +#define MSM8994_BASE0_MASK 0x3ff > >> +#define MSM8994_BASE1_MASK 0xffc00 > >> +#define MSM8994_BASE0_SHIFT 0 > >> +#define MSM8994_BASE1_SHIFT 10 > > > > Generally I feel that all the _MASK values can be better generated > > using the GENMASK and newly defined _SHIFT value. > Yes, I agree, however I think it'd be better to do it for > all the defines in this file at once in a separate commit. Then I'd suggest fixing the file first and adding 8992/4 on top of that. > > Konrad > > > >> + > >> +#define MSM8994_S0_MASK 0xf00000 > >> +#define MSM8994_S1_MASK 0xf000000 > >> +#define MSM8994_S2_MASK 0xf0000000 > >> +#define MSM8994_S3_MASK 0xf > >> +#define MSM8994_S4_MASK 0xf0 > >> +#define MSM8994_S5_MASK 0xf00 > >> +#define MSM8994_S6_MASK 0xf000 > >> +#define MSM8994_S7_MASK 0xf0000 > >> +#define MSM8994_S8_MASK 0xf00000 > >> +#define MSM8994_S9_MASK 0xf000000 > >> +#define MSM8994_S10_MASK 0xf0000000 > >> +#define MSM8994_S11_MASK 0xf > >> +#define MSM8994_S12_MASK 0xf0 > >> +#define MSM8994_S13_MASK 0xf00 > >> +#define MSM8994_S14_MASK 0xf000 > >> +#define MSM8994_S15_MASK 0xf0000 > >> + > >> +#define MSM8994_S0_SHIFT 20 > >> +#define MSM8994_S1_SHIFT 24 > >> +#define MSM8994_S2_SHIFT 28 > >> +#define MSM8994_S3_SHIFT 0 > >> +#define MSM8994_S4_SHIFT 4 > >> +#define MSM8994_S5_SHIFT 8 > >> +#define MSM8994_S6_SHIFT 12 > >> +#define MSM8994_S7_SHIFT 16 > >> +#define MSM8994_S8_SHIFT 20 > >> +#define MSM8994_S9_SHIFT 24 > >> +#define MSM8994_S10_SHIFT 28 > >> +#define MSM8994_S11_SHIFT 0 > >> +#define MSM8994_S12_SHIFT 4 > >> +#define MSM8994_S13_SHIFT 8 > >> +#define MSM8994_S14_SHIFT 12 > >> +#define MSM8994_S15_SHIFT 16 > > > > [skipped the rest] > > -- With best wishes Dmitry