From patchwork Thu Feb 5 06:30:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 436632 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A899914027C for ; Thu, 5 Feb 2015 17:31:47 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 8D9331A0CE4 for ; Thu, 5 Feb 2015 17:31:47 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id AB29D1A0C18 for ; Thu, 5 Feb 2015 17:31:30 +1100 (AEDT) Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Feb 2015 06:31:27 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Feb 2015 06:31:26 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id EC6E01B0805F for ; Thu, 5 Feb 2015 06:31:32 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t156VPJW9437606 for ; Thu, 5 Feb 2015 06:31:25 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t156VPs4022154 for ; Wed, 4 Feb 2015 23:31:25 -0700 Received: from hermes.kaod.org (sig-9-79-46-126.de.ibm.com [9.79.46.126]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t156VLD8022052; Wed, 4 Feb 2015 23:31:24 -0700 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: skiboot@lists.ozlabs.org Date: Thu, 5 Feb 2015 07:30:55 +0100 Message-Id: <1423117857-32759-8-git-send-email-clg@fr.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1423117857-32759-1-git-send-email-clg@fr.ibm.com> References: <1423117857-32759-1-git-send-email-clg@fr.ibm.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15020506-0021-0000-0000-000002CC2865 Subject: [Skiboot] [PATCH 07/11] sensor: add a type property X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The hwmon framework in Linux needs a type for the sensors it exposes in userspace through the sysfs interface. This patch gives Linux a hand on what is dealing with when parsing the sensor device tree. Signed-off-by: Cédric Le Goater --- hw/dts.c | 2 +- hw/fsp/fsp-sensor.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/dts.c b/hw/dts.c index b5498d95924b..46391cdbedcc 100644 --- a/hw/dts.c +++ b/hw/dts.c @@ -220,7 +220,7 @@ bool dts_sensor_create_nodes(void) handler = sensor_make_handler(sensor_class, c->pir, SENSOR_DTS_ATTR_TEMP_TRIP); dt_add_property_cells(node, "sensor-status", handler); - + dt_add_property_string(node, "sensor-type", "temp"); } } diff --git a/hw/fsp/fsp-sensor.c b/hw/fsp/fsp-sensor.c index 90bed4e90922..13fd5cdeb5d1 100644 --- a/hw/fsp/fsp-sensor.c +++ b/hw/fsp/fsp-sensor.c @@ -636,6 +636,17 @@ out: #define MAX_NAME 64 +static const char *convert_frc_to_sensor_type(int frc) +{ + switch (frc) { + case SENSOR_FRC_POWER_SUPPLY: return "power"; + case SENSOR_FRC_COOLING_FAN: return "fan"; + case SENSOR_FRC_AMB_TEMP: return "temp"; + default: + return ""; + } +} + static struct dt_node *sensor_get_node(struct dt_node *sensors, struct sensor_header *header) { @@ -662,6 +673,8 @@ static struct dt_node *sensor_get_node(struct dt_node *sensors, node = dt_new(sensors, name); dt_add_property_string(node, "compatible", "ibm,opal-sensor"); + dt_add_property_string(node, "sensor-type", + convert_frc_to_sensor_type(header->frc)); } return node; }