From patchwork Fri Oct 7 04:42:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Scott X-Patchwork-Id: 9365585 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 4CFE260752 for ; Fri, 7 Oct 2016 04:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D216292B3 for ; Fri, 7 Oct 2016 04:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31C68292E0; Fri, 7 Oct 2016 04:42:33 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 05D59292B3 for ; Fri, 7 Oct 2016 04:42:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750898AbcJGEmb (ORCPT ); Fri, 7 Oct 2016 00:42:31 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:49525 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbcJGEmb (ORCPT ); Fri, 7 Oct 2016 00:42:31 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 43CBC806A8; Fri, 7 Oct 2016 17:42:27 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1475815347; bh=c6YgKgUl4btRy8FmOEgEtWfCUD18zAM7eUB7gcBWlzE=; h=From:To:Cc:Subject:Date; b=gy45KTsDfaGXNTpQzKqJwBHPCuy1ejGxNqrX5s1sFxO8MfWTFgCbMQrcJS3Xixvrw U3RhhXlOnexLqhTrXQn2GbqvKWLh0WhxI8l2yv2wfwHyWiG3ScEQ9KgnpJ99p4IdnO 9YUj2COnbAmBs7/AOlirhk/qUYzNwy6In1jm/CdA= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 6, 8438) id ; Fri, 07 Oct 2016 17:42:26 +1300 Received: from joshuas-dl.ws.atlnz.lc (joshuas-dl.ws.atlnz.lc [10.33.13.25]) by smtp (Postfix) with ESMTP id 8BFE613EF11; Fri, 7 Oct 2016 17:42:25 +1300 (NZDT) Received: by joshuas-dl.ws.atlnz.lc (Postfix, from userid 1634) id BCA0E1A0806; Fri, 7 Oct 2016 17:42:26 +1300 (NZDT) From: Joshua Scott To: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Cc: Joshua Scott , Chris Packham Subject: [PATCH] hwmon: (lm73) Add temp1_max_hyst entry to sysfs Date: Fri, 7 Oct 2016 17:42:21 +1300 Message-Id: <20161007044221.25577-1-joshua.scott@alliedtelesis.co.nz> X-Mailer: git-send-email 2.9.3 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the lm73 driver has a temp1_max and a temp1_min. These make sense when using temp1_max_alarm and temp1_min_alarm to determine if the temperature has exceeded the chosen limits. However, when using the ALARM output pin on the lm73 chip, the lower temperature value behaves as a hysteresis value. Rather than the low value triggering a "too cold" alarm, it is the point at which an existing high temperature alarm is turned off. Add a sysfs entry for temp1_max_hyst, tied to the same register as temp1_min. Signed-off-by: Joshua Scott --- drivers/hwmon/lm73.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c index 9653bb8..b46a91a 100644 --- a/drivers/hwmon/lm73.c +++ b/drivers/hwmon/lm73.c @@ -170,6 +170,8 @@ abort: static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp, set_temp, LM73_REG_MAX); +static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, + show_temp, set_temp, LM73_REG_MIN); static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp, set_temp, LM73_REG_MIN); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, @@ -184,6 +186,7 @@ static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, static struct attribute *lm73_attrs[] = { &sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr, + &sensor_dev_attr_temp1_max_hyst.dev_attr.attr, &sensor_dev_attr_temp1_min.dev_attr.attr, &sensor_dev_attr_update_interval.dev_attr.attr, &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,