Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807847/?format=api
{ "id": 807847, "url": "http://patchwork.ozlabs.org/api/patches/807847/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20170830182100.9311-1-s.abhisit@gmail.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170830182100.9311-1-s.abhisit@gmail.com>", "list_archive_url": null, "date": "2017-08-30T18:21:00", "name": "[4/5] lmp92001: mfd: gpio: Add support LMP92001", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "da0d18d781d4a08ef6e62448656de0c0b820ee10", "submitter": { "id": 72084, "url": "http://patchwork.ozlabs.org/api/people/72084/?format=api", "name": null, "email": "s.abhisit@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20170830182100.9311-1-s.abhisit@gmail.com/mbox/", "series": [ { "id": 680, "url": "http://patchwork.ozlabs.org/api/series/680/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=680", "date": "2017-08-30T18:21:00", "name": null, "version": 1, "mbox": "http://patchwork.ozlabs.org/series/680/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807847/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807847/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-gpio-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-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"FQlSMBU9\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjDN53lBfz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 04:21:09 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752721AbdH3SVI (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 30 Aug 2017 14:21:08 -0400", "from mail-pg0-f67.google.com ([74.125.83.67]:35157 \"EHLO\n\tmail-pg0-f67.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752719AbdH3SVH (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Wed, 30 Aug 2017 14:21:07 -0400", "by mail-pg0-f67.google.com with SMTP id r133so5617653pgr.2;\n\tWed, 30 Aug 2017 11:21:07 -0700 (PDT)", "from localhost.localdomain ([2403:6200:8810:83fb::3])\n\tby smtp.gmail.com with ESMTPSA id\n\tp71sm11708854pfl.56.2017.08.30.11.21.02\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tWed, 30 Aug 2017 11:21:05 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=HyTR5OVbOmMdH66rVaEr7qW5JJvq5gu2JkbmDVMNo3g=;\n\tb=FQlSMBU9Ujdj34U4OCQQPpdwDGiRcSraThnrfzbsaXuTzlS+3hIbp/xuxIaXl4ClOS\n\t+qC9LlfRzUoH+EC8K9bZTF16xw7g5NJHHHP5a7/WZ5EVjP1QHm65Gg2NkRkGryNs5Zem\n\tEK1bjI6OIxNtD3VJpSRxd9VzCqq4xkmVbiZRwnFzfNOSWJNcmdNrbY6WOtAX8ec5HK69\n\t03ns3IrWC29o6M3wjJYr4QEgMHZaCcEcMOyRAfcu5CvEdWn8LtQvCq203J6TWX0kQQ5D\n\tMqNX97gtpyR/r0Ab6GFtictUDzKC+cz9uxcA/jKYkBDDy80c7INVJIJE2deV+fUO+HmK\n\tDmog==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=HyTR5OVbOmMdH66rVaEr7qW5JJvq5gu2JkbmDVMNo3g=;\n\tb=SzW9MtZNT1v6Zq6DKQncEn3DZZ1vx+h33O8ILykhZSUtNmpaHVT2o1yPgqJaYa5iC1\n\tbeubt1Q7aLIDxx9cMBgewjiagvi3LsJ8lpwNdPzNHqKVLhsriea5dXV1ZNXgzVGfQu2Q\n\txOh6w0JBxHMYOpqCsAG7TYfFaxwKbap2N2pgkwkxXpf1pWW7bXq8DwCzRGZLa7AhbpkC\n\tXnq80cIecFI9KPPjWLr2q0UKRxHamv8flAZHZyNFqGVAWWMYmWHPxcSb2eFoQxKcEOlj\n\tr8AgoS9dNyce5fBPlzT/GZQ5hRsi0ARoChT69SHd1YGaKCJwbqa5IQEgXEuGNJBZE1tG\n\t/NGQ==", "X-Gm-Message-State": "AHYfb5gx33kC3NFsCbyQ1+tttIpW8BODPi4nsrCYwhDW3z9sUOiQ9Zo7\n\tNXBQo4RIihK+Bg==", "X-Received": "by 10.98.248.2 with SMTP id d2mr2553674pfh.336.1504117266454;\n\tWed, 30 Aug 2017 11:21:06 -0700 (PDT)", "From": "s.abhisit@gmail.com", "To": "linus.walleij@linaro.org", "Cc": "linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n\tpmeerw@pmeerw.net, Jonathan.Cameron@huawei.com, jacopo@jmondi.org,\n\tlars@metafoo.de, Abhisit Sangjan <s.abhisit@gmail.com>", "Subject": "[PATCH 4/5] lmp92001: mfd: gpio: Add support LMP92001", "Date": "Thu, 31 Aug 2017 01:21:00 +0700", "Message-Id": "<20170830182100.9311-1-s.abhisit@gmail.com>", "X-Mailer": "git-send-email 2.13.0", "Sender": "linux-gpio-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-gpio.vger.kernel.org>", "X-Mailing-List": "linux-gpio@vger.kernel.org" }, "content": "From: Abhisit Sangjan <s.abhisit@gmail.com>\n\nTI LMP92001 Analog System Monitor and Controller\n\n8-bit GPIOs.\n12 DACs with 12-bit resolution.\n\nThe GPIOs and DACs are shared port function with Cy function pin to\ntake control the pin suddenly from external hardware.\nDAC's referance voltage selectable for Internal/External.\n\n16 + 1 ADCs with 12-bit resolution.\n\nBuilt-in internal Temperature Sensor on channel 17.\nWindow Comparator Function is supported on channel 1-3 and 9-11 for\nmonitoring with interrupt signal (pending to implement for interrupt).\nADC's referance voltage selectable for Internal/External.\n\nSigned-off-by: Abhisit Sangjan <s.abhisit@gmail.com>\n---\n drivers/gpio/Kconfig | 7 ++\n drivers/gpio/Makefile | 1 +\n drivers/gpio/gpio-lmp92001.c | 202 +++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 210 insertions(+)\n create mode 100644 drivers/gpio/gpio-lmp92001.c", "diff": "diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig\nindex 461d6fc3688b..5962ea0d6745 100644\n--- a/drivers/gpio/Kconfig\n+++ b/drivers/gpio/Kconfig\n@@ -948,6 +948,13 @@ config GPIO_KEMPLD\n \t This driver can also be built as a module. If so, the module will be\n \t called gpio-kempld.\n \n+config GPIO_LMP92001\n+ tristate \"LMP92001 GPIOs\"\n+ depends on MFD_LMP92001\n+ help\n+ Say yes here to access the GPIO signals of TI LMP92001 Analog System\n+ Monitor and Controller.\n+\n config GPIO_LP3943\n \ttristate \"TI/National Semiconductor LP3943 GPIO expander\"\n \tdepends on MFD_LP3943\ndiff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile\nindex a9fda6c55113..560d59c67758 100644\n--- a/drivers/gpio/Makefile\n+++ b/drivers/gpio/Makefile\n@@ -62,6 +62,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL)\t+= gpio-janz-ttl.o\n obj-$(CONFIG_GPIO_KEMPLD)\t+= gpio-kempld.o\n obj-$(CONFIG_ARCH_KS8695)\t+= gpio-ks8695.o\n obj-$(CONFIG_GPIO_INTEL_MID)\t+= gpio-intel-mid.o\n+obj-$(CONFIG_GPIO_LMP92001)\t+= gpio-lmp92001.o\n obj-$(CONFIG_GPIO_LOONGSON)\t+= gpio-loongson.o\n obj-$(CONFIG_GPIO_LP3943)\t+= gpio-lp3943.o\n obj-$(CONFIG_GPIO_LPC18XX)\t+= gpio-lpc18xx.o\ndiff --git a/drivers/gpio/gpio-lmp92001.c b/drivers/gpio/gpio-lmp92001.c\nnew file mode 100644\nindex 000000000000..4079e362e9b3\n--- /dev/null\n+++ b/drivers/gpio/gpio-lmp92001.c\n@@ -0,0 +1,202 @@\n+/*\n+ * gpio-lmp92001.c - Support for TI LMP92001 GPIOs\n+ *\n+ * Copyright 2016-2017 Celestica Ltd.\n+ *\n+ * Author: Abhisit Sangjan <s.abhisit@gmail.com>\n+ *\n+ * Inspired by wm831x driver.\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ */\n+\n+#include <linux/bitops.h>\n+#include <linux/gpio/driver.h>\n+#include <linux/kernel.h>\n+#include <linux/module.h>\n+\n+#include <linux/mfd/lmp92001/core.h>\n+\n+struct lmp92001_gpio {\n+\tstruct lmp92001 *lmp92001;\n+\tstruct gpio_chip gpio_chip;\n+};\n+\n+static int lmp92001_gpio_get_direction(struct gpio_chip *chip, unsigned offset)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\tunsigned int val;\n+\tint ret;\n+\n+\tret = regmap_read(lmp92001->regmap, LMP92001_CGPO, &val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\treturn !!(val & BIT(offset));\n+}\n+\n+static int lmp92001_gpio_direction_in(struct gpio_chip *chip, unsigned offset)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\n+\treturn regmap_update_bits(lmp92001->regmap, LMP92001_CGPO, BIT(offset),\n+\t\t\t\t\tBIT(offset));\n+}\n+\n+static int lmp92001_gpio_get(struct gpio_chip *chip, unsigned offset)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\tunsigned int val, sgen;\n+\n+\t/*\n+\t * Does the GPIO input mode?\n+\t * Does the GPIO set?\n+\t * Reading indicated logic level.\n+\t * Clear indicated logic level.\n+\t */\n+\tregmap_read(lmp92001->regmap, LMP92001_CGPO, &val);\n+\tif ((val >> offset) & BIT(0)) {\n+\t\tregmap_read(lmp92001->regmap, LMP92001_SGEN, &sgen);\n+\t\tif (sgen & SGEN_GPI) {\n+\t\t\tregmap_read(lmp92001->regmap, LMP92001_SGPI, &val);\n+\t\t\tregmap_update_bits(lmp92001->regmap, LMP92001_CGPO,\n+\t\t\t\t\t\t0xFF, val);\n+\t\t}\n+\t}\n+\n+\treturn !!(val & BIT(offset));\n+}\n+\n+static int lmp92001_gpio_direction_out(struct gpio_chip *chip, unsigned offset,\n+\tint value)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\n+\treturn regmap_update_bits(lmp92001->regmap, LMP92001_CGPO, BIT(offset),\n+\t\t\t\t\t0 /* 0 << offset */);\n+}\n+\n+static void lmp92001_gpio_set(struct gpio_chip *chip, unsigned offset,\n+\tint value)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\n+\tregmap_update_bits(lmp92001->regmap, LMP92001_CGPO, BIT(offset),\n+\t\t\t\tvalue << offset);\n+}\n+\n+#ifdef CONFIG_DEBUG_FS\n+static void lmp92001_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)\n+{\n+\tstruct lmp92001_gpio *lmp92001_gpio = gpiochip_get_data(chip);\n+\tstruct lmp92001 *lmp92001 = lmp92001_gpio->lmp92001;\n+\tint i, gpio;\n+\tunsigned int cgpo;\n+\tconst char *label, *dir, *logic;\n+\n+\tfor (i = 0; i < chip->ngpio; i++) {\n+\t\tgpio = i + chip->base;\n+\n+\t\tlabel = gpiochip_is_requested(chip, i);\n+\t\tif (!label)\n+\t\t\tcontinue;\n+\n+\t\tregmap_read(lmp92001->regmap, LMP92001_CGPO, &cgpo);\n+\t\tif ((cgpo >> i) & BIT(0))\n+\t\t\tdir = \"in\";\n+\t\telse\n+\t\t\tdir = \"out\";\n+\n+\t\tif (lmp92001_gpio_get(chip, i))\n+\t\t\tlogic = \"hi\";\n+\t\telse\n+\t\t\tlogic = \"lo\";\n+\n+\t\tseq_printf(s, \" gpio-%-3d (%-20.20s) %-3.3s %-2.2s\\n\",\n+\t\t\t\tgpio, label, dir, logic);\n+\t}\n+}\n+#else\n+#define lmp92001_gpio_dbg_show NULL\n+#endif\n+\n+static struct gpio_chip lmp92001_gpio_chip = {\n+\t.label\t\t\t= \"lmp92001\",\n+\t.owner\t\t\t= THIS_MODULE,\n+\t.get_direction\t\t= lmp92001_gpio_get_direction,\n+\t.direction_input\t= lmp92001_gpio_direction_in,\n+\t.get\t\t\t= lmp92001_gpio_get,\n+\t.direction_output\t= lmp92001_gpio_direction_out,\n+\t.set\t\t\t= lmp92001_gpio_set,\n+\t.dbg_show\t\t= lmp92001_gpio_dbg_show,\n+};\n+\n+static int lmp92001_gpio_probe(struct platform_device *pdev)\n+{\n+\tstruct lmp92001 *lmp92001 = dev_get_drvdata(pdev->dev.parent);\n+\tstruct lmp92001_gpio *lmp92001_gpio;\n+\tint ret;\n+\n+\tlmp92001_gpio = devm_kzalloc(&pdev->dev, sizeof(*lmp92001_gpio),\n+\t\t\t\t\tGFP_KERNEL);\n+\tif (!lmp92001_gpio)\n+\t\treturn -ENOMEM;\n+\n+\tlmp92001_gpio->lmp92001 = lmp92001;\n+\tlmp92001_gpio->gpio_chip = lmp92001_gpio_chip;\n+\tlmp92001_gpio->gpio_chip.ngpio = 8;\n+\tlmp92001_gpio->gpio_chip.parent = &pdev->dev;\n+\tlmp92001_gpio->gpio_chip.base = -1;\n+\n+\tret = devm_gpiochip_add_data(&pdev->dev, &lmp92001_gpio->gpio_chip,\n+\t\t\t\t\tlmp92001_gpio);\n+\tif (ret < 0) {\n+\t\tdev_err(&pdev->dev, \"could not register gpiochip, %d\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\tplatform_set_drvdata(pdev, lmp92001_gpio);\n+\n+\treturn ret;\n+}\n+\n+static int lmp92001_gpio_remove(struct platform_device *pdev)\n+{\n+\treturn 0;\n+}\n+\n+static struct platform_driver lmp92001_gpio_driver = {\n+\t.driver.name\t= \"lmp92001-gpio\",\n+\t.probe\t\t= lmp92001_gpio_probe,\n+\t.remove\t\t= lmp92001_gpio_remove,\n+};\n+\n+static int __init lmp92001_gpio_init(void)\n+{\n+\treturn platform_driver_register(&lmp92001_gpio_driver);\n+}\n+subsys_initcall(lmp92001_gpio_init);\n+\n+static void __exit lmp92001_gpio_exit(void)\n+{\n+\tplatform_driver_unregister(&lmp92001_gpio_driver);\n+}\n+module_exit(lmp92001_gpio_exit);\n+\n+MODULE_AUTHOR(\"Abhisit Sangjan <s.abhisit@gmail.com>\");\n+MODULE_DESCRIPTION(\"GPIO interface for TI LMP92001\");\n+MODULE_LICENSE(\"GPL\");\n+MODULE_ALIAS(\"platform:lmp92001-gpio\");\n", "prefixes": [ "4/5" ] }