Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 2 | |
| 3 | #include <device/device.h> |
| 4 | #include <device/pnp.h> |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 5 | #include <pc80/keyboard.h> |
Felix Held | 1a14375 | 2017-12-27 20:52:04 +0100 | [diff] [blame] | 6 | #include <superio/conf_mode.h> |
Elyes HAOUAS | 2329a25 | 2019-05-15 22:11:18 +0200 | [diff] [blame] | 7 | |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 8 | #include "it8721f.h" |
| 9 | |
Edward O'Callaghan | f21bdc3 | 2014-10-21 07:43:41 +1100 | [diff] [blame] | 10 | static void init(struct device *dev) |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 11 | { |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 12 | if (!dev->enabled) |
| 13 | return; |
| 14 | |
| 15 | switch (dev->path.pnp.device) { |
| 16 | case IT8721F_FDC: /* TODO. */ |
| 17 | break; |
| 18 | case IT8721F_PP: /* TODO. */ |
| 19 | break; |
| 20 | case IT8721F_EC: /* TODO. */ |
| 21 | break; |
| 22 | case IT8721F_KBCK: |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 23 | pc_keyboard_init(NO_AUX_DEVICE); |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 24 | break; |
| 25 | case IT8721F_KBCM: /* TODO. */ |
| 26 | break; |
| 27 | case IT8721F_IR: /* TODO. */ |
| 28 | break; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | static struct device_operations ops = { |
| 33 | .read_resources = pnp_read_resources, |
| 34 | .set_resources = pnp_set_resources, |
| 35 | .enable_resources = pnp_enable_resources, |
| 36 | .enable = pnp_enable, |
| 37 | .init = init, |
Felix Held | 1a14375 | 2017-12-27 20:52:04 +0100 | [diff] [blame] | 38 | .ops_pnp_mode = &pnp_conf_mode_870155_aa, |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 39 | }; |
| 40 | |
Arthur Heymans | 7200638 | 2018-08-20 00:12:31 +0200 | [diff] [blame] | 41 | /* Guessed */ |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 42 | static struct pnp_info pnp_dev_info[] = { |
Arthur Heymans | 7200638 | 2018-08-20 00:12:31 +0200 | [diff] [blame] | 43 | { NULL, IT8721F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 |
| 44 | | PNP_MSC0 | PNP_MSC1, 0x0ff8, }, |
Felix Held | c40275b | 2017-12-27 22:11:30 +0100 | [diff] [blame] | 45 | { NULL, IT8721F_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, }, |
| 46 | { NULL, IT8721F_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, |
| 47 | 0x07f8, }, |
Arthur Heymans | 7200638 | 2018-08-20 00:12:31 +0200 | [diff] [blame] | 48 | { NULL, IT8721F_PP, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_DRQ0 | PNP_MSC0, |
| 49 | 0x0ff8, 0x0ff8, }, |
| 50 | { NULL, IT8721F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 |
| 51 | | PNP_MSC0 | PNP_MSC1 | PNP_MSC2 | PNP_MSC3 |
| 52 | | PNP_MSC4 | PNP_MSC5 | PNP_MSC6, |
| 53 | 0x0ff8, 0x0ff8, }, |
Felix Held | c40275b | 2017-12-27 22:11:30 +0100 | [diff] [blame] | 54 | { NULL, IT8721F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, }, |
Arthur Heymans | 7200638 | 2018-08-20 00:12:31 +0200 | [diff] [blame] | 55 | { NULL, IT8721F_KBCM, PNP_IRQ0 | PNP_MSC0, }, |
| 56 | { NULL, IT8721F_IR, }, |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | static void enable_dev(struct device *dev) |
| 60 | { |
Felix Held | c40275b | 2017-12-27 22:11:30 +0100 | [diff] [blame] | 61 | pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | struct chip_operations superio_ite_it8721f_ops = { |
Nicholas Sudsgaard | bfb11be | 2024-01-30 09:53:46 +0900 | [diff] [blame] | 65 | .name = "ITE IT8721F Super I/O", |
QingPei Wang | e169f82 | 2011-09-13 13:35:43 +0800 | [diff] [blame] | 66 | .enable_dev = enable_dev, |
| 67 | }; |