diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2021-06-14 13:08:11 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-06-21 13:00:42 +0100 |
commit | d38ebaf2c88442a830d402fa7805ddbb60c4cd0c (patch) | |
tree | 0f8dc38c2467782e4034bc7a087b2d84d5aa02ec /drivers/soundwire/bus.c | |
parent | fac165f22ac947b55407cd3a60a2a9824f905235 (diff) | |
download | linux-stable-d38ebaf2c88442a830d402fa7805ddbb60c4cd0c.tar.gz linux-stable-d38ebaf2c88442a830d402fa7805ddbb60c4cd0c.tar.bz2 linux-stable-d38ebaf2c88442a830d402fa7805ddbb60c4cd0c.zip |
soundwire: export sdw_update() and sdw_update_no_pm()
We currently export sdw_read() and sdw_write() but the sdw_update()
and sdw_update_no_pm() are currently available only to the bus
code. This was missed in an earlier contribution.
Export both functions so that codec drivers can perform
read-modify-write operations without duplicating the code.
Fixes: b04c975e654c ('soundwire: bus: use sdw_update_no_pm when initializing a device')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20210614180815.153711-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/soundwire/bus.c')
-rw-r--r-- | drivers/soundwire/bus.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index a9e0aa72654d..5d5b0bd59ae3 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -492,7 +492,7 @@ int sdw_read_no_pm(struct sdw_slave *slave, u32 addr) } EXPORT_SYMBOL(sdw_read_no_pm); -static int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) +int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) { int tmp; @@ -503,6 +503,21 @@ static int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) tmp = (tmp & ~mask) | val; return sdw_write_no_pm(slave, addr, tmp); } +EXPORT_SYMBOL(sdw_update_no_pm); + +/* Read-Modify-Write Slave register */ +int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) +{ + int tmp; + + tmp = sdw_read(slave, addr); + if (tmp < 0) + return tmp; + + tmp = (tmp & ~mask) | val; + return sdw_write(slave, addr, tmp); +} +EXPORT_SYMBOL(sdw_update); /** * sdw_nread() - Read "n" contiguous SDW Slave registers |