From patchwork Sun Sep 26 00:17:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 514641 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2814526jao; Sat, 25 Sep 2021 17:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIFIWzuXlZU9Jo9cfpsrSf0ywwqiC77uoPusS1ib+43jFXTSSj8s3WiEMrfB5EPJ7A20QD X-Received: by 2002:a50:d803:: with SMTP id o3mr13968504edj.91.1632615437635; Sat, 25 Sep 2021 17:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632615437; cv=none; d=google.com; s=arc-20160816; b=Ssqh/+U8+DvnoqQdXclXXM7ZB8KGHFLoHpeG3EcOCQv5dZqcHCXyeSu38wNcm/Jv1j KX9jjhIQNaD2/4l83N8GgNhj1XNlKQf4uxCSPpTAFNzlfKaANq7tIksE/Oe4AV0kDizu M6p8VVccmPevdUxUemx7pAwTtIs7d4K2Qvxxo8iv/79DDfvvMTYV3uQeicM5NFaUkc8V PG/otzgn8SEY02d4nj31YTBQIIZdJxeijZN77cgE1ycbKw9TrGJbgzqzF8Ob7ezRW/JH k5qAzYQWZr210zL9i/nfXO2WI4izDiCaVapqxunUxIERl53V6XagrDw8R9e5NhMgxwf9 0tGQ== 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=55iHUMzFFyoxNfHYv5W5Wm8oMzXKeDg6FrgyetZh2+M=; b=JXSmE/+Ec48gnzM7PNysgk5rRFLPUhuNd5ehfulrF1oHsGuJzxuR6DSGKvhZIBN+vO 0JK4CMLvXQslJCaVU2tYb/7xfNrwGcR4ihyZfTnZLv6vBbhvrjgzmyMIhhodiF9kqebw N72gAWZ8DZ8FtMTCCL2nT9nolgYsSoRk3m8JyW/faiB/6L8lH54RlCRiJLHJPHkFM29B vuCNt4K/VYvhkzzPXRlwBEsWnjxQJF0pheHoY0EsRN9WC/jZ+mGUgDL/2Ydjxhqg6vew aidmuxuMj5RBsrVgyaVIm5/VF25TfSDlW9AmRdr6syyp+Fv5JIlZn20h1RaGuOiBoLWN 8rJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T+VX3ch8; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si17741916ejw.120.2021.09.25.17.17.17; Sat, 25 Sep 2021 17:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T+VX3ch8; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S230197AbhIZASu (ORCPT + 17 others); Sat, 25 Sep 2021 20:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbhIZASt (ORCPT ); Sat, 25 Sep 2021 20:18:49 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5102FC061714 for ; Sat, 25 Sep 2021 17:17:14 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id u18so56546933lfd.12 for ; Sat, 25 Sep 2021 17:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=55iHUMzFFyoxNfHYv5W5Wm8oMzXKeDg6FrgyetZh2+M=; b=T+VX3ch8D0gBkFU/UV99bm4qwjRtkQttFzQoWYkQfqGpVO+OYRww5KBl6am/YUfMhi 7frE7cVb6JFJPrmVpoJcMK+TE3yFlfbLbhbXFXPAb4ab2widABSEgbpBmNfRzdLrpCDd XSj7eDEYFpijqSk0UdYpdyfCXWgvkqqddl2iHioVTxeYxMIatJms4BQ3OJYWUsqw7R2m ijxiaDlIBj7cZHGlkmab8daDHF/jNGjPLpQcQxwkpB0amL9OhRncOleXB0mNPDeVmmvV tCNxJMZw2O25H5woan6i11qPhB0+xNcLm4zkR70xp+twHnFZX2iJFPhRj4hutPlyomm9 QXMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=55iHUMzFFyoxNfHYv5W5Wm8oMzXKeDg6FrgyetZh2+M=; b=o+Xc1K3uQBLbmSsiIP14GOXJbETT4poYbAH2saHUqQPl3R8rFkT9boGH4wJAvTnbiV NNhBwIm+TykJgc28GDDPcy9Byza9I7utW79VBNE43nZwVRdZK6UkJcPmGj9nJU1H/pVp 1FEEdns4yYaYf63D64vFgcmtl5bUkyjt24LaXnHM5i6zVzsgzfd52QskEnZilbjsqG+o JZ2Zfr7rCwIPdUq5HEYKs7oiyLXGEB4IAYJr51grWp1V0sJR5x6SZBxEuip7YTyFXEj2 3xXQ2xdFFb3uQhdQE7zXCCAOYeAkKInwzBzFbO8DDj2C9aGp49ZKmthaRM7oitPEeAfm Ooyg== X-Gm-Message-State: AOAM530GJBjwbgnunwfUwRE9A/9L45Qkqw8jFDSPGYepx0hCHfoCgD0n b6peE6pKZhQpF1ckzqhSqMS3cg== X-Received: by 2002:a2e:7f04:: with SMTP id a4mr20879634ljd.308.1632615432668; Sat, 25 Sep 2021 17:17:12 -0700 (PDT) Received: from umbar.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id i10sm1146270lfu.71.2021.09.25.17.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 17:17:12 -0700 (PDT) From: Dmitry Baryshkov To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Zhang Rui , Daniel Lezcano Cc: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/2] thermal: qcom: tsens: fix VER_0 support Date: Sun, 26 Sep 2021 03:17:11 +0300 Message-Id: <20210926001711.2431912-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210926001711.2431912-1-dmitry.baryshkov@linaro.org> References: <20210926001711.2431912-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For VER_0 tsens shares the device with the clock controller, but nevertheless it does not use syscon for these registers. Drop syscon_node_to_regmap() and acquire the regmap on our own. apq8064 has tsens as a part of gcc device tree node, ipq8064 puts tsens node as a child node of gcc. Thus check whether tsens resource can be fetched either from the device itself or from it's parent. Fixes: 53e2a20e4c41 ("thermal/drivers/tsens: Add VER_0 tsens version") Signed-off-by: Dmitry Baryshkov --- drivers/thermal/qcom/tsens.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.30.2 diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6aeea74c1bb0..4c3960c188da 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -773,19 +773,19 @@ int __init init_common(struct tsens_priv *priv) if (tsens_version(priv) >= VER_0_1) { res = platform_get_resource(op, IORESOURCE_MEM, 0); tm_base = devm_ioremap_resource(dev, res); - if (IS_ERR(tm_base)) { - ret = PTR_ERR(tm_base); - goto err_put_device; - } - - priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config); } else { /* VER_0 share the same gcc regs using a syscon */ - struct device *parent = priv->dev->parent; + res = platform_get_resource(op, IORESOURCE_MEM, 0); + if (!res) + res = platform_get_resource(priv->dev->parent, IORESOURCE_MEM, 0); + tm_base = devm_ioremap(dev, res->start, resource_size(res)); + } - if (parent) - priv->tm_map = syscon_node_to_regmap(parent->of_node); + if (IS_ERR(tm_base)) { + ret = PTR_ERR(tm_base); + goto err_put_device; } + priv->tm_map = devm_regmap_init_mmio(dev, tm_base, &tsens_config); if (IS_ERR_OR_NULL(priv->tm_map)) { if (!priv->tm_map) ret = -ENODEV;