Skip to content

Commit

Permalink
regmap: sdw: use _no_pm functions in regmap_read/write
Browse files Browse the repository at this point in the history
sdw_update_slave_status will be invoked when a codec is attached,
and the codec driver will initialize the codec with regmap functions
while the codec device is pm_runtime suspended.

regmap routines currently rely on regular SoundWire IO functions,
which will call pm_runtime_get_sync()/put_autosuspend.

This causes a deadlock where the resume routine waits for an
initialization complete signal that while the initialization complete
can only be reached when the resume completes.

The only solution if we allow regmap functions to be used in resume
operations as well as during codec initialization is to use _no_pm
routines. The duty of making sure the bus is operational needs to be
handled above the regmap level.

Fixes: 7c22ce6 ('regmap: Add SoundWire bus support')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210122070634.12825-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
bardliao authored and vinodkoul committed Feb 11, 2021
1 parent 957e3f7 commit d288a57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/regmap/regmap-sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val)
struct device *dev = context;
struct sdw_slave *slave = dev_to_sdw_dev(dev);

return sdw_write(slave, reg, val);
return sdw_write_no_pm(slave, reg, val);
}

static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)
Expand All @@ -22,7 +22,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val)
struct sdw_slave *slave = dev_to_sdw_dev(dev);
int read;

read = sdw_read(slave, reg);
read = sdw_read_no_pm(slave, reg);
if (read < 0)
return read;

Expand Down

0 comments on commit d288a57

Please sign in to comment.