Skip to content

Commit ce952d8

Browse files
committed
Merge tag 'gpio-updates-for-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski "This was a quiet release cycle for the GPIO tree and so this pull-request is relatively small. We have one new driver, some minor improvements to the GPIO core code and across several drivers, some DT and documentation updates but in general nothing stands out or is controversial. All changes have spent time in next with no reported issues (or ones that were quickly fixed). GPIO core: - remove more unused legacy interfaces (after converting the last remaining users to better alternatives) - update kerneldocs - improve error handling and log messages in GPIO ACPI code - remove dead code (always true checks) from GPIOLIB New drivers: - add a driver for Intel Granite Rapids-D vGPIO Driver improvements: - use -ENOTSUPP consistently in gpio-regmap and gpio-pcie-idio-24 - provide an ID table for gpio-cros-ec to avoid a driver name fallback check - add support for gpio-ranges for GPIO drivers supporting multiple GPIO banks - switch to using dynamic GPIO base in gpio-brcmstb - fix irq handling in gpio-npcm-sgpio - switch to memory mapped IO accessors in gpio-sch DT bindings: - add support for gpio-ranges to gpio-brcmstb - add support for a new model and the gpio-line-names property to gpio-mpfs Documentation: - replace leading tabs with spaces in code blocks - fix typos" * tag 'gpio-updates-for-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (30 commits) gpio: nuvoton: Fix sgpio irq handle error gpiolib: Discourage to use formatting strings in line names gpio: brcmstb: add support for gpio-ranges gpio: of: support gpio-ranges for multiple gpiochip devices dt-bindings: gpio: brcmstb: add gpio-ranges gpio: Add Intel Granite Rapids-D vGPIO driver gpio: brcmstb: Use dynamic GPIO base numbers gpiolib: acpi: Set label for IRQ only lines gpiolib: acpi: Add fwnode name to the GPIO interrupt label gpiolib: Get rid of never false gpio_is_valid() calls gpiolib: acpi: Pass con_id instead of property into acpi_dev_gpio_irq_get_by() gpiolib: acpi: Move acpi_can_fallback_to_crs() out of __acpi_find_gpio() gpiolib: acpi: Simplify error handling in __acpi_find_gpio() gpiolib: acpi: Extract __acpi_find_gpio() helper gpio: sch: Utilise temporary variable for struct device gpio: sch: Switch to memory mapped IO accessors gpio: regmap: Use -ENOTSUPP consistently gpio: pcie-idio-24: Use -ENOTSUPP consistently Documentation: gpio: Replace leading TABs by spaces in code blocks gpiolib: acpi: Check for errors first in acpi_find_gpio() ...
2 parents 9d81e2d + 7f45fe2 commit ce952d8

File tree

31 files changed

+622
-235
lines changed

31 files changed

+622
-235
lines changed

Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ properties:
6262
6363
interrupt-controller: true
6464

