Skip to content

Commit fe2861b

Browse files
tmlemankartben
authored andcommitted
dai: intel: ssp: Refactor power management initialization
This patch refactors the power management initialization for the SSP driver across ACE15, ACE20, and ACE30 generations to align with the recommended practices outlined in the documentation. The changes include: 1. Replacing the conditional initialization of power management state with a call to `pm_device_driver_init` in the `ssp_init` function. 2. Adding the `zephyr,pm-device-runtime-auto` property to the SSP nodes in the device tree files for ACE15, ACE20, and ACE30. 3. Moving the power domain assignment for the SSP device in the device tree. The previous configuration resulted in the device not being under any power domain and being initialized as always ON. These changes ensure that the SSP driver is initialized with the appropriate power management state and that runtime power management is automatically enabled based on the device tree configuration. The functionality of the power management state remains unchanged, ensuring consistent behavior. Signed-off-by: Tomasz Leman <[email protected]>
1 parent 618e83e commit fe2861b

File tree

5 files changed

+109
-20
lines changed

5 files changed

+109
-20
lines changed

drivers/dai/intel/ssp/ssp.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,14 +2663,7 @@ static int dai_intel_ssp_init_device(const struct device *dev)
26632663
static int ssp_init(const struct device *dev)
26642664
{
26652665
dai_intel_ssp_init_device(dev);
2666-
2667-
if (pm_device_on_power_domain(dev)) {
2668-
pm_device_init_off(dev);
2669-
} else {
2670-
pm_device_init_suspended(dev);
2671-
}
2672-
2673-
return pm_device_runtime_enable(dev);
2666+
return pm_device_driver_init(dev, ssp_pm_action);
26742667
}
26752668

