aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soundwire/mipi_disco.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-09-03soundwire: fix port_ready[] dynamic allocation in mipi_discoPierre-Louis Bossart1-17/+1
The existing code allocates memory for the total number of ports. This only works if the ports are contiguous, but will break if e.g. a Devices uses port0, 1, and 14. The port_ready[] array would contain 3 elements, which would lead to an out-of-bounds access. Conversely in other cases, the wrong port index would be used leading to timeouts on prepare. This can be fixed by allocating for the worst-case of 15 ports (DP0..DP14). In addition since the number is now fixed, we can use an array instead of a dynamic allocation. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Link: https://lore.kernel.org/r/20200831134318.11443-4-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2020-05-20soundwire: disco: s/ch/channels/Pierre-Louis Bossart1-5/+6
Use more meaningful member names in preparation for sysfs support. No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20200518203551.2053-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02soundwire: mipi_disco: Switch to use fwnode_property_count_uXX()Andy Shevchenko1-12/+6
Use use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20190723194218.69168-1-andriy.shevchenko@linux.intel.com Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27soundwire: rename/clarify MIPI DisCo propertiesPierre-Louis Bossart1-3/+3
The existing definitions are ambiguous and possibly misleading. For DP0, 'flow-control' is only relevant for the BRA protocol and should not be confused with async modes explicitly not supported for DP0, add prefix to follow MIPI DisCo definition The use of 'device_interrupts' is also questionable. The MIPI SoundWire spec defines Slave-, DP0- and DPN-level implementation-defined interrupts. Using the 'device' prefix in the last two cases is misleading, not only is the term 'device' overloaded but these properties are only valid at the DP0 and DPn levels. Rename to follow the MIPI definitions, no need to be creative here. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27soundwire: mipi-disco: fix clock stop modesPierre-Louis Bossart1-2/+2
Fix support for clock_stop_mode0 and 1. The existing code uses a bitmask between enums, one of which being zero. Or-ing with zero is not very useful in general...Fix by or-ing with a BIT dependent on the enum value. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27soundwire: rename 'freq' fieldsPierre-Louis Bossart1-11/+12
Rename all fields with 'freq' as 'clk_freq' to follow the MIPI specification and avoid confusion between bus clock and audio clocks. No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27soundwire: mipi_disco: fix master/link errorPierre-Louis Bossart1-1/+1
The MIPI DisCo specification for SoundWire defines the "mipi-sdw-link-N-subproperties" for slaves and "mipi-sdw-master-N-subproperties" for controllers. This is a mistake that was not identified until now. Existing Intel DSDT tables use 'link' everywhere, and the MIPI spec will be updated to deprecate "mipi-sdw-master-N-subproperties" Fix to parse firmware information on existing devices. If we ever see a system with 'master-N-subproperties' I guess we'll have to try both. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-02soundwire: remove empty line before/after bracesVinod Koul1-6/+0
Linux code style doesn't expect empty lines before or after braces and gives warning: CHECK: Blank lines aren't necessary after an open brace '{' CHECK: Blank lines aren't necessary before a close brace '}' Fix these instances in soundwire core Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-02soundwire: mipi_disco: fix boolean comparisonsPierre-Louis Bossart1-2/+2
No need for explicit test against true Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-02soundwire: mipi_disco: fix alignment issuesPierre-Louis Bossart1-50/+62
Use Linux style. In some cases parenthesis alignment is modified to keep the code readable. Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19soundwire: Add MIPI DisCo property helpersVinod Koul1-0/+401
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>