Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814420/?format=api
{ "id": 814420, "url": "http://patchwork.ozlabs.org/api/patches/814420/?format=api", "web_url": "http://patchwork.ozlabs.org/project/devicetree-bindings/patch/20170915233113.17855-5-fancer.lancer@gmail.com/", "project": { "id": 37, "url": "http://patchwork.ozlabs.org/api/projects/37/?format=api", "name": "Devicetree Bindings", "link_name": "devicetree-bindings", "list_id": "devicetree.vger.kernel.org", "list_email": "devicetree@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170915233113.17855-5-fancer.lancer@gmail.com>", "list_archive_url": null, "date": "2017-09-15T23:31:12", "name": "[4/5] usb: usb251xb: Use GPIO descriptor consumer interface", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "0727b46a6e3b45a0b7a0f5fd81c6b2cc13e6b52d", "submitter": { "id": 70038, "url": "http://patchwork.ozlabs.org/api/people/70038/?format=api", "name": "Serge Semin", "email": "fancer.lancer@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/devicetree-bindings/patch/20170915233113.17855-5-fancer.lancer@gmail.com/mbox/", "series": [ { "id": 3398, "url": "http://patchwork.ozlabs.org/api/series/3398/?format=api", "web_url": "http://patchwork.ozlabs.org/project/devicetree-bindings/list/?series=3398", "date": "2017-09-15T23:31:08", "name": "usb: usb251xb: Add USB2517i hub support and fix some bugs", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3398/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814420/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814420/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<devicetree-owner@vger.kernel.org>", "X-Original-To": "incoming-dt@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<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=\"Q55km1fS\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xvBWm4hrtz9sPk\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 09:32:20 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751685AbdIOXbe (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tFri, 15 Sep 2017 19:31:34 -0400", "from mail-lf0-f67.google.com ([209.85.215.67]:35857 \"EHLO\n\tmail-lf0-f67.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751640AbdIOXb3 (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Fri, 15 Sep 2017 19:31:29 -0400", "by mail-lf0-f67.google.com with SMTP id l196so1871663lfl.3;\n\tFri, 15 Sep 2017 16:31:28 -0700 (PDT)", "from linux.local ([95.79.181.62]) by smtp.gmail.com with ESMTPSA id\n\tb75sm351841lff.38.2017.09.15.16.31.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 15 Sep 2017 16:31:27 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=A558lpq5QYVIHoagRuYfadKz8XVENmBwY1h1ZaK4f5g=;\n\tb=Q55km1fSQvF5nWM4OqyvjNL4uMdgffPSEY6kHlYSCmOyUWV4NyNgiowBsIWPjRlE4N\n\tkDzOlYWNkEh+71Hh+V9nERegr2Im9NIFKyaREg9X+PAPnCqQsNvo9EHKTRb7v8EDcb4t\n\tlPbo7NiRVfTpgMXJIFDcjs8NNKYWchVTUk1sPBPahCKgOGJwv1UDPbHSYTmbqTN3hcF9\n\tj9EwQP/O+zNRwyFafPHBSw836vA+FNKpHQguam99M08qYjUfDDWgvDrEyw8+1DaItV7K\n\tGA81cBucbbkQ4TLVjTDpMlxDoG52jlF72/FVQKAfuT+oUHAmB4sZVWoENP1PG1H7Pgzw\n\tMlXA==", "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:in-reply-to\n\t:references;\n\tbh=A558lpq5QYVIHoagRuYfadKz8XVENmBwY1h1ZaK4f5g=;\n\tb=mf0rnxovoBr2fxTlSDGBLdVjuJ+YEv/OVLX/PSK4QrGf72uyre/vS0nc/iiCV/Y+pJ\n\tjPW4NzYck/zft/OOAwI5BSBWgqeERK2/38qt3InpmGhalJRlmkvvS+DmzbZQdLFCMRdE\n\tS3VYTLBZ/y54JJJHr3jk5XloT0Pyg4jH/+W8CQgAbzT3JgwAkC68WPaPP9pPRKkdIzuf\n\taZKC1y5Pc00rwQJ+t//TXEMcuOMIcC3mGDTnQcyfFh2bkVWG6fTrVdO3X69Y5o9FCSCV\n\tl/Vudhzhtfg8aFJo69BE5YmTkdHDKZfOE43KWJu2GUR9eAlq9TYxEZEv3rUbjNZRNMLW\n\th0oA==", "X-Gm-Message-State": "AHPjjUjSej54lwCjb7kknZb5xJlq+HXfXVIQgaQpx300Y1S9W+EO/Ljt\n\thZPMiX/MTAurYQ==", "X-Google-Smtp-Source": "AOwi7QDGOZdFpFfXVe7exAvry/uw9URJqSvgfZKCb96yUXNyNAAA9689ijC+sWMMHQVbVGw1zEh+EQ==", "X-Received": "by 10.46.34.195 with SMTP id i186mr4444437lji.139.1505518287859; \n\tFri, 15 Sep 2017 16:31:27 -0700 (PDT)", "From": "Serge Semin <fancer.lancer@gmail.com>", "To": "richard.leitner@skidata.com, gregkh@linuxfoundation.org,\n\trobh+dt@kernel.org, mark.rutland@arm.com", "Cc": "Sergey.Semin@t-platforms.ru, linux-usb@vger.kernel.org,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tSerge Semin <fancer.lancer@gmail.com>", "Subject": "[PATCH 4/5] usb: usb251xb: Use GPIO descriptor consumer interface", "Date": "Sat, 16 Sep 2017 02:31:12 +0300", "Message-Id": "<20170915233113.17855-5-fancer.lancer@gmail.com>", "X-Mailer": "git-send-email 2.12.0", "In-Reply-To": "<20170915233113.17855-1-fancer.lancer@gmail.com>", "References": "<20170915233113.17855-1-fancer.lancer@gmail.com>", "Sender": "devicetree-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<devicetree.vger.kernel.org>", "X-Mailing-List": "devicetree@vger.kernel.org" }, "content": "The driver used to be developed with legacy GPIO API support. It's\nbetter to use descriptor-based interface for several reasons. First\nof all the legacy API doesn't support the ACTIVE_LOW/HIGH flag of dts\nnodes, which is essential since different hardware may have different\nGPIOs connectivity including the logical value inversion. Secondly,\nby requesting the reset GPIO descriptor the driver prevent the other\napplications from changing its value. And last but not least the\nlegacy GPIO interface should be avoided in the new code due to it\nobsolescence.\n\nSigned-off-by: Serge Semin <fancer.lancer@gmail.com>\n---\n Documentation/devicetree/bindings/usb/usb251xb.txt | 2 +-\n drivers/usb/misc/usb251xb.c | 33 +++++++++-------------\n 2 files changed, 14 insertions(+), 21 deletions(-)", "diff": "diff --git a/Documentation/devicetree/bindings/usb/usb251xb.txt b/Documentation/devicetree/bindings/usb/usb251xb.txt\nindex dd59a32e7..7c981d556 100644\n--- a/Documentation/devicetree/bindings/usb/usb251xb.txt\n+++ b/Documentation/devicetree/bindings/usb/usb251xb.txt\n@@ -8,10 +8,10 @@ Required properties :\n \t\"microchip,usb2512b\", \"microchip,usb2512bi\", \"microchip,usb2513b\",\n \t\"microchip,usb2513bi\", \"microchip,usb2514b\", \"microchip,usb2514bi\",\n \t\"microchip,usb2517\", \"microchip,usb2517i\"\n- - reset-gpios : Should specify the gpio for hub reset\n - reg : I2C address on the selected bus (default is <0x2C>)\n \n Optional properties :\n+ - reset-gpios : Should specify the gpio for hub reset\n - skip-config : Skip Hub configuration, but only send the USB-Attach command\n - vendor-id : Set USB Vendor ID of the hub (16 bit, default is 0x0424)\n - product-id : Set USB Product ID of the hub (16 bit, default depends on type)\ndiff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c\nindex d6a0ff4ec..1d47acd09 100644\n--- a/drivers/usb/misc/usb251xb.c\n+++ b/drivers/usb/misc/usb251xb.c\n@@ -20,12 +20,11 @@\n */\n \n #include <linux/delay.h>\n-#include <linux/gpio.h>\n+#include <linux/gpio/consumer.h>\n #include <linux/i2c.h>\n #include <linux/module.h>\n #include <linux/nls.h>\n #include <linux/of_device.h>\n-#include <linux/of_gpio.h>\n #include <linux/slab.h>\n \n /* Internal Register Set Addresses & Default Values acc. to DS00001692C */\n@@ -127,7 +126,7 @@ struct usb251xb {\n \tstruct device *dev;\n \tstruct i2c_client *i2c;\n \tu8 skip_config;\n-\tint gpio_reset;\n+\tstruct gpio_desc *gpio_reset;\n \tu16 vendor_id;\n \tu16 product_id;\n \tu16 device_id;\n@@ -235,13 +234,13 @@ static const struct usb251xb_data usb2517i_data = {\n \n static void usb251xb_reset(struct usb251xb *hub, int state)\n {\n-\tif (!gpio_is_valid(hub->gpio_reset))\n+\tif (!hub->gpio_reset)\n \t\treturn;\n \n-\tgpio_set_value_cansleep(hub->gpio_reset, state);\n+\tgpiod_set_value_cansleep(hub->gpio_reset, state);\n \n \t/* wait for hub recovery/stabilization */\n-\tif (state)\n+\tif (!state)\n \t\tusleep_range(500, 750);\t/* >=500us at power on */\n \telse\n \t\tusleep_range(1, 10);\t/* >=1us at power down */\n@@ -260,7 +259,7 @@ static int usb251xb_connect(struct usb251xb *hub)\n \t\ti2c_wb[0] = 0x01;\n \t\ti2c_wb[1] = USB251XB_STATUS_COMMAND_ATTACH;\n \n-\t\tusb251xb_reset(hub, 1);\n+\t\tusb251xb_reset(hub, 0);\n \n \t\terr = i2c_smbus_write_i2c_block_data(hub->i2c,\n \t\t\t\tUSB251XB_ADDR_STATUS_COMMAND, 2, i2c_wb);\n@@ -310,7 +309,7 @@ static int usb251xb_connect(struct usb251xb *hub)\n \ti2c_wb[USB251XB_ADDR_PORT_MAP_7] = hub->port_map7;\n \ti2c_wb[USB251XB_ADDR_STATUS_COMMAND] = USB251XB_STATUS_COMMAND_ATTACH;\n \n-\tusb251xb_reset(hub, 1);\n+\tusb251xb_reset(hub, 0);\n \n \t/* write registers */\n \tfor (i = 0; i < (USB251XB_I2C_REG_SZ / USB251XB_I2C_WRITE_SZ); i++) {\n@@ -363,19 +362,13 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,\n \telse\n \t\thub->skip_config = 0;\n \n-\thub->gpio_reset = of_get_named_gpio(np, \"reset-gpios\", 0);\n-\tif (hub->gpio_reset == -EPROBE_DEFER)\n+\thub->gpio_reset = devm_gpiod_get_optional(dev, \"reset\", GPIOD_OUT_HIGH);\n+\tif (PTR_ERR(hub->gpio_reset) == -EPROBE_DEFER) {\n \t\treturn -EPROBE_DEFER;\n-\tif (gpio_is_valid(hub->gpio_reset)) {\n-\t\terr = devm_gpio_request_one(dev, hub->gpio_reset,\n-\t\t\t\t\t GPIOF_OUT_INIT_LOW,\n-\t\t\t\t\t \"usb251xb reset\");\n-\t\tif (err) {\n-\t\t\tdev_err(dev,\n-\t\t\t\t\"unable to request GPIO %d as reset pin (%d)\\n\",\n-\t\t\t\thub->gpio_reset, err);\n-\t\t\treturn err;\n-\t\t}\n+\t} else if (IS_ERR(hub->gpio_reset)) {\n+\t\terr = PTR_ERR(hub->gpio_reset);\n+\t\tdev_err(dev, \"unable to request GPIO reset pin (%d)\\n\", err);\n+\t\treturn err;\n \t}\n \n \tif (of_property_read_u16_array(np, \"vendor-id\", &hub->vendor_id, 1))\n", "prefixes": [ "4/5" ] }