65+
gpio-ranges: true
66+
6567
wakeup-source:
6668
type: boolean
6769
description: >
@@ -88,6 +90,7 @@ examples:
8890
interrupt-parent = <&irq0_intc>;
8991
interrupts = <0x6>;
9092
brcm,gpio-bank-widths = <32 32 32 24>;
93+
gpio-ranges = <&pinctrl 0 0 120>;
9194
};
9295
9396
upg_gio_aon: gpio@f04172c0 {

Documentation/devicetree/bindings/gpio/microchip,mpfs-gpio.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ properties:
1414
items:
1515
- enum:
1616
- microchip,mpfs-gpio
17+
- microchip,coregpio-rtl-v3
1718

1819
reg:
1920
maxItems: 1
@@ -43,6 +44,7 @@ properties:
4344
default: 32
4445

4546
gpio-controller: true
47+
gpio-line-names: true
4648

4749
patternProperties:
4850
"^.+-hog(-[0-9]+)?$":
@@ -62,12 +64,21 @@ patternProperties:
6264
- gpio-hog
6365
- gpios
6466

67+
allOf:
68+
- if:
69+
properties:
70+
compatible:
71+
contains:
72+
const: microchip,mpfs-gpio
73+
then:
74+
required:
75+
- interrupts
76+
- "#interrupt-cells"
77+
- interrupt-controller
78+
6579
required:
6680
- compatible
6781
- reg
68-
- interrupts
69-
- "#interrupt-cells"
70-
- interrupt-controller
7182
- "#gpio-cells"
7283
- gpio-controller
7384
- clocks

Documentation/driver-api/gpio/driver.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document serves as a guide for writers of GPIO chip drivers.
77
Each GPIO controller driver needs to include the following header, which defines
88
the structures used to define a GPIO driver::
99

10-
#include <linux/gpio/driver.h>
10+
#include <linux/gpio/driver.h>
1111

1212

1313
Internal Representation of GPIOs
@@ -144,7 +144,7 @@ is not open, it will present a high-impedance (tristate) to the external rail::
144144
in ----|| |/
145145
||--+ in ----|
146146
| |\
147-
GND GND
147+
GND GND
148148

149149
This configuration is normally used as a way to achieve one of two things:
150150

@@ -550,10 +550,10 @@ the interrupt separately and go with it:
550550
struct my_gpio *g;
551551
struct gpio_irq_chip *girq;
552552
553-
ret = devm_request_threaded_irq(dev, irq, NULL,
554-
irq_thread_fn, IRQF_ONESHOT, "my-chip", g);
553+
ret = devm_request_threaded_irq(dev, irq, NULL, irq_thread_fn,
554+
IRQF_ONESHOT, "my-chip", g);
555555
if (ret < 0)
556-
return ret;
556+
return ret;
557557
558558
/* Get a pointer to the gpio_irq_chip */
559559
girq = &g->gc.irq;
@@ -681,12 +681,12 @@ certain operations and keep track of usage inside of the gpiolib subsystem.
681681
Input GPIOs can be used as IRQ signals. When this happens, a driver is requested
682682
to mark the GPIO as being used as an IRQ::
683683

684-
int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
684+
int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
685685

686686
This will prevent the use of non-irq related GPIO APIs until the GPIO IRQ lock
687687
is released::
688688

689-
void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset)
689+
void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset)
690690

691691
When implementing an irqchip inside a GPIO driver, these two functions should
692692
typically be called in the .startup() and .shutdown() callbacks from the
@@ -708,12 +708,12 @@ When a GPIO is used as an IRQ signal, then gpiolib also needs to know if
708708
the IRQ is enabled or disabled. In order to inform gpiolib about this,
709709
the irqchip driver should call::
710710

711-
void gpiochip_disable_irq(struct gpio_chip *chip, unsigned int offset)
711+
void gpiochip_disable_irq(struct gpio_chip *chip, unsigned int offset)
712712

713713
This allows drivers to drive the GPIO as an output while the IRQ is
714714
disabled. When the IRQ is enabled again, a driver should call::
715715

716-
void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset)
716+
void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset)
717717

718718
When implementing an irqchip inside a GPIO driver, these two functions should
719719
typically be called in the .irq_disable() and .irq_enable() callbacks from the
@@ -763,12 +763,12 @@ Sometimes it is useful to allow a GPIO chip driver to request its own GPIO
763763
descriptors through the gpiolib API. A GPIO driver can use the following
764764
functions to request and free descriptors::
765765

766-
struct gpio_desc *gpiochip_request_own_desc(struct gpio_desc *desc,
767-
u16 hwnum,
768-
const char *label,
769-
enum gpiod_flags flags)
766+
struct gpio_desc *gpiochip_request_own_desc(struct gpio_desc *desc,
767+
u16 hwnum,
768+
const char *label,
769+
enum gpiod_flags flags)
770770

771-
void gpiochip_free_own_desc(struct gpio_desc *desc)
771+
void gpiochip_free_own_desc(struct gpio_desc *desc)
772772

773773
Descriptors requested with gpiochip_request_own_desc() must be released with
774774
gpiochip_free_own_desc().

Documentation/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ setup or driver probe/teardown code, so this is an easy constraint.)::
225225
gpio_request()
226226

227227
## gpio_request_one()
228-
## gpio_request_array()
229-
## gpio_free_array()
230228

231229
gpio_free()
232230

@@ -295,14 +293,6 @@ are claimed, three additional calls are defined::
295293
*/
296294
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
297295

298-
/* request multiple GPIOs in a single call
299-
*/
300-
int gpio_request_array(struct gpio *array, size_t num);
301-
302-
/* release multiple GPIOs in a single call
303-
*/
304-
void gpio_free_array(struct gpio *array, size_t num);
305-
306296
where 'flags' is currently defined to specify the following properties:
307297

308298
* GPIOF_DIR_IN - to configure direction as input
@@ -341,12 +331,6 @@ A typical example of usage::
341331
if (err)
342332
...
343333

