From patchwork Wed Jun 1 03:59: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: 9145975 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 695C560761 for ; Wed, 1 Jun 2016 03:59:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B9E020499 for ; Wed, 1 Jun 2016 03:59:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E49A2679B; Wed, 1 Jun 2016 03:59:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0AF920499 for ; Wed, 1 Jun 2016 03:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757173AbcFAD7c (ORCPT ); Tue, 31 May 2016 23:59:32 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:51844 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757005AbcFAD7b (ORCPT ); Tue, 31 May 2016 23:59:31 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u513xPIt022125; Tue, 31 May 2016 22:59:25 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u513xT01024904; Tue, 31 May 2016 22:59:29 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Tue, 31 May 2016 22:59:29 -0500 Received: from ula0393675.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u513xQUA010504; Tue, 31 May 2016 22:59:27 -0500 From: Keerthy To: , CC: , , , , Subject: [PATCH v2] thermal: ti-soc-thermal: Add set_emul_temp hook Date: Wed, 1 Jun 2016 09:29:10 +0530 Message-ID: <1464753550-2529-1-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.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 --- Changes in v2: * Rebased on top of: git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal sysfs_locking Tested on DRA7/DRA72 baords. drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 15c0a9a..8d069ee 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -278,6 +278,17 @@ 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; + tz->emul_temperature = temp; + + 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 +300,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 = {