Received: by 2002:a05:6512:e85:0:0:0:0 with SMTP id bi5csp3099583lfb; Tue, 28 Jun 2022 06:30:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1upgt+X6ApiyMret3+1qD1U7tFud7lP/AJHWOe+MKin5rHN4rjvudWCEjbVPrOcTO0EzT60 X-Received: by 2002:aa7:db46:0:b0:435:676e:c138 with SMTP id n6-20020aa7db46000000b00435676ec138mr23681665edt.388.1656423026014; Tue, 28 Jun 2022 06:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656423026; cv=none; d=google.com; s=arc-20160816; b=bFvgRNShh3zqpVfJRG64Y02k2ZlBAfuiOdxxnx+uNBCArIYmQuzS1qK8sjHqmQ05Tr HgfMpolzlOkV+ViB2Mf4XiYk5f1N5W9sP+66YgS8bPrL5Pf5VXiHfWbwZBS/dOinu7Iz ijMPHYUu6QS7dk2IKHEgYoyyJkFzkslAJ0Wv0q5inDBWGPqc+r3utGOd/2edXl/KuxXH CA3Ok6iJ1qKs4VYbpY8i86jK4ka1T444CxhunGwzIvW+tMWb0SlbqdI0wxioqXeqUNVt aWRbaI8WuQcT1q1MmTzcm8hec+vzZT8HlT3xJ/YdZ7pnLT0UVdnOcWx+YM1vkkHQxBw6 iTPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=dosYg2NgxB5TQdaBefzaZIp2kNS5RQ3AyQzO+4J1eDw=; b=G5p7z9mMeAFWrMmGtXY2dsQsB7N889sVoT89DTJEwt826/FLvD+1AMbYeVDhd7t97G c4Qe4vo/YFFHAR37PYCXV4z8MIjTAphvgAPFxHe8k1AhXE2UNWCk84XOd3DL3UuYxt30 B7UGU2mnuV5xAhA6E4r9F8ojHduBPHEvciOKsH6lFz6+1B0IT4M2m3I5IBw9PJivfUwK 2QMJ3Rrnh5d/ozzn3m5V5+Zpp8SJj8xgvXjRYxNpeoX0Y75q3v9qZhv5HwLWwTMOq4We 9H9fniDMr44sPiJQRlay5jhMQgYVPZ7zSWTtBlp6+GUpX7h2tN4MJqnR8LEeHuRG19Dk 5r+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020a170906795600b006f49faa49easi15582624ejo.974.2022.06.28.06.29.54; Tue, 28 Jun 2022 06:30:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346312AbiF1NVm (ORCPT + 99 others); Tue, 28 Jun 2022 09:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346208AbiF1NVQ (ORCPT ); Tue, 28 Jun 2022 09:21:16 -0400 Received: from relay07.th.seeweb.it (relay07.th.seeweb.it [5.144.164.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1C1035DC4; Tue, 28 Jun 2022 06:19:20 -0700 (PDT) Received: from [192.168.1.101] (abxi223.neoplus.adsl.tpnet.pl [83.9.2.223]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id D1CFD3EEC7; Tue, 28 Jun 2022 15:19:17 +0200 (CEST) Message-ID: Date: Tue, 28 Jun 2022 15:19:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v3 2/2] thermal: qcom: tsens-v1: Add support for MSM8992/4 TSENS Content-Language: en-US To: Dmitry Baryshkov 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 References: <20220501202025.211567-1-konrad.dybcio@somainline.org> <20220501202025.211567-2-konrad.dybcio@somainline.org> From: Konrad Dybcio In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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. 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] >