From patchwork Mon Jan 28 21:06:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10784791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE3401390 for ; Mon, 28 Jan 2019 21:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC78C2BBF2 for ; Mon, 28 Jan 2019 21:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A081E2BC10; Mon, 28 Jan 2019 21:06:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 435072BBF2 for ; Mon, 28 Jan 2019 21:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbfA1VGw (ORCPT ); Mon, 28 Jan 2019 16:06:52 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:35055 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbfA1VGv (ORCPT ); Mon, 28 Jan 2019 16:06:51 -0500 Received: by mail-lj1-f195.google.com with SMTP id x85-v6so15577834ljb.2 for ; Mon, 28 Jan 2019 13:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=j4/teC/9Qj54C/ORjUYkAMrw0bVEH0/K0MoNfCdsOp8=; b=MMbZj+E86sYVbn38wtyn4X515VWyzisAqqyGZoMzKHh5J5Ap/rjW/Eay05/kop9kYD jkb9Y9k/99GphXwF/RK0xA9FsqwEamOv0LaugYAXABgTQ3yCIOa9qUGYt4YB6nylvaCW wzZ3OZNC9mfedBZeCtKilM0bZKro401g9bwo0= 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:mime-version :content-transfer-encoding; bh=j4/teC/9Qj54C/ORjUYkAMrw0bVEH0/K0MoNfCdsOp8=; b=q7ldM3gQgSx9wFqIzuKMj30zP/TpUD2wVRxsf0+1K/ZcJyajFShQQvvN3ICcc0NbeO bqz2b17mBsdFUjl2/VjBzE1Z9WmNGMANGx3bnZqMrELLgW5v9XGqxUXkmHKZ6z9+iycj 6+pSGYrQu/GwF/WBdCWuXlkExrijNI8hwUE2RMHw9o73tqvep7ifQYKk3+q8/q6ZNo/+ 7qvEf+LsYVfgve/1yoQWtJf6xy6WzbvtMW5PkOVl3nrFrXR/hjOWyELo7o0UbzQbDm+W 1TaIP6Qc0qm6P5c7a8+vNBWVPVOMV3DVWegCHUO38tF1bnBkPBDIQE6xNMZSShUVtWv0 0hLA== X-Gm-Message-State: AHQUAua7Jz6PZW/iY9JHvqOapBIPHScKBVVfIArQa9LostARuRCil91O mt/YwFAB8pgYnIpZa3dlmIh29g== X-Google-Smtp-Source: AHgI3IaEc5hPrycJ6rWSnu8i4FMjB+VYxfJssLwy07NSQ4bFh6k7cokc4DtLw3bwuJj4bPCJdG/wAw== X-Received: by 2002:a2e:1603:: with SMTP id w3-v6mr24219ljd.33.1548709609644; Mon, 28 Jan 2019 13:06:49 -0800 (PST) Received: from linux.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id u15-v6sm3555755lja.63.2019.01.28.13.06.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 13:06:48 -0800 (PST) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Linus Walleij , devicetree@vger.kernel.org Subject: [PATCH 1/2] hwmon: (ad741x) Add DT bindings for Analog Devices AD741x Date: Mon, 28 Jan 2019 22:06:36 +0100 Message-Id: <20190128210637.22323-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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 This adds device tree bindings for Analog Devices AD741x as found in Gateway routers. Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- .../devicetree/bindings/hwmon/ad741x.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/ad741x.txt diff --git a/Documentation/devicetree/bindings/hwmon/ad741x.txt b/Documentation/devicetree/bindings/hwmon/ad741x.txt new file mode 100644 index 000000000000..9102152c8410 --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/ad741x.txt @@ -0,0 +1,15 @@ +* AD7416/AD7417/AD7418 Temperature Sensor Device Tree Bindings + +Required properties: +- compatible: one of + "adi,ad7416" + "adi,ad7417" + "adi,ad7418" +- reg: I2C address + +Example: + +hwmon@28 { + compatible = "adi,ad7418"; + reg = <0x28>; +}; From patchwork Mon Jan 28 21:06:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10784793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA9FE13BF for ; Mon, 28 Jan 2019 21:06:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E572BBF2 for ; Mon, 28 Jan 2019 21:06:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CC102BC10; Mon, 28 Jan 2019 21:06:55 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 6560C2BBF2 for ; Mon, 28 Jan 2019 21:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726984AbfA1VGy (ORCPT ); Mon, 28 Jan 2019 16:06:54 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39553 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbfA1VGy (ORCPT ); Mon, 28 Jan 2019 16:06:54 -0500 Received: by mail-lj1-f194.google.com with SMTP id t9-v6so15536763ljh.6 for ; Mon, 28 Jan 2019 13:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2s0QdAjCyelsZpr2rXLqe0hcE59BfEPoAUYu8ZDlATU=; b=AbiyOulbGtn9LFILGzixPibwLb5ApbAq11MvjkOvGjUhCL8oWWRyWTXf+9DjBpAVR3 l+Cb+2MzLKutpqS/bCPk/PahAuPjKfyzMfbSEWti0Hzem/Ynyoqz1wOijXAEMLytFALN S3Xqc4zymb7QjGZWra+Bn5g9P2W0SZbV6sYB4= 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:mime-version:content-transfer-encoding; bh=2s0QdAjCyelsZpr2rXLqe0hcE59BfEPoAUYu8ZDlATU=; b=ClVU/Dc5wzSlKzAAtRV5+Oa3BhDpnKfnucy2XLwixacNAMTDYsWatirWYVXu0KlzG/ CB3i6z00oxnbjuVv2qCMSzatBVP1ltlRqzs3QSTK0PfCB9v8mP/hH4pW19zIQv2sDjLJ 0Z7kFm9jo7MqdD+fLl8TxZeIh2ER+x8rBnplTo13b3YATjaqoSuaRoOSGwA4BJbdrugF m5FOthX8u12k9s4v6Bv+AkFBRvIy9YtginPSVCd0miswNYXxeAQco0CQv4EbxyaMZUwY cWZhZ0bzb+I2GGrT0w9l43PRiMvYPiin40i8YckEgPh3M+aId9fFgkb8ZLT8p7LQf9hD sQcw== X-Gm-Message-State: AJcUukfygJdOh7XuU10WSgiD4fFHvIEl9WWe4RNeg/F6Q7atriRX8OAA ewn8oT5qR9HPgvSqbwE1I7J/Qg== X-Google-Smtp-Source: ALg8bN5nUFNWERQTD3+hRF1+539yroJ9ydVLlJ41Pmrh5mvIEwKzbMMYvShq4QH+7JW4kVEbpIXDJw== X-Received: by 2002:a2e:8596:: with SMTP id b22-v6mr18520620lji.122.1548709611837; Mon, 28 Jan 2019 13:06:51 -0800 (PST) Received: from linux.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id u15-v6sm3555755lja.63.2019.01.28.13.06.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 13:06:50 -0800 (PST) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Linus Walleij Subject: [PATCH 2/2] hwmon: (ad7418) Add device tree probing Date: Mon, 28 Jan 2019 22:06:37 +0100 Message-Id: <20190128210637.22323-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128210637.22323-1-linus.walleij@linaro.org> References: <20190128210637.22323-1-linus.walleij@linaro.org> MIME-Version: 1.0 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 This adds device tree probing for the AD7418 hwmon sensor. When device tree is not enabled, stub functions will kick in. Tested on the Gateway Cambria GW2358-4. Signed-off-by: Linus Walleij --- drivers/hwmon/ad7418.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/ad7418.c b/drivers/hwmon/ad7418.c index 76f0a5c01e8a..ec0f5d8f18c3 100644 --- a/drivers/hwmon/ad7418.c +++ b/drivers/hwmon/ad7418.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -220,7 +221,10 @@ static int ad7418_probe(struct i2c_client *client, mutex_init(&data->lock); data->client = client; - data->type = id->driver_data; + if (dev->of_node) + data->type = (enum chips)of_device_get_match_data(dev); + else + data->type = id->driver_data; switch (data->type) { case ad7416: @@ -258,9 +262,17 @@ static const struct i2c_device_id ad7418_id[] = { }; MODULE_DEVICE_TABLE(i2c, ad7418_id); +static const struct of_device_id ad7418_dt_ids[] = { + { .compatible = "adi,ad7416", .data = (void *)ad7416, }, + { .compatible = "adi,ad7417", .data = (void *)ad7417, }, + { .compatible = "adi,ad7418", .data = (void *)ad7418, }, +}; +MODULE_DEVICE_TABLE(of, ad7418_dt_ids); + static struct i2c_driver ad7418_driver = { .driver = { .name = "ad7418", + .of_match_table = ad7418_dt_ids, }, .probe = ad7418_probe, .id_table = ad7418_id,