ASoC: codecs: wsa883x: add clock stop support

WSA883x does support clock stop, so remove code that reset
the Codec during runtime pm suspend and add flag to mark
clock stop support.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220906170112.1984-7-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Srinivas Kandagatla 2022-09-06 18:01:06 +01:00 committed by Mark Brown
parent c1057a08af
commit 3e29fb7479
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -415,7 +415,6 @@
#define WSA883X_NUM_REGISTERS (WSA883X_EMEM_63 + 1)
#define WSA883X_MAX_REGISTER (WSA883X_NUM_REGISTERS - 1)
#define WSA883X_PROBE_TIMEOUT 1000
#define WSA883X_VERSION_1_0 0
#define WSA883X_VERSION_1_1 1
@ -1409,6 +1408,7 @@ static int wsa883x_probe(struct sdw_slave *pdev,
wsa883x->sconfig.type = SDW_STREAM_PDM;
pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS, 0);
pdev->prop.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
gpiod_direction_output(wsa883x->sd_n, 1);
@ -1440,43 +1440,17 @@ err:
static int __maybe_unused wsa883x_runtime_suspend(struct device *dev)
{
struct regmap *regmap = dev_get_regmap(dev, NULL);
struct wsa883x_priv *wsa883x = dev_get_drvdata(dev);
gpiod_direction_output(wsa883x->sd_n, 0);
regcache_cache_only(regmap, true);
regcache_mark_dirty(regmap);
regulator_disable(wsa883x->vdd);
return 0;
}
static int __maybe_unused wsa883x_runtime_resume(struct device *dev)
{
struct sdw_slave *slave = dev_to_sdw_dev(dev);
struct regmap *regmap = dev_get_regmap(dev, NULL);
struct wsa883x_priv *wsa883x = dev_get_drvdata(dev);
unsigned long time;
int ret;
ret = regulator_enable(wsa883x->vdd);
if (ret) {
dev_err(dev, "Failed to enable vdd regulator (%d)\n", ret);
return ret;
}
gpiod_direction_output(wsa883x->sd_n, 1);
time = wait_for_completion_timeout(&slave->initialization_complete,
msecs_to_jiffies(WSA883X_PROBE_TIMEOUT));
if (!time) {
dev_err(dev, "Initialization not complete, timed out\n");
gpiod_direction_output(wsa883x->sd_n, 0);
regulator_disable(wsa883x->vdd);
return -ETIMEDOUT;
}
usleep_range(20000, 20010);
regcache_cache_only(regmap, false);
regcache_sync(regmap);