Path: csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod From: Florian Fainelli Newsgroups: linux.kernel Subject: [PATCH 2/2] hwmon: (lm70) Add support for TI TMP122/124 Date: Sat, 21 Jan 2017 20:30:01 +0100 Message-ID: References: Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eGL6+UPsuvmD6066LDCfAxfB1AK2woI90Kyv+Po7w2E=; b=CEHU+qe5Pa3Z+VBZpjdPjEotEOEZ6bCxf97Vn9p+yqL9jGl2rLYhkTMUh2L5yct9df fOpH29Ce4T+X1Qqb5hcBp6NpTPh+4CkOsL6c7NB46guxRZfO6RymXXhdBFjxMjOIuceJ 12hCOkyAuZSwggrIuqnrCD0D4gQFefca7Mp5b44ZJRpJ+r8U5YoO/H+BJMwbdhYu0eid p/wLGkf7qU2NDxH5rBaoJ7C9ZcT1tWAlxHUY+8lraGldxKhy5sY59pL6zA2FgFaQPWes SwMQwt6pSiqOSctU5sLw1bqq5PFkCsndDEfD6NAPmqe19TfaBIAclZUSjRDoGC/iup/y B5qA== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eGL6+UPsuvmD6066LDCfAxfB1AK2woI90Kyv+Po7w2E=; b=Ds2uiyEIBI+Ntwg0ERkKzQHruzwDOpIkk7J7kqXVX9EKFEE2EfUfr00KUh9fQ9wGn/ emp/oPkGaUzaUQjTg8y3ypAHkJJ/I9PlH5eGXLHSsd2fLAXn9YQ7QKQuDiTvImapvV6a /USEhg5nO45KYvgUq/fhEPm8KE1nWd0KIsDy92EWu4KXGlfweePmlDaAaaAuV8pAj9vp 4MihhJ962xQG78Z/AXDmNOsuku49PHzerks5IRzGf1G/HEsnlsS7vNMsNoEzGgdMauBU 7eiu8fq6ytYO3eP5ilJnZfFJ2jT9ZbMh0elsSS/f+y9C3DlVWIvzmd4zK1o2hMa1a71V t1Ow== X-Gm-Message-State: AIkVDXJcfDt/cpSNMl+cblNR/PnoeKNP/0/zb2FynRpyPf2U8uRXTITKnZ4H2yKY3DBqKw== X-Received: by 10.55.72.210 with SMTP id v201mr17538230qka.145.1485026430135; Sat, 21 Jan 2017 11:20:30 -0800 (PST) X-Mailer: git-send-email 2.9.3 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 99 Organization: linux.* mail to news gateway X-Original-Cc: Florian Fainelli , Rob Herring , Mark Rutland , Jean Delvare , Guenter Roeck , Jonathan Corbet , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING), linux-doc@vger.kernel.org (open list:DOCUMENTATION) X-Original-Date: Sat, 21 Jan 2017 11:20:10 -0800 X-Original-Message-ID: <20170121192010.30681-3-f.fainelli@gmail.com> X-Original-References: <20170121192010.30681-1-f.fainelli@gmail.com> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1564222 Add support for Texas Instruments TMP122/124 which are nearly identical to their TMP121/123 except that they also support programmable temperature thresholds. Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/hwmon/lm70.txt | 1 + Documentation/hwmon/lm70 | 8 ++++++-- drivers/hwmon/lm70.c | 9 ++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/hwmon/lm70.txt b/Documentation/devicetree/bindings/hwmon/lm70.txt index e7fd921aa4f1..ea417a0d32af 100644 --- a/Documentation/devicetree/bindings/hwmon/lm70.txt +++ b/Documentation/devicetree/bindings/hwmon/lm70.txt @@ -4,6 +4,7 @@ Required properties: - compatible: one of "ti,lm70" "ti,tmp121" + "ti,tmp122" "ti,lm71" "ti,lm74" diff --git a/Documentation/hwmon/lm70 b/Documentation/hwmon/lm70 index 1bb2db440671..c3a1f2ea017d 100644 --- a/Documentation/hwmon/lm70 +++ b/Documentation/hwmon/lm70 @@ -6,6 +6,8 @@ Supported chips: Datasheet: http://www.national.com/pf/LM/LM70.html * Texas Instruments TMP121/TMP123 Information: http://focus.ti.com/docs/prod/folders/print/tmp121.html + * Texas Instruments TMP122/TMP124 + Information: http://www.ti.com/product/tmp122 * National Semiconductor LM71 Datasheet: http://www.ti.com/product/LM71 * National Semiconductor LM74 @@ -35,8 +37,10 @@ As a real (in-tree) example of this "SPI protocol driver" interfacing with a "SPI master controller driver", see drivers/spi/spi_lm70llp.c and its associated documentation. -The LM74 and TMP121/TMP123 are very similar; main difference is 13-bit -temperature data (0.0625 degrees celsius resolution). +The LM74 and TMP121/TMP122/TMP123/TMP124 are very similar; main difference is +13-bit temperature data (0.0625 degrees celsius resolution). + +The TMP122/TMP124 also feature configurable temperature thresholds. The LM71 is also very similar; main difference is 14-bit temperature data (0.03125 degrees celsius resolution). diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index 52c5cdd00448..543556dc563b 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c @@ -46,6 +46,7 @@ #define LM70_CHIP_TMP121 1 /* TI TMP121/TMP123 */ #define LM70_CHIP_LM71 2 /* NS LM71 */ #define LM70_CHIP_LM74 3 /* NS LM74 */ +#define LM70_CHIP_TMP122 4 /* TI TMP122/TMP124 */ struct lm70 { struct spi_device *spi; @@ -92,7 +93,7 @@ static ssize_t temp1_input_show(struct device *dev, * Celsius. * So it's equivalent to multiplying by 0.25 * 1000 = 250. * - * LM74 and TMP121/TMP123: + * LM74 and TMP121/TMP122/TMP123/TMP124: * 13 bits of 2's complement data, discard LSB 3 bits, * resolution 0.0625 degrees celsius. * @@ -106,6 +107,7 @@ static ssize_t temp1_input_show(struct device *dev, break; case LM70_CHIP_TMP121: + case LM70_CHIP_TMP122: case LM70_CHIP_LM74: val = ((int)raw / 8) * 625 / 10; break; @@ -143,6 +145,10 @@ static const struct of_device_id lm70_of_ids[] = { .data = (void *) LM70_CHIP_TMP121, }, { + .compatible = "ti,tmp122", + .data = (void *) LM70_CHIP_TMP122, + }, + { .compatible = "ti,lm71", .data = (void *) LM70_CHIP_LM71, }, @@ -191,6 +197,7 @@ static int lm70_probe(struct spi_device *spi) static const struct spi_device_id lm70_ids[] = { { "lm70", LM70_CHIP_LM70 }, { "tmp121", LM70_CHIP_TMP121 }, + { "tmp122", LM70_CHIP_TMP122 }, { "lm71", LM70_CHIP_LM71 }, { "lm74", LM70_CHIP_LM74 }, { }, -- 2.9.3