From patchwork Mon Apr 1 16:04:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 2371631 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 491AA3FDDA for ; Mon, 1 Apr 2013 16:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758989Ab3DAQKW (ORCPT ); Mon, 1 Apr 2013 12:10:22 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:57313 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758916Ab3DAQKV (ORCPT ); Mon, 1 Apr 2013 12:10:21 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r31GAI39009256; Mon, 1 Apr 2013 11:10:18 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r31GAIOf021810; Mon, 1 Apr 2013 11:10:18 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Mon, 1 Apr 2013 11:10:17 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r31GAHUL024204; Mon, 1 Apr 2013 11:10:17 -0500 Received: from localhost (h64-8.vpn.ti.com [172.24.64.8]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r31GAEV05025; Mon, 1 Apr 2013 11:10:14 -0500 (CDT) From: Eduardo Valentin To: Greg Kroah-Hartman CC: , , , J Keerthy , Eduardo Valentin Subject: [PATCH 14/14] staging: ti-soc-thermal: Add get_trend support Date: Mon, 1 Apr 2013 12:04:46 -0400 Message-ID: <1364832286-17304-15-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c In-Reply-To: <1364832286-17304-1-git-send-email-eduardo.valentin@ti.com> References: <1364832286-17304-1-git-send-email-eduardo.valentin@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: J Keerthy Patch adds get_trend functionality for OMAP Bandgap thermal devices. Signed-off-by: J Keerthy Signed-off-by: Eduardo Valentin --- drivers/staging/ti-soc-thermal/ti-thermal-common.c | 27 +++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/drivers/staging/ti-soc-thermal/ti-thermal-common.c b/drivers/staging/ti-soc-thermal/ti-thermal-common.c index 231c549..092b39d 100644 --- a/drivers/staging/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/staging/ti-soc-thermal/ti-thermal-common.c @@ -215,6 +215,31 @@ static int ti_thermal_get_trip_temp(struct thermal_zone_device *thermal, return 0; } +/* Get the temperature trend callback functions for thermal zone */ +static int ti_thermal_get_trend(struct thermal_zone_device *thermal, + int trip, enum thermal_trend *trend) +{ + struct ti_thermal_data *data = thermal->devdata; + struct ti_bandgap *bgp; + int id, tr, ret = 0; + + bgp = data->bgp; + id = data->sensor_id; + + ret = ti_bandgap_get_trend(bgp, id, &tr); + if (ret) + return ret; + + if (tr > 0) + *trend = THERMAL_TREND_RAISING; + else if (tr < 0) + *trend = THERMAL_TREND_DROPPING; + else + *trend = THERMAL_TREND_STABLE; + + return 0; +} + /* Get critical temperature callback functions for thermal zone */ static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, unsigned long *temp) @@ -225,7 +250,7 @@ static int ti_thermal_get_crit_temp(struct thermal_zone_device *thermal, static struct thermal_zone_device_ops ti_thermal_ops = { .get_temp = ti_thermal_get_temp, - /* TODO: add .get_trend */ + .get_trend = ti_thermal_get_trend, .bind = ti_thermal_bind, .unbind = ti_thermal_unbind, .get_mode = ti_thermal_get_mode,