gpio-f7188x.c (24ccef359e8c540083a89a8f2347fae451fe8086) gpio-f7188x.c (7e9603638ac69696be5bcc2614365c1e8cc892dd)
1/*
1/*
2 * GPIO driver for Fintek Super-I/O F71869, F71882 and F71889
2 * GPIO driver for Fintek Super-I/O F71869, F71869A, F71882 and F71889
3 *
4 * Copyright (C) 2010-2013 LaCie
5 *
6 * Author: Simon Guinot <simon.guinot@sequanux.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or

--- 17 unchanged lines hidden (view full) ---

28#define SIO_MANID 0x23 /* Fintek ID (2 bytes) */
29
30#define SIO_LD_GPIO 0x06 /* GPIO logical device */
31#define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */
32#define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */
33
34#define SIO_FINTEK_ID 0x1934 /* Manufacturer ID */
35#define SIO_F71869_ID 0x0814 /* F71869 chipset ID */
3 *
4 * Copyright (C) 2010-2013 LaCie
5 *
6 * Author: Simon Guinot <simon.guinot@sequanux.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or

--- 17 unchanged lines hidden (view full) ---

28#define SIO_MANID 0x23 /* Fintek ID (2 bytes) */
29
30#define SIO_LD_GPIO 0x06 /* GPIO logical device */
31#define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */
32#define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */
33
34#define SIO_FINTEK_ID 0x1934 /* Manufacturer ID */
35#define SIO_F71869_ID 0x0814 /* F71869 chipset ID */
36#define SIO_F71869A_ID 0x1007 /* F71869A chipset ID */
36#define SIO_F71882_ID 0x0541 /* F71882 chipset ID */
37#define SIO_F71889_ID 0x0909 /* F71889 chipset ID */
38
37#define SIO_F71882_ID 0x0541 /* F71882 chipset ID */
38#define SIO_F71889_ID 0x0909 /* F71889 chipset ID */
39
39enum chips { f71869, f71882fg, f71889f };
40enum chips { f71869, f71869a, f71882fg, f71889f };
40
41static const char * const f7188x_names[] = {
42 "f71869",
41
42static const char * const f7188x_names[] = {
43 "f71869",
44 "f71869a",
43 "f71882fg",
44 "f71889f",
45};
46
47struct f7188x_sio {
48 int addr;
49 enum chips type;
50};

--- 102 unchanged lines hidden (view full) ---

153 F7188X_GPIO_BANK(10, 8, 0xE0),
154 F7188X_GPIO_BANK(20, 8, 0xD0),
155 F7188X_GPIO_BANK(30, 8, 0xC0),
156 F7188X_GPIO_BANK(40, 8, 0xB0),
157 F7188X_GPIO_BANK(50, 5, 0xA0),
158 F7188X_GPIO_BANK(60, 6, 0x90),
159};
160
45 "f71882fg",
46 "f71889f",
47};
48
49struct f7188x_sio {
50 int addr;
51 enum chips type;
52};

--- 102 unchanged lines hidden (view full) ---

155 F7188X_GPIO_BANK(10, 8, 0xE0),
156 F7188X_GPIO_BANK(20, 8, 0xD0),
157 F7188X_GPIO_BANK(30, 8, 0xC0),
158 F7188X_GPIO_BANK(40, 8, 0xB0),
159 F7188X_GPIO_BANK(50, 5, 0xA0),
160 F7188X_GPIO_BANK(60, 6, 0x90),
161};
162
163static struct f7188x_gpio_bank f71869a_gpio_bank[] = {
164 F7188X_GPIO_BANK(0, 6, 0xF0),
165 F7188X_GPIO_BANK(10, 8, 0xE0),
166 F7188X_GPIO_BANK(20, 8, 0xD0),
167 F7188X_GPIO_BANK(30, 8, 0xC0),
168 F7188X_GPIO_BANK(40, 8, 0xB0),
169 F7188X_GPIO_BANK(50, 5, 0xA0),
170 F7188X_GPIO_BANK(60, 8, 0x90),
171 F7188X_GPIO_BANK(70, 8, 0x80),
172};
173
161static struct f7188x_gpio_bank f71882_gpio_bank[] = {
162 F7188X_GPIO_BANK(0 , 8, 0xF0),
163 F7188X_GPIO_BANK(10, 8, 0xE0),
164 F7188X_GPIO_BANK(20, 8, 0xD0),
165 F7188X_GPIO_BANK(30, 4, 0xC0),
166 F7188X_GPIO_BANK(40, 4, 0xB0),
167};
168

