Skip to content

Commit 91a3043

Browse files
committed
Merge tag 'gpio-fixes-for-v6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix incorrect output in in-tree gpio tools - fix a shell coding issue in gpio-sim selftests - correctly set the permissions for debugfs attributes exposed by gpio-mockup - fix chip name and pin count in gpio-f7188x for one of the supported models - fix numberspace pollution when using dynamically and statically allocated GPIOs together * tag 'gpio-fixes-for-v6.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio-f7188x: fix chip name and pin count on Nuvoton chip gpiolib: fix allocation of mixed dynamic/static GPIOs gpio: mockup: Fix mode of debugfs files selftests: gpio: gpio-sim: Fix BUG: test FAILED due to recent change tools: gpio: fix debounce_period_us output of lsgpio
2 parents b158dd9 + 3002b86 commit 91a3043

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

drivers/gpio/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ config GPIO_F7188X
897897
help
898898
This option enables support for GPIOs found on Fintek Super-I/O
899899
chips F71869, F71869A, F71882FG, F71889F and F81866.
900-
As well as Nuvoton Super-I/O chip NCT6116D.
900+
As well as Nuvoton Super-I/O chip NCT6126D.
901901

902902
To compile this driver as a module, choose M here: the module will
903903
be called f7188x-gpio.

drivers/gpio/gpio-f7188x.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
/*
4949
* Nuvoton devices.
5050
*/
51-
#define SIO_NCT6116D_ID 0xD283 /* NCT6116D chipset ID */
51+
#define SIO_NCT6126D_ID 0xD283 /* NCT6126D chipset ID */
5252

5353
#define SIO_LD_GPIO_NUVOTON 0x07 /* GPIO logical device */
5454

@@ -62,7 +62,7 @@ enum chips {
6262
f81866,
6363
f81804,
6464
f81865,
65-
nct6116d,
65+
nct6126d,
6666
};
6767