26762669
static int dai_ssp_dma_control_set(const struct device *dev,

dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,13 @@
292292
dmas = <&lpgpdma0 2
293293
&lpgpdma0 3>;
294294
dma-names = "tx", "rx";
295-
power-domains = <&io0_domain>;
296295
ssp-index = <0>;
297296
status = "okay";
298297

299298
ssp00: ssp@0 {
300299
compatible = "intel,ssp-dai";
300+
power-domains = <&io0_domain>;
301+
zephyr,pm-device-runtime-auto;
301302
status = "okay";
302303
reg = <0x0>;
303304
};
@@ -314,12 +315,13 @@
314315
dmas = <&lpgpdma0 4
315316
&lpgpdma0 5>;
316317
dma-names = "tx", "rx";
317-
power-domains = <&io0_domain>;
318318
ssp-index = <1>;
319319
status = "okay";
320320

321321
ssp10: ssp@10 {
322322
compatible = "intel,ssp-dai";
323+
power-domains = <&io0_domain>;
324+
zephyr,pm-device-runtime-auto;
323325
status = "okay";
324326
reg = <0x10>;
325327
};
@@ -336,12 +338,13 @@
336338
dmas = <&lpgpdma0 6
337339
&lpgpdma0 7>;
338340
dma-names = "tx", "rx";
339-
power-domains = <&io0_domain>;
340341
ssp-index = <2>;
341342
status = "okay";
342343

343344
ssp20: ssp@20 {
344345
compatible = "intel,ssp-dai";
346+
power-domains = <&io0_domain>;
347+
zephyr,pm-device-runtime-auto;
345348
status = "okay";
346349
reg = <0x20>;
347350
};

dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,13 @@
222222
dmas = <&hda_link_out 1
223223
&hda_link_in 1>;
224224
dma-names = "tx", "rx";
225-
power-domains = <&io0_domain>;
226225
ssp-index = <0>;
227226
status = "okay";
228227

229228
ssp00: ssp@0 {
230229
compatible = "intel,ssp-dai";
230+
power-domains = <&io0_domain>;
231+
zephyr,pm-device-runtime-auto;
231232
status = "okay";
232233
reg = <0x0>;
233234
};
@@ -245,12 +246,13 @@
245246
dmas = <&hda_link_out 2
246247
&hda_link_in 2>;
247248
dma-names = "tx", "rx";
248-
power-domains = <&io0_domain>;
249249
ssp-index = <1>;
250250
status = "okay";
251251

252252
ssp10: ssp@10 {
253253
compatible = "intel,ssp-dai";
254+
power-domains = <&io0_domain>;
255+
zephyr,pm-device-runtime-auto;
254256
status = "okay";
255257
reg = <0x10>;
256258
};
@@ -268,12 +270,13 @@
268270
dmas = <&hda_link_out 3
269271
&hda_link_in 3>;
270272
dma-names = "tx", "rx";
271-
power-domains = <&io0_domain>;
272273
ssp-index = <2>;
273274
status = "okay";
274275

275276
ssp20: ssp@20 {
276277
compatible = "intel,ssp-dai";
278+
power-domains = <&io0_domain>;
279+
zephyr,pm-device-runtime-auto;
277280
status = "okay";
278281
reg = <0x20>;
279282
};

dts/xtensa/intel/intel_adsp_ace30.dtsi

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,53 +214,68 @@
214214
&hda_link_in 1>;
215215
dma-names = "tx", "rx";
216216
ssp-index = <0>;
217-
power-domains = <&io0_domain>;
218217
status = "okay";
219218

220219
ssp00: ssp@0 {
221220
compatible = "intel,ssp-dai";
221+
power-domains = <&io0_domain>;
222+
zephyr,pm-device-runtime-auto;
222223
reg = <0x0>;
223224
status = "okay";
224225
};
225226

226227
ssp01: ssp@1 {
227228
compatible = "intel,ssp-dai";
229+
power-domains = <&io0_domain>;
230+
zephyr,pm-device-runtime-auto;
228231
reg = <0x1>;
229232
status = "okay";
230233
};
231234

232235
ssp02: ssp@2 {
233236
compatible = "intel,ssp-dai";
237+
power-domains = <&io0_domain>;
238+
zephyr,pm-device-runtime-auto;
234239
reg = <0x2>;
235240
status = "okay";
236241
};
237242

238243
ssp03: ssp@3 {
239244
compatible = "intel,ssp-dai";
245+
power-domains = <&io0_domain>;
246+
zephyr,pm-device-runtime-auto;
240247
reg = <0x3>;
241248
status = "okay";
242249
};
243250

244251
ssp04: ssp@4 {
245252
compatible = "intel,ssp-dai";
253+
power-domains = <&io0_domain>;
254+
zephyr,pm-device-runtime-auto;
246255
reg = <0x4>;
247256
status = "okay";
248257
};
249258

250259
ssp05: ssp@5 {
251260
compatible = "intel,ssp-dai";
261+
power-domains = <&io0_domain>;
262+
zephyr,pm-device-runtime-auto;
252263
reg = <0x5>;
253264
status = "okay";
254265
};
255266

256267
ssp06: ssp@6 {
257268
compatible = "intel,ssp-dai";
269+
power-domains = <&io0_domain>;
270+
zephyr,pm-device-runtime-auto;
258271
reg = <0x6>;
259272
status = "okay";
260273
};
261274

262275
ssp07: ssp@7 {
263276
compatible = "intel,ssp-dai";
277+
power-domains = <&io0_domain>;
278+
zephyr,pm-device-runtime-auto;
264279
reg = <0x7>;
265280
status = "okay";
266281
};
@@ -279,53 +294,68 @@
279294
&hda_link_in 2>;
280295
dma-names = "tx", "rx";
281296
ssp-index = <1>;
282-
power-domains = <&io0_domain>;
283297
status = "okay";
284298

285299
ssp10: ssp@10 {
286300
compatible = "intel,ssp-dai";
301+
power-domains = <&io0_domain>;
302+
zephyr,pm-device-runtime-auto;
287303
reg = <0x10>;
288304
status = "okay";
289305
};
290306

291307
ssp11: ssp@11 {
292308
compatible = "intel,ssp-dai";
309+
power-domains = <&io0_domain>;
310+
zephyr,pm-device-runtime-auto;
293311
reg = <0x11>;
294312
status = "okay";
295313
};
296314

297315
ssp12: ssp@12 {
298316
compatible = "intel,ssp-dai";
317+
power-domains = <&io0_domain>;
318+
zephyr,pm-device-runtime-auto;
299319
reg = <0x12>;
300320
status = "okay";
301321
};
302322

303323
ssp13: ssp@13 {
304324
compatible = "intel,ssp-dai";
325+
power-domains = <&io0_domain>;
326+
zephyr,pm-device-runtime-auto;
305327
reg = <0x13>;
306328
status = "okay";
307329
};
308330

309331
ssp14: ssp@14 {
310332
compatible = "intel,ssp-dai";
333+
power-domains = <&io0_domain>;
334+
zephyr,pm-device-runtime-auto;
311335
reg = <0x14>;
312336
status = "okay";
313337
};
314338

315339
ssp15: ssp@15 {
316340
compatible = "intel,ssp-dai";
341+
power-domains = <&io0_domain>;
342+
zephyr,pm-device-runtime-auto;
317343
reg = <0x15>;
318344
status = "okay";
319345
};
320346

321347
ssp16: ssp@16 {
322348
compatible = "intel,ssp-dai";
349+
power-domains = <&io0_domain>;
350+
zephyr,pm-device-runtime-auto;
323351
reg = <0x16>;
324352
status = "okay";
325353
};
326354

327355
ssp17: ssp@17 {
328356
compatible = "intel,ssp-dai";
357+
power-domains = <&io0_domain>;
358+
zephyr,pm-device-runtime-auto;
329359
reg = <0x17>;
330360
status = "okay";
331361
};
@@ -344,53 +374,68 @@
344374
&hda_link_in 3>;
345375
dma-names = "tx", "rx";
346376
ssp-index = <2>;
347-
power-domains = <&io0_domain>;
348377
status = "okay";
349378

350379
ssp20: ssp@20 {
351380
compatible = "intel,ssp-dai";
381+
power-domains = <&io0_domain>;
382+
zephyr,pm-device-runtime-auto;
352383
reg = <0x20>;
353384
status = "okay";
354385
};
355386

356387
ssp21: ssp@21 {
357388
compatible = "intel,ssp-dai";
389+
power-domains = <&io0_domain>;
390+
zephyr,pm-device-runtime-auto;
358391
reg = <0x21>;
359392
status = "okay";
360393
};
361394

362395
ssp22: ssp@22 {
363396
compatible = "intel,ssp-dai";
397+
power-domains = <&io0_domain>;
398+
zephyr,pm-device-runtime-auto;
364399
reg = <0x22>;
365400
status = "okay";
366401
};
367402

368403
ssp23: ssp@23 {
369404
compatible = "intel,ssp-dai";
405+
power-domains = <&io0_domain>;
406+
zephyr,pm-device-runtime-auto;
370407
reg = <0x23>;
371408
status = "okay";
372409
};
373410

374411
ssp24: ssp@24 {
375412
compatible = "intel,ssp-dai";
413+
power-domains = <&io0_domain>;
414+
zephyr,pm-device-runtime-auto;
376415
reg = <0x24>;
377416
status = "okay";
378417
};
379418

380419
ssp25: ssp@25 {
381420
compatible = "intel,ssp-dai";
421+
power-domains = <&io0_domain>;
422+
zephyr,pm-device-runtime-auto;
382423
reg = <0x25>;
383424
status = "okay";
384425
};
385426

386427
ssp26: ssp@26 {
387428
compatible = "intel,ssp-dai";
429+
power-domains = <&io0_domain>;
430+
zephyr,pm-device-runtime-auto;
388431
reg = <0x26>;
389432
status = "okay";
390433
};
391434

392435
ssp27: ssp@27 {
393436
compatible = "intel,ssp-dai";
437+
power-domains = <&io0_domain>;
438+
zephyr,pm-device-runtime-auto;
394439
reg = <0x27>;
395440
status = "okay";
396441
};

0 commit comments

Comments
 (0)