From patchwork Tue May 10 11:42:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 9057051 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D9BABF29F for ; Tue, 10 May 2016 11:43:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C12F220149 for ; Tue, 10 May 2016 11:43:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED55B20142 for ; Tue, 10 May 2016 11:43:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751492AbcEJLmu (ORCPT ); Tue, 10 May 2016 07:42:50 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:43076 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbcEJLmt (ORCPT ); Tue, 10 May 2016 07:42:49 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u4ABglmE027360; Tue, 10 May 2016 06:42:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4ABglDw026802; Tue, 10 May 2016 06:42:47 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Tue, 10 May 2016 06:42:46 -0500 Received: from ula0393675.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4ABgilC021208; Tue, 10 May 2016 06:42:44 -0500 From: Keerthy To: , CC: , , , , Subject: [PATCH] thermal: ti-soc-thermal: Add set_emul_temp hook Date: Tue, 10 May 2016 17:12:10 +0530 Message-ID: <1462880530-13935-1-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Setting the emulation temperature helps reproduce critical temperature scenarios without risking the actual hardware at extreme temperatures. Adding __ti_thermal_set_emul_temp as the set_emul_temp hook. Signed-off-by: Keerthy --- Tested the emulation temperature feature on DRA72-EVM. drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index b213a12..e6f7025 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -278,6 +278,20 @@ static int ti_thermal_get_trend(struct thermal_zone_device *thermal, return 0; } +static int __ti_thermal_set_emul_temp(void *p, int temp) +{ + struct ti_thermal_data *data = p; + struct thermal_zone_device *tz; + + tz = data->ti_thermal; + + mutex_lock(&tz->lock); + tz->emul_temperature = temp; + mutex_unlock(&tz->lock); + + return 0; +} + /* Get critical temperature callback functions for thermal zone */ static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, int *temp) @@ -289,6 +303,7 @@ static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, static const struct thermal_zone_of_device_ops ti_of_thermal_ops = { .get_temp = __ti_thermal_get_temp, .get_trend = __ti_thermal_get_trend, + .set_emul_temp = __ti_thermal_set_emul_temp, }; static struct thermal_zone_device_ops ti_thermal_ops = {