From patchwork Thu Jan 22 07:09:20 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: 431686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0D0B01402A1 for ; Thu, 22 Jan 2015 18:10:08 +1100 (AEDT) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id E07CE1A0E3E for ; Thu, 22 Jan 2015 18:10:07 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e06smtp16.uk.ibm.com (e06smtp16.uk.ibm.com [195.75.94.112]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 1660E1A0E3D for ; Thu, 22 Jan 2015 18:09:48 +1100 (AEDT) Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Jan 2015 07:09:45 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Jan 2015 07:09:43 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 50C4217D805A for ; Thu, 22 Jan 2015 07:09:45 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0M79gAv56950808 for ; Thu, 22 Jan 2015 07:09:42 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0M79gGx007480 for ; Thu, 22 Jan 2015 00:09:42 -0700 Received: from hermes.kaod.org (sig-9-84-94-176.evts.de.ibm.com [9.84.94.176]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t0M79b8I007346; Thu, 22 Jan 2015 00:09:42 -0700 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: skiboot@lists.ozlabs.org Date: Thu, 22 Jan 2015 08:09:20 +0100 Message-Id: <1421910562-18973-8-git-send-email-clg@fr.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1421910562-18973-1-git-send-email-clg@fr.ibm.com> References: <1421910562-18973-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: 15012207-0025-0000-0000-0000038380C5 Subject: [Skiboot] [RFC PATCH v2 7/9] 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 | 1 + hw/fsp/fsp-sensor.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/hw/dts.c b/hw/dts.c index 4590d0dba7b6..7fc4ce45fa2b 100644 --- a/hw/dts.c +++ b/hw/dts.c @@ -201,6 +201,7 @@ bool dts_sensor_create_nodes(void) dt_add_property_string(node, "compatible", "ibm,opal-sensor"); dt_add_property_cells(node, "sensor-data", handler); + dt_add_property_string(node, "sensor-type", "temp"); } } diff --git a/hw/fsp/fsp-sensor.c b/hw/fsp/fsp-sensor.c index c08e79dae6b3..27fcb2d57a4a 100644 --- a/hw/fsp/fsp-sensor.c +++ b/hw/fsp/fsp-sensor.c @@ -635,6 +635,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) { @@ -661,6 +672,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; }