@@ -119,50 +119,6 @@ static inline bool ish_should_leave_d0i3(struct pci_dev *pdev)
119
119
return !pm_resume_via_firmware () || pdev -> device == CHV_DEVICE_ID ;
120
120
}
121
121
122
- static int enable_gpe (struct device * dev )
123
- {
124
- #ifdef CONFIG_ACPI
125
- acpi_status acpi_sts ;
126
- struct acpi_device * adev ;
127
- struct acpi_device_wakeup * wakeup ;
128
-
129
- adev = ACPI_COMPANION (dev );
130
- if (!adev ) {
131
- dev_err (dev , "get acpi handle failed\n" );
132
- return - ENODEV ;
133
- }
134
- wakeup = & adev -> wakeup ;
135
-
136
- /*
137
- * Call acpi_disable_gpe(), so that reference count
138
- * gpe_event_info->runtime_count doesn't overflow.
139
- * When gpe_event_info->runtime_count = 0, the call
140
- * to acpi_disable_gpe() simply return.
141
- */
142
- acpi_disable_gpe (wakeup -> gpe_device , wakeup -> gpe_number );
143
-
144
- acpi_sts = acpi_enable_gpe (wakeup -> gpe_device , wakeup -> gpe_number );
145
- if (ACPI_FAILURE (acpi_sts )) {
146
- dev_err (dev , "enable ose_gpe failed\n" );
147
- return - EIO ;
148
- }
149
-
150
- return 0 ;
151
- #else
152
- return - ENODEV ;
153
- #endif
154
- }
155
-
156
- static void enable_pme_wake (struct pci_dev * pdev )
157
- {
158
- if ((pci_pme_capable (pdev , PCI_D0 ) ||
159
- pci_pme_capable (pdev , PCI_D3hot ) ||
160
- pci_pme_capable (pdev , PCI_D3cold )) && !enable_gpe (& pdev -> dev )) {
161
- pci_pme_active (pdev , true);
162
- dev_dbg (& pdev -> dev , "ish ipc driver pme wake enabled\n" );
163
- }
164
- }
165
-
166
122
/**
167
123
* ish_probe() - PCI driver probe callback
168
124
* @pdev: pci device
@@ -233,7 +189,7 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
233
189
234
190
/* Enable PME for EHL */
235
191
if (pdev -> device == EHL_Ax_DEVICE_ID )
236
- enable_pme_wake ( pdev );
192
+ device_init_wakeup ( dev , true );
237
193
238
194
ret = ish_init (ishtp );
239
195
if (ret )
@@ -256,6 +212,19 @@ static void ish_remove(struct pci_dev *pdev)
256
212
ish_device_disable (ishtp_dev );
257
213
}
258
214
215
+
216
+ /**
217
+ * ish_shutdown() - PCI driver shutdown callback
218
+ * @pdev: pci device
219
+ *
220
+ * This function sets up wakeup for S5
221
+ */
222
+ static void ish_shutdown (struct pci_dev * pdev )
223
+ {
224
+ if (pdev -> device == EHL_Ax_DEVICE_ID )
225
+ pci_prepare_to_sleep (pdev );
226
+ }
227
+
259
228
static struct device __maybe_unused * ish_resume_device ;
260
229
261
230
/* 50ms to get resume response */
@@ -378,13 +347,6 @@ static int __maybe_unused ish_resume(struct device *device)
378
347
struct pci_dev * pdev = to_pci_dev (device );
379
348
struct ishtp_device * dev = pci_get_drvdata (pdev );
380
349
381
- /* add this to finish power flow for EHL */
382
- if (dev -> pdev -> device == EHL_Ax_DEVICE_ID ) {
383
- pci_set_power_state (pdev , PCI_D0 );
384
- enable_pme_wake (pdev );
385
- dev_dbg (dev -> devc , "set power state to D0 for ehl\n" );
386
- }
387
-
388
350
ish_resume_device = device ;
389
351
dev -> resume_flag = 1 ;
390
352
@@ -400,6 +362,7 @@ static struct pci_driver ish_driver = {
400
362
.id_table = ish_pci_tbl ,
401
363
.probe = ish_probe ,
402
364
.remove = ish_remove ,
365
+ .shutdown = ish_shutdown ,
403
366
.driver .pm = & ish_pm_ops ,
404
367
};
405
368
0 commit comments