Skip to content

Commit e0d3cb2

Browse files
henning-schildsmb49
authored andcommitted
gpio-f7188x: fix chip name and pin count on Nuvoton chip
BugLink: https://bugs.launchpad.net/bugs/2028979 [ Upstream commit 3002b86 ] In fact the device with chip id 0xD283 is called NCT6126D, and that is the chip id the Nuvoton code was written for. Correct that name to avoid confusion, because a NCT6116D in fact exists as well but has another chip id, and is currently not supported. The look at the spec also revealed that GPIO group7 in fact has 8 pins, so correct the pin count in that group as well. Fixes: d0918a8 ("gpio-f7188x: Add GPIO support for Nuvoton NCT6116") Reported-by: Xing Tong Wu <xingtong.wu@siemens.com> Signed-off-by: Henning Schild <henning.schild@siemens.com> Acked-by: Simon Guinot <simon.guinot@sequanux.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent cfe30d6 commit e0d3cb2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

drivers/gpio/Kconfig

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

889889
To compile this driver as a module, choose M here: the module will
890890
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:

0 commit comments

Comments
 (0)