• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "w83627thg.h"
8 
w83627thg_init(struct device * dev)9 static void w83627thg_init(struct device *dev)
10 {
11 	if (!dev->enabled)
12 		return;
13 
14 	switch (dev->path.pnp.device) {
15 	case W83627THG_KBC:
16 		pc_keyboard_init(NO_AUX_DEVICE);
17 		break;
18 	}
19 }
20 
21 static struct device_operations ops = {
22 	.read_resources   = pnp_read_resources,
23 	.set_resources    = pnp_set_resources,
24 	.enable_resources = pnp_enable_resources,
25 	.enable           = pnp_enable,
26 	.init             = w83627thg_init,
27 	.ops_pnp_mode     = &pnp_conf_mode_8787_aa,
28 };
29 
30 static struct pnp_info pnp_dev_info[] = {
31 	{ NULL, W83627THG_FDC,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
32 	{ NULL, W83627THG_PP,    PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
33 	{ NULL, W83627THG_SP1,   PNP_IO0 | PNP_IRQ0, 0x07f8, },
34 	{ NULL, W83627THG_SP2,   PNP_IO0 | PNP_IRQ0 | PNP_MSC1, 0x07f8, },
35 	{ NULL, W83627THG_KBC,
36 		PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1 | PNP_MSC0,
37 		0x07ff, 0x07ff, },
38 	{ NULL, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0,
39 		0x07ff, 0x07fe, },
40 	{ NULL, W83627THG_GPIO2, },
41 	{ NULL, W83627THG_GPIO3, PNP_EN | PNP_MSC0 | PNP_MSC1, },
42 	{ NULL, W83627THG_ACPI,  PNP_IRQ0, },
43 	{ NULL, W83627THG_HWM,   PNP_IO0 | PNP_IRQ0, 0x0ff8, },
44 };
45 
enable_dev(struct device * dev)46 static void enable_dev(struct device *dev)
47 {
48 	pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
49 }
50 
51 struct chip_operations superio_winbond_w83627thg_ops = {
52 	.name = "Winbond W83627THG Super I/O",
53 	.enable_dev = enable_dev,
54 };
55