344-
err = gpio_request_array(leds_gpios, ARRAY_SIZE(leds_gpios));
345-
if (err)
346-
...
347-
348-
gpio_free_array(leds_gpios, ARRAY_SIZE(leds_gpios));
349-
350334

351335
GPIOs mapped to IRQs
352336
--------------------

Documentation/translations/zh_CN/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ GPIO 值的命令需要等待其信息排到队首才发送命令,再获得其
208208
gpio_request()
209209

210210
## gpio_request_one()
211-
## gpio_request_array()
212-
## gpio_free_array()
213211

214212
gpio_free()
215213

@@ -272,14 +270,6 @@ gpio_request()前将这类细节配置好,例如使用引脚控制子系统的
272270
*/
273271
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
274272

275-
/* 在单个函数中申请多个 GPIO
276-
*/
277-
int gpio_request_array(struct gpio *array, size_t num);
278-
279-
/* 在单个函数中释放多个 GPIO
280-
*/
281-
void gpio_free_array(struct gpio *array, size_t num);
282-
283273
这里 'flags' 当前定义可指定以下属性:
284274

285275
* GPIOF_DIR_IN - 配置方向为输入
@@ -317,12 +307,6 @@ gpio_request()前将这类细节配置好,例如使用引脚控制子系统的
317307
if (err)
318308
...
319309

320-
err = gpio_request_array(leds_gpios, ARRAY_SIZE(leds_gpios));
321-
if (err)
322-
...
323-
324-
gpio_free_array(leds_gpios, ARRAY_SIZE(leds_gpios));
325-
326310

327311
GPIO 映射到 IRQ
328312
----------------

Documentation/translations/zh_TW/gpio.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,10 @@ GPIO 值的命令需要等待其信息排到隊首才發送命令,再獲得其
215215
gpio_request()
216216

217217
## gpio_request_one()
218-
## gpio_request_array()
219-
## gpio_free_array()
220218

221219
gpio_free()
222220

223221

224-
225222
聲明和釋放 GPIO
226223
----------------------------
227224
爲了有助於捕獲系統配置錯誤,定義了兩個函數。
@@ -278,14 +275,6 @@ gpio_request()前將這類細節配置好,例如使用 pinctrl 子系統的映
278275
*/
279276
int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
280277

281-
/* 在單個函數中申請多個 GPIO
282-
*/
283-
int gpio_request_array(struct gpio *array, size_t num);
284-
285-
/* 在單個函數中釋放多個 GPIO
286-
*/
287-
void gpio_free_array(struct gpio *array, size_t num);
288-
289278
這裡 'flags' 當前定義可指定以下屬性:
290279

291280
* GPIOF_DIR_IN - 配置方向爲輸入
@@ -323,12 +312,6 @@ gpio_request()前將這類細節配置好,例如使用 pinctrl 子系統的映
323312
if (err)
324313
...
325314

326-
err = gpio_request_array(leds_gpios, ARRAY_SIZE(leds_gpios));
327-
if (err)
328-
...
329-
330-
gpio_free_array(leds_gpios, ARRAY_SIZE(leds_gpios));
331-
332315

333316
GPIO 映射到 IRQ
334317
--------------------

Documentation/userspace-api/gpio/gpio-v2-get-line-ioctl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Only one event clock flag, ``GPIO_V2_LINE_FLAG_EVENT_CLOCK_xxx``, may be set.
8181
If none are set then the event clock defaults to ``CLOCK_MONOTONIC``.
8282
The ``GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE`` flag requires supporting hardware
8383
and a kernel with ``CONFIG_HTE`` set. Requesting HTE from a device that
84-
doesn't support it is an error (**EOPNOTSUP**).
84+
doesn't support it is an error (**EOPNOTSUPP**).
8585

8686
The :c:type:`debounce_period_us<gpio_v2_line_attribute>` attribute may only
8787
be applied to lines with ``GPIO_V2_LINE_FLAG_INPUT`` set. When set, debounce

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10936,6 +10936,7 @@ L: [email protected]
1093610936
S: Supported
1093710937
T: git git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git
1093810938
F: drivers/gpio/gpio-elkhartlake.c
10939+
F: drivers/gpio/gpio-graniterapids.c
1093910940
F: drivers/gpio/gpio-ich.c
1094010941
F: drivers/gpio/gpio-merrifield.c
1094110942
F: drivers/gpio/gpio-ml-ioh.c

arch/arm/mach-pxa/spitz_pm.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@
3535

3636
static int spitz_last_ac_status;
3737

