Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7125349ybc; Thu, 28 Nov 2019 11:21:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzfuWdFXeqtt1UCmBqszeTd2hIP9GG6Il6dPUXeUBuFOvabqqOSURTgw2DZX018WXFWjePQ X-Received: by 2002:a50:becf:: with SMTP id e15mr40397294edk.135.1574968874905; Thu, 28 Nov 2019 11:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574968874; cv=none; d=google.com; s=arc-20160816; b=DrCtinERN7tN9/h8R/ykYlk17WS7SV9RWm6gyXB29yxqXzhdBp188fHAzhJBzhcIwh UTl7or/RcLeP/TBdnwqw29DbJNxQ6nNRVqlwRfV79NFX+1jvS90LN+okjqjeEihx/VIK hTJ6a53cvgBwpMfvtaoBeU1RPoL+f+X8ZViClb0HBhZKzldYC1sGjpvi6sUx4A87T2Yb de4QAHAXca8g7qISI1XrDDTMyufdncl68O5Lpnf6dPO7C1jSuCJqO0fbbdmNQ+f5zWdY UjW6mQo/d8a3jcp4oMU/VxOID5/B7OvPk96n+oCzGtdthf2RlU0Hjch93ZW3ji1ZRWEb andw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5wX6nC/YJw5YE+55HDTs3wT2pEfI76Dlm8jJmHMxkZM=; b=OqoVQv/BnHwzqa7RuuBzZpARxKJ2487DBIvfJGlnMBci7lA4mY0+XwMEkPgfn64xC7 VSqFTm845TcxFRW8cs7Xm2pERwWDVaG4AaTOYPDz5BgOh9/O2aJnNUvZVnVR+3H3dnd0 aZevAadCDJc3SHLIfkXp3d/EVnzSxCi0jdc08ZM9TKVZDpq3KaWMD2Z6yQPfXRBi5jYh 7u5aZ7yjRS9lBRk/tg7ye1jA07+SE+bWSeS6AZ37sTKqsR0CynMwjJqSp3MBYyiwbbmv /pyYPm0Y49RwArwVGjzDP3sSnfBBLdzhKiIYXCDEVeLV9zTUtQsxq6aSpeoqwuXMlH4t vXIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pcqNI9Eo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si947866eje.34.2019.11.28.11.20.49; Thu, 28 Nov 2019 11:21:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pcqNI9Eo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726664AbfK1TQk (ORCPT + 99 others); Thu, 28 Nov 2019 14:16:40 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:33976 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726622AbfK1TQj (ORCPT ); Thu, 28 Nov 2019 14:16:39 -0500 Received: by mail-ua1-f68.google.com with SMTP id w20so749894uap.1 for ; Thu, 28 Nov 2019 11:16:37 -0800 (PST) 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=5wX6nC/YJw5YE+55HDTs3wT2pEfI76Dlm8jJmHMxkZM=; b=pcqNI9Eonn2OlLZ3h+S501B1xboLrOP+r52iUTl+U9YQFNQiXkmjdS+AmqmMhB4+du MCX0ESxbpXcnylEs8IBdQrYbzMWshiI2LmoKiAGMmUDYzClG3E+xI6ltgklBGQcStpWY xX0rJWB8NiRv8PeMcfAipKqswWPPzY3CCb3UQ0y3zui86YFMj0sxrXLn/dn1oGygTgib fAWW+DNXwv/cDwXdJOqaEtOTjCrdCIwliyPtkGqgFUQ2httAilWkyEzMK5KJS0q/Zwnu fyjOWUHUQviz/F6VvOlBLm00v7XW7TjGRcW6VBBs1n9MSM6xdBFknrhx0GOqvLONfT9+ hU5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5wX6nC/YJw5YE+55HDTs3wT2pEfI76Dlm8jJmHMxkZM=; b=ug9pg20op7PE8HUspylGX+swFjEqo58e4RtIsznYI7rt6NHB0rJaLmqFQuSsvMk9Jc Eu9Fq9xM3T3JMgycKuuOu5LsQ483+EG4IfXzsi73rMJsnAqjc47sGaZi65FzZq/FR9Qo KWm0hc/62MRFOTE65jhiMeyc+VfGQ09GssQMJzLV2jKVvlfLtYSfATnQvBRFWfY/xDvT gMHAXjdzQMkzDwVfuWxkCd6SqhzVTZxaD75p9wlPE//t62W0dBd02E1co9AJn4TzFtPf lnJcjWZeVZYZALzsQbdppXo5WODlo4HS9WmHtP8n/BErwXyGabT+8pEUe4epqsbe3SgR EMgQ== X-Gm-Message-State: APjAAAWaSeZEa5b76XjnpWjpti/rRAW/BpUsuUo+u854nmEf2bCB2xkj 5ElKMG8/wUyDSBJZKqJoRbEVO9IheP6l2eTmrGus2g== X-Received: by 2002:ab0:7684:: with SMTP id v4mr7274678uaq.94.1574968597182; Thu, 28 Nov 2019 11:16:37 -0800 (PST) MIME-Version: 1.0 References: <5dcdd754.1c69fb81.27caf.7022@mx.google.com> In-Reply-To: <5dcdd754.1c69fb81.27caf.7022@mx.google.com> From: Amit Kucheria Date: Fri, 29 Nov 2019 00:46:26 +0530 Message-ID: Subject: Re: [PATCH 2/3] drivers: thermal: tsens: Add watchdog support To: Stephen Boyd Cc: Andy Gross , Bjorn Andersson , Eduardo Valentin , linux-arm-msm , LKML , sivaa@codeaurora.org, Daniel Lezcano , Linux PM list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 15, 2019 at 4:08 AM Stephen Boyd wrote: > > Quoting Amit Kucheria (2019-11-11 11:21:28) > > TSENS IP v2.3 onwards adds support for a watchdog to detect if the TSENS > > HW FSM is frozen. Add support to detect and restart the FSM in the > > Maybe 'frozen' is an ambiguous term? Maybe 'stuck' or 'has stopped > making progress'? Alright, let's keep Disney out of this. Will use 'stuck'. > > driver. The watchdog is configured by the bootloader, we just enable the > > feature in the kernel. > > Does it work to enable it if we don't configure it in the bootloader? TBH, I don't know. Getting modified firmware to test this will be a bit of a challenge. > > > > Signed-off-by: Amit Kucheria > > --- > > drivers/thermal/qcom/tsens-common.c | 41 +++++++++++++++++++++++++++++ > > drivers/thermal/qcom/tsens-v2.c | 10 +++++++ > > drivers/thermal/qcom/tsens.h | 12 +++++++++ > > 3 files changed, 63 insertions(+) > > > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > > index 2989cb952cdb..9432518502a7 100644 > > --- a/drivers/thermal/qcom/tsens-common.c > > +++ b/drivers/thermal/qcom/tsens-common.c > > @@ -794,6 +820,21 @@ int __init init_common(struct tsens_priv *priv) > > } > > } > > > > + if (tsens_version(priv) > VER_1_X && ver_minor > 2) { > > + /* Watchdog is present only on v2.3+ */ > > + for (i = 0, j = WDOG_BARK_STATUS; j <= CC_MON_MASK; i++, j++) { > > The variable 'i' is not actually used in this loop. What's going on? Sorry, left over from a botched copy-paste job from the loop above this. Will fix. > > > + priv->rf[j] = devm_regmap_field_alloc(dev, priv->tm_map, > > + priv->fields[j]); > > + if (IS_ERR(priv->rf[j])) { > > + ret = PTR_ERR(priv->rf[j]); > > + goto err_put_device; > > + } > > + } > > + /* Enable WDOG and disable cycle completion monitoring */ > > + regmap_field_write(priv->rf[WDOG_BARK_MASK], 0); > > + regmap_field_write(priv->rf[CC_MON_MASK], 1); > > + }