Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3087465iog; Mon, 27 Jun 2022 08:53:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v3KNg13UC4c1o0aTeESHmd6X4PVz3D34EOaf+5SSx+449LQnpJjVO9QSOIQXqgXwZWx93O X-Received: by 2002:a17:903:41d2:b0:16a:2cc4:4824 with SMTP id u18-20020a17090341d200b0016a2cc44824mr15355578ple.112.1656345218463; Mon, 27 Jun 2022 08:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656345218; cv=none; d=google.com; s=arc-20160816; b=aOmtjflErQXaktE5icrS0v+xmJA0fhP+XwjrZqY4j5NpZj5SedCjNG0spRvdSki21F Jtq6lUn3RAZDLGTOQqozmXU6uHbQTofGm3tnAmJ77NE08PpOAXnRz+u8zf+xL9fzZQOD hKw8NYfE4U4xbAygXeCLy4J7EMYHTKV2W/27i+C2Q9S/s4E+p1A6t7Lwt/qt7F45P6+I Zgnbt5fDjikEcWWX9jmawlDVk+1ZfAa6w+MV1mBXJL1qIURyyH3YHMtgqqQgt9TCrJoa etvrmINbGAPf8MK7rB3mmGu9KqOn8x5x4lWPySLRrIHro44hHp6QWultwTygC5CEtnW3 ae2w== 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=mzJBc6lpxrhRFAK19Ed32rRqhbZNObvqIUjXDfqFSfg=; b=d3Vd8aozoJtoNNWG2lHMFCtRh6u2AOPTiVyf7qlvFU+geawUJ9k/+MwWTtFr6FP/yn 79ymuun14xppZtVVHlVco6f92d/KUgQ1fPiH907W+WXK7rOL1tVjCX+Jz+lfJjtmzWr1 8u6f4OJjm+s+lQ6D8iDJb89ejUlTUJi3bqO7vEc0Dorqms7tKUaGu62NPj/OkNSur7yN OqFwV9GZh1USgpVhM3XLAhr69IxAcB14LiOEMCDpXBjLyG7nW8jXF0FAP0bpNWC13ehr B8RuqcF94hzlgK8PU+EcN4eol409cfmlo7XP2UcOgoA3LWIotWOYLPXFX2tXaYAoVvQ+ F9Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m67baQfF; 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 y32-20020a056a00182000b0051bd440b069si17886858pfa.14.2022.06.27.08.53.25; Mon, 27 Jun 2022 08:53:38 -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=m67baQfF; 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 S237792AbiF0PPb (ORCPT + 99 others); Mon, 27 Jun 2022 11:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236155AbiF0PPa (ORCPT ); Mon, 27 Jun 2022 11:15:30 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB27186C5 for ; Mon, 27 Jun 2022 08:15:28 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id c1so15103821qvi.11 for ; Mon, 27 Jun 2022 08:15:28 -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=mzJBc6lpxrhRFAK19Ed32rRqhbZNObvqIUjXDfqFSfg=; b=m67baQfFZVYozVrPpK7ebfiOEWopTNMUi5ny7mGhXcwG8FGpcUPLYZqxyJV2qyNgpt V3DN2DoadHlkkqlczAi/yJVFj8AlRi0aG0bWtztLQ2NnSdWjMD9MatduW+M/FluFke1W t4vfg2QsCjaMDRoxDdrbZudjjex22JBpDrtryJyZ/rY9nnG/JRt8Z5JtGoI0818mgajG 8KyBReHKQOpw/75RNbwZqRctyg1qKnlZnJfSorQa3H7PJxOw4oz1XA/NOWej+M2mJqgr Rnbitb+kztu1tVv8RhcypNCwguzlroIwUk28vvQ88BCVnA8MVc1aFOX8obGV9BLYHV3a GsNA== 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=mzJBc6lpxrhRFAK19Ed32rRqhbZNObvqIUjXDfqFSfg=; b=G+k8KY7j7IEVqlO9YF/zSMqvdU5duUA2HG2Ha4mO1v6a++OJzjL3mqShNhE7S9IIaF exnvOKWm5RrTQPcypBZ9+rnMVtj5ONrtEojXRLO8h6Tb+h1quGjC9nVlrLF1oyre8AIf veDZCTj4HbZOHaw6/f5czUA6HvLoU3zMTTlG8Iiv+J7aqG21orD/pquE+4xlNK+OJ/vX QehHz6PDM+hrXf3iVaX9zX3ZOEoFOArblXc85WPjOtjOf0Cg063YD9Y2OJ1XYp6RQpXM 5hjbM88C7KJiuvzuGl/hEsQ17zSK8kIJK/+4vZktJiUxsSEKssVB6UrYC2fJJ5qUOBRr NpZA== X-Gm-Message-State: AJIora97kqP57xYoQb0LsT0/kC+Px9wcm58tWQAMWSp5s9UnNIHFktY4 m/Nch1m9UAZmSeQNUfYsRBZLaGFtYAqcGDE6gIqY+w== X-Received: by 2002:a05:6214:2a83:b0:470:a898:e467 with SMTP id jr3-20020a0562142a8300b00470a898e467mr8896772qvb.122.1656342927912; Mon, 27 Jun 2022 08:15:27 -0700 (PDT) MIME-Version: 1.0 References: <20220501202025.211567-1-konrad.dybcio@somainline.org> <20220501202025.211567-2-konrad.dybcio@somainline.org> In-Reply-To: <20220501202025.211567-2-konrad.dybcio@somainline.org> From: Dmitry Baryshkov Date: Mon, 27 Jun 2022 18:15:15 +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 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. > + > +#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