diff options
author | Vinod Koul <vinod.koul@intel.com> | 2017-12-14 11:19:35 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-19 11:14:57 +0100 |
commit | 56d4fe31af77f684bed62fb8201e6327e6ddf4e6 (patch) | |
tree | 1fd78ef27508083d887f39a069fdab120a403454 /drivers/soundwire/bus_type.c | |
parent | 7c3cd189b86d2fcf0579a7b61e8d9c6d5717a72e (diff) | |
download | linux-56d4fe31af77f684bed62fb8201e6327e6ddf4e6.tar.gz linux-56d4fe31af77f684bed62fb8201e6327e6ddf4e6.tar.bz2 linux-56d4fe31af77f684bed62fb8201e6327e6ddf4e6.zip |
soundwire: Add MIPI DisCo property helpers
MIPI Discovery And Configuration (DisCo) Specification for SoundWire
specifies properties to be implemented for SoundWire Masters and
Slaves. The DisCo spec doesn't mandate these properties. However,
SDW bus cannot work without knowing these values.
The helper functions read the Master and Slave properties.
Implementers of Master or Slave drivers can use any of the below
three mechanisms:
a) Use these APIs here as .read_prop() callback for Master
and Slave
b) Implement own methods and set those as .read_prop(), but invoke
APIs in this file for generic read and override the values with
platform specific data
c) Implement ones own methods which do not use anything provided
here
Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Acked-By: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/soundwire/bus_type.c')
-rw-r--r-- | drivers/soundwire/bus_type.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 8d8dcc68e9a8..d5f3a70c06b0 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -77,6 +77,8 @@ static int sdw_drv_probe(struct device *dev) if (!id) return -ENODEV; + slave->ops = drv->ops; + /* * attach to power domain but don't turn on (last arg) */ @@ -89,7 +91,26 @@ static int sdw_drv_probe(struct device *dev) } } - return ret; + if (ret) + return ret; + + /* device is probed so let's read the properties now */ + if (slave->ops && slave->ops->read_prop) + slave->ops->read_prop(slave); + + /* + * Check for valid clk_stop_timeout, use DisCo worst case value of + * 300ms + * + * TODO: check the timeouts and driver removal case + */ + if (slave->prop.clk_stop_timeout == 0) + slave->prop.clk_stop_timeout = 300; + + slave->bus->clk_stop_timeout = max_t(u32, slave->bus->clk_stop_timeout, + slave->prop.clk_stop_timeout); + + return 0; } static int sdw_drv_remove(struct device *dev) |