Commit ba98d7d8 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe

The workqueues are initialized in the io_init functions, which isn't
quite right. In some tests, this leads to warnings throw from
__queue_delayed_work()

WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn);

Move all the initializations to the probe functions.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606203752.144159-7-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0484271a
...@@ -1115,6 +1115,11 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap, ...@@ -1115,6 +1115,11 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap,
mutex_init(&rt700->disable_irq_lock); mutex_init(&rt700->disable_irq_lock);
INIT_DELAYED_WORK(&rt700->jack_detect_work,
rt700_jack_detect_handler);
INIT_DELAYED_WORK(&rt700->jack_btn_check_work,
rt700_btn_check_handler);
/* /*
* Mark hw_init to false * Mark hw_init to false
* HW init will be performed when device reports present * HW init will be performed when device reports present
...@@ -1209,13 +1214,6 @@ int rt700_io_init(struct device *dev, struct sdw_slave *slave) ...@@ -1209,13 +1214,6 @@ int rt700_io_init(struct device *dev, struct sdw_slave *slave)
/* Finish Initial Settings, set power to D3 */ /* Finish Initial Settings, set power to D3 */
regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
if (!rt700->first_hw_init) {
INIT_DELAYED_WORK(&rt700->jack_detect_work,
rt700_jack_detect_handler);
INIT_DELAYED_WORK(&rt700->jack_btn_check_work,
rt700_btn_check_handler);
}
/* /*
* if set_jack callback occurred early than io_init, * if set_jack callback occurred early than io_init,
* we set up the jack detection function now * we set up the jack detection function now
......
...@@ -1415,6 +1415,9 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap, ...@@ -1415,6 +1415,9 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap,
mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->calibrate_mutex);
mutex_init(&rt711->disable_irq_lock); mutex_init(&rt711->disable_irq_lock);
INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_sdca_jack_detect_handler);
INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handler);
/* /*
* Mark hw_init to false * Mark hw_init to false
* HW init will be performed when device reports present * HW init will be performed when device reports present
...@@ -1546,13 +1549,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave) ...@@ -1546,13 +1549,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL, rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL,
RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00); RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00);
if (!rt711->first_hw_init) {
INIT_DELAYED_WORK(&rt711->jack_detect_work,
rt711_sdca_jack_detect_handler);
INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
rt711_sdca_btn_check_handler);
}
/* calibration */ /* calibration */
ret = rt711_sdca_calibration(rt711); ret = rt711_sdca_calibration(rt711);
if (ret < 0) if (ret < 0)
......
...@@ -1207,6 +1207,10 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap, ...@@ -1207,6 +1207,10 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap,
mutex_init(&rt711->calibrate_mutex); mutex_init(&rt711->calibrate_mutex);
mutex_init(&rt711->disable_irq_lock); mutex_init(&rt711->disable_irq_lock);
INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_jack_detect_handler);
INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler);
INIT_WORK(&rt711->calibration_work, rt711_calibration_work);
/* /*
* Mark hw_init to false * Mark hw_init to false
* HW init will be performed when device reports present * HW init will be performed when device reports present
...@@ -1314,14 +1318,8 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave) ...@@ -1314,14 +1318,8 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave)
if (rt711->first_hw_init) if (rt711->first_hw_init)
rt711_calibration(rt711); rt711_calibration(rt711);
else { else
INIT_DELAYED_WORK(&rt711->jack_detect_work,
rt711_jack_detect_handler);
INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
rt711_btn_check_handler);
INIT_WORK(&rt711->calibration_work, rt711_calibration_work);
schedule_work(&rt711->calibration_work); schedule_work(&rt711->calibration_work);
}
/* /*
* if set_jack callback occurred early than io_init, * if set_jack callback occurred early than io_init,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment