linux/drivers/input/serio/i8042-x86ia64io.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2#ifndef _I8042_X86IA64IO_H
   3#define _I8042_X86IA64IO_H
   4
   5
   6#ifdef CONFIG_X86
   7#include <asm/x86_init.h>
   8#endif
   9
  10/*
  11 * Names.
  12 */
  13
  14#define I8042_KBD_PHYS_DESC "isa0060/serio0"
  15#define I8042_AUX_PHYS_DESC "isa0060/serio1"
  16#define I8042_MUX_PHYS_DESC "isa0060/serio%d"
  17
  18/*
  19 * IRQs.
  20 */
  21
  22#if defined(__ia64__)
  23# define I8042_MAP_IRQ(x)       isa_irq_to_vector((x))
  24#else
  25# define I8042_MAP_IRQ(x)       (x)
  26#endif
  27
  28#define I8042_KBD_IRQ   i8042_kbd_irq
  29#define I8042_AUX_IRQ   i8042_aux_irq
  30
  31static int i8042_kbd_irq;
  32static int i8042_aux_irq;
  33
  34/*
  35 * Register numbers.
  36 */
  37
  38#define I8042_COMMAND_REG       i8042_command_reg
  39#define I8042_STATUS_REG        i8042_command_reg
  40#define I8042_DATA_REG          i8042_data_reg
  41
  42static int i8042_command_reg = 0x64;
  43static int i8042_data_reg = 0x60;
  44
  45
  46static inline int i8042_read_data(void)
  47{
  48        return inb(I8042_DATA_REG);
  49}
  50
  51static inline int i8042_read_status(void)
  52{
  53        return inb(I8042_STATUS_REG);
  54}
  55
  56static inline void i8042_write_data(int val)
  57{
  58        outb(val, I8042_DATA_REG);
  59}
  60
  61static inline void i8042_write_command(int val)
  62{
  63        outb(val, I8042_COMMAND_REG);
  64}
  65
  66#ifdef CONFIG_X86
  67
  68#include <linux/dmi.h>
  69
  70static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
  71        {
  72                /*
  73                 * Arima-Rioworks HDAMB -
  74                 * AUX LOOP command does not raise AUX IRQ
  75                 */
  76                .matches = {
  77                        DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
  78                        DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
  79                        DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
  80                },
  81        },
  82        {
  83                /* ASUS G1S */
  84                .matches = {
  85                        DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
  86                        DMI_MATCH(DMI_BOARD_NAME, "G1S"),
  87                        DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
  88                },
  89        },
  90        {
  91                /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
  92                .matches = {
  93                        DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  94                        DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
  95                        DMI_MATCH(DMI_BOARD_VERSION, "REV 2.X"),
  96                },
  97        },
  98        {
  99                .matches = {
 100                        DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
 101                        DMI_MATCH(DMI_PRODUCT_NAME, "X750LN"),
 102                },
 103        },
 104        {
 105                .matches = {
 106                        DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
 107                        DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
 108                        DMI_MATCH(DMI_PRODUCT_VERSION, "8500"),
 109                },
 110        },
 111        {
 112                .matches = {
 113                        DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
 114                        DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
 115                        DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
 116                },
 117        },
 118        {
 119                /* Dell Embedded Box PC 3000 */
 120                .matches = {
 121                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 122                        DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
 123                },
 124        },
 125        {
 126                /* OQO Model 01 */
 127                .matches = {
 128                        DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
 129                        DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
 130                        DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
 131                },
 132        },
 133        {
 134                /* ULI EV4873 - AUX LOOP does not work properly */
 135                .matches = {
 136                        DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
 137                        DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
 138                        DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
 139                },
 140        },
 141        {
 142                /* Microsoft Virtual Machine */
 143                .matches = {
 144                        DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
 145                        DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
 146                        DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"),
 147                },
 148        },
 149        {
 150                /* Medion MAM 2070 */
 151                .matches = {
 152                        DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
 153                        DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
 154                        DMI_MATCH(DMI_PRODUCT_VERSION, "5a"),
 155                },
 156        },
 157        {
 158                /* Medion Akoya E7225 */
 159                .matches = {
 160                        DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
 161                        DMI_MATCH(DMI_PRODUCT_NAME, "Akoya E7225"),
 162                        DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
 163                },
 164        },
 165        {
 166                /* Blue FB5601 */
 167                .matches = {
 168                        DMI_MATCH(DMI_SYS_VENDOR, "blue"),
 169                        DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
 170                        DMI_MATCH(DMI_PRODUCT_VERSION, "M606"),
 171                },
 172        },
 173        {
 174                /* Gigabyte M912 */
 175                .matches = {
 176                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 177                        DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
 178                        DMI_MATCH(DMI_PRODUCT_VERSION, "01"),
 179                },
 180        },
 181        {
 182                /* Gigabyte M1022M netbook */
 183                .matches = {
 184                        DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
 185                        DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
 186                        DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
 187                },
 188        },
 189        {
 190                /* Gigabyte Spring Peak - defines wrong chassis type */
 191                .matches = {
 192                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 193                        DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
 194                },
 195        },
 196        {
 197                /* Gigabyte T1005 - defines wrong chassis type ("Other") */
 198                .matches = {
 199                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 200                        DMI_MATCH(DMI_PRODUCT_NAME, "T1005"),
 201                },
 202        },
 203        {
 204                /* Gigabyte T1005M/P - defines wrong chassis type ("Other") */
 205                .matches = {
 206                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 207                        DMI_MATCH(DMI_PRODUCT_NAME, "T1005M/P"),
 208                },
 209        },
 210        {
 211                .matches = {
 212                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 213                        DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
 214                        DMI_MATCH(DMI_PRODUCT_VERSION, "Rev 1"),
 215                },
 216        },
 217        {
 218                .matches = {
 219                        DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"),
 220                        DMI_MATCH(DMI_PRODUCT_NAME, "C15B"),
 221                },
 222        },
 223        { }
 224};
 225
 226/*
 227 * Some Fujitsu notebooks are having trouble with touchpads if
 228 * active multiplexing mode is activated. Luckily they don't have
 229 * external PS/2 ports so we can safely disable it.
 230 * ... apparently some Toshibas don't like MUX mode either and
 231 * die horrible death on reboot.
 232 */
 233static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
 234        {
 235                /* Fujitsu Lifebook P7010/P7010D */
 236                .matches = {
 237                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 238                        DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
 239                },
 240        },
 241        {
 242                /* Fujitsu Lifebook P7010 */
 243                .matches = {
 244                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
 245                        DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
 246                },
 247        },
 248        {
 249                /* Fujitsu Lifebook P5020D */
 250                .matches = {
 251                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 252                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
 253                },
 254        },
 255        {
 256                /* Fujitsu Lifebook S2000 */
 257                .matches = {
 258                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 259                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
 260                },
 261        },
 262        {
 263                /* Fujitsu Lifebook S6230 */
 264                .matches = {
 265                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 266                        DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
 267                },
 268        },
 269        {
 270                /* Fujitsu Lifebook U745 */
 271                .matches = {
 272                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 273                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"),
 274                },
 275        },
 276        {
 277                /* Fujitsu T70H */
 278                .matches = {
 279                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 280                        DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
 281                },
 282        },
 283        {
 284                /* Fujitsu-Siemens Lifebook T3010 */
 285                .matches = {
 286                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
 287                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
 288                },
 289        },
 290        {
 291                /* Fujitsu-Siemens Lifebook E4010 */
 292                .matches = {
 293                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
 294                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
 295                },
 296        },
 297        {
 298                /* Fujitsu-Siemens Amilo Pro 2010 */
 299                .matches = {
 300                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
 301                        DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
 302                },
 303        },
 304        {
 305                /* Fujitsu-Siemens Amilo Pro 2030 */
 306                .matches = {
 307                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
 308                        DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
 309                },
 310        },
 311        {
 312                /*
 313                 * No data is coming from the touchscreen unless KBC
 314                 * is in legacy mode.
 315                 */
 316                /* Panasonic CF-29 */
 317                .matches = {
 318                        DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
 319                        DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
 320                },
 321        },
 322        {
 323                /*
 324                 * HP Pavilion DV4017EA -
 325                 * errors on MUX ports are reported without raising AUXDATA
 326                 * causing "spurious NAK" messages.
 327                 */
 328                .matches = {
 329                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 330                        DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
 331                },
 332        },
 333        {
 334                /*
 335                 * HP Pavilion ZT1000 -
 336                 * like DV4017EA does not raise AUXERR for errors on MUX ports.
 337                 */
 338                .matches = {
 339                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 340                        DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
 341                        DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"),
 342                },
 343        },
 344        {
 345                /*
 346                 * HP Pavilion DV4270ca -
 347                 * like DV4017EA does not raise AUXERR for errors on MUX ports.
 348                 */
 349                .matches = {
 350                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 351                        DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
 352                },
 353        },
 354        {
 355                .matches = {
 356                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
 357                        DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
 358                },
 359        },
 360        {
 361                .matches = {
 362                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
 363                        DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
 364                },
 365        },
 366        {
 367                .matches = {
 368                        DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
 369                        DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"),
 370                },
 371        },
 372        {
 373                .matches = {
 374                        DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
 375                        DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
 376                },
 377        },
 378        {
 379                /* Sharp Actius MM20 */
 380                .matches = {
 381                        DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
 382                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
 383                },
 384        },
 385        {
 386                /* Sony Vaio FS-115b */
 387                .matches = {
 388                        DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
 389                        DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
 390                },
 391        },
 392        {
 393                /*
 394                 * Sony Vaio FZ-240E -
 395                 * reset and GET ID commands issued via KBD port are
 396                 * sometimes being delivered to AUX3.
 397                 */
 398                .matches = {
 399                        DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
 400                        DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
 401                },
 402        },
 403        {
 404                /*
 405                 * Most (all?) VAIOs do not have external PS/2 ports nor
 406                 * they implement active multiplexing properly, and
 407                 * MUX discovery usually messes up keyboard/touchpad.
 408                 */
 409                .matches = {
 410                        DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
 411                        DMI_MATCH(DMI_BOARD_NAME, "VAIO"),
 412                },
 413        },
 414        {
 415                /* Amoi M636/A737 */
 416                .matches = {
 417                        DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
 418                        DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
 419                },
 420        },
 421        {
 422                /* Lenovo 3000 n100 */
 423                .matches = {
 424                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 425                        DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
 426                },
 427        },
 428        {
 429                /* Lenovo XiaoXin Air 12 */
 430                .matches = {
 431                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 432                        DMI_MATCH(DMI_PRODUCT_NAME, "80UN"),
 433                },
 434        },
 435        {
 436                .matches = {
 437                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 438                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
 439                },
 440        },
 441        {
 442                /* Acer Aspire 5710 */
 443                .matches = {
 444                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 445                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"),
 446                },
 447        },
 448        {
 449                /* Acer Aspire 7738 */
 450                .matches = {
 451                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 452                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7738"),
 453                },
 454        },
 455        {
 456                /* Gericom Bellagio */
 457                .matches = {
 458                        DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
 459                        DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
 460                },
 461        },
 462        {
 463                /* IBM 2656 */
 464                .matches = {
 465                        DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
 466                        DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
 467                },
 468        },
 469        {
 470                /* Dell XPS M1530 */
 471                .matches = {
 472                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 473                        DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
 474                },
 475        },
 476        {
 477                /* Compal HEL80I */
 478                .matches = {
 479                        DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
 480                        DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
 481                },
 482        },
 483        {
 484                /* Dell Vostro 1510 */
 485                .matches = {
 486                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 487                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
 488                },
 489        },
 490        {
 491                /* Acer Aspire 5536 */
 492                .matches = {
 493                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 494                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
 495                        DMI_MATCH(DMI_PRODUCT_VERSION, "0100"),
 496                },
 497        },
 498        {
 499                /* Dell Vostro V13 */
 500                .matches = {
 501                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 502                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
 503                },
 504        },
 505        {
 506                /* Newer HP Pavilion dv4 models */
 507                .matches = {
 508                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 509                        DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
 510                },
 511        },
 512        {
 513                /* Asus X450LCP */
 514                .matches = {
 515                        DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
 516                        DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"),
 517                },
 518        },
 519        {
 520                /* Avatar AVIU-145A6 */
 521                .matches = {
 522                        DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
 523                        DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
 524                },
 525        },
 526        {
 527                /* TUXEDO BU1406 */
 528                .matches = {
 529                        DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
 530                        DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
 531                },
 532        },
 533        {
 534                /* Lenovo LaVie Z */
 535                .matches = {
 536                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 537                        DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
 538                },
 539        },
 540        {
 541                /*
 542                 * Acer Aspire 5738z
 543                 * Touchpad stops working in mux mode when dis- + re-enabled
 544                 * with the touchpad enable/disable toggle hotkey
 545                 */
 546                .matches = {
 547                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 548                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
 549                },
 550        },
 551        {
 552                /* Entroware Proteus */
 553                .matches = {
 554                        DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
 555                        DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
 556                        DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
 557                },
 558        },
 559        { }
 560};
 561
 562static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = {
 563        {
 564                /*
 565                 * Sony Vaio VGN-CS series require MUX or the touch sensor
 566                 * buttons will disturb touchpad operation
 567                 */
 568                .matches = {
 569                        DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
 570                        DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
 571                },
 572        },
 573        { }
 574};
 575
 576/*
 577 * On some Asus laptops, just running self tests cause problems.
 578 */
 579static const struct dmi_system_id i8042_dmi_noselftest_table[] = {
 580        {
 581                .matches = {
 582                        DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
 583                        DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
 584                },
 585        },
 586        { }
 587};
 588static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
 589        {
 590                /* MSI Wind U-100 */
 591                .matches = {
 592                        DMI_MATCH(DMI_BOARD_NAME, "U-100"),
 593                        DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
 594                },
 595        },
 596        {
 597                /* LG Electronics X110 */
 598                .matches = {
 599                        DMI_MATCH(DMI_BOARD_NAME, "X110"),
 600                        DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
 601                },
 602        },
 603        {
 604                /* Acer Aspire One 150 */
 605                .matches = {
 606                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 607                        DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
 608                },
 609        },
 610        {
 611                /* Advent 4211 */
 612                .matches = {
 613                        DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
 614                        DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
 615                },
 616        },
 617        {
 618                /* Medion Akoya Mini E1210 */
 619                .matches = {
 620                        DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
 621                        DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
 622                },
 623        },
 624        {
 625                /* Medion Akoya E1222 */
 626                .matches = {
 627                        DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
 628                        DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
 629                },
 630        },
 631        {
 632                /* Mivvy M310 */
 633                .matches = {
 634                        DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
 635                        DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
 636                },
 637        },
 638        {
 639                /* Dell Vostro 1320 */
 640                .matches = {
 641                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 642                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
 643                },
 644        },
 645        {
 646                /* Dell Vostro 1520 */
 647                .matches = {
 648                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 649                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
 650                },
 651        },
 652        {
 653                /* Dell Vostro 1720 */
 654                .matches = {
 655                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 656                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
 657                },
 658        },
 659        {
 660                /* Lenovo Ideapad U455 */
 661                .matches = {
 662                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 663                        DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
 664                },
 665        },
 666        {
 667                /* Lenovo ThinkPad L460 */
 668                .matches = {
 669                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 670                        DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"),
 671                },
 672        },
 673        {
 674                /* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
 675                .matches = {
 676                        DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
 677                        DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
 678                },
 679        },
 680        {
 681                /* Lenovo ThinkPad Twist S230u */
 682                .matches = {
 683                        DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
 684                        DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
 685                },
 686        },
 687        {
 688                /* Entroware Proteus */
 689                .matches = {
 690                        DMI_MATCH(DMI_SYS_VENDOR, "Entroware"),
 691                        DMI_MATCH(DMI_PRODUCT_NAME, "Proteus"),
 692                        DMI_MATCH(DMI_PRODUCT_VERSION, "EL07R4"),
 693                },
 694        },
 695        { }
 696};
 697
 698#ifdef CONFIG_PNP
 699static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
 700        {
 701                /* Intel MBO Desktop D845PESV */
 702                .matches = {
 703                        DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
 704                        DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
 705                },
 706        },
 707        {
 708                /*
 709                 * Intel NUC D54250WYK - does not have i8042 controller but
 710                 * declares PS/2 devices in DSDT.
 711                 */
 712                .matches = {
 713                        DMI_MATCH(DMI_BOARD_NAME, "D54250WYK"),
 714                        DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
 715                },
 716        },
 717        {
 718                /* MSI Wind U-100 */
 719                .matches = {
 720                        DMI_MATCH(DMI_BOARD_NAME, "U-100"),
 721                        DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
 722                },
 723        },
 724        {
 725                /* Acer Aspire 5 A515 */
 726                .matches = {
 727                        DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"),
 728                        DMI_MATCH(DMI_BOARD_VENDOR, "PK"),
 729                },
 730        },
 731        { }
 732};
 733
 734static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
 735        {
 736                .matches = {
 737                        DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
 738                },
 739        },
 740        {
 741                .matches = {
 742                        DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
 743                },
 744        },
 745        {
 746                .matches = {
 747                        DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
 748                },
 749        },
 750        {
 751                .matches = {
 752                        DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
 753                },
 754        },
 755        { }
 756};
 757#endif
 758
 759static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
 760        {
 761                /* Dell Vostro V13 */
 762                .matches = {
 763                        DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 764                        DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"),
 765                },
 766        },
 767        {
 768                /* Newer HP Pavilion dv4 models */
 769                .matches = {
 770                        DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
 771                        DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
 772                },
 773        },
 774        {
 775                /* Fujitsu A544 laptop */
 776                /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */
 777                .matches = {
 778                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 779                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"),
 780                },
 781        },
 782        {
 783                /* Fujitsu AH544 laptop */
 784                /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
 785                .matches = {
 786                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 787                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"),
 788                },
 789        },
 790        {
 791                /* Fujitsu U574 laptop */
 792                /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
 793                .matches = {
 794                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 795                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
 796                },
 797        },
 798        {
 799                /* Fujitsu UH554 laptop */
 800                .matches = {
 801                        DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
 802                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK UH544"),
 803                },
 804        },
 805        { }
 806};
 807
 808/*
 809 * Some Wistron based laptops need us to explicitly enable the 'Dritek
 810 * keyboard extension' to make their extra keys start generating scancodes.
 811 * Originally, this was just confined to older laptops, but a few Acer laptops
 812 * have turned up in 2007 that also need this again.
 813 */
 814static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
 815        {
 816                /* Acer Aspire 5100 */
 817                .matches = {
 818                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 819                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5100"),
 820                },
 821        },
 822        {
 823                /* Acer Aspire 5610 */
 824                .matches = {
 825                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 826                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
 827                },
 828        },
 829        {
 830                /* Acer Aspire 5630 */
 831                .matches = {
 832                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 833                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
 834                },
 835        },
 836        {
 837                /* Acer Aspire 5650 */
 838                .matches = {
 839                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 840                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
 841                },
 842        },
 843        {
 844                /* Acer Aspire 5680 */
 845                .matches = {
 846                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 847                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
 848                },
 849        },
 850        {
 851                /* Acer Aspire 5720 */
 852                .matches = {
 853                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 854                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
 855                },
 856        },
 857        {
 858                /* Acer Aspire 9110 */
 859                .matches = {
 860                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 861                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
 862                },
 863        },
 864        {
 865                /* Acer TravelMate 660 */
 866                .matches = {
 867                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 868                        DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
 869                },
 870        },
 871        {
 872                /* Acer TravelMate 2490 */
 873                .matches = {
 874                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 875                        DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
 876                },
 877        },
 878        {
 879                /* Acer TravelMate 4280 */
 880                .matches = {
 881                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
 882                        DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
 883                },
 884        },
 885        { }
 886};
 887
 888/*
 889 * Some laptops need keyboard reset before probing for the trackpad to get
 890 * it detected, initialised & finally work.
 891 */
 892static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
 893        {
 894                /* Gigabyte P35 v2 - Elantech touchpad */
 895                .matches = {
 896                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 897                        DMI_MATCH(DMI_PRODUCT_NAME, "P35V2"),
 898                },
 899        },
 900                {
 901                /* Aorus branded Gigabyte X3 Plus - Elantech touchpad */
 902                .matches = {
 903                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 904                        DMI_MATCH(DMI_PRODUCT_NAME, "X3"),
 905                },
 906        },
 907        {
 908                /* Gigabyte P34 - Elantech touchpad */
 909                .matches = {
 910                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 911                        DMI_MATCH(DMI_PRODUCT_NAME, "P34"),
 912                },
 913        },
 914        {
 915                /* Gigabyte P57 - Elantech touchpad */
 916                .matches = {
 917                        DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
 918                        DMI_MATCH(DMI_PRODUCT_NAME, "P57"),
 919                },
 920        },
 921        {
 922                /* Schenker XMG C504 - Elantech touchpad */
 923                .matches = {
 924                        DMI_MATCH(DMI_SYS_VENDOR, "XMG"),
 925                        DMI_MATCH(DMI_PRODUCT_NAME, "C504"),
 926                },
 927        },
 928        { }
 929};
 930
 931#endif /* CONFIG_X86 */
 932
 933#ifdef CONFIG_PNP
 934#include <linux/pnp.h>
 935
 936static bool i8042_pnp_kbd_registered;
 937static unsigned int i8042_pnp_kbd_devices;
 938static bool i8042_pnp_aux_registered;
 939static unsigned int i8042_pnp_aux_devices;
 940
 941static int i8042_pnp_command_reg;
 942static int i8042_pnp_data_reg;
 943static int i8042_pnp_kbd_irq;
 944static int i8042_pnp_aux_irq;
 945
 946static char i8042_pnp_kbd_name[32];
 947static char i8042_pnp_aux_name[32];
 948
 949static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
 950{
 951        strlcpy(dst, "PNP:", dst_size);
 952
 953        while (id) {
 954                strlcat(dst, " ", dst_size);
 955                strlcat(dst, id->id, dst_size);
 956                id = id->next;
 957        }
 958}
 959
 960static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
 961{
 962        if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
 963                i8042_pnp_data_reg = pnp_port_start(dev,0);
 964
 965        if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
 966                i8042_pnp_command_reg = pnp_port_start(dev, 1);
 967
 968        if (pnp_irq_valid(dev,0))
 969                i8042_pnp_kbd_irq = pnp_irq(dev, 0);
 970
 971        strlcpy(i8042_pnp_kbd_name, did->id, sizeof(i8042_pnp_kbd_name));
 972        if (strlen(pnp_dev_name(dev))) {
 973                strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
 974                strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
 975        }
 976        i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
 977                               sizeof(i8042_kbd_firmware_id));
 978        i8042_kbd_fwnode = dev_fwnode(&dev->dev);
 979
 980        /* Keyboard ports are always supposed to be wakeup-enabled */
 981        device_set_wakeup_enable(&dev->dev, true);
 982
 983        i8042_pnp_kbd_devices++;
 984        return 0;
 985}
 986
 987static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *did)
 988{
 989        if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
 990                i8042_pnp_data_reg = pnp_port_start(dev,0);
 991
 992        if (pnp_port_valid(dev, 1) && pnp_port_len(dev, 1) == 1)
 993                i8042_pnp_command_reg = pnp_port_start(dev, 1);
 994
 995        if (pnp_irq_valid(dev, 0))
 996                i8042_pnp_aux_irq = pnp_irq(dev, 0);
 997
 998        strlcpy(i8042_pnp_aux_name, did->id, sizeof(i8042_pnp_aux_name));
 999        if (strlen(pnp_dev_name(dev))) {
1000                strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
1001                strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
1002        }
1003        i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
1004                               sizeof(i8042_aux_firmware_id));
1005
1006        i8042_pnp_aux_devices++;
1007        return 0;
1008}
1009
1010static const struct pnp_device_id pnp_kbd_devids[] = {
1011        { .id = "PNP0300", .driver_data = 0 },
1012        { .id = "PNP0301", .driver_data = 0 },
1013        { .id = "PNP0302", .driver_data = 0 },
1014        { .id = "PNP0303", .driver_data = 0 },
1015        { .id = "PNP0304", .driver_data = 0 },
1016        { .id = "PNP0305", .driver_data = 0 },
1017        { .id = "PNP0306", .driver_data = 0 },
1018        { .id = "PNP0309", .driver_data = 0 },
1019        { .id = "PNP030a", .driver_data = 0 },
1020        { .id = "PNP030b", .driver_data = 0 },
1021        { .id = "PNP0320", .driver_data = 0 },
1022        { .id = "PNP0343", .driver_data = 0 },
1023        { .id = "PNP0344", .driver_data = 0 },
1024        { .id = "PNP0345", .driver_data = 0 },
1025        { .id = "CPQA0D7", .driver_data = 0 },
1026        { .id = "", },
1027};
1028MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
1029
1030static struct pnp_driver i8042_pnp_kbd_driver = {
1031        .name           = "i8042 kbd",
1032        .id_table       = pnp_kbd_devids,
1033        .probe          = i8042_pnp_kbd_probe,
1034        .driver         = {
1035                .probe_type = PROBE_FORCE_SYNCHRONOUS,
1036                .suppress_bind_attrs = true,
1037        },
1038};
1039
1040static const struct pnp_device_id pnp_aux_devids[] = {
1041        { .id = "AUI0200", .driver_data = 0 },
1042        { .id = "FJC6000", .driver_data = 0 },
1043        { .id = "FJC6001", .driver_data = 0 },
1044        { .id = "PNP0f03", .driver_data = 0 },
1045        { .id = "PNP0f0b", .driver_data = 0 },
1046        { .id = "PNP0f0e", .driver_data = 0 },
1047        { .id = "PNP0f12", .driver_data = 0 },
1048        { .id = "PNP0f13", .driver_data = 0 },
1049        { .id = "PNP0f19", .driver_data = 0 },
1050        { .id = "PNP0f1c", .driver_data = 0 },
1051        { .id = "SYN0801", .driver_data = 0 },
1052        { .id = "", },
1053};
1054MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
1055
1056static struct pnp_driver i8042_pnp_aux_driver = {
1057        .name           = "i8042 aux",
1058        .id_table       = pnp_aux_devids,
1059        .probe          = i8042_pnp_aux_probe,
1060        .driver         = {
1061                .probe_type = PROBE_FORCE_SYNCHRONOUS,
1062                .suppress_bind_attrs = true,
1063        },
1064};
1065
1066static void i8042_pnp_exit(void)
1067{
1068        if (i8042_pnp_kbd_registered) {
1069                i8042_pnp_kbd_registered = false;
1070                pnp_unregister_driver(&i8042_pnp_kbd_driver);
1071        }
1072
1073        if (i8042_pnp_aux_registered) {
1074                i8042_pnp_aux_registered = false;
1075                pnp_unregister_driver(&i8042_pnp_aux_driver);
1076        }
1077}
1078
1079static int __init i8042_pnp_init(void)
1080{
1081        char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
1082        bool pnp_data_busted = false;
1083        int err;
1084
1085#ifdef CONFIG_X86
1086        if (dmi_check_system(i8042_dmi_nopnp_table))
1087                i8042_nopnp = true;
1088#endif
1089
1090        if (i8042_nopnp) {
1091                pr_info("PNP detection disabled\n");
1092                return 0;
1093        }
1094
1095        err = pnp_register_driver(&i8042_pnp_kbd_driver);
1096        if (!err)
1097                i8042_pnp_kbd_registered = true;
1098
1099        err = pnp_register_driver(&i8042_pnp_aux_driver);
1100        if (!err)
1101                i8042_pnp_aux_registered = true;
1102
1103        if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
1104                i8042_pnp_exit();
1105#if defined(__ia64__)
1106                return -ENODEV;
1107#else
1108                pr_info("PNP: No PS/2 controller found.\n");
1109                if (x86_platform.legacy.i8042 !=
1110                                X86_LEGACY_I8042_EXPECTED_PRESENT)
1111                        return -ENODEV;
1112                pr_info("Probing ports directly.\n");
1113                return 0;
1114#endif
1115        }
1116
1117        if (i8042_pnp_kbd_devices)
1118                snprintf(kbd_irq_str, sizeof(kbd_irq_str),
1119                        "%d", i8042_pnp_kbd_irq);
1120        if (i8042_pnp_aux_devices)
1121                snprintf(aux_irq_str, sizeof(aux_irq_str),
1122                        "%d", i8042_pnp_aux_irq);
1123
1124        pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
1125                i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1126                i8042_pnp_aux_name,
1127                i8042_pnp_data_reg, i8042_pnp_command_reg,
1128                kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
1129                aux_irq_str);
1130
1131#if defined(__ia64__)
1132        if (!i8042_pnp_kbd_devices)
1133                i8042_nokbd = true;
1134        if (!i8042_pnp_aux_devices)
1135                i8042_noaux = true;
1136#endif
1137
1138        if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
1139              i8042_pnp_data_reg != i8042_data_reg) ||
1140            !i8042_pnp_data_reg) {
1141                pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
1142                        i8042_pnp_data_reg, i8042_data_reg);
1143                i8042_pnp_data_reg = i8042_data_reg;
1144                pnp_data_busted = true;
1145        }
1146
1147        if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
1148              i8042_pnp_command_reg != i8042_command_reg) ||
1149            !i8042_pnp_command_reg) {
1150                pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n",
1151                        i8042_pnp_command_reg, i8042_command_reg);
1152                i8042_pnp_command_reg = i8042_command_reg;
1153                pnp_data_busted = true;
1154        }
1155
1156        if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
1157                pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n",
1158                        i8042_kbd_irq);
1159                i8042_pnp_kbd_irq = i8042_kbd_irq;
1160                pnp_data_busted = true;
1161        }
1162
1163        if (!i8042_noaux && !i8042_pnp_aux_irq) {
1164                if (!pnp_data_busted && i8042_pnp_kbd_irq) {
1165                        pr_warn("PNP: PS/2 appears to have AUX port disabled, "
1166                                "if this is incorrect please boot with i8042.nopnp\n");
1167                        i8042_noaux = true;
1168                } else {
1169                        pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n",
1170                                i8042_aux_irq);
1171                        i8042_pnp_aux_irq = i8042_aux_irq;
1172                }
1173        }
1174
1175        i8042_data_reg = i8042_pnp_data_reg;
1176        i8042_command_reg = i8042_pnp_command_reg;
1177        i8042_kbd_irq = i8042_pnp_kbd_irq;
1178        i8042_aux_irq = i8042_pnp_aux_irq;
1179
1180#ifdef CONFIG_X86
1181        i8042_bypass_aux_irq_test = !pnp_data_busted &&
1182                                    dmi_check_system(i8042_dmi_laptop_table);
1183#endif
1184
1185        return 0;
1186}
1187
1188#else  /* !CONFIG_PNP */
1189static inline int i8042_pnp_init(void) { return 0; }
1190static inline void i8042_pnp_exit(void) { }
1191#endif /* CONFIG_PNP */
1192
1193static int __init i8042_platform_init(void)
1194{
1195        int retval;
1196
1197#ifdef CONFIG_X86
1198        u8 a20_on = 0xdf;
1199        /* Just return if platform does not have i8042 controller */
1200        if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT)
1201                return -ENODEV;
1202#endif
1203
1204/*
1205 * On ix86 platforms touching the i8042 data register region can do really
1206 * bad things. Because of this the region is always reserved on ix86 boxes.
1207 *
1208 *      if (!request_region(I8042_DATA_REG, 16, "i8042"))
1209 *              return -EBUSY;
1210 */
1211
1212        i8042_kbd_irq = I8042_MAP_IRQ(1);
1213        i8042_aux_irq = I8042_MAP_IRQ(12);
1214
1215        retval = i8042_pnp_init();
1216        if (retval)
1217                return retval;
1218
1219#if defined(__ia64__)
1220        i8042_reset = I8042_RESET_ALWAYS;
1221#endif
1222
1223#ifdef CONFIG_X86
1224        /* Honor module parameter when value is not default */
1225        if (i8042_reset == I8042_RESET_DEFAULT) {
1226                if (dmi_check_system(i8042_dmi_reset_table))
1227                        i8042_reset = I8042_RESET_ALWAYS;
1228
1229                if (dmi_check_system(i8042_dmi_noselftest_table))
1230                        i8042_reset = I8042_RESET_NEVER;
1231        }
1232
1233        if (dmi_check_system(i8042_dmi_noloop_table))
1234                i8042_noloop = true;
1235
1236        if (dmi_check_system(i8042_dmi_nomux_table))
1237                i8042_nomux = true;
1238
1239        if (dmi_check_system(i8042_dmi_forcemux_table))
1240                i8042_nomux = false;
1241
1242        if (dmi_check_system(i8042_dmi_notimeout_table))
1243                i8042_notimeout = true;
1244
1245        if (dmi_check_system(i8042_dmi_dritek_table))
1246                i8042_dritek = true;
1247
1248        if (dmi_check_system(i8042_dmi_kbdreset_table))
1249                i8042_kbdreset = true;
1250
1251        /*
1252         * A20 was already enabled during early kernel init. But some buggy
1253         * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
1254         * resume from S3. So we do it here and hope that nothing breaks.
1255         */
1256        i8042_command(&a20_on, 0x10d1);
1257        i8042_command(NULL, 0x00ff);    /* Null command for SMM firmware */
1258#endif /* CONFIG_X86 */
1259
1260        return retval;
1261}
1262
1263static inline void i8042_platform_exit(void)
1264{
1265        i8042_pnp_exit();
1266}
1267
1268#endif /* _I8042_X86IA64IO_H */
1269