Debian Codegraph @

src/superio/ite/it8728f/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 #include <superio/ite/common/env_ctrl.h>
8
9 #include "chip.h"
10 #include "it8728f.h"
11
12 static void it8728f_init(struct device *dev)
13 {
14 const struct superio_ite_it8728f_config *conf = dev->chip_info;
15 const struct resource *res;
16
17 if (!dev->enabled)
18 return;
19
20 switch (dev->path.pnp.device) {
21 /* TODO: Might potentially need code for FDC etc. */
22 case IT8728F_EC:
23 res = probe_resource(dev, PNP_IDX_IO0);
24 if (!conf || !res)
25 break;
26 ite_ec_init(res->base, &conf->ec);
27 ite_ec_set_power_state(dev);
28 break;
29 case IT8728F_KBCK:
30 set_kbc_ps2_mode();
31 pc_keyboard_init(NO_AUX_DEVICE);
32 break;
33 }
34 }
35
36 static struct device_operations ops = {
37 .read_resources = pnp_read_resources,
38 .set_resources = pnp_set_resources,
39 .enable_resources = pnp_enable_resources,
40 .enable = pnp_alt_enable,
41 .init = it8728f_init,
42 .ops_pnp_mode = &pnp_conf_mode_870155_aa,
43 };
44
45 static struct pnp_info pnp_dev_info[] = {
46 { NULL, IT8728F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ff8, },
47 { NULL, IT8728F_SP1, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
48 { NULL, IT8728F_SP2, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
49 { NULL, IT8728F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ffc, },
50 { NULL, IT8728F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0ff8, 0x0ff8, },
51 { NULL, IT8728F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0fff, 0x0fff, },
52 { NULL, IT8728F_KBCM, PNP_IRQ0, },
53 { NULL, IT8728F_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0,
54 0x0fff, 0x0ff8, 0x0ff8, },
55 { NULL, IT8728F_IR, PNP_IO0 | PNP_IRQ0, 0x0ff8, },
56 };
57
58 static void enable_dev(struct device *dev)
59 {
60 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
61 }
62
63 struct chip_operations superio_ite_it8728f_ops = {
64 .name = "ITE IT8728F Super I/O",
65 .enable_dev = enable_dev
66 };