hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/platform/x86/intel_atomisp2_pm.c
....@@ -1,8 +1,8 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3
- * Dummy driver for Intel's Image Signal Processor found on Bay and Cherry
4
- * Trail devices. The sole purpose of this driver is to allow the ISP to
5
- * be put in D3.
3
+ * Dummy driver for Intel's Image Signal Processor found on Bay Trail
4
+ * and Cherry Trail devices. The sole purpose of this driver is to allow
5
+ * the ISP to be put in D3.
66 *
77 * Copyright (C) 2018 Hans de Goede <hdegoede@redhat.com>
88 *
....@@ -36,8 +36,7 @@
3636 static int isp_set_power(struct pci_dev *dev, bool enable)
3737 {
3838 unsigned long timeout;
39
- u32 val = enable ? ISPSSPM0_IUNIT_POWER_ON :
40
- ISPSSPM0_IUNIT_POWER_OFF;
39
+ u32 val = enable ? ISPSSPM0_IUNIT_POWER_ON : ISPSSPM0_IUNIT_POWER_OFF;
4140
4241 /* Write to ISPSSPM0 bit[1:0] to power on/off the IUNIT */
4342 iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0,
....@@ -45,29 +44,25 @@
4544
4645 /*
4746 * There should be no IUNIT access while power-down is
48
- * in progress HW sighting: 4567865
47
+ * in progress. HW sighting: 4567865.
4948 * Wait up to 50 ms for the IUNIT to shut down.
5049 * And we do the same for power on.
5150 */
5251 timeout = jiffies + msecs_to_jiffies(50);
53
- while (1) {
52
+ do {
5453 u32 tmp;
5554
5655 /* Wait until ISPSSPM0 bit[25:24] shows the right value */
5756 iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, &tmp);
5857 tmp = (tmp & ISPSSPM0_ISPSSS_MASK) >> ISPSSPM0_ISPSSS_OFFSET;
5958 if (tmp == val)
60
- break;
59
+ return 0;
6160
62
- if (time_after(jiffies, timeout)) {
63
- dev_err(&dev->dev, "IUNIT power-%s timeout.\n",
64
- enable ? "on" : "off");
65
- return -EBUSY;
66
- }
6761 usleep_range(1000, 2000);
68
- }
62
+ } while (time_before(jiffies, timeout));
6963
70
- return 0;
64
+ dev_err(&dev->dev, "IUNIT power-%s timeout.\n", enable ? "on" : "off");
65
+ return -EBUSY;
7166 }
7267
7368 static int isp_probe(struct pci_dev *dev, const struct pci_device_id *id)