| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005, 2006 IBM Corporation |
|---|
| 3 | 4 | * Copyright (C) 2014, 2015 Intel Corporation |
|---|
| .. | .. |
|---|
| 13 | 14 | * |
|---|
| 14 | 15 | * This device driver implements the TPM interface as defined in |
|---|
| 15 | 16 | * the TCG TPM Interface Spec version 1.2, revision 1.0. |
|---|
| 16 | | - * |
|---|
| 17 | | - * This program is free software; you can redistribute it and/or |
|---|
| 18 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 19 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 20 | | - * License. |
|---|
| 21 | 17 | */ |
|---|
| 22 | 18 | #include <linux/init.h> |
|---|
| 23 | 19 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 87 | 83 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"), |
|---|
| 88 | 84 | }, |
|---|
| 89 | 85 | }, |
|---|
| 86 | + { |
|---|
| 87 | + .callback = tpm_tis_disable_irq, |
|---|
| 88 | + .ident = "ThinkStation P360 Tiny", |
|---|
| 89 | + .matches = { |
|---|
| 90 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 91 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkStation P360 Tiny"), |
|---|
| 92 | + }, |
|---|
| 93 | + }, |
|---|
| 94 | + { |
|---|
| 95 | + .callback = tpm_tis_disable_irq, |
|---|
| 96 | + .ident = "ThinkPad L490", |
|---|
| 97 | + .matches = { |
|---|
| 98 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 99 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L490"), |
|---|
| 100 | + }, |
|---|
| 101 | + }, |
|---|
| 90 | 102 | {} |
|---|
| 91 | 103 | }; |
|---|
| 92 | 104 | |
|---|
| .. | .. |
|---|
| 129 | 141 | const struct acpi_device_id *aid = acpi_match_device(tpm_acpi_tbl, dev); |
|---|
| 130 | 142 | struct acpi_table_tpm2 *tbl; |
|---|
| 131 | 143 | acpi_status st; |
|---|
| 144 | + int ret = 0; |
|---|
| 132 | 145 | |
|---|
| 133 | 146 | if (!aid || aid->driver_data != DEVICE_IS_TPM2) |
|---|
| 134 | 147 | return 0; |
|---|
| .. | .. |
|---|
| 136 | 149 | /* If the ACPI TPM2 signature is matched then a global ACPI_SIG_TPM2 |
|---|
| 137 | 150 | * table is mandatory |
|---|
| 138 | 151 | */ |
|---|
| 139 | | - st = |
|---|
| 140 | | - acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); |
|---|
| 152 | + st = acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); |
|---|
| 141 | 153 | if (ACPI_FAILURE(st) || tbl->header.length < sizeof(*tbl)) { |
|---|
| 142 | 154 | dev_err(dev, FW_BUG "failed to get TPM2 ACPI table\n"); |
|---|
| 143 | 155 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 145 | 157 | |
|---|
| 146 | 158 | /* The tpm2_crb driver handles this device */ |
|---|
| 147 | 159 | if (tbl->start_method != ACPI_TPM2_MEMORY_MAPPED) |
|---|
| 148 | | - return -ENODEV; |
|---|
| 160 | + ret = -ENODEV; |
|---|
| 149 | 161 | |
|---|
| 150 | | - return 0; |
|---|
| 162 | + acpi_put_table((struct acpi_table_header *)tbl); |
|---|
| 163 | + return ret; |
|---|
| 151 | 164 | } |
|---|
| 152 | 165 | #else |
|---|
| 153 | 166 | static int check_acpi_tpm2(struct device *dev) |
|---|
| .. | .. |
|---|
| 264 | 277 | return tpm_tis_init(&pnp_dev->dev, &tpm_info); |
|---|
| 265 | 278 | } |
|---|
| 266 | 279 | |
|---|
| 280 | +/* |
|---|
| 281 | + * There is a known bug caused by 93e1b7d42e1e ("[PATCH] tpm: add HID module |
|---|
| 282 | + * parameter"). This commit added IFX0102 device ID, which is also used by |
|---|
| 283 | + * tpm_infineon but ignored to add quirks to probe which driver ought to be |
|---|
| 284 | + * used. |
|---|
| 285 | + */ |
|---|
| 286 | + |
|---|
| 267 | 287 | static struct pnp_device_id tpm_pnp_tbl[] = { |
|---|
| 268 | 288 | {"PNP0C31", 0}, /* TPM */ |
|---|
| 269 | 289 | {"ATM1200", 0}, /* Atmel */ |
|---|
| .. | .. |
|---|
| 315 | 335 | } |
|---|
| 316 | 336 | tpm_info.res = *res; |
|---|
| 317 | 337 | |
|---|
| 318 | | - tpm_info.irq = platform_get_irq(pdev, 0); |
|---|
| 338 | + tpm_info.irq = platform_get_irq_optional(pdev, 0); |
|---|
| 319 | 339 | if (tpm_info.irq <= 0) { |
|---|
| 320 | 340 | if (pdev != force_pdev) |
|---|
| 321 | 341 | tpm_info.irq = -1; |
|---|