.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
---|
2 | 2 | /* |
---|
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. |
---|
6 | 6 | * |
---|
7 | 7 | * Copyright (C) 2018 Hans de Goede <hdegoede@redhat.com> |
---|
8 | 8 | * |
---|
.. | .. |
---|
36 | 36 | static int isp_set_power(struct pci_dev *dev, bool enable) |
---|
37 | 37 | { |
---|
38 | 38 | 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; |
---|
41 | 40 | |
---|
42 | 41 | /* Write to ISPSSPM0 bit[1:0] to power on/off the IUNIT */ |
---|
43 | 42 | iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, |
---|
.. | .. |
---|
45 | 44 | |
---|
46 | 45 | /* |
---|
47 | 46 | * There should be no IUNIT access while power-down is |
---|
48 | | - * in progress HW sighting: 4567865 |
---|
| 47 | + * in progress. HW sighting: 4567865. |
---|
49 | 48 | * Wait up to 50 ms for the IUNIT to shut down. |
---|
50 | 49 | * And we do the same for power on. |
---|
51 | 50 | */ |
---|
52 | 51 | timeout = jiffies + msecs_to_jiffies(50); |
---|
53 | | - while (1) { |
---|
| 52 | + do { |
---|
54 | 53 | u32 tmp; |
---|
55 | 54 | |
---|
56 | 55 | /* Wait until ISPSSPM0 bit[25:24] shows the right value */ |
---|
57 | 56 | iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, ISPSSPM0, &tmp); |
---|
58 | 57 | tmp = (tmp & ISPSSPM0_ISPSSS_MASK) >> ISPSSPM0_ISPSSS_OFFSET; |
---|
59 | 58 | if (tmp == val) |
---|
60 | | - break; |
---|
| 59 | + return 0; |
---|
61 | 60 | |
---|
62 | | - if (time_after(jiffies, timeout)) { |
---|
63 | | - dev_err(&dev->dev, "IUNIT power-%s timeout.\n", |
---|
64 | | - enable ? "on" : "off"); |
---|
65 | | - return -EBUSY; |
---|
66 | | - } |
---|
67 | 61 | usleep_range(1000, 2000); |
---|
68 | | - } |
---|
| 62 | + } while (time_before(jiffies, timeout)); |
---|
69 | 63 | |
---|
70 | | - return 0; |
---|
| 64 | + dev_err(&dev->dev, "IUNIT power-%s timeout.\n", enable ? "on" : "off"); |
---|
| 65 | + return -EBUSY; |
---|
71 | 66 | } |
---|
72 | 67 | |
---|
73 | 68 | static int isp_probe(struct pci_dev *dev, const struct pci_device_id *id) |
---|