Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3568410pxp; Tue, 8 Mar 2022 17:40:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJykKY1yrmpXzt3tQmfTCDCVvdWrFtQeapgW/qHRin1hi69mx3S3pF1SC1xchLnBg54rPn5b X-Received: by 2002:a63:e303:0:b0:380:83f6:55a2 with SMTP id f3-20020a63e303000000b0038083f655a2mr6796556pgh.519.1646790054586; Tue, 08 Mar 2022 17:40:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646790054; cv=none; d=google.com; s=arc-20160816; b=pRiRO67Qh/ba9gJsdvO2hsnYwREseTrnoWb7c+gOH0OVi34UVAfv4KYSwrTXWW/vWi D/Ep1xtEuYuLHQa+NyupOujA7ykQXM7P4VjIFYSVfdElCD2qI21sfpCgaaX6yLtXNJXx a3LUFJYSHabEikAOgaBuVbb0GGgpPte6f2ZVwaIkVfOlAokZDVZTh0q8122qaDgWvgD3 wSa2ypcvNazCiSKD5HRdzk+mEjO2hO1jUJ5NyRxh2N+FmEbV68O6Zf2AH14XBOv1rnDd y0PnHKpjwydE46bd1ez1B7ljUpj2K8Iuv4A/Dz59hzq0I2FxxnPQKouGOsxlaP4Iv4zI xCZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=p5EQvhuvUh/i32VbwfS9DgkOo7IpZ5mlI+CyySn+M08=; b=JRe9R4g9quPfd2QSDorp7zGgtINpvdfEXTpw492ezPEB76zvCgSr0UtvCA5d9qLCvd smll6k1w5ciRSRM61t2FxmXdywItsYYlypv9z6acrRJOkkkiCoV5jI2BZrHCSupMAwA0 5vrVb1/gWRoUKU262c3O65B83Gfb7iQWzIF5QxpDsLZjPng/MaNm1iYqIkhNNXtHoNr/ g5og6pr0/+S+U89NMFJQevygoeWB2RoS4BOLcEjUZEu+UL/GQ/m83yBAcawrIkLYPD9R YToCYXLTHFwY9VHBGrq8wacgMS9fv+94pIpu59e8h2Pb91UA4he6WYES3ZKY98MW3wiL emCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gSkIrN32; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c6-20020a170902d48600b00151cea965ffsi587968plg.471.2022.03.08.17.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 17:40:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gSkIrN32; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 052DE2275AB; Tue, 8 Mar 2022 16:34:36 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345148AbiCHT1m (ORCPT + 99 others); Tue, 8 Mar 2022 14:27:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239799AbiCHT1l (ORCPT ); Tue, 8 Mar 2022 14:27:41 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79ACE4E394; Tue, 8 Mar 2022 11:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1646767604; x=1678303604; h=from:to:cc:subject:date:message-id:mime-version; bh=p5EQvhuvUh/i32VbwfS9DgkOo7IpZ5mlI+CyySn+M08=; b=gSkIrN32zfiNhoDyxPcN20k8/kMelW4gRpkrp29RLo0x+jBhhnqEAj7i HyQ0ewcgadA+O7FSEU8LyCYKYvkEe87qwAPgarWVkKSundSh8X69dShT9 aAUw+JLR15uJPvT/DYl0ddGBqySoFWH4tscNWflsQCMSd3xOzLz0BW9+m A=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 08 Mar 2022 11:26:44 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 11:26:44 -0800 Received: from nalasex01b.na.qualcomm.com (10.47.209.197) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Tue, 8 Mar 2022 11:26:43 -0800 Received: from codeaurora.org (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Tue, 8 Mar 2022 11:26:40 -0800 From: Manaf Meethalavalappu Pallikunhi To: "Rafael J . Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui CC: , , "Manaf Meethalavalappu Pallikunhi" Subject: [PATCH v2] drivers/thermal/thermal_of: Add change_mode ops support for thermal_of sensor Date: Wed, 9 Mar 2022 00:56:26 +0530 Message-ID: <1646767586-31908-1-git-send-email-quic_manafm@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The sensor driver which register through thermal_of interface doesn't have an option to get thermal zone mode change notification from thermal core. Add support for change_mode ops in thermal_of interface so that sensor driver can use this ops for mode change notification. Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/thermal_of.c | 12 ++++++++++++ include/linux/thermal.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 9233f7e..da48480 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -203,6 +203,14 @@ static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, return data->ops->get_trend(data->sensor_data, trip, trend); } +static int of_thermal_change_mode(struct thermal_zone_device *tz, + enum thermal_device_mode mode) +{ + struct __thermal_zone *data = tz->devdata; + + return data->ops->change_mode(data->sensor_data, mode); +} + static int of_thermal_bind(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev) { @@ -408,6 +416,9 @@ thermal_zone_of_add_sensor(struct device_node *zone, if (ops->set_emul_temp) tzd->ops->set_emul_temp = of_thermal_set_emul_temp; + if (ops->change_mode) + tzd->ops->change_mode = of_thermal_change_mode; + mutex_unlock(&tzd->lock); return tzd; @@ -569,6 +580,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev, tzd->ops->get_temp = NULL; tzd->ops->get_trend = NULL; tzd->ops->set_emul_temp = NULL; + tzd->ops->change_mode = NULL; tz->ops = NULL; tz->sensor_data = NULL; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index c3148939..365733b 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -299,6 +299,8 @@ struct thermal_zone_params { * temperature. * @set_trip_temp: a pointer to a function that sets the trip temperature on * hardware. + * @change_mode: a pointer to a function that notifies the thermal zone + * mode change. */ struct thermal_zone_of_device_ops { int (*get_temp)(void *, int *); @@ -306,6 +308,7 @@ struct thermal_zone_of_device_ops { int (*set_trips)(void *, int, int); int (*set_emul_temp)(void *, int); int (*set_trip_temp)(void *, int, int); + int (*change_mode) (void *, enum thermal_device_mode); }; /* Function declarations */