Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/793168/?format=api
{ "id": 793168, "url": "http://patchwork.ozlabs.org/api/patches/793168/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/1500954024-6860-4-git-send-email-preid@electromag.com.au/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "name": "Linux I2C development", "link_name": "linux-i2c", "list_id": "linux-i2c.vger.kernel.org", "list_email": "linux-i2c@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1500954024-6860-4-git-send-email-preid@electromag.com.au>", "list_archive_url": null, "date": "2017-07-25T03:40:17", "name": "[v10,03/10] i2c: i2c-smbus: add of_i2c_setup_smbus_alert", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "bc0e1f72b3da6010b95d61aa1764af797f8bf8f3", "submitter": { "id": 66145, "url": "http://patchwork.ozlabs.org/api/people/66145/?format=api", "name": "Phil Reid", "email": "preid@electromag.com.au" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/1500954024-6860-4-git-send-email-preid@electromag.com.au/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/793168/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/793168/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-i2c-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xGkXx1rYLz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 25 Jul 2017 13:40:49 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753620AbdGYDkk (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 24 Jul 2017 23:40:40 -0400", "from anchovy1.45ru.net.au ([203.30.46.145]:36545 \"EHLO\n\tanchovy.45ru.net.au\" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1754326AbdGYDkf (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Mon, 24 Jul 2017 23:40:35 -0400", "(qmail 7142 invoked by uid 5089); 25 Jul 2017 03:40:33 -0000", "by simscan 1.2.0 ppid: 7038, pid: 7042, t: 0.0397s\n\tscanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950", "from unknown (HELO preid-centos7.electromag.com.au)\n\t(preid@electromag.com.au@203.59.230.133)\n\tby anchovy1.45ru.net.au with ESMTPA; 25 Jul 2017 03:40:32 -0000", "by preid-centos7.electromag.com.au (Postfix, from userid 1000)\n\tid 83CBD30001823; Tue, 25 Jul 2017 11:40:29 +0800 (AWST)" ], "X-RBL": "$rbltext", "From": "Phil Reid <preid@electromag.com.au>", "To": "wsa@the-dreams.de, robh+dt@kernel.org, mark.rutland@arm.com,\n\tsre@kernel.org, jdelvare@suse.com, jglauber@cavium.com,\n\tdavid.daney@cavium.com, peda@axentia.se, preid@electromag.com.au,\n\tbenjamin.tissoires@redhat.com, linux-i2c@vger.kernel.org,\n\tdevicetree@vger.kernel.org, linux-pm@vger.kernel.org", "Subject": "[PATCH v10 03/10] i2c: i2c-smbus: add of_i2c_setup_smbus_alert", "Date": "Tue, 25 Jul 2017 11:40:17 +0800", "Message-Id": "<1500954024-6860-4-git-send-email-preid@electromag.com.au>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1500954024-6860-1-git-send-email-preid@electromag.com.au>", "References": "<1500954024-6860-1-git-send-email-preid@electromag.com.au>", "Sender": "linux-i2c-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-i2c.vger.kernel.org>", "X-Mailing-List": "linux-i2c@vger.kernel.org" }, "content": "This commit adds of_i2c_setup_smbus_alert which allows the smbalert\ndriver to be attached to an i2c adapter via the device tree.\n\nSigned-off-by: Phil Reid <preid@electromag.com.au>\nAcked-by: Rob Herring <robh@kernel.org>\n---\n Documentation/devicetree/bindings/i2c/i2c.txt | 4 ++--\n drivers/i2c/i2c-core-smbus.c | 22 ++++++++++++++++++++++\n drivers/i2c/i2c-smbus.c | 10 +++++++++-\n include/linux/i2c-smbus.h | 9 +++++++++\n 4 files changed, 42 insertions(+), 3 deletions(-)", "diff": "diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt\nindex cee9d50..1126398 100644\n--- a/Documentation/devicetree/bindings/i2c/i2c.txt\n+++ b/Documentation/devicetree/bindings/i2c/i2c.txt\n@@ -59,8 +59,8 @@ wants to support one of the below features, it should adapt the bindings below.\n \tinterrupts used by the device.\n \n - interrupt-names\n-\t\"irq\" and \"wakeup\" names are recognized by I2C core, other names are\n-\tleft to individual drivers.\n+\t\"irq\", \"wakeup\" and \"smbus_alert\" names are recognized by I2C core,\n+\tother names are\tleft to individual drivers.\n \n - host-notify\n \tdevice uses SMBus host notify protocol instead of interrupt line.\ndiff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c\nindex 7f3ec02..4bb9927 100644\n--- a/drivers/i2c/i2c-core-smbus.c\n+++ b/drivers/i2c/i2c-core-smbus.c\n@@ -625,3 +625,25 @@ struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,\n \treturn i2c_new_device(adapter, &ara_board_info);\n }\n EXPORT_SYMBOL_GPL(i2c_setup_smbus_alert);\n+\n+#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF)\n+int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter)\n+{\n+\tstruct i2c_client *client;\n+\tint irq;\n+\n+\tirq = of_property_match_string(adapter->dev.of_node, \"interrupt-names\",\n+\t\t\t\t \"smbus_alert\");\n+\tif (irq == -EINVAL || irq == -ENODATA)\n+\t\treturn 0;\n+\telse if (irq < 0)\n+\t\treturn irq;\n+\n+\tclient = i2c_setup_smbus_alert(adapter, NULL);\n+\tif (!client)\n+\t\treturn -ENODEV;\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(of_i2c_setup_smbus_alert);\n+#endif\ndiff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c\nindex d0bb035..5a1dd7f 100644\n--- a/drivers/i2c/i2c-smbus.c\n+++ b/drivers/i2c/i2c-smbus.c\n@@ -21,6 +21,7 @@\n #include <linux/interrupt.h>\n #include <linux/kernel.h>\n #include <linux/module.h>\n+#include <linux/of_irq.h>\n #include <linux/slab.h>\n #include <linux/workqueue.h>\n \n@@ -139,7 +140,14 @@ static int smbalert_probe(struct i2c_client *ara,\n \tif (!alert)\n \t\treturn -ENOMEM;\n \n-\tirq = setup->irq;\n+\tif (setup) {\n+\t\tirq = setup->irq;\n+\t} else {\n+\t\tirq = of_irq_get_byname(adapter->dev.of_node, \"smbus_alert\");\n+\t\tif (irq <= 0)\n+\t\t\treturn irq;\n+\t}\n+\n \tINIT_WORK(&alert->alert, smbalert_work);\n \talert->ara = ara;\n \ndiff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h\nindex 19efbd1..fb0e040 100644\n--- a/include/linux/i2c-smbus.h\n+++ b/include/linux/i2c-smbus.h\n@@ -49,4 +49,13 @@ struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,\n \t\t\t\t\t struct i2c_smbus_alert_setup *setup);\n int i2c_handle_smbus_alert(struct i2c_client *ara);\n \n+#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF)\n+int of_i2c_setup_smbus_alert(struct i2c_adapter *adap);\n+#else\n+static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap)\n+{\n+\treturn 0;\n+}\n+#endif\n+\n #endif /* _LINUX_I2C_SMBUS_H */\n", "prefixes": [ "v10", "03/10" ] }