hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/platform/x86/pmc_atom.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel Atom SOC Power Management Controller Driver
34 * Copyright (c) 2014, Intel Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
145 */
156
167 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -253,7 +244,7 @@
253244 pm1_cnt_port = acpi_base_addr + PM1_CNT;
254245
255246 pm1_cnt_value = inl(pm1_cnt_port);
256
- pm1_cnt_value &= SLEEP_TYPE_MASK;
247
+ pm1_cnt_value &= ~SLEEP_TYPE_MASK;
257248 pm1_cnt_value |= SLEEP_TYPE_S5;
258249 pm1_cnt_value |= SLEEP_ENABLE;
259250
....@@ -350,45 +341,24 @@
350341
351342 DEFINE_SHOW_ATTRIBUTE(pmc_sleep_tmr);
352343
353
-static void pmc_dbgfs_unregister(struct pmc_dev *pmc)
344
+static void pmc_dbgfs_register(struct pmc_dev *pmc)
354345 {
355
- debugfs_remove_recursive(pmc->dbgfs_dir);
356
-}
357
-
358
-static int pmc_dbgfs_register(struct pmc_dev *pmc)
359
-{
360
- struct dentry *dir, *f;
346
+ struct dentry *dir;
361347
362348 dir = debugfs_create_dir("pmc_atom", NULL);
363
- if (!dir)
364
- return -ENOMEM;
365349
366350 pmc->dbgfs_dir = dir;
367351
368
- f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO,
369
- dir, pmc, &pmc_dev_state_fops);
370
- if (!f)
371
- goto err;
372
-
373
- f = debugfs_create_file("pss_state", S_IFREG | S_IRUGO,
374
- dir, pmc, &pmc_pss_state_fops);
375
- if (!f)
376
- goto err;
377
-
378
- f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO,
379
- dir, pmc, &pmc_sleep_tmr_fops);
380
- if (!f)
381
- goto err;
382
-
383
- return 0;
384
-err:
385
- pmc_dbgfs_unregister(pmc);
386
- return -ENODEV;
352
+ debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc,
353
+ &pmc_dev_state_fops);
354
+ debugfs_create_file("pss_state", S_IFREG | S_IRUGO, dir, pmc,
355
+ &pmc_pss_state_fops);
356
+ debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, dir, pmc,
357
+ &pmc_sleep_tmr_fops);
387358 }
388359 #else
389
-static int pmc_dbgfs_register(struct pmc_dev *pmc)
360
+static void pmc_dbgfs_register(struct pmc_dev *pmc)
390361 {
391
- return 0;
392362 }
393363 #endif /* CONFIG_DEBUG_FS */
394364
....@@ -434,6 +404,13 @@
434404 .matches = {
435405 DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"),
436406 DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"),
407
+ },
408
+ },
409
+ {
410
+ .ident = "SIMATIC IPC277E",
411
+ .matches = {
412
+ DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"),
413
+ DMI_MATCH(DMI_PRODUCT_VERSION, "6AV7882-0"),
437414 },
438415 },
439416 {
....@@ -496,7 +473,7 @@
496473 pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr);
497474 pmc->base_addr &= PMC_BASE_ADDR_MASK;
498475
499
- pmc->regmap = ioremap_nocache(pmc->base_addr, PMC_MMIO_REG_LEN);
476
+ pmc->regmap = ioremap(pmc->base_addr, PMC_MMIO_REG_LEN);
500477 if (!pmc->regmap) {
501478 dev_err(&pdev->dev, "error: ioremap failed\n");
502479 return -ENOMEM;
....@@ -507,9 +484,7 @@
507484 /* PMC hardware registers setup */
508485 pmc_hw_reg_setup(pmc);
509486
510
- ret = pmc_dbgfs_register(pmc);
511
- if (ret)
512
- dev_warn(&pdev->dev, "debugfs register failed\n");
487
+ pmc_dbgfs_register(pmc);
513488
514489 /* Register platform clocks - PMC_PLT_CLK [0..5] */
515490 ret = pmc_setup_clks(pdev, pmc->regmap, data);