History

Merge tag 'acpi-5.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki: "These add support for a new ACPI device configuration object called _DSC, fix some issues including one recent regression, add two new items to quirk lists and clean up assorted pieces of code. Specifics: - Add support for new ACPI device configuration object called _DSC ("Deepest State for Configuration") to allow certain devices to be probed without changing their power states, document it and make two drivers use it (Sakari Ailus, Rajmohan Mani). - Fix device wakeup power reference counting broken recently by mistake (Rafael Wysocki). - Drop unused symbol and macros depending on it from acgcc.h (Rafael Wysocki). - Add HP ZHAN 66 Pro to the "no EC wakeup" quirk list (Binbin Zhou). - Add Xiaomi Mi Pad 2 to the backlight quirk list and drop an unused piece of data from all of the list entries (Hans de Goede). - Fix register read accesses handling in the Intel PMIC operation region driver (Hans de Goede). - Clean up static variables initialization in the EC driver (wangzhitong)" * tag 'acpi-5.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Documentation: ACPI: Fix non-D0 probe _DSC object example ACPI: Drop ACPI_USE_BUILTIN_STDARG ifdef from acgcc.h ACPI: PM: Fix device wakeup power reference counting error ACPI: video: use platform backlight driver on Xiaomi Mi Pad 2 ACPI: video: Drop dmi_system_id.ident settings from video_detect_dmi_table[] ACPI: PMIC: Fix intel_pmic_regs_handler() read accesses ACPI: EC: Remove initialization of static variables to false ACPI: EC: Use ec_no_wakeup on HP ZHAN 66 Pro at24: Support probing while in non-zero ACPI D state media: i2c: imx319: Support device probe in non-zero ACPI D state ACPI: Add a convenience function to tell a device is in D0 state Documentation: ACPI: Document _DSC object usage for enum power state i2c: Allow an ACPI driver to manage the device's power state during probe ACPI: scan: Obtain device's desired enumeration power state

Linus Torvalds committed 5 years ago

Commit 285fc3d2 parents e68a7d3 314c6e216 files · +301 −129Browse files

Unified · Split

16 files
  1. Documentation/firmware-guide/acpi/index.rst +1 −0
  2. Documentation/firmware-guide/acpi/non-d0-probe.rst +78 −0
  3. drivers/acpi/device_pm.c +26 −0
  4. drivers/acpi/ec.c +9 −2
  5. drivers/acpi/pmic/intel_pmic.c +28 −23
  6. drivers/acpi/power.c +3 −5
  7. drivers/acpi/scan.c +4 −0
  8. drivers/acpi/video_detect.c +43 −35
  9. drivers/i2c/i2c-core-acpi.c +10 −0
  10. drivers/i2c/i2c-core-base.c +4 −3
  11. drivers/media/i2c/imx319.c +44 −30
  12. drivers/misc/eeprom/at24.c +27 −18
  13. include/acpi/acpi_bus.h +1 −0
  14. include/acpi/platform/acgcc.h +0 −13
  15. include/linux/acpi.h +5 −0
  16. include/linux/i2c.h +18 −0
