Debian Codegraph @

src/superio/fintek/f81966d/superio.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #include <device/device.h>
4 #include <device/pnp.h>
5 #include <superio/conf_mode.h>
6 #include <pc80/keyboard.h>
7
8 #include "chip.h"
9 #include "fintek_internal.h"
10 #include "f81966d.h"
11
12 static void f81966d_init(struct device *dev)
13 {
14 if (!dev->enabled)
15 return;
16
17 switch (dev->path.pnp.device) {
18 case F81966D_KBC:
19 pc_keyboard_init(NO_AUX_DEVICE);
20 break;
21 case F81966D_HWM:
22 /* Fixing temp sensor read out and init Fan control */
23 f81966d_hwm_init(dev);
24 break;
25 case F81966D_SP1:
26 /* Enable Uart1 and IRQ share register */
27 f81966d_uart_init(dev);
28 break;
29 case F81966D_SP2:
30 /* Enable Uart2 and IRQ share register */
31 f81966d_uart_init(dev);
32 break;
33 case F81966D_SP3:
34 /* Enable Uart3 and IRQ share register */
35 f81966d_uart_init(dev);
36 break;
37 case F81966D_SP4:
38 /* Enable Uart4 and IRQ share register */
39 f81966d_uart_init(dev);
40 break;
41 case F81966D_GPIO:
42 /* Enable GPIO */
43 f81966d_gpio_init(dev);
44 break;
45 }
46 }
47
48 static struct device_operations ops = {
49 .read_resources = pnp_read_resources,
50 .set_resources = pnp_set_resources,
51 .enable_resources = pnp_enable_resources,
52 .enable = pnp_alt_enable,
53 .init = f81966d_init,
54 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
55 };
56
57 static struct pnp_info pnp_dev_info[] = {
58 /* TODO: some of the 0x7f8 values may need to be corrected. */
59 { NULL, F81966D_SP1, PNP_IO0 | PNP_IRQ0, 0x7f8, },
60 { NULL, F81966D_SP2, PNP_IO0 | PNP_IRQ0, 0x7f8, },
61 { NULL, F81966D_SP3, PNP_IO0 | PNP_IRQ0, 0x7f8, },
62 { NULL, F81966D_SP4, PNP_IO0 | PNP_IRQ0, 0x7f8, },
63 { NULL, F81966D_SP5, PNP_IO0 | PNP_IRQ0, 0x7f8, },
64 { NULL, F81966D_SP6, PNP_IO0 | PNP_IRQ0, 0x7f8, },
65 { NULL, F81966D_KBC, PNP_IO0 | PNP_IRQ0 | PNP_IRQ1, 0x07ff, },
66 { NULL, F81966D_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
67 { NULL, F81966D_HWM, PNP_IO0 | PNP_IRQ0, 0xff8, },
68 { NULL, F81966D_GPIO, PNP_IO0, 0xff8, },
69 { NULL, F81966D_PME, },
70 { NULL, F81966D_WDT, },
71 { NULL, F81966D_SPI, },
72 };
73
74 static void enable_dev(struct device *dev)
75 {
76 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
77 }
78
79 struct chip_operations superio_fintek_f81966d_ops = {
80 .name = "Fintek F81966D-I Super I/O",
81 .enable_dev = enable_dev
82 };