6868
static const char * const f7188x_names[] = {
@@ -74,7 +74,7 @@ static const char * const f7188x_names[] = {
7474
"f81866",
7575
"f81804",
7676
"f81865",
77-
"nct6116d",
77+
"nct6126d",
7878
};
7979

8080
struct f7188x_sio {
@@ -187,8 +187,8 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset,
187187
/* Output mode register (0:open drain 1:push-pull). */
188188
#define f7188x_gpio_out_mode(base) ((base) + 3)
189189

190-
#define f7188x_gpio_dir_invert(type) ((type) == nct6116d)
191-
#define f7188x_gpio_data_single(type) ((type) == nct6116d)
190+
#define f7188x_gpio_dir_invert(type) ((type) == nct6126d)
191+
#define f7188x_gpio_data_single(type) ((type) == nct6126d)
192192

193193
static struct f7188x_gpio_bank f71869_gpio_bank[] = {
194194
F7188X_GPIO_BANK(0, 6, 0xF0, DRVNAME "-0"),
@@ -274,15 +274,15 @@ static struct f7188x_gpio_bank f81865_gpio_bank[] = {
274274
F7188X_GPIO_BANK(60, 5, 0x90, DRVNAME "-6"),
275275
};
276276

277-
static struct f7188x_gpio_bank nct6116d_gpio_bank[] = {
277+
static struct f7188x_gpio_bank nct6126d_gpio_bank[] = {
278278
F7188X_GPIO_BANK(0, 8, 0xE0, DRVNAME "-0"),
279279
F7188X_GPIO_BANK(10, 8, 0xE4, DRVNAME "-1"),
280280
F7188X_GPIO_BANK(20, 8, 0xE8, DRVNAME "-2"),
281281
F7188X_GPIO_BANK(30, 8, 0xEC, DRVNAME "-3"),
282282
F7188X_GPIO_BANK(40, 8, 0xF0, DRVNAME "-4"),
283283
F7188X_GPIO_BANK(50, 8, 0xF4, DRVNAME "-5"),
284284
F7188X_GPIO_BANK(60, 8, 0xF8, DRVNAME "-6"),
285-
F7188X_GPIO_BANK(70, 1, 0xFC, DRVNAME "-7"),
285+
F7188X_GPIO_BANK(70, 8, 0xFC, DRVNAME "-7"),
286286
};
287287

288288
static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
@@ -490,9 +490,9 @@ static int f7188x_gpio_probe(struct platform_device *pdev)
490490
data->nr_bank = ARRAY_SIZE(f81865_gpio_bank);
491491
data->bank = f81865_gpio_bank;
492492
break;
493-
case nct6116d:
494-
data->nr_bank = ARRAY_SIZE(nct6116d_gpio_bank);
495-
data->bank = nct6116d_gpio_bank;
493+
case nct6126d:
494+
data->nr_bank = ARRAY_SIZE(nct6126d_gpio_bank);
495+
data->bank = nct6126d_gpio_bank;
496496
break;
497497
default:
498498
return -ENODEV;
@@ -559,17 +559,17 @@ static int __init f7188x_find(int addr, struct f7188x_sio *sio)
559559
case SIO_F81865_ID:
560560
sio->type = f81865;
561561
break;
562-
case SIO_NCT6116D_ID:
562+
case SIO_NCT6126D_ID:
563563
sio->device = SIO_LD_GPIO_NUVOTON;
564-
sio->type = nct6116d;
564+
sio->type = nct6126d;
565565
break;
566566
default:
567567
pr_info("Unsupported Fintek device 0x%04x\n", devid);
568568
goto err;
569569
}
570570

571571
/* double check manufacturer where possible */
572-
if (sio->type != nct6116d) {
572+
if (sio->type != nct6126d) {
573573
manid = superio_inw(addr, SIO_FINTEK_MANID);
574574
if (manid != SIO_FINTEK_ID) {
575575
pr_debug("Not a Fintek device at 0x%08x\n", addr);
@@ -581,7 +581,7 @@ static int __init f7188x_find(int addr, struct f7188x_sio *sio)
581581
err = 0;
582582

583583
pr_info("Found %s at %#x\n", f7188x_names[sio->type], (unsigned int)addr);
584-
if (sio->type != nct6116d)
584+
if (sio->type != nct6126d)
585585
pr_info(" revision %d\n", superio_inb(addr, SIO_FINTEK_DEVREV));
586586

587587
err:

drivers/gpio/gpio-mockup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
369369
priv->offset = i;
370370
priv->desc = gpiochip_get_desc(gc, i);
371371

372-
debugfs_create_file(name, 0200, chip->dbg_dir, priv,
372+
debugfs_create_file(name, 0600, chip->dbg_dir, priv,
373373
&gpio_mockup_debugfs_ops);
374374
}
375375
}

drivers/gpio/gpiolib.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ static int gpiochip_find_base(int ngpio)
209209
break;
210210
/* nope, check the space right after the chip */
211211
base = gdev->base + gdev->ngpio;
212+
if (base < GPIO_DYNAMIC_BASE)
213+
base = GPIO_DYNAMIC_BASE;
212214
}
213215

214216
if (gpio_is_valid(base)) {

tools/gpio/lsgpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void print_attributes(struct gpio_v2_line_info *info)
9494
for (i = 0; i < info->num_attrs; i++) {
9595
if (info->attrs[i].id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE)
9696
fprintf(stdout, ", debounce_period=%dusec",
97-
info->attrs[0].debounce_period_us);
97+
info->attrs[i].debounce_period_us);
9898
}
9999
}
100100

tools/testing/selftests/gpio/gpio-sim.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ create_chip chip
389389
create_bank chip bank
390390
set_num_lines chip bank 8
391391
enable_chip chip
392+
DEVNAME=`configfs_dev_name chip`
393+
CHIPNAME=`configfs_chip_name chip bank`
394+
SYSFS_PATH="/sys/devices/platform/$DEVNAME/$CHIPNAME/sim_gpio0/value"
392395
$BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0
393396
test `cat $SYSFS_PATH` = "1" || fail "bias setting does not work"
394397
remove_chip chip

0 commit comments

Comments
 (0)