Documentation/firmware-guide/acpi/index.rst+1−0
@@ -26,5 +26,6 @@ ACPI Support · 25 unmodified lines
26 acpi-lid26 acpi-lid
27 lpit27 lpit
28 video_extension28 video_extension
29 non-d0-probe
29 extcon-intel-int349630 extcon-intel-int3496
30 intel-pmc-mux31 intel-pmc-mux
Documentation/firmware-guide/acpi/non-d0-probe.rst+78−0
@@ -0,0 +1,78 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3========================================
4Probing devices in other D states than 0
5========================================
6
7Introduction
8============
9
10In some cases it may be preferred to leave certain devices powered off for the
11entire system bootup if powering on these devices has adverse side effects,
12beyond just powering on the said device.
13
14How it works
15============
16
17The _DSC (Device State for Configuration) object that evaluates to an integer
18may be used to tell Linux the highest allowed D state for a device during
19probe. The support for _DSC requires support from the kernel bus type if the
20bus driver normally sets the device in D0 state for probe.
21
22The downside of using _DSC is that as the device is not powered on, even if
23there's a problem with the device, the driver likely probes just fine but the
24first user will find out the device doesn't work, instead of a failure at probe
25time. This feature should thus be used sparingly.
26
27I²C
28---
29
30If an I²C driver indicates its support for this by setting the
31I2C_DRV_ACPI_WAIVE_D0_PROBE flag in struct i2c_driver.flags field and the
32_DSC object evaluates to integer higher than the D state of the device,
33the device will not be powered on (put in D0 state) for probe.
34
35D states
36--------
37
38The D states and thus also the allowed values for _DSC are listed below. Refer
39to [1] for more information on device power states.
40
41.. code-block:: text
42
43 Number State Description
44 0 D0 Device fully powered on
45 1 D1
46 2 D2
47 3 D3hot
48 4 D3cold Off
49
50References
51==========
52
53[1] https://uefi.org/specifications/ACPI/6.4/02_Definition_of_Terms/Definition_of_Terms.html#device-power-state-definitions
54
55Example
56=======
57
58An ASL example describing an ACPI device using _DSC object to tell Operating
59System the device should remain powered off during probe looks like this. Some
60objects not relevant from the example point of view have been omitted.
61
62.. code-block:: text
63
64 Device (CAM0)
65 {
66 Name (_HID, "SONY319A")
67 Name (_UID, Zero)
68 Name (_CRS, ResourceTemplate ()
69 {
70 I2cSerialBus(0x0020, ControllerInitiated, 0x00061A80,
71 AddressingMode7Bit, "\\_SB.PCI0.I2C0",
72 0x00, ResourceConsumer)
73 })
74 Method (_DSC, 0, NotSerialized)
75 {
76 Return (0x4)
77 }
78 }
drivers/acpi/device_pm.c+26−0
@@ -1400,4 +1400,30 @@ bool acpi_storage_d3(struct device *dev) · 1399 unmodified lines
1400}1400}
1401EXPORT_SYMBOL_GPL(acpi_storage_d3);1401EXPORT_SYMBOL_GPL(acpi_storage_d3);
1402 1402
1403/**
1404 * acpi_dev_state_d0 - Tell if the device is in D0 power state
1405 * @dev: Physical device the ACPI power state of which to check
1406 *
1407 * On a system without ACPI, return true. On a system with ACPI, return true if
1408 * the current ACPI power state of the device is D0, or false otherwise.
1409 *
1410 * Note that the power state of a device is not well-defined after it has been
1411 * passed to acpi_device_set_power() and before that function returns, so it is
1412 * not valid to ask for the ACPI power state of the device in that time frame.
1413 *
1414 * This function is intended to be used in a driver's probe or remove
1415 * function. See Documentation/firmware-guide/acpi/low-power-probe.rst for
1416 * more information.
1417 */
1418bool acpi_dev_state_d0(struct device *dev)
1419{
1420 struct acpi_device *adev = ACPI_COMPANION(dev);
1421
1422 if (!adev)
1423 return true;
1424
1425 return adev->power.state == ACPI_STATE_D0;
1426}
1427EXPORT_SYMBOL_GPL(acpi_dev_state_d0);
1428
1403#endif /* CONFIG_PM */1429#endif /* CONFIG_PM */
drivers/acpi/ec.c+9−2
@@ -133,7 +133,7 @@ static unsigned int ec_storm_threshold __read_mostly = 8; · 132 unmodified lines
133module_param(ec_storm_threshold, uint, 0644);133module_param(ec_storm_threshold, uint, 0644);
134MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm");134MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm");
135 135
136static bool ec_freeze_events __read_mostly = false;136static bool ec_freeze_events __read_mostly;
137module_param(ec_freeze_events, bool, 0644);137module_param(ec_freeze_events, bool, 0644);
138MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume");138MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume");
139 139
@@ -177,7 +177,7 @@ struct acpi_ec *first_ec; · 37 unmodified lines
177EXPORT_SYMBOL(first_ec);177EXPORT_SYMBOL(first_ec);
178 178
179static struct acpi_ec *boot_ec;179static struct acpi_ec *boot_ec;
180static bool boot_ec_is_ecdt = false;180static bool boot_ec_is_ecdt;
181static struct workqueue_struct *ec_wq;181static struct workqueue_struct *ec_wq;
182static struct workqueue_struct *ec_query_wq;182static struct workqueue_struct *ec_query_wq;
183 183
@@ -2152,6 +2152,13 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = { · 1968 unmodified lines
2152 DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Yoga 3rd"),2152 DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Yoga 3rd"),
2153 },2153 },
2154 },2154 },
2155 {
2156 .ident = "HP ZHAN 66 Pro",
2157 .matches = {
2158 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
2159 DMI_MATCH(DMI_PRODUCT_FAMILY, "103C_5336AN HP ZHAN 66 Pro"),
2160 },
2161 },
2155 { },2162 { },
2156};2163};
2157 2164
drivers/acpi/pmic/intel_pmic.c+28−23
@@ -211,31 +211,36 @@ static acpi_status intel_pmic_regs_handler(u32 function, · 210 unmodified lines
211 void *handler_context, void *region_context)211 void *handler_context, void *region_context)
212{212{
213 struct intel_pmic_opregion *opregion = region_context;213 struct intel_pmic_opregion *opregion = region_context;
214 int result = 0;214 int result = -EINVAL;
215
216 if (function == ACPI_WRITE) {
217 switch (address) {
218 case 0:
219 return AE_OK;
220 case 1:
221 opregion->ctx.addr |= (*value64 & 0xff) << 8;
222 return AE_OK;
223 case 2:
224 opregion->ctx.addr |= *value64 & 0xff;
225 return AE_OK;
226 case 3:
227 opregion->ctx.val = *value64 & 0xff;
228 return AE_OK;
229 case 4:
230 if (*value64) {
231 result = regmap_write(opregion->regmap, opregion->ctx.addr,
232 opregion->ctx.val);
233 } else {
234 result = regmap_read(opregion->regmap, opregion->ctx.addr,
235 &opregion->ctx.val);
236 }
237 opregion->ctx.addr = 0;
238 }
239 }
215 240
216 switch (address) {241 if (function == ACPI_READ && address == 3) {
217 case 0:242 *value64 = opregion->ctx.val;
218 return AE_OK;
219 case 1:
220 opregion->ctx.addr |= (*value64 & 0xff) << 8;
221 return AE_OK;
222 case 2:
223 opregion->ctx.addr |= *value64 & 0xff;
224 return AE_OK;243 return AE_OK;
225 case 3:
226 opregion->ctx.val = *value64 & 0xff;
227 return AE_OK;
228 case 4:
229 if (*value64) {
230 result = regmap_write(opregion->regmap, opregion->ctx.addr,
231 opregion->ctx.val);
232 } else {
233 result = regmap_read(opregion->regmap, opregion->ctx.addr,
234 &opregion->ctx.val);
235 if (result == 0)
236 *value64 = opregion->ctx.val;
237 }
238 memset(&opregion->ctx, 0x00, sizeof(opregion->ctx));
239 }244 }
240 245
241 if (result < 0) {246 if (result < 0) {
drivers/acpi/power.c+3−5
@@ -757,13 +757,11 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) · 756 unmodified lines
757 757
758 mutex_lock(&acpi_device_lock);758 mutex_lock(&acpi_device_lock);
759 759
760 if (dev->wakeup.prepare_count > 1) {760 /* Do nothing if wakeup power has not been enabled for this device. */
761 dev->wakeup.prepare_count--;761 if (dev->wakeup.prepare_count <= 0)
762 goto out;762 goto out;
763 }
764 763
765 /* Do nothing if wakeup power has not been enabled for this device. */764 if (--dev->wakeup.prepare_count > 0)
766 if (!dev->wakeup.prepare_count)
767 goto out;765 goto out;
768 766
769 err = acpi_device_sleep_wake(dev, 0, 0, 0);767 err = acpi_device_sleep_wake(dev, 0, 0, 0);
drivers/acpi/scan.c+4−0
@@ -1017,6 +1017,7 @@ static void acpi_bus_init_power_state(struct acpi_device *device, int state) · 1016 unmodified lines
1017 1017
1018static void acpi_bus_get_power_flags(struct acpi_device *device)1018static void acpi_bus_get_power_flags(struct acpi_device *device)
1019{1019{
1020 unsigned long long dsc = ACPI_STATE_D0;
1020 u32 i;1021 u32 i;
1021 1022
1022 /* Presence of _PS0|_PR0 indicates 'power manageable' */1023 /* Presence of _PS0|_PR0 indicates 'power manageable' */
@@ -1038,6 +1039,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) · 15 unmodified lines
1038 if (acpi_has_method(device->handle, "_DSW"))1039 if (acpi_has_method(device->handle, "_DSW"))
1039 device->power.flags.dsw_present = 1;1040 device->power.flags.dsw_present = 1;
1040 1041
1042 acpi_evaluate_integer(device->handle, "_DSC", NULL, &dsc);
1043 device->power.state_for_enumeration = dsc;
1044
1041 /*1045 /*
1042 * Enumerate supported power management states1046 * Enumerate supported power management states
1043 */1047 */
drivers/acpi/video_detect.c+43−35
@@ -115,7 +115,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 114 unmodified lines
115 */115 */
116 {116 {
117 .callback = video_detect_force_vendor,117 .callback = video_detect_force_vendor,
118 .ident = "X360",118 /* X360 */
119 .matches = {119 .matches = {
120 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),120 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
121 DMI_MATCH(DMI_PRODUCT_NAME, "X360"),121 DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
@@ -124,7 +124,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
124 },124 },
125 {125 {
126 .callback = video_detect_force_vendor,126 .callback = video_detect_force_vendor,
127 .ident = "Asus UL30VT",127 /* Asus UL30VT */
128 .matches = {128 .matches = {
129 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),129 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
130 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),130 DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"),
@@ -132,7 +132,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
132 },132 },
133 {133 {
134 .callback = video_detect_force_vendor,134 .callback = video_detect_force_vendor,
135 .ident = "Asus UL30A",135 /* Asus UL30A */
136 .matches = {136 .matches = {
137 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),137 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
138 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),138 DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
@@ -140,7 +140,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
140 },140 },
141 {141 {
142 .callback = video_detect_force_vendor,142 .callback = video_detect_force_vendor,
143 .ident = "GIGABYTE GB-BXBT-2807",143 /* GIGABYTE GB-BXBT-2807 */
144 .matches = {144 .matches = {
145 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),145 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
146 DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"),146 DMI_MATCH(DMI_PRODUCT_NAME, "GB-BXBT-2807"),
@@ -148,12 +148,20 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
148 },148 },
149 {149 {
150 .callback = video_detect_force_vendor,150 .callback = video_detect_force_vendor,
151 .ident = "Sony VPCEH3U1E",151 /* Sony VPCEH3U1E */
152 .matches = {152 .matches = {
153 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),153 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
154 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),154 DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),
155 },155 },
156 },156 },
157 {
158 .callback = video_detect_force_vendor,
159 /* Xiaomi Mi Pad 2 */
160 .matches = {
161 DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"),
162 DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
163 },
164 },
157 165
158 /*166 /*
159 * These models have a working acpi_video backlight control, and using167 * These models have a working acpi_video backlight control, and using
@@ -164,7 +172,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 4 unmodified lines
164 */172 */
165 {173 {
166 .callback = video_detect_force_video,174 .callback = video_detect_force_video,
167 .ident = "ThinkPad T420",175 /* ThinkPad T420 */
168 .matches = {176 .matches = {
169 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),177 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
170 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"),178 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"),
@@ -172,7 +180,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
172 },180 },
173 {181 {
174 .callback = video_detect_force_video,182 .callback = video_detect_force_video,
175 .ident = "ThinkPad T520",183 /* ThinkPad T520 */
176 .matches = {184 .matches = {
177 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),185 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
178 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"),186 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"),
@@ -180,7 +188,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
180 },188 },
181 {189 {
182 .callback = video_detect_force_video,190 .callback = video_detect_force_video,
183 .ident = "ThinkPad X201s",191 /* ThinkPad X201s */
184 .matches = {192 .matches = {
185 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),193 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
186 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),194 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"),
@@ -188,7 +196,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
188 },196 },
189 {197 {
190 .callback = video_detect_force_video,198 .callback = video_detect_force_video,
191 .ident = "ThinkPad X201T",199 /* ThinkPad X201T */
192 .matches = {200 .matches = {
193 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),201 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
194 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),202 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201T"),
@@ -199,7 +207,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 4 unmodified lines
199 {207 {
200 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */208 /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */
201 .callback = video_detect_force_video,209 .callback = video_detect_force_video,
202 .ident = "HP ENVY 15 Notebook",210 /* HP ENVY 15 Notebook */
203 .matches = {211 .matches = {
204 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),212 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
205 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),213 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"),
@@ -207,7 +215,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
207 },215 },
208 {216 {
209 .callback = video_detect_force_video,217 .callback = video_detect_force_video,
210 .ident = "SAMSUNG 870Z5E/880Z5E/680Z5E",218 /* SAMSUNG 870Z5E/880Z5E/680Z5E */
211 .matches = {219 .matches = {
212 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),220 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
213 DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"),221 DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"),
@@ -215,7 +223,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
215 },223 },
216 {224 {
217 .callback = video_detect_force_video,225 .callback = video_detect_force_video,
218 .ident = "SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V",226 /* SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V */
219 .matches = {227 .matches = {
220 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),228 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
221 DMI_MATCH(DMI_PRODUCT_NAME,229 DMI_MATCH(DMI_PRODUCT_NAME,
@@ -225,7 +233,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 3 unmodified lines
225 {233 {
226 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */234 /* https://bugzilla.redhat.com/show_bug.cgi?id=1186097 */
227 .callback = video_detect_force_video,235 .callback = video_detect_force_video,
228 .ident = "SAMSUNG 3570R/370R/470R/450R/510R/4450RV",236 /* SAMSUNG 3570R/370R/470R/450R/510R/4450RV */
229 .matches = {237 .matches = {
230 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),238 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
231 DMI_MATCH(DMI_PRODUCT_NAME,239 DMI_MATCH(DMI_PRODUCT_NAME,
@@ -235,7 +243,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 3 unmodified lines
235 {243 {
236 /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */244 /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */
237 .callback = video_detect_force_video,245 .callback = video_detect_force_video,
238 .ident = "SAMSUNG 670Z5E",246 /* SAMSUNG 670Z5E */
239 .matches = {247 .matches = {
240 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),248 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
241 DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"),249 DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"),
@@ -244,7 +252,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
244 {252 {
245 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */253 /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
246 .callback = video_detect_force_video,254 .callback = video_detect_force_video,
247 .ident = "SAMSUNG 730U3E/740U3E",255 /* SAMSUNG 730U3E/740U3E */
248 .matches = {256 .matches = {
249 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),257 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
250 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),258 DMI_MATCH(DMI_PRODUCT_NAME, "730U3E/740U3E"),
@@ -253,7 +261,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
253 {261 {
254 /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */262 /* https://bugs.freedesktop.org/show_bug.cgi?id=87286 */
255 .callback = video_detect_force_video,263 .callback = video_detect_force_video,
256 .ident = "SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D",264 /* SAMSUNG 900X3C/900X3D/900X3E/900X4C/900X4D */
257 .matches = {265 .matches = {
258 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),266 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
259 DMI_MATCH(DMI_PRODUCT_NAME,267 DMI_MATCH(DMI_PRODUCT_NAME,
@@ -263,7 +271,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 3 unmodified lines
263 {271 {
264 /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */272 /* https://bugzilla.redhat.com/show_bug.cgi?id=1272633 */
265 .callback = video_detect_force_video,273 .callback = video_detect_force_video,
266 .ident = "Dell XPS14 L421X",274 /* Dell XPS14 L421X */
267 .matches = {275 .matches = {
268 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),276 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
269 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),277 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"),
@@ -272,7 +280,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
272 {280 {
273 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */281 /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */
274 .callback = video_detect_force_video,282 .callback = video_detect_force_video,
275 .ident = "Dell XPS15 L521X",283 /* Dell XPS15 L521X */
276 .matches = {284 .matches = {
277 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),285 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
278 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),286 DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
@@ -281,7 +289,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
281 {289 {
282 /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */290 /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */
283 .callback = video_detect_force_video,291 .callback = video_detect_force_video,
284 .ident = "SAMSUNG 530U4E/540U4E",292 /* SAMSUNG 530U4E/540U4E */
285 .matches = {293 .matches = {
286 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),294 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
287 DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"),295 DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"),
@@ -290,7 +298,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
290 /* https://bugs.launchpad.net/bugs/1894667 */298 /* https://bugs.launchpad.net/bugs/1894667 */
291 {299 {
292 .callback = video_detect_force_video,300 .callback = video_detect_force_video,
293 .ident = "HP 635 Notebook",301 /* HP 635 Notebook */
294 .matches = {302 .matches = {
295 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),303 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
296 DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"),304 DMI_MATCH(DMI_PRODUCT_NAME, "HP 635 Notebook PC"),
@@ -301,7 +309,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 4 unmodified lines
301 {309 {
302 /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */310 /* https://bugzilla.redhat.com/show_bug.cgi?id=1201530 */
303 .callback = video_detect_force_native,311 .callback = video_detect_force_native,
304 .ident = "Lenovo Ideapad S405",312 /* Lenovo Ideapad S405 */
305 .matches = {313 .matches = {
306 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),314 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
307 DMI_MATCH(DMI_BOARD_NAME, "Lenovo IdeaPad S405"),315 DMI_MATCH(DMI_BOARD_NAME, "Lenovo IdeaPad S405"),
@@ -310,7 +318,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
310 {318 {
311 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */319 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
312 .callback = video_detect_force_native,320 .callback = video_detect_force_native,
313 .ident = "Lenovo Ideapad Z570",321 /* Lenovo Ideapad Z570 */
314 .matches = {322 .matches = {
315 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),323 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
316 DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),324 DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),
@@ -318,7 +326,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
318 },326 },
319 {327 {
320 .callback = video_detect_force_native,328 .callback = video_detect_force_native,
321 .ident = "Lenovo E41-25",329 /* Lenovo E41-25 */
322 .matches = {330 .matches = {
323 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),331 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
324 DMI_MATCH(DMI_PRODUCT_NAME, "81FS"),332 DMI_MATCH(DMI_PRODUCT_NAME, "81FS"),
@@ -326,7 +334,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
326 },334 },
327 {335 {
328 .callback = video_detect_force_native,336 .callback = video_detect_force_native,
329 .ident = "Lenovo E41-45",337 /* Lenovo E41-45 */
330 .matches = {338 .matches = {
331 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),339 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
332 DMI_MATCH(DMI_PRODUCT_NAME, "82BK"),340 DMI_MATCH(DMI_PRODUCT_NAME, "82BK"),
@@ -335,7 +343,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
335 {343 {
336 /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */344 /* https://bugzilla.redhat.com/show_bug.cgi?id=1217249 */
337 .callback = video_detect_force_native,345 .callback = video_detect_force_native,
338 .ident = "Apple MacBook Pro 12,1",346 /* Apple MacBook Pro 12,1 */
339 .matches = {347 .matches = {
340 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),348 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
341 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),349 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),
@@ -343,7 +351,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
343 },351 },
344 {352 {
345 .callback = video_detect_force_native,353 .callback = video_detect_force_native,
346 .ident = "Dell Vostro V131",354 /* Dell Vostro V131 */
347 .matches = {355 .matches = {
348 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),356 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
349 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),357 DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
@@ -352,7 +360,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
352 {360 {
353 /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */361 /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */
354 .callback = video_detect_force_native,362 .callback = video_detect_force_native,
355 .ident = "Dell XPS 17 L702X",363 /* Dell XPS 17 L702X */
356 .matches = {364 .matches = {
357 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),365 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
358 DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"),366 DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"),
@@ -360,7 +368,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
360 },368 },
361 {369 {
362 .callback = video_detect_force_native,370 .callback = video_detect_force_native,
363 .ident = "Dell Precision 7510",371 /* Dell Precision 7510 */
364 .matches = {372 .matches = {
365 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),373 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
366 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"),374 DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"),
@@ -368,7 +376,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
368 },376 },
369 {377 {
370 .callback = video_detect_force_native,378 .callback = video_detect_force_native,
371 .ident = "Acer Aspire 5738z",379 /* Acer Aspire 5738z */
372 .matches = {380 .matches = {
373 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),381 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
374 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),382 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
@@ -378,7 +386,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 3 unmodified lines
378 {386 {
379 /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */387 /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */
380 .callback = video_detect_force_native,388 .callback = video_detect_force_native,
381 .ident = "Acer TravelMate 5735Z",389 /* Acer TravelMate 5735Z */
382 .matches = {390 .matches = {
383 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),391 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
384 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"),392 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"),
@@ -387,7 +395,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 2 unmodified lines
387 },395 },
388 {396 {
389 .callback = video_detect_force_native,397 .callback = video_detect_force_native,
390 .ident = "ASUSTeK COMPUTER INC. GA401",398 /* ASUSTeK COMPUTER INC. GA401 */
391 .matches = {399 .matches = {
392 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),400 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
393 DMI_MATCH(DMI_PRODUCT_NAME, "GA401"),401 DMI_MATCH(DMI_PRODUCT_NAME, "GA401"),
@@ -395,7 +403,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
395 },403 },
396 {404 {
397 .callback = video_detect_force_native,405 .callback = video_detect_force_native,
398 .ident = "ASUSTeK COMPUTER INC. GA502",406 /* ASUSTeK COMPUTER INC. GA502 */
399 .matches = {407 .matches = {
400 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),408 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
401 DMI_MATCH(DMI_PRODUCT_NAME, "GA502"),409 DMI_MATCH(DMI_PRODUCT_NAME, "GA502"),
@@ -403,7 +411,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
403 },411 },
404 {412 {
405 .callback = video_detect_force_native,413 .callback = video_detect_force_native,
406 .ident = "ASUSTeK COMPUTER INC. GA503",414 /* ASUSTeK COMPUTER INC. GA503 */
407 .matches = {415 .matches = {
408 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),416 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
409 DMI_MATCH(DMI_PRODUCT_NAME, "GA503"),417 DMI_MATCH(DMI_PRODUCT_NAME, "GA503"),
@@ -416,7 +424,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 6 unmodified lines
416 */424 */
417 {425 {
418 .callback = video_detect_force_none,426 .callback = video_detect_force_none,
419 .ident = "Dell OptiPlex 9020M",427 /* Dell OptiPlex 9020M */
420 .matches = {428 .matches = {
421 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),429 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
422 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"),430 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"),
@@ -424,7 +432,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 1 unmodified line
424 },432 },
425 {433 {
426 .callback = video_detect_force_none,434 .callback = video_detect_force_none,
427 .ident = "MSI MS-7721",435 /* MSI MS-7721 */
428 .matches = {436 .matches = {
429 DMI_MATCH(DMI_SYS_VENDOR, "MSI"),437 DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
430 DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"),438 DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"),
drivers/i2c/i2c-core-acpi.c+10−0
@@ -522,6 +522,16 @@ struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, · 521 unmodified lines
522}522}
523EXPORT_SYMBOL_GPL(i2c_acpi_new_device);523EXPORT_SYMBOL_GPL(i2c_acpi_new_device);
524 524
525bool i2c_acpi_waive_d0_probe(struct device *dev)
526{
527 struct i2c_driver *driver = to_i2c_driver(dev->driver);
528 struct acpi_device *adev = ACPI_COMPANION(dev);
529
530 return driver->flags & I2C_DRV_ACPI_WAIVE_D0_PROBE &&
531 adev && adev->power.state_for_enumeration >= adev->power.state;
532}
533EXPORT_SYMBOL_GPL(i2c_acpi_waive_d0_probe);
534
525#ifdef CONFIG_ACPI_I2C_OPREGION535#ifdef CONFIG_ACPI_I2C_OPREGION
526static int acpi_gsb_i2c_read_bytes(struct i2c_client *client,536static int acpi_gsb_i2c_read_bytes(struct i2c_client *client,
527 u8 cmd, u8 *data, u8 data_len)537 u8 cmd, u8 *data, u8 data_len)
drivers/i2c/i2c-core-base.c+4−3
@@ -551,7 +551,8 @@ static int i2c_device_probe(struct device *dev) · 550 unmodified lines
551 if (status < 0)551 if (status < 0)
552 goto err_clear_wakeup_irq;552 goto err_clear_wakeup_irq;
553 553
554 status = dev_pm_domain_attach(&client->dev, true);554 status = dev_pm_domain_attach(&client->dev,
555 !i2c_acpi_waive_d0_probe(dev));
555 if (status)556 if (status)
556 goto err_clear_wakeup_irq;557 goto err_clear_wakeup_irq;
557 558
@@ -590,7 +591,7 @@ static int i2c_device_probe(struct device *dev) · 32 unmodified lines
590err_release_driver_resources:591err_release_driver_resources:
591 devres_release_group(&client->dev, client->devres_group_id);592 devres_release_group(&client->dev, client->devres_group_id);
592err_detach_pm_domain:593err_detach_pm_domain:
593 dev_pm_domain_detach(&client->dev, true);594 dev_pm_domain_detach(&client->dev, !i2c_acpi_waive_d0_probe(dev));
594err_clear_wakeup_irq:595err_clear_wakeup_irq:
595 dev_pm_clear_wake_irq(&client->dev);596 dev_pm_clear_wake_irq(&client->dev);
596 device_init_wakeup(&client->dev, false);597 device_init_wakeup(&client->dev, false);
@@ -621,7 +622,7 @@ static void i2c_device_remove(struct device *dev) · 24 unmodified lines
621 622
622 devres_release_group(&client->dev, client->devres_group_id);623 devres_release_group(&client->dev, client->devres_group_id);
623 624
624 dev_pm_domain_detach(&client->dev, true);625 dev_pm_domain_detach(&client->dev, !i2c_acpi_waive_d0_probe(dev));
625 if (!pm_runtime_status_suspended(&client->dev) && adap->bus_regulator)626 if (!pm_runtime_status_suspended(&client->dev) && adap->bus_regulator)
626 regulator_disable(adap->bus_regulator);627 regulator_disable(adap->bus_regulator);
627 628
drivers/media/i2c/imx319.c+44−30
@@ -140,6 +140,8 @@ struct imx319 { · 139 unmodified lines
140 140
141 /* Streaming on/off */141 /* Streaming on/off */
142 bool streaming;142 bool streaming;
143 /* True if the device has been identified */
144 bool identified;
143};145};
144 146
145static const struct imx319_reg imx319_global_regs[] = {147static const struct imx319_reg imx319_global_regs[] = {
@@ -2084,6 +2086,31 @@ imx319_set_pad_format(struct v4l2_subdev *sd, · 1938 unmodified lines
2084 return 0;2086 return 0;
2085}2087}
2086 2088
2089/* Verify chip ID */
2090static int imx319_identify_module(struct imx319 *imx319)
2091{
2092 struct i2c_client *client = v4l2_get_subdevdata(&imx319->sd);
2093 int ret;
2094 u32 val;
2095
2096 if (imx319->identified)
2097 return 0;
2098
2099 ret = imx319_read_reg(imx319, IMX319_REG_CHIP_ID, 2, &val);
2100 if (ret)
2101 return ret;
2102
2103 if (val != IMX319_CHIP_ID) {
2104 dev_err(&client->dev, "chip id mismatch: %x!=%x",
2105 IMX319_CHIP_ID, val);
2106 return -EIO;
2107 }
2108
2109 imx319->identified = true;
2110
2111 return 0;
2112}
2113
2087/* Start streaming */2114/* Start streaming */
2088static int imx319_start_streaming(struct imx319 *imx319)2115static int imx319_start_streaming(struct imx319 *imx319)
2089{2116{
@@ -2091,6 +2118,10 @@ static int imx319_start_streaming(struct imx319 *imx319) · 1 unmodified line
2091 const struct imx319_reg_list *reg_list;2118 const struct imx319_reg_list *reg_list;
2092 int ret;2119 int ret;
2093 2120
2121 ret = imx319_identify_module(imx319);
2122 if (ret)
2123 return ret;
2124
2094 /* Global Setting */2125 /* Global Setting */
2095 reg_list = &imx319_global_setting;2126 reg_list = &imx319_global_setting;
2096 ret = imx319_write_regs(imx319, reg_list->regs, reg_list->num_of_regs);2127 ret = imx319_write_regs(imx319, reg_list->regs, reg_list->num_of_regs);
@@ -2206,26 +2237,6 @@ error: · 109 unmodified lines
2206 return ret;2237 return ret;
2207}2238}
2208 2239
2209/* Verify chip ID */
2210static int imx319_identify_module(struct imx319 *imx319)
2211{
2212 struct i2c_client *client = v4l2_get_subdevdata(&imx319->sd);
2213 int ret;
2214 u32 val;
2215
2216 ret = imx319_read_reg(imx319, IMX319_REG_CHIP_ID, 2, &val);
2217 if (ret)
2218 return ret;
2219
2220 if (val != IMX319_CHIP_ID) {
2221 dev_err(&client->dev, "chip id mismatch: %x!=%x",
2222 IMX319_CHIP_ID, val);
2223 return -EIO;
2224 }
2225
2226 return 0;
2227}
2228
2229static const struct v4l2_subdev_core_ops imx319_subdev_core_ops = {2240static const struct v4l2_subdev_core_ops imx319_subdev_core_ops = {
2230 .subscribe_event = v4l2_ctrl_subdev_subscribe_event,2241 .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
2231 .unsubscribe_event = v4l2_event_subdev_unsubscribe,2242 .unsubscribe_event = v4l2_event_subdev_unsubscribe,
@@ -2420,6 +2431,7 @@ out_err: · 188 unmodified lines
2420static int imx319_probe(struct i2c_client *client)2431static int imx319_probe(struct i2c_client *client)
2421{2432{
2422 struct imx319 *imx319;2433 struct imx319 *imx319;
2434 bool full_power;
2423 int ret;2435 int ret;
2424 u32 i;2436 u32 i;
2425 2437
@@ -2432,11 +2444,14 @@ static int imx319_probe(struct i2c_client *client) · 6 unmodified lines
2432 /* Initialize subdev */2444 /* Initialize subdev */
2433 v4l2_i2c_subdev_init(&imx319->sd, client, &imx319_subdev_ops);2445 v4l2_i2c_subdev_init(&imx319->sd, client, &imx319_subdev_ops);
2434 2446
2435 /* Check module identity */2447 full_power = acpi_dev_state_d0(&client->dev);
2436 ret = imx319_identify_module(imx319);2448 if (full_power) {
2437 if (ret) {2449 /* Check module identity */
2438 dev_err(&client->dev, "failed to find sensor: %d", ret);2450 ret = imx319_identify_module(imx319);
2439 goto error_probe;2451 if (ret) {
2452 dev_err(&client->dev, "failed to find sensor: %d", ret);
2453 goto error_probe;
2454 }
2440 }2455 }
2441 2456
2442 imx319->hwcfg = imx319_get_hwcfg(&client->dev);2457 imx319->hwcfg = imx319_get_hwcfg(&client->dev);
@@ -2488,11 +2503,9 @@ static int imx319_probe(struct i2c_client *client) · 45 unmodified lines
2488 if (ret < 0)2503 if (ret < 0)
2489 goto error_media_entity;2504 goto error_media_entity;
2490 2505
2491 /*2506 /* Set the device's state to active if it's in D0 state. */
2492 * Device is already turned on by i2c-core with ACPI domain PM.2507 if (full_power)
2493 * Enable runtime PM and turn off the device.2508 pm_runtime_set_active(&client->dev);
2494 */
2495 pm_runtime_set_active(&client->dev);
2496 pm_runtime_enable(&client->dev);2509 pm_runtime_enable(&client->dev);
2497 pm_runtime_idle(&client->dev);2510 pm_runtime_idle(&client->dev);
2498 2511
@@ -2545,6 +2558,7 @@ static struct i2c_driver imx319_i2c_driver = { · 46 unmodified lines
2545 },2558 },
2546 .probe_new = imx319_probe,2559 .probe_new = imx319_probe,
2547 .remove = imx319_remove,2560 .remove = imx319_remove,
2561 .flags = I2C_DRV_ACPI_WAIVE_D0_PROBE,
2548};2562};
2549module_i2c_driver(imx319_i2c_driver);2563module_i2c_driver(imx319_i2c_driver);
2550 2564
drivers/misc/eeprom/at24.c+27−18
@@ -595,6 +595,7 @@ static int at24_probe(struct i2c_client *client) · 594 unmodified lines
595 bool i2c_fn_i2c, i2c_fn_block;595 bool i2c_fn_i2c, i2c_fn_block;
596 unsigned int i, num_addresses;596 unsigned int i, num_addresses;
597 struct at24_data *at24;597 struct at24_data *at24;
598 bool full_power;
598 struct regmap *regmap;599 struct regmap *regmap;
599 bool writable;600 bool writable;
600 u8 test_byte;601 u8 test_byte;
@@ -747,14 +748,16 @@ static int at24_probe(struct i2c_client *client) · 146 unmodified lines
747 748
748 i2c_set_clientdata(client, at24);749 i2c_set_clientdata(client, at24);
749 750
750 err = regulator_enable(at24->vcc_reg);751 full_power = acpi_dev_state_d0(&client->dev);
751 if (err) {752 if (full_power) {
752 dev_err(dev, "Failed to enable vcc regulator\n");753 err = regulator_enable(at24->vcc_reg);
753 return err;754 if (err) {
754 }755 dev_err(dev, "Failed to enable vcc regulator\n");
756 return err;
757 }
755 758
756 /* enable runtime pm */759 pm_runtime_set_active(dev);
757 pm_runtime_set_active(dev);760 }
758 pm_runtime_enable(dev);761 pm_runtime_enable(dev);
759 762
760 at24->nvmem = devm_nvmem_register(dev, &nvmem_config);763 at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
@@ -766,15 +769,18 @@ static int at24_probe(struct i2c_client *client) · 5 unmodified lines
766 }769 }
767 770
768 /*771 /*
769 * Perform a one-byte test read to verify that the772 * Perform a one-byte test read to verify that the chip is functional,
770 * chip is functional.773 * unless powering on the device is to be avoided during probe (i.e.
774 * it's powered off right now).
771 */775 */
772 err = at24_read(at24, 0, &test_byte, 1);776 if (full_power) {
773 if (err) {777 err = at24_read(at24, 0, &test_byte, 1);
774 pm_runtime_disable(dev);778 if (err) {
775 if (!pm_runtime_status_suspended(dev))779 pm_runtime_disable(dev);
776 regulator_disable(at24->vcc_reg);780 if (!pm_runtime_status_suspended(dev))
777 return -ENODEV;781 regulator_disable(at24->vcc_reg);
782 return -ENODEV;
783 }
778 }784 }
779 785
780 pm_runtime_idle(dev);786 pm_runtime_idle(dev);
@@ -794,9 +800,11 @@ static int at24_remove(struct i2c_client *client) · 13 unmodified lines
794 struct at24_data *at24 = i2c_get_clientdata(client);800 struct at24_data *at24 = i2c_get_clientdata(client);
795 801
796 pm_runtime_disable(&client->dev);802 pm_runtime_disable(&client->dev);
797 if (!pm_runtime_status_suspended(&client->dev))803 if (acpi_dev_state_d0(&client->dev)) {
798 regulator_disable(at24->vcc_reg);804 if (!pm_runtime_status_suspended(&client->dev))
799 pm_runtime_set_suspended(&client->dev);805 regulator_disable(at24->vcc_reg);
806 pm_runtime_set_suspended(&client->dev);
807 }
800 808
801 return 0;809 return 0;
802}810}
@@ -833,6 +841,7 @@ static struct i2c_driver at24_driver = { · 30 unmodified lines
833 .probe_new = at24_probe,841 .probe_new = at24_probe,
834 .remove = at24_remove,842 .remove = at24_remove,
835 .id_table = at24_ids,843 .id_table = at24_ids,
844 .flags = I2C_DRV_ACPI_WAIVE_D0_PROBE,
836};845};
837 846
838static int __init at24_init(void)847static int __init at24_init(void)
include/acpi/acpi_bus.h+1−0
@@ -278,6 +278,7 @@ struct acpi_device_power { · 277 unmodified lines
278 int state; /* Current state */278 int state; /* Current state */
279 struct acpi_device_power_flags flags;279 struct acpi_device_power_flags flags;
280 struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */280 struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */
281 u8 state_for_enumeration; /* Deepest power state for enumeration */
281};282};
282 283
283struct acpi_dep_data {284struct acpi_dep_data {
include/acpi/platform/acgcc.h+0−13
@@ -10,25 +10,12 @@ · 9 unmodified lines
10#ifndef __ACGCC_H__10#ifndef __ACGCC_H__
11#define __ACGCC_H__11#define __ACGCC_H__
12 12
13/*
14 * Use compiler specific <stdarg.h> is a good practice for even when
15 * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
16 */
17#ifndef va_arg13#ifndef va_arg
18#ifdef ACPI_USE_BUILTIN_STDARG
19typedef __builtin_va_list va_list;
20#define va_start(v, l) __builtin_va_start(v, l)
21#define va_end(v) __builtin_va_end(v)
22#define va_arg(v, l) __builtin_va_arg(v, l)
23#define va_copy(d, s) __builtin_va_copy(d, s)
24#else
25#ifdef __KERNEL__14#ifdef __KERNEL__
26#include <linux/stdarg.h>15#include <linux/stdarg.h>
27#else16#else
28/* Used to build acpi tools */
29#include <stdarg.h>17#include <stdarg.h>
30#endif /* __KERNEL__ */18#endif /* __KERNEL__ */
31#endif /* ACPI_USE_BUILTIN_STDARG */
32#endif /* ! va_arg */19#endif /* ! va_arg */
33 20
34#define ACPI_INLINE __inline__21#define ACPI_INLINE __inline__
include/linux/acpi.h+5−0
@@ -1014,6 +1014,7 @@ int acpi_subsys_runtime_suspend(struct device *dev); · 1013 unmodified lines
1014int acpi_subsys_runtime_resume(struct device *dev);1014int acpi_subsys_runtime_resume(struct device *dev);
1015int acpi_dev_pm_attach(struct device *dev, bool power_on);1015int acpi_dev_pm_attach(struct device *dev, bool power_on);
1016bool acpi_storage_d3(struct device *dev);1016bool acpi_storage_d3(struct device *dev);
1017bool acpi_dev_state_d0(struct device *dev);
1017#else1018#else
1018static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }1019static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
1019static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }1020static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
@@ -1025,6 +1026,10 @@ static inline bool acpi_storage_d3(struct device *dev) · 5 unmodified lines
1025{1026{
1026 return false;1027 return false;
1027}1028}
1029static inline bool acpi_dev_state_d0(struct device *dev)
1030{
1031 return true;
1032}
1028#endif1033#endif
1029 1034
1030#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)1035#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
include/linux/i2c.h+18−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11#define _LINUX_I2C_H11#define _LINUX_I2C_H
12 12
13#include <linux/acpi.h> /* for acpi_handle */13#include <linux/acpi.h> /* for acpi_handle */
14#include <linux/bits.h>
14#include <linux/mod_devicetable.h>15#include <linux/mod_devicetable.h>
15#include <linux/device.h> /* for struct device */16#include <linux/device.h> /* for struct device */
16#include <linux/sched.h> /* for completion */17#include <linux/sched.h> /* for completion */
@@ -222,6 +223,15 @@ enum i2c_alert_protocol { · 205 unmodified lines
222 I2C_PROTOCOL_SMBUS_HOST_NOTIFY,223 I2C_PROTOCOL_SMBUS_HOST_NOTIFY,
223};224};
224 225
226/**
227 * enum i2c_driver_flags - Flags for an I2C device driver
228 *
229 * @I2C_DRV_ACPI_WAIVE_D0_PROBE: Don't put the device in D0 state for probe
230 */
231enum i2c_driver_flags {
232 I2C_DRV_ACPI_WAIVE_D0_PROBE = BIT(0),
233};
234
225/**235/**
226 * struct i2c_driver - represent an I2C device driver236 * struct i2c_driver - represent an I2C device driver
227 * @class: What kind of i2c device we instantiate (for detect)237 * @class: What kind of i2c device we instantiate (for detect)
@@ -236,6 +246,7 @@ enum i2c_alert_protocol { · 8 unmodified lines
236 * @detect: Callback for device detection246 * @detect: Callback for device detection
237 * @address_list: The I2C addresses to probe (for detect)247 * @address_list: The I2C addresses to probe (for detect)
238 * @clients: List of detected clients we created (for i2c-core use only)248 * @clients: List of detected clients we created (for i2c-core use only)
249 * @flags: A bitmask of flags defined in &enum i2c_driver_flags
239 *250 *
240 * The driver.owner field should be set to the module owner of this driver.251 * The driver.owner field should be set to the module owner of this driver.
241 * The driver.name field should be set to the name of this driver.252 * The driver.name field should be set to the name of this driver.
@@ -294,6 +305,8 @@ struct i2c_driver { · 52 unmodified lines
294 int (*detect)(struct i2c_client *client, struct i2c_board_info *info);305 int (*detect)(struct i2c_client *client, struct i2c_board_info *info);
295 const unsigned short *address_list;306 const unsigned short *address_list;
296 struct list_head clients;307 struct list_head clients;
308
309 u32 flags;
297};310};
298#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)311#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
299 312
@@ -1015,6 +1028,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev); · 715 unmodified lines
1015struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,1028struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
1016 struct i2c_board_info *info);1029 struct i2c_board_info *info);
1017struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle);1030struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle);
1031bool i2c_acpi_waive_d0_probe(struct device *dev);
1018#else1032#else
1019static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,1033static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
1020 struct acpi_resource_i2c_serialbus **i2c)1034 struct acpi_resource_i2c_serialbus **i2c)
@@ -1038,6 +1052,10 @@ static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle ha · 17 unmodified lines
1038{1052{
1039 return NULL;1053 return NULL;
1040}1054}
1055static inline bool i2c_acpi_waive_d0_probe(struct device *dev)
1056{
1057 return false;
1058}
1041#endif /* CONFIG_ACPI */1059#endif /* CONFIG_ACPI */
1042 1060
1043#endif /* _LINUX_I2C_H */1061#endif /* _LINUX_I2C_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t