Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 2 | |
Jon Dufresne | 39b13f4 | 2006-12-01 09:41:11 +0000 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pnp.h> |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 5 | #include <pc80/keyboard.h> |
Edward O'Callaghan | 0f7ec31 | 2014-11-01 12:11:58 +1100 | [diff] [blame] | 6 | #include <superio/conf_mode.h> |
| 7 | |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 8 | #include "it8712f.h" |
| 9 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 10 | static void it8712f_init(struct device *dev) |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 11 | { |
Uwe Hermann | 5c6bae2 | 2010-11-08 15:16:30 +0000 | [diff] [blame] | 12 | if (!dev->enabled) |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 13 | return; |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 14 | |
Stefan Reinauer | 2b34db8 | 2009-02-28 20:10:20 +0000 | [diff] [blame] | 15 | switch (dev->path.pnp.device) { |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 16 | case IT8712F_FDC: /* TODO. */ |
| 17 | break; |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 18 | case IT8712F_PP: /* TODO. */ |
| 19 | break; |
| 20 | case IT8712F_EC: /* TODO. */ |
| 21 | break; |
| 22 | case IT8712F_KBCK: |
Marc Jones | ecd176f | 2008-09-26 19:15:38 +0000 | [diff] [blame] | 23 | set_kbc_ps2_mode(); |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 24 | pc_keyboard_init(NO_AUX_DEVICE); |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 25 | break; |
| 26 | case IT8712F_KBCM: /* TODO. */ |
| 27 | break; |
| 28 | case IT8712F_MIDI: /* TODO. */ |
| 29 | break; |
| 30 | case IT8712F_GAME: /* TODO. */ |
| 31 | break; |
| 32 | case IT8712F_IR: /* TODO. */ |
| 33 | break; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | static struct device_operations ops = { |
Nico Huber | 9cb0941 | 2013-06-15 15:30:19 +0200 | [diff] [blame] | 38 | .read_resources = pnp_read_resources, |
Nico Huber | 0b2ee93 | 2013-06-15 19:58:35 +0200 | [diff] [blame] | 39 | .set_resources = pnp_set_resources, |
| 40 | .enable_resources = pnp_enable_resources, |
| 41 | .enable = pnp_alt_enable, |
Nico Huber | 9cb0941 | 2013-06-15 15:30:19 +0200 | [diff] [blame] | 42 | .init = it8712f_init, |
Edward O'Callaghan | 0f7ec31 | 2014-11-01 12:11:58 +1100 | [diff] [blame] | 43 | .ops_pnp_mode = &pnp_conf_mode_870155_aa, |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 46 | static struct pnp_info pnp_dev_info[] = { |
Felix Held | c40275b | 2017-12-27 22:11:30 +0100 | [diff] [blame] | 47 | { NULL, IT8712F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ff8, }, |
| 48 | { NULL, IT8712F_SP1, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
| 49 | { NULL, IT8712F_SP2, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
| 50 | { NULL, IT8712F_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x0ffc, }, |
| 51 | { NULL, IT8712F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0ff8, 0x0ff8, }, |
| 52 | { NULL, IT8712F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x0fff, 0x0fff, }, |
| 53 | { NULL, IT8712F_KBCM, PNP_IRQ0, }, |
| 54 | { NULL, IT8712F_GPIO, PNP_IO0 | PNP_IO1 | PNP_IO2 | PNP_IRQ0, |
| 55 | 0x0fff, 0x0ff8, 0x0ff8, }, |
| 56 | { NULL, IT8712F_MIDI, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
| 57 | { NULL, IT8712F_GAME, PNP_IO0, 0x0fff, }, |
| 58 | { NULL, IT8712F_IR, PNP_IO0 | PNP_IRQ0, 0x0ff8, }, |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | static void enable_dev(struct device *dev) |
| 62 | { |
Felix Held | c40275b | 2017-12-27 22:11:30 +0100 | [diff] [blame] | 63 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 64 | } |
| 65 | |
Uwe Hermann | f28674e | 2006-11-01 12:52:49 +0000 | [diff] [blame] | 66 | struct chip_operations superio_ite_it8712f_ops = { |
Nicholas Sudsgaard | bfb11be | 2024-01-30 09:53:46 +0900 | [diff] [blame] | 67 | .name = "ITE IT8712F Super I/O", |
Stefan Reinauer | 6af77ae | 2006-08-25 19:29:57 +0000 | [diff] [blame] | 68 | .enable_dev = enable_dev, |
| 69 | }; |