--- 123 unchanged lines hidden (view full) ---

292 if (!data)
293 return -ENOMEM;
294
295 switch (sio->type) {
296 case f71869:
297 data->nr_bank = ARRAY_SIZE(f71869_gpio_bank);
298 data->bank = f71869_gpio_bank;
299 break;
174static struct f7188x_gpio_bank f71882_gpio_bank[] = {
175 F7188X_GPIO_BANK(0 , 8, 0xF0),
176 F7188X_GPIO_BANK(10, 8, 0xE0),
177 F7188X_GPIO_BANK(20, 8, 0xD0),
178 F7188X_GPIO_BANK(30, 4, 0xC0),
179 F7188X_GPIO_BANK(40, 4, 0xB0),
180};
181

--- 123 unchanged lines hidden (view full) ---

305 if (!data)
306 return -ENOMEM;
307
308 switch (sio->type) {
309 case f71869:
310 data->nr_bank = ARRAY_SIZE(f71869_gpio_bank);
311 data->bank = f71869_gpio_bank;
312 break;
313 case f71869a:
314 data->nr_bank = ARRAY_SIZE(f71869a_gpio_bank);
315 data->bank = f71869a_gpio_bank;
316 break;
300 case f71882fg:
301 data->nr_bank = ARRAY_SIZE(f71882_gpio_bank);
302 data->bank = f71882_gpio_bank;
303 break;
304 case f71889f:
305 data->nr_bank = ARRAY_SIZE(f71889_gpio_bank);
306 data->bank = f71889_gpio_bank;
307 break;

--- 60 unchanged lines hidden (view full) ---

368 goto err;
369 }
370
371 devid = superio_inw(addr, SIO_DEVID);
372 switch (devid) {
373 case SIO_F71869_ID:
374 sio->type = f71869;
375 break;
317 case f71882fg:
318 data->nr_bank = ARRAY_SIZE(f71882_gpio_bank);
319 data->bank = f71882_gpio_bank;
320 break;
321 case f71889f:
322 data->nr_bank = ARRAY_SIZE(f71889_gpio_bank);
323 data->bank = f71889_gpio_bank;
324 break;

--- 60 unchanged lines hidden (view full) ---

385 goto err;
386 }
387
388 devid = superio_inw(addr, SIO_DEVID);
389 switch (devid) {
390 case SIO_F71869_ID:
391 sio->type = f71869;
392 break;
393 case SIO_F71869A_ID:
394 sio->type = f71869a;
395 break;
376 case SIO_F71882_ID:
377 sio->type = f71882fg;
378 break;
379 case SIO_F71889_ID:
380 sio->type = f71889f;
381 break;
382 default:
383 pr_info(DRVNAME ": Unsupported Fintek device 0x%04x\n", devid);

--- 80 unchanged lines hidden (view full) ---

464
465static void __exit f7188x_gpio_exit(void)
466{
467 platform_device_unregister(f7188x_gpio_pdev);
468 platform_driver_unregister(&f7188x_gpio_driver);
469}
470module_exit(f7188x_gpio_exit);
471
396 case SIO_F71882_ID:
397 sio->type = f71882fg;
398 break;
399 case SIO_F71889_ID:
400 sio->type = f71889f;
401 break;
402 default:
403 pr_info(DRVNAME ": Unsupported Fintek device 0x%04x\n", devid);

--- 80 unchanged lines hidden (view full) ---

484
485static void __exit f7188x_gpio_exit(void)
486{
487 platform_device_unregister(f7188x_gpio_pdev);
488 platform_driver_unregister(&f7188x_gpio_driver);
489}
490module_exit(f7188x_gpio_exit);
491
472MODULE_DESCRIPTION("GPIO driver for Super-I/O chips F71869, F71882FG and F71889F");
492MODULE_DESCRIPTION("GPIO driver for Super-I/O chips F71869, F71869A, F71882FG and F71889F");
473MODULE_AUTHOR("Simon Guinot <simon.guinot@sequanux.org>");
474MODULE_LICENSE("GPL");
493MODULE_AUTHOR("Simon Guinot <simon.guinot@sequanux.org>");
494MODULE_LICENSE("GPL");