Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6016810ybe; Tue, 10 Sep 2019 12:12:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOG4GES/h2yJ1E+cdIy7A+7W3ng7oNgh3CHKf14nGm6WJutG+VDb3N15xXL+kA/CVprFXv X-Received: by 2002:a50:e691:: with SMTP id z17mr32651022edm.84.1568142729008; Tue, 10 Sep 2019 12:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568142728; cv=none; d=google.com; s=arc-20160816; b=t1hSthVl0axbMcoTsBS9hVOfZqy3FgZV/Vg1w0G/sw9sCiaQVJPiSiXG5gzBZckyLs /+CtU27/+Z5OZt8Q7NjQwW7j/SFx+iI+SmiQPJr6jK4wO1atZnPAEYZAxsPQkP+9EqaG xFXQO5qjWY/0RmuOjVRkv113+im463nJauzXK+xp+8Ut1dB8KSP5RUDawGR7FbN6F3VY KEvZzgHoz41TgP3UQGs/MvugjaiARuXHXCPse1EIxyfGTRsn8+iSJ8VjzeqeiP8l8m7d bBGYfiZv6uD2Z1XA5ha0M7+pPE3bv+HvyudfGHQUrSiMOlRf/OUg82yT1QtEIK1TQrv2 27aw== 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=i4GD13AWYtGaucIdPfBacL0HOCS06RwW+OYru26aZGo=; b=z4nUn0t2yYqu/rG3TNSgNtdJnSIiESTSCYMxXInSjFj4BiPQ1dH2yXtXEJBCZ4rRHo kkay2G7h0iDoRDuO7ozzGuOev61fBnYqPPCYZ1B+Zdgdylo95H2KoL3Inzup8u9BgzZv 7ne8briEqgYouYIOE6X0hQYCC621F+/6NcNrWdDJJU9SwisSAvHPx6vy5/mewD+iuAQV G4wAAUdgt86rsCxWCjhCU0FLjL/xWEvVyWfrhl5/gsPAmDLFxwdb492/EB4G323tsSyb ZrDLrysN648m01WZL7kND0d0AglRB+I3UL1x9M1VLueW2Zny9DNtUEn4uvigXWTkQ4qI 2FTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bFVqYmBJ; 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 r23si8835209edq.243.2019.09.10.12.11.45; Tue, 10 Sep 2019 12:12:08 -0700 (PDT) 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=bFVqYmBJ; 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 S2394063AbfIJQBv (ORCPT + 99 others); Tue, 10 Sep 2019 12:01:51 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:34612 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393142AbfIJQBu (ORCPT ); Tue, 10 Sep 2019 12:01:50 -0400 Received: by mail-qk1-f195.google.com with SMTP id q203so17586739qke.1 for ; Tue, 10 Sep 2019 09:01:50 -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=i4GD13AWYtGaucIdPfBacL0HOCS06RwW+OYru26aZGo=; b=bFVqYmBJIFyWISBLSfHrMzHiHbX5do/4cERYQDzWJt+PZeUX0OHsy+TSpRVBXTL+aQ 3OvVTAx2WOC9NxGNNC9S6FV8QWMDIDndDSi7jqkc0qtujb/mOjXJc5BbsLL4O7ILwOLl ioI7jRVbci1bxCMndyhJyQ1t7X59S++cBodci18y3HAd1Y/j6ApRGSqlu2EnSogzcaCP NdJyhxsV0XKDKjhdMZ64YeSabZD1Li+xXFb79HCd/3i3LEksxFoU/kzsuLi/8LdbqKR5 wi/J4RsiJiLJJHF/ktI1oaePbrpTMpxPq5h6iC2XB1nngjzzPq6YNTUrNxnc3thwBD+/ SMlA== 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=i4GD13AWYtGaucIdPfBacL0HOCS06RwW+OYru26aZGo=; b=ixMXC0rd0amt6yPX/LNI4J9O0yLO3lvnmM7gInsL6VpdG8WQA+avvmjWy/gbKdR6dX ng5MSkHNKMI1FR0/KBs5AE+DITF5HwBgA8Nleai9OMudM8VkmccVxrjQwtvJl9I+OE3S /yNGTnVNcGN85/ohMe+f9sQzK6FYsBpRiEHy+qzKQXA81WMeT82cst+W4nLolXZyCoI3 ch3MVO09CtCsU6+VRncQx/a56eymzLuPGc/hkrwU0FbvUs46poQD+2HMyKxbkh7FMxZY wZf8nkHyrzS0RO6Q6JeQVqF64pmrCrBqvF1gy5DSvOVjUq/yBusC9FXhlwe3tuW7msQk xuAw== X-Gm-Message-State: APjAAAVOL39OMudhcHTIOyXvRMZ+ZeQPL7TyBgKzE3t2wXxuMfm/NC3D nZi3ZS99uvRFkzljmvy6Go9i1lgnJsuPsc9vlw6H/A== X-Received: by 2002:a37:2784:: with SMTP id n126mr29003422qkn.302.1568131309763; Tue, 10 Sep 2019 09:01:49 -0700 (PDT) MIME-Version: 1.0 References: <5D674C35.6060001@linaro.org> In-Reply-To: <5D674C35.6060001@linaro.org> From: Amit Kucheria Date: Tue, 10 Sep 2019 21:31:38 +0530 Message-ID: Subject: Re: [PATCH v2 15/15] drivers: thermal: tsens: Add interrupt support To: Thara Gopinath Cc: Linux Kernel Mailing List , linux-arm-msm , Bjorn Andersson , Eduardo Valentin , Andy Gross , Stephen Boyd , Brian Masney , Marc Gonzalez , Daniel Lezcano , Mark Rutland , Rob Herring , Zhang Rui , 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 Hi Thara, Thanks for the review. Please find replies below. On Thu, Aug 29, 2019 at 9:23 AM Thara Gopinath wrote: > > Hi Amit, > > On 08/27/2019 08:14 AM, Amit Kucheria wrote: > > Depending on the IP version, TSENS supports upper, lower, max, min and > > critical threshold interrupts. We only add support for upper and lower > > threshold interrupts for now. > > > > TSENSv2 has an irq [status|clear|mask] bit tuple for each sensor while > > earlier versions only have a single bit per sensor to denote status and > > clear. At each interrupt, we reprogram the new upper and lower threshold > > in the .set_trip callback. > > > > Signed-off-by: Amit Kucheria > > --- > > drivers/thermal/qcom/tsens-common.c | 377 ++++++++++++++++++++++++++-- > > drivers/thermal/qcom/tsens-v0_1.c | 11 + > > drivers/thermal/qcom/tsens-v1.c | 29 +++ > > drivers/thermal/qcom/tsens-v2.c | 13 + > > drivers/thermal/qcom/tsens.c | 32 ++- > > drivers/thermal/qcom/tsens.h | 270 ++++++++++++++++---- > > 6 files changed, 669 insertions(+), 63 deletions(-) > > > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > > index 06b44cfd5eab9..c549f8e1488ba 100644 > > --- a/drivers/thermal/qcom/tsens-common.c > > +++ b/drivers/thermal/qcom/tsens-common.c Please snip liberally when only replying to a small part of the patch. :-) > > + > > + spin_unlock_irqrestore(&priv->ul_lock, flags); > > + > > + if (trigger) { > > + dev_dbg(priv->dev, "[%u] %s: TZ update trigger (%d mC)\n", > > + hw_id, __func__, temp); > > + thermal_zone_device_update(priv->sensor[i].tzd, > > + THERMAL_EVENT_UNSPECIFIED); > Why not use thermal_notify_framework? Or do you want to loop over all > registered trips ? Mainly so we get a driver call-back to set_trips where we might want to change behaviour once we cross certain thresholds. > Another comment I have is regarding support for multiple thermal zone. > It might not be needed now, but presence of the same sensor can serve > multiple zones (one for cooling and one for warming) . I am not sure if > you want to put some infrastructure in place for that as well for > interrupt handling. It is premature to add such infrastructure to the driver until we decide how we're going to implement support for this, IMO.