Skip to content

Commit 36e3b38

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel: add in-band wake callbacks in hw_ops
No functionality change, only add indirection for in-band wake management helpers. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Rander Wang <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 49c9ff4 commit 36e3b38

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

drivers/soundwire/intel.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,9 @@ const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops = {
14371437
.link_power_up = intel_link_power_up,
14381438
.link_power_down = intel_link_power_down,
14391439

1440+
.shim_check_wake = intel_shim_check_wake,
1441+
.shim_wake = intel_shim_wake,
1442+
14401443
.pre_bank_switch = intel_pre_bank_switch,
14411444
.post_bank_switch = intel_post_bank_switch,
14421445
};
@@ -1720,11 +1723,11 @@ int intel_link_process_wakeen_event(struct auxiliary_device *auxdev)
17201723
return 0;
17211724
}
17221725

1723-
if (!intel_shim_check_wake(sdw))
1726+
if (!sdw_intel_shim_check_wake(sdw))
17241727
return 0;
17251728

17261729
/* disable WAKEEN interrupt ASAP to prevent interrupt flood */
1727-
intel_shim_wake(sdw, false);
1730+
sdw_intel_shim_wake(sdw, false);
17281731

17291732
/*
17301733
* resume the Master, which will generate a bus reset and result in
@@ -1852,7 +1855,7 @@ static int __maybe_unused intel_suspend(struct device *dev)
18521855
*/
18531856
dev_err(dev, "%s: invalid config: parent is suspended\n", __func__);
18541857
} else {
1855-
intel_shim_wake(sdw, false);
1858+
sdw_intel_shim_wake(sdw, false);
18561859
}
18571860
}
18581861

@@ -1987,7 +1990,7 @@ static int __maybe_unused intel_resume_runtime(struct device *dev)
19871990
}
19881991

19891992
/* unconditionally disable WAKEEN interrupt */
1990-
intel_shim_wake(sdw, false);
1993+
sdw_intel_shim_wake(sdw, false);
19911994

19921995
clock_stop_quirks = sdw->link_res->clock_stop_quirks;
19931996

drivers/soundwire/intel.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,17 @@ static inline int sdw_intel_link_power_down(struct sdw_intel *sdw)
132132
return -ENOTSUPP;
133133
}
134134

135+
static inline int sdw_intel_shim_check_wake(struct sdw_intel *sdw)
136+
{
137+
if (SDW_INTEL_CHECK_OPS(sdw, shim_check_wake))
138+
return SDW_INTEL_OPS(sdw, shim_check_wake)(sdw);
139+
return -ENOTSUPP;
140+
}
141+
142+
static inline void sdw_intel_shim_wake(struct sdw_intel *sdw, bool wake_enable)
143+
{
144+
if (SDW_INTEL_CHECK_OPS(sdw, shim_wake))
145+
SDW_INTEL_OPS(sdw, shim_wake)(sdw, wake_enable);
146+
}
147+
135148
#endif /* __SDW_INTEL_LOCAL_H */

include/linux/soundwire/sdw_intel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ struct sdw_intel;
307307
* @stop_bus: stop all bus
308308
* @link_power_up: power-up using chip-specific helpers
309309
* @link_power_down: power-down with chip-specific helpers
310+
* @shim_check_wake: check if a wake was received
311+
* @shim_wake: enable/disable in-band wake management
310312
* @pre_bank_switch: helper for bus management
311313
* @post_bank_switch: helper for bus management
312314
*/
@@ -325,6 +327,9 @@ struct sdw_intel_hw_ops {
325327
int (*link_power_up)(struct sdw_intel *sdw);
326328
int (*link_power_down)(struct sdw_intel *sdw);
327329

330+
int (*shim_check_wake)(struct sdw_intel *sdw);
331+
void (*shim_wake)(struct sdw_intel *sdw, bool wake_enable);
332+
328333
int (*pre_bank_switch)(struct sdw_intel *sdw);
329334
int (*post_bank_switch)(struct sdw_intel *sdw);
330335
};

0 commit comments

Comments
 (0)