38-
static struct gpio spitz_charger_gpios[] = {
39-
{ SPITZ_GPIO_KEY_INT, GPIOF_IN, "Keyboard Interrupt" },
40-
{ SPITZ_GPIO_SYNC, GPIOF_IN, "Sync" },
41-
{ SPITZ_GPIO_AC_IN, GPIOF_IN, "Charger Detection" },
42-
{ SPITZ_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
43-
{ SPITZ_GPIO_JK_B, GPIOF_OUT_INIT_LOW, "JK B" },
44-
{ SPITZ_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" },
45-
};
46-
4738
static void spitz_charger_init(void)
4839
{
49-
gpio_request_array(ARRAY_AND_SIZE(spitz_charger_gpios));
40+
gpio_request(SPITZ_GPIO_KEY_INT, "Keyboard Interrupt");
41+
gpio_direction_input(SPITZ_GPIO_KEY_INT);
42+
gpio_request(SPITZ_GPIO_SYNC, "Sync");
43+
gpio_direction_input(SPITZ_GPIO_SYNC);
44+
gpio_request(SPITZ_GPIO_AC_IN, "Charger Detection");
45+
gpio_direction_input(SPITZ_GPIO_AC_IN);
46+
gpio_request(SPITZ_GPIO_ADC_TEMP_ON, "ADC Temp On");
47+
gpio_direction_output(SPITZ_GPIO_ADC_TEMP_ON, 0);
48+
gpio_request(SPITZ_GPIO_JK_B, "JK B");
49+
gpio_direction_output(SPITZ_GPIO_JK_B, 0);
50+
gpio_request(SPITZ_GPIO_CHRG_ON, "Charger On");
51+
gpio_direction_output(SPITZ_GPIO_CHRG_ON, 0);
5052
}
5153

5254
static void spitz_measure_temp(int on)

arch/arm/mach-sa1100/h3600.c

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020

2121
#include "generic.h"
2222

23-
/*
24-
* helper for sa1100fb
25-
*/
26-
static struct gpio h3600_lcd_gpio[] = {
27-
{ H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD power" },
28-
{ H3600_EGPIO_LCD_PCI, GPIOF_OUT_INIT_LOW, "LCD control" },
29-
{ H3600_EGPIO_LCD_5V_ON, GPIOF_OUT_INIT_LOW, "LCD 5v" },
30-
{ H3600_EGPIO_LVDD_ON, GPIOF_OUT_INIT_LOW, "LCD 9v/-6.5v" },
31-
};
32-
3323
static bool h3600_lcd_request(void)
3424
{
3525
static bool h3600_lcd_ok;
@@ -38,7 +28,42 @@ static bool h3600_lcd_request(void)
3828
if (h3600_lcd_ok)
3929
return true;
4030

41-
rc = gpio_request_array(h3600_lcd_gpio, ARRAY_SIZE(h3600_lcd_gpio));
31+
rc = gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power");
32+
if (rc)
33+
goto out;
34+
rc = gpio_direction_output(H3XXX_EGPIO_LCD_ON, 0);
35+
if (rc)
36+
goto out_free_on;
37+
rc = gpio_request(H3600_EGPIO_LCD_PCI, "LCD control");
38+
if (rc)
39+
goto out_free_on;
40+
rc = gpio_direction_output(H3600_EGPIO_LCD_PCI, 0);
41+
if (rc)
42+
goto out_free_pci;
43+
rc = gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v");
44+
if (rc)
45+
goto out_free_pci;
46+
rc = gpio_direction_output(H3600_EGPIO_LCD_5V_ON, 0);
47+
if (rc)
48+
goto out_free_5v_on;
49+
rc = gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v");
50+
if (rc)
51+
goto out_free_5v_on;
52+
rc = gpio_direction_output(H3600_EGPIO_LVDD_ON, 0);
53+
if (rc)
54+
goto out_free_lvdd_on;
55+
56+
goto out;
57+
58+
out_free_lvdd_on:
59+
gpio_free(H3600_EGPIO_LVDD_ON);
60+
out_free_5v_on:
61+
gpio_free(H3600_EGPIO_LCD_5V_ON);
62+
out_free_pci:
63+
gpio_free(H3600_EGPIO_LCD_PCI);
64+
out_free_on:
65+
gpio_free(H3XXX_EGPIO_LCD_ON);
66+
out:
4267
if (rc)
4368
pr_err("%s: can't request GPIOs\n", __func__);
4469
else

0 commit comments

Comments
 (0)