Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7100519ybc; Thu, 28 Nov 2019 10:53:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyk9Kncqz+YyEsE3j0XCyyn/eWZ1bb+LtZ7BawdxDGz3eCkFnffdzWw2iyDGVYBPSoR3dVh X-Received: by 2002:a05:6402:387:: with SMTP id o7mr15975592edv.84.1574967195135; Thu, 28 Nov 2019 10:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574967195; cv=none; d=google.com; s=arc-20160816; b=p7fgvb7YFqfsxGs3ypG/g16FrFwYJaHMMyobpPnahwLp/iByMQo+PnPokir+ce3yrn sl3c6QWcFLO+ta1Z+eg2UunTJM52NQrNwwoa+EzC9TjLs6CN3HaerOfShZd8mdiJtIhn dTdj3E9NBA8j2Bac/f6/fBlL6sjF/RpAbyfH3gDW8dFRrSRiM1GL3vldxs6SMYkHMe76 5lpaT65UULoP4LyMACGY1+HRNoF88Qaz6A+7bOC+pykuDhROpJReojBASjbCkoM7vVQj FgrYaEmEs08b7IGp2mYvxMwBKR1vbKFzh402hVT5J/g1+09LIKSuWio/sVwveaN62Azs ZiTQ== 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=ZAcsdTWTMDRBmGclm59Bby1W0j7rzUU6vpArZy95gbA=; b=SzPOER5aLAk6jJfgKODqIZkrZ8ZVWoqXpl/kLdxZZd5NLvBfGRPuf8Ks0t9YZGwkg0 zrRraFxXxcNd2ygS5RDzsDwB3aMYDgMaxap0SAAmK5JEkUfvOSduKpEUSAevRuIJ9kVx EpGSjYIO0eLvzHOaa27B/azGrwZ+Ok9XQjZLBlV+tSN/vrYWBgydQI7sVKCT4fwpW6EV sP719K98dZjmeM2rpnQ1IwZ67QyoocYkb1TnibP8dSylgJQpHa7KoLL5dJ++I9xCODCe f2Wz/FlwSa190SfyshI5NI28WJG07BugJ81f6Q9O6pJqPg7eEr9Kjg8ZG1UAV9jfXvFh RjaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wDJqdr0i; 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 a2si12786829ejb.257.2019.11.28.10.52.21; Thu, 28 Nov 2019 10:53:15 -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=wDJqdr0i; 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 S1726609AbfK1Sqp (ORCPT + 99 others); Thu, 28 Nov 2019 13:46:45 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:44518 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbfK1Sqp (ORCPT ); Thu, 28 Nov 2019 13:46:45 -0500 Received: by mail-vk1-f196.google.com with SMTP id u189so5398058vkf.11 for ; Thu, 28 Nov 2019 10:46:44 -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=ZAcsdTWTMDRBmGclm59Bby1W0j7rzUU6vpArZy95gbA=; b=wDJqdr0iECuvOvYXrL9HYzzNGKueDft0lNsdVIRX2eezSz4hgren7SSeI//ULzKuwF 7pUShn36jMVG9vgVRoZQlCzrhcBvSFs1StoVVG1NPeC5wdVV2cH1HiaKKocPUGK6f76B cSuhdGSmyeTZi5NRXXLZnii3pPapDWvHECs3KTyOV2c3Q6KHbbZ6J05GsvBazmqQbZjH k5wuFWlkgFu2oYtM3eB00cML9a8udl9AK3nTaZl6xwP5sjiBRcpcU3Hout+3K8zGlBzQ U6yHjx/AsZUYE+8gT258StJX5mWrswzlVOBOD+P7yMw/XNUiUelZCttzRMBOKBfn9RZE bIcw== 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=ZAcsdTWTMDRBmGclm59Bby1W0j7rzUU6vpArZy95gbA=; b=eK66Vb+D6T8/8CtkQy3gkbIHm/FSb4bGPUux6/BDbUqOmEzjVojp1fJw6qzfCOeK5x /hsHvVJXhaU1cbLaMI/xVPy3L2oOMchXpXZHp8e+tEN+EeWv6rcuBG1UADBW59kHlmce jk7Tw0Lx2tk4Mm+hqJBGIMxxNMU6FV+/os4Rlc48nDqT6e6fVLFB9O19LtS9ZuevsgyW 3gpSjUq/Sbbwqz4ltv1W6YOeiGFbyCgRi7nNKkDx1eLvpmsIkrVZzmdrX+s7JQfrB6Ca C4C0bsoUF0qVns8OOXzpihEgZaL3Gjj3cFr7srly7bmmQ+f/kDqbceJUfB7bRTc1Orps vtzQ== X-Gm-Message-State: APjAAAVqdr5SvkMkioATrg+x1WXvsjWo9/PhESwwCeZJezBjRNoYU9Oq 7W9pT5fhl59a35dqY/g93lyx77KXn7YhWEyddisUkw== X-Received: by 2002:a1f:fe45:: with SMTP id l66mr7733653vki.9.1574966804202; Thu, 28 Nov 2019 10:46:44 -0800 (PST) MIME-Version: 1.0 References: <4b949a4f401a7f9d403ed0f0c16c7feb083f3524.1573499020.git.amit.kucheria@linaro.org> <20191112193852.GC3140946@builder> In-Reply-To: <20191112193852.GC3140946@builder> From: Amit Kucheria Date: Fri, 29 Nov 2019 00:16:33 +0530 Message-ID: Subject: Re: [PATCH 1/3] drivers: thermal: tsens: Add critical interrupt support To: Bjorn Andersson Cc: LKML , linux-arm-msm , Eduardo Valentin , Stephen Boyd , sivaa@codeaurora.org, Andy Gross , 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 Wed, Nov 13, 2019 at 1:08 AM Bjorn Andersson wrote: > > On Mon 11 Nov 11:21 PST 2019, Amit Kucheria wrote: > > > TSENS IP v2.x adds critical threshold interrupt support for each sensor > > in addition to the upper/lower threshold interrupt. Add support in the > > driver. > > > > Signed-off-by: Amit Kucheria > > --- > > drivers/thermal/qcom/tsens-common.c | 129 ++++++++++++++++++++++++++-- > > drivers/thermal/qcom/tsens-v2.c | 8 +- > > drivers/thermal/qcom/tsens.c | 21 +++++ > > drivers/thermal/qcom/tsens.h | 73 ++++++++++++++++ > > 4 files changed, 220 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > > index 4359a4247ac3..2989cb952cdb 100644 > > --- a/drivers/thermal/qcom/tsens-common.c > > +++ b/drivers/thermal/qcom/tsens-common.c > > @@ -23,6 +23,10 @@ > > * @low_thresh: lower threshold temperature value > > * @low_irq_mask: mask register for lower threshold irqs > > * @low_irq_clear: clear register for lower threshold irqs > > + * @crit_viol: critical threshold violated > > "violated" as in "temperature is above crit_thresh"? Yes. > > > + * @crit_thresh: critical threshold temperature value > > + * @crit_irq_mask: mask register for critical threshold irqs > > + * @crit_irq_clear: clear register for critical threshold irqs > > * > [..] > > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > > index 7d317660211e..784c4976c4f9 100644 > > --- a/drivers/thermal/qcom/tsens.c > > +++ b/drivers/thermal/qcom/tsens.c > > @@ -121,6 +121,27 @@ static int tsens_register(struct tsens_priv *priv) > > > > enable_irq_wake(irq); > > > > + if (tsens_version(priv) > VER_1_X) { > > + irq = platform_get_irq_byname(pdev, "critical"); > > + if (irq < 0) { > > Treating this as a fatal error breaks backwards compatibility with > current devicetree; and even within your patch series, tsens should fail > to probe between this patch and the application of patch 3. Good catch. > Please flip this around and do: > > irq = platform_get_irq_byname(pdev, "critical"); > if (irq >= 0 && tsens_version(priv) > VER_1_X) { > request_irq()... > } Won't this still break with current devicetree since irq < 0 until patch 3? Or are you saying we shouldn't check for platform_get_irq_byname() failure? I can see two ways out: 1. We patch the dtsi before the code change. 2. We make critical interrupt failure non-fatal by just printing some messages and still returning success. Regards, Amit > > + ret = irq; > > + goto err_put_device; > > + } > > + > > + ret = devm_request_threaded_irq(&pdev->dev, irq, > > + NULL, tsens_critical_irq_thread, > > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > > + dev_name(&pdev->dev), priv); > > + if (ret) { > > + dev_err(&pdev->dev, "%s: failed to get critical irq\n", __func__); > > + goto err_put_device; > > + } > > + > > + enable_irq_wake(irq); > > + } > > + > > + return 0; > > + > > err_put_device: > > put_device(&pdev->dev); > > return ret; > > Regards, > Bjorn