get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2235018/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2235018,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2235018/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260508-regmap-gpio-sparse-fixed-dir-v2-1-deee84df3027@kernel.org/",
    "project": {
        "id": 42,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260508-regmap-gpio-sparse-fixed-dir-v2-1-deee84df3027@kernel.org>",
    "list_archive_url": null,
    "date": "2026-05-08T12:51:26",
    "name": "[v2,1/2] gpio: regmap: Support sparsed fixed direction",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "8a616d1675c5066c139212dca97d627526bb915f",
    "submitter": {
        "id": 92050,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92050/?format=api",
        "name": "Linus Walleij",
        "email": "linusw@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/20260508-regmap-gpio-sparse-fixed-dir-v2-1-deee84df3027@kernel.org/mbox/",
    "series": [
        {
            "id": 503387,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/503387/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=503387",
            "date": "2026-05-08T12:51:25",
            "name": "Improvement spotted during patch review.",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/503387/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2235018/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2235018/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-gpio+bounces-36462-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-gpio@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=FKUyhf6a;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-gpio+bounces-36462-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"FKUyhf6a\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBpxf1hFwz1yCg\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 22:55:18 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 3022B30AB2FE\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  8 May 2026 12:51:36 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2473A3E1CFF;\n\tFri,  8 May 2026 12:51:33 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D9DBD3DFC92;\n\tFri,  8 May 2026 12:51:32 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPSA id 09DC9C2BCC7;\n\tFri,  8 May 2026 12:51:30 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778244692; cv=none;\n b=M1NbGAx+tmf/BI1GflBH5XrL4BOAQ4waHOfU5ljuEVKGz/+qSEwetTsh39IsjYhAFWAgwM9ShGR4Nb2Vz8NO/z5wA38e3APURvUHp9ITi4f+NwUv3kbMDJ8lZNOfl+s6vfwywz+OGCKbF2U6EU5j17CXFEmHKjOWScEO9+0B21o=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778244692; c=relaxed/simple;\n\tbh=Z4d/UAJ3M/A/sbfOgSOipQRQ0aIMTxR/C/kevDeLGxI=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=bHt5SfuF9pYegBKujLWwTMQrdvrf3WmtA1wZ1WyLuNaWJdpLyE5dRBPmejbS4qy48sgZy1L1Tcj0CYNaSie9AnLSPVh4SUEKoHBQyKlm9DnRmXCYuT34JK2PdUxTk3Ggj7RYcjphomU7wRnj9mIsHLQN9Q/ZAePtFtOGtJgaSZQ=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=FKUyhf6a; arc=none smtp.client-ip=10.30.226.201",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778244692;\n\tbh=Z4d/UAJ3M/A/sbfOgSOipQRQ0aIMTxR/C/kevDeLGxI=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=FKUyhf6aEYY/o1EdFVCeQCxr6Yi1+RaEskmn0l6hwp5p5pvLn21uINwH60p1B/q7t\n\t 7cUQZuCYXYU2nnC9BZqSxL1NeuAhbmp1uRjXf0MmTCfr30VeQs9TiJawFgF6oY1a/s\n\t UEoyh6zf37dV1Sim8ejtSFqk5zpD0Yh6BhG4FQpmbPL9FgctP9792IY7x0U1H0mxoO\n\t ZwAPEYOrKV3+ZlkAk1Kl+wu5ERk5Cc987ygRlHlg6CDAcg+NqsabcxnaetaHABDuow\n\t nyGINvFDHk+EsHhd+FpcAIUsEk0dZG16JYgch71xRwTMYDumqxZ+jhQLoL7I13UYwU\n\t zGdnmwFNvmZ0w==",
        "From": "Linus Walleij <linusw@kernel.org>",
        "Date": "Fri, 08 May 2026 14:51:26 +0200",
        "Subject": "[PATCH v2 1/2] gpio: regmap: Support sparsed fixed direction",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-gpio@vger.kernel.org",
        "List-Id": "<linux-gpio.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-gpio+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-gpio+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "\n <20260508-regmap-gpio-sparse-fixed-dir-v2-1-deee84df3027@kernel.org>",
        "References": "\n <20260508-regmap-gpio-sparse-fixed-dir-v2-0-deee84df3027@kernel.org>",
        "In-Reply-To": "\n <20260508-regmap-gpio-sparse-fixed-dir-v2-0-deee84df3027@kernel.org>",
        "To": "Michael Walle <mwalle@kernel.org>,\n Bartosz Golaszewski <brgl@kernel.org>",
        "Cc": "linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,\n Linus Walleij <linusw@kernel.org>, Alex Elder <elder@riscstar.com>",
        "X-Mailer": "b4 0.15.2"
    },
    "content": "On some regmapped GPIOs apparently only a sparser selection\nof the lines (not all) are actually fixed direction.\n\nSupport this situation by adding an optional bitmap indicating\nwhich GPIOs are actually fixed direction and which are not.\n\nCc: Alex Elder <elder@riscstar.com>\nLink: https://lore.kernel.org/linux-gpio/20260501155421.3329862-10-elder@riscstar.com/\nTested-by: Alex Elder <elder@riscstar.com>\nSigned-off-by: Linus Walleij <linusw@kernel.org>\n---\n drivers/gpio/gpio-regmap.c  | 37 +++++++++++++++++++++++++++++++++----\n include/linux/gpio/regmap.h |  7 +++++++\n 2 files changed, 40 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c\nindex 9ae4a41a2427..f45a432e8ebe 100644\n--- a/drivers/gpio/gpio-regmap.c\n+++ b/drivers/gpio/gpio-regmap.c\n@@ -31,6 +31,7 @@ struct gpio_regmap {\n \tunsigned int reg_clr_base;\n \tunsigned int reg_dir_in_base;\n \tunsigned int reg_dir_out_base;\n+\tunsigned long *fixed_direction_sparse;\n \tunsigned long *fixed_direction_output;\n \n #ifdef CONFIG_REGMAP_IRQ\n@@ -138,6 +139,20 @@ static int gpio_regmap_set_with_clear(struct gpio_chip *chip,\n \treturn regmap_write(gpio->regmap, reg, mask);\n }\n \n+static bool gpio_regmap_fixed_direction(struct gpio_regmap *gpio,\n+\t\t\t\t\tunsigned int offset)\n+{\n+\tif (!gpio->fixed_direction_output)\n+\t\treturn false;\n+\n+\t/* In this case only some GPIOs are fixed as input/output */\n+\tif (gpio->fixed_direction_sparse &&\n+\t    !test_bit(offset, gpio->fixed_direction_sparse))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n static int gpio_regmap_get_direction(struct gpio_chip *chip,\n \t\t\t\t     unsigned int offset)\n {\n@@ -145,7 +160,7 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip,\n \tunsigned int base, val, reg, mask;\n \tint invert, ret;\n \n-\tif (gpio->fixed_direction_output) {\n+\tif (gpio_regmap_fixed_direction(gpio, offset)) {\n \t\tif (test_bit(offset, gpio->fixed_direction_output))\n \t\t\treturn GPIO_LINE_DIRECTION_OUT;\n \t\telse\n@@ -302,12 +317,23 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config\n \t\t\tgoto err_free_gpio;\n \t}\n \n+\tif (config->fixed_direction_sparse) {\n+\t\tgpio->fixed_direction_sparse = bitmap_alloc(chip->ngpio,\n+\t\t\t\t\t\t\t    GFP_KERNEL);\n+\t\tif (!gpio->fixed_direction_sparse) {\n+\t\t\tret = -ENOMEM;\n+\t\t\tgoto err_free_gpio;\n+\t\t}\n+\t\tbitmap_copy(gpio->fixed_direction_sparse,\n+\t\t\t    config->fixed_direction_sparse, chip->ngpio);\n+\t}\n+\n \tif (config->fixed_direction_output) {\n \t\tgpio->fixed_direction_output = bitmap_alloc(chip->ngpio,\n \t\t\t\t\t\t\t    GFP_KERNEL);\n \t\tif (!gpio->fixed_direction_output) {\n \t\t\tret = -ENOMEM;\n-\t\t\tgoto err_free_gpio;\n+\t\t\tgoto err_free_bitmap_sparse;\n \t\t}\n \t\tbitmap_copy(gpio->fixed_direction_output,\n \t\t\t    config->fixed_direction_output, chip->ngpio);\n@@ -329,7 +355,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config\n \n \tret = gpiochip_add_data(chip, gpio);\n \tif (ret < 0)\n-\t\tgoto err_free_bitmap;\n+\t\tgoto err_free_bitmap_output;\n \n #ifdef CONFIG_REGMAP_IRQ\n \tif (config->regmap_irq_chip) {\n@@ -355,8 +381,10 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config\n \n err_remove_gpiochip:\n \tgpiochip_remove(chip);\n-err_free_bitmap:\n+err_free_bitmap_output:\n \tbitmap_free(gpio->fixed_direction_output);\n+err_free_bitmap_sparse:\n+\tbitmap_free(gpio->fixed_direction_sparse);\n err_free_gpio:\n \tkfree(gpio);\n \treturn ERR_PTR(ret);\n@@ -376,6 +404,7 @@ void gpio_regmap_unregister(struct gpio_regmap *gpio)\n \n \tgpiochip_remove(&gpio->gpio_chip);\n \tbitmap_free(gpio->fixed_direction_output);\n+\tbitmap_free(gpio->fixed_direction_sparse);\n \tkfree(gpio);\n }\n EXPORT_SYMBOL_GPL(gpio_regmap_unregister);\ndiff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h\nindex 12d154732ca9..ff00b4aeaf1c 100644\n--- a/include/linux/gpio/regmap.h\n+++ b/include/linux/gpio/regmap.h\n@@ -38,6 +38,12 @@ struct regmap;\n  *\t\t\toffset to a register/bitmask pair. If not\n  *\t\t\tgiven the default gpio_regmap_simple_xlate()\n  *\t\t\tis used.\n+ * @fixed_direction_sparse:\n+ *\t\t\t(Optional) Bitmap representing the GPIO lines that\n+ *\t\t\tmake use of the @fixed_direction_output list to\n+ *\t\t\tenforce direction of the GPIO. If this is NULL\n+ *\t\t\tand @fixed_direction_output is defined, ALL GPIOs\n+ *\t\t\tare assumed to be fixed direction (out or in).\n  * @fixed_direction_output:\n  *\t\t\t(Optional) Bitmap representing the fixed direction of\n  *\t\t\tthe GPIO lines. Useful when there are GPIO lines with a\n@@ -89,6 +95,7 @@ struct gpio_regmap_config {\n \tint reg_stride;\n \tint ngpio_per_reg;\n \tstruct irq_domain *irq_domain;\n+\tunsigned long *fixed_direction_sparse;\n \tunsigned long *fixed_direction_output;\n \n #ifdef CONFIG_REGMAP_IRQ\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}