Skip to content

Commit fb2dc6a

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel: add debugfs callbacks in hw_ops
No functionality change, only add indirection for debugfs 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 b3ad31f commit fb2dc6a

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

drivers/soundwire/intel.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,9 @@ static int intel_stop_bus(struct sdw_intel *sdw, bool clock_stop)
14231423
}
14241424

14251425
const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops = {
1426+
.debugfs_init = intel_debugfs_init,
1427+
.debugfs_exit = intel_debugfs_exit,
1428+
14261429
.pre_bank_switch = intel_pre_bank_switch,
14271430
.post_bank_switch = intel_post_bank_switch,
14281431
};
@@ -1614,7 +1617,7 @@ int intel_link_startup(struct auxiliary_device *auxdev)
16141617
goto err_power_up;
16151618
}
16161619

1617-
intel_debugfs_init(sdw);
1620+
sdw_intel_debugfs_init(sdw);
16181621

16191622
/* start bus */
16201623
ret = intel_start_bus(sdw);
@@ -1685,7 +1688,7 @@ static void intel_link_remove(struct auxiliary_device *auxdev)
16851688
* SDW_INTEL_CLK_STOP_NOT_ALLOWED
16861689
*/
16871690
if (!bus->prop.hw_disabled) {
1688-
intel_debugfs_exit(sdw);
1691+
sdw_intel_debugfs_exit(sdw);
16891692
sdw_cdns_enable_interrupt(cdns, false);
16901693
}
16911694
sdw_bus_master_delete(bus);

drivers/soundwire/intel.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ struct sdw_intel_link_dev {
6161
#define auxiliary_dev_to_sdw_intel_link_dev(auxiliary_dev) \
6262
container_of(auxiliary_dev, struct sdw_intel_link_dev, auxdev)
6363

64+
#define SDW_INTEL_CHECK_OPS(sdw, cb) ((sdw) && (sdw)->link_res && (sdw)->link_res->hw_ops && \
65+
(sdw)->link_res->hw_ops->cb)
66+
#define SDW_INTEL_OPS(sdw, cb) ((sdw)->link_res->hw_ops->cb)
67+
68+
static inline void sdw_intel_debugfs_init(struct sdw_intel *sdw)
69+
{
70+
if (SDW_INTEL_CHECK_OPS(sdw, debugfs_init))
71+
SDW_INTEL_OPS(sdw, debugfs_init)(sdw);
72+
}
73+
74+
static inline void sdw_intel_debugfs_exit(struct sdw_intel *sdw)
75+
{
76+
if (SDW_INTEL_CHECK_OPS(sdw, debugfs_exit))
77+
SDW_INTEL_OPS(sdw, debugfs_exit)(sdw);
78+
}
79+
6480
#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
@@ -297,10 +297,15 @@ irqreturn_t sdw_intel_thread(int irq, void *dev_id);
297297
struct sdw_intel;
298298

299299
/* struct intel_sdw_hw_ops - SoundWire ops for Intel platforms.
300+
* @debugfs_init: initialize all debugfs capabilities
301+
* @debugfs_exit: close and cleanup debugfs capabilities
300302
* @pre_bank_switch: helper for bus management
301303
* @post_bank_switch: helper for bus management
302304
*/
303305
struct sdw_intel_hw_ops {
306+
void (*debugfs_init)(struct sdw_intel *sdw);
307+
void (*debugfs_exit)(struct sdw_intel *sdw);
308+
304309
int (*pre_bank_switch)(struct sdw_intel *sdw);
305310
int (*post_bank_switch)(struct sdw_intel *sdw);
306311
};

0 commit comments

Comments
 (0)