Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2819635rdb; Wed, 4 Oct 2023 12:23:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9H+hXXwzff9jZiLQ8dCa7vzM84QJEqmLoMfMP7WEW3NEpVj3eDxPwyme1ggikCHoyrRns X-Received: by 2002:a17:90a:9a94:b0:274:a861:4391 with SMTP id e20-20020a17090a9a9400b00274a8614391mr2844429pjp.40.1696447417862; Wed, 04 Oct 2023 12:23:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696447417; cv=none; d=google.com; s=arc-20160816; b=rbl0Adqshiw+UVBWHjZPG6ds/lz5zVaDvuIZKqSSRitLWjgLDL3D+B+eooDyaH/B9u 4B4MTBh23obrzMb970rG0cGB/P2fH1ub/qTV5Kzhbtq3pKSABNo+XS8HPmrtEUBuXxJB yhVYm5Ii/nXxtEOJCGWLcelkgofkNVZCSQOtV6BciF2c7ZT3gDhlztSaIOVp102tJabK hwiKJd6Id5crgl7iIKxR8rTlp6CgZ3qgEZ9ivrUKVp4qUuzlnRkduKoRZ/vGuHffuWx2 0oYiJ/agWCNL6rQ6IYbARoD4XCbKXme4gzawLGzLbuysZrSEyQEfyD6CrdK8OhLNatWy 1BWA== 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 :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=LfKbENQF1OCDpyRozcLgcbIFYekG+q6fUxVUaA/+cFk=; fh=FTGCNC6hYVuS83gXpvZDSzLqpq3HHRZ5cg7ljkh8m3M=; b=uVIhJjYFmp5Yqj+UTuHtmAuh39irhL/XCcupdGhJDmSPLmZCYws1Kq6BuvtbvIPyG2 B6iauxXPTg+w7D6D302z3A0zkrLmLDUa66dMD90PhHl7fy2lqXWLzU7cj6f2nBJWtKkO CIp50rG2v3X8Y6hdp1GuyOf5uBfcGwPNezj1UCrOozP4XdoAzWFg1Kemf1leddmfpv9F 5VYwMKZcy48DGGjEQkxX4pWmDayC/bVihc0at3GZhcqVQHOms2LlzpbI0Nca4ysy66Ht eW8/x7I1MhawsdPXvynS+VnIMFGdUUSDxU3OotLbnoBnBg8jJunDBF3dtGGSofTjgQda P8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="b3VtB/EK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ds12-20020a17090b08cc00b00263a99b8448si2009330pjb.113.2023.10.04.12.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:23:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="b3VtB/EK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B9647827175B; Wed, 4 Oct 2023 12:23:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245333AbjJDTJn (ORCPT + 99 others); Wed, 4 Oct 2023 15:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245252AbjJDTJY (ORCPT ); Wed, 4 Oct 2023 15:09:24 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA18D10C7; Wed, 4 Oct 2023 12:07:39 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-53829312d12so2886594a12.0; Wed, 04 Oct 2023 12:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696446458; x=1697051258; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=LfKbENQF1OCDpyRozcLgcbIFYekG+q6fUxVUaA/+cFk=; b=b3VtB/EKY2wwAsSWeMt2BAqctndLxxPkiM9CLeN3v025aqwFW6KxJMueyd0P4B73pf p1VhqXJ3V07VCyPpsZ+QOQpRbWI36TCYZ2z25t28zmlpLX+IBmzdqNaWtkY4ju0TMW2T 8m/yHoQmqN9ltqnKDCZn7/XFkuhstZdKyhJDSo7wJICr4TZY+9A4njqhPuN/xg9LxOD5 h8Nyy8bsJJ8hoHaWqODP09BxclXHw+IAv5yE6nAsFiJxuOFACFaVI5DpFXQlNcr4Wqtx Y1zEujuKNPKpczSANlA0xrfBU+x+3w2PFen35B5AfjDNIoQfNOvJpmO5gLKABNFsDdC3 DZYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696446458; x=1697051258; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LfKbENQF1OCDpyRozcLgcbIFYekG+q6fUxVUaA/+cFk=; b=pxH3bE57OMhi50foVjhso/T/7R1SzRIYwKedd89ix5tsuKzH+SvkOyo48YJmlNN4Tu 7VO+1SoHlcgJyd+lr8yRbc1q2flsxG6T32DOUdRd2NlqIJohl3eDm+pH+zgz/4mP3kNJ gMqBAqWiNlVE6myvYF+NZQDiazFPJDkFjjFLGSWDdXcOxqw6WsXpD0W4nG9Q+jZshR0a L5+RKdWesxdRutnpoV8SxXeHZx+5Ni0fDBNdtKP1VyaMfXTrFIrm9Flw8j79KA497dvk MZIS/oRqtJb225g+kWwu+wuUf6KHSFKZa0MUTPa0u3znY16OOSPZj68z8UjlonlLe2Ss U8oQ== X-Gm-Message-State: AOJu0YxRS9AEKT+mgL5kqDiWLoPmN8PU9BnjackTwC8CCj3gY7ReuePv rY5bFJizr30bSjZlVjJC3m4+mVQtWbfnww== X-Received: by 2002:a17:906:3109:b0:9b6:3be9:a8f with SMTP id 9-20020a170906310900b009b63be90a8fmr497677ejx.20.1696446457879; Wed, 04 Oct 2023 12:07:37 -0700 (PDT) Received: from [192.168.3.32] (cpezg-94-253-131-161-cbl.xnet.hr. [94.253.131.161]) by smtp.gmail.com with ESMTPSA id p24-20020a170906a01800b009b28ad521f4sm3261380ejy.4.2023.10.04.12.07.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Oct 2023 12:07:37 -0700 (PDT) Message-ID: Date: Wed, 4 Oct 2023 21:07:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH V3 3/4] thermal/drivers/tsens: Add support for IPQ5018 tsens To: Sricharan R , krzysztof.kozlowski@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, srinivas.kandagatla@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, thara.gopinath@gmail.com, rafael@kernel.org, daniel.lezcano@linaro.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dmitry.baryshkov@linaro.org, quic_srichara@quicinc.com References: <20230922115116.2748804-1-srichara@win-platform-upstream01.qualcomm.com> <20230922115116.2748804-4-srichara@win-platform-upstream01.qualcomm.com> Content-Language: en-US From: Robert Marko In-Reply-To: <20230922115116.2748804-4-srichara@win-platform-upstream01.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 12:23:37 -0700 (PDT) On 22. 09. 2023. 13:51, Sricharan R wrote: > From: Sricharan Ramabadhran > > IPQ5018 has tsens IP V1.0, 4 sensors and 1 interrupt. > The soc does not have a RPM, hence tsens has to be reset and > enabled in the driver init. Adding the driver support for same. > > Signed-off-by: Sricharan Ramabadhran > --- > [v3] Fixed Dmitry's comments for error checks in init_ipq5018 > > drivers/thermal/qcom/tsens-v1.c | 60 +++++++++++++++++++++++++++++++++ > drivers/thermal/qcom/tsens.c | 3 ++ > drivers/thermal/qcom/tsens.h | 2 +- > 3 files changed, 64 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c > index dc1c4ae2d8b0..acee2064f83e 100644 > --- a/drivers/thermal/qcom/tsens-v1.c > +++ b/drivers/thermal/qcom/tsens-v1.c > @@ -79,6 +79,18 @@ static struct tsens_features tsens_v1_feat = { > .trip_max_temp = 120000, > }; > > +static struct tsens_features tsens_v1_ipq5018_feat = { > + .ver_major = VER_1_X, > + .crit_int = 0, > + .combo_int = 0, > + .adc = 1, > + .srot_split = 1, > + .max_sensors = 11, > + .trip_min_temp = -40000, > + .trip_max_temp = 120000, > + .ignore_enable = 1, > +}; > + > static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = { > /* ----- SROT ------ */ > /* VERSION */ > @@ -150,6 +162,41 @@ static int __init init_8956(struct tsens_priv *priv) { > return init_common(priv); > } > > +static int init_ipq5018(struct tsens_priv *priv) __init is missing after int, otherwise I get modpost warning while building: WARNING: modpost: vmlinux: section mismatch in reference: init_ipq5018+0x14 (section: .text) -> init_common (section: .init.text) Regards, Robert > +{ > + int ret; > + u32 mask; > + > + ret = init_common(priv); > + if (ret < 0) { > + dev_err(priv->dev, "Init common failed %d\n", ret); > + return ret; > + } > + > + ret = regmap_field_write(priv->rf[TSENS_SW_RST], 1); > + if (ret) { > + dev_err(priv->dev, "Reset failed\n"); > + return ret; > + } > + > + mask = GENMASK(priv->num_sensors, 0); > + ret = regmap_field_update_bits(priv->rf[SENSOR_EN], mask, mask); > + if (ret) { > + dev_err(priv->dev, "Sensor Enable failed\n"); > + return ret; > + } > + > + ret = regmap_field_write(priv->rf[TSENS_EN], 1); > + if (ret) { > + dev_err(priv->dev, "Enable failed\n"); > + return ret; > + } > + > + ret = regmap_field_write(priv->rf[TSENS_SW_RST], 0); > + > + return ret; > +} > + > static const struct tsens_ops ops_generic_v1 = { > .init = init_common, > .calibrate = calibrate_v1, > @@ -187,3 +234,16 @@ struct tsens_plat_data data_8976 = { > .feat = &tsens_v1_feat, > .fields = tsens_v1_regfields, > }; > + > +const struct tsens_ops ops_ipq5018 = { > + .init = init_ipq5018, > + .calibrate = tsens_calibrate_common, > + .get_temp = get_temp_tsens_valid, > +}; > + > +struct tsens_plat_data data_ipq5018 = { > + .num_sensors = 5, > + .ops = &ops_ipq5018, > + .feat = &tsens_v1_ipq5018_feat, > + .fields = tsens_v1_regfields, > +}; > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > index 0a43ccf02ec4..c792b9dc6676 100644 > --- a/drivers/thermal/qcom/tsens.c > +++ b/drivers/thermal/qcom/tsens.c > @@ -1101,6 +1101,9 @@ static SIMPLE_DEV_PM_OPS(tsens_pm_ops, tsens_suspend, tsens_resume); > > static const struct of_device_id tsens_table[] = { > { > + .compatible = "qcom,ipq5018-tsens", > + .data = &data_ipq5018, > + }, { > .compatible = "qcom,ipq8064-tsens", > .data = &data_8960, > }, { > diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h > index e254cd2df904..b6594b546d11 100644 > --- a/drivers/thermal/qcom/tsens.h > +++ b/drivers/thermal/qcom/tsens.h > @@ -645,7 +645,7 @@ extern struct tsens_plat_data data_8960; > extern struct tsens_plat_data data_8226, data_8909, data_8916, data_8939, data_8974, data_9607; > > /* TSENS v1 targets */ > -extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956; > +extern struct tsens_plat_data data_tsens_v1, data_8976, data_8956, data_ipq5018; > > /* TSENS v2 targets */ > extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2;