aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soundwire/bus.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-01-22soundwire: Fix a signedness bugDan Carpenter1-2/+2
"ret" is an int and "buf" is a u8. sdw_read() returns negative error codes which are truncated to the u8, 0-255 range before being stored as an int. It means that "ret" can't be less than zero. Fixes: b0a9c37b0178 ("soundwire: Add slave status handling") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09soundwire: Fix incorrect return value checkShreyas NC1-2/+2
pm_runtime_get_sync will return negative values for error and 0 or 1 for success. Update the error check accordingly. Signed-off-by: Shreyas NC <shreyas.nc@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 9d715fa005eb: ("soundwire: Add IO transfer") Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08soundwire: Fix typo in return value check of sdw_read()Wei Yongjun1-5/+5
Fix the typo, 'status' should be instead of 'status2'. Fixes: b0a9c37b0178 ("soundwire: Add slave status handling") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08soundwire: fix sign extension when shifting buf[2] 24 placesColin Ian King1-2/+2
The buf[2] left shift by 24 bits is promoted to int (32 bit signed) and then signed-extended to unsigned long long. Hence if the upper bit to buf[2] is set then all the upper bits of addr end up as 1. Fix this by casting it to u64 before shifting it. Also replace the unsigned long long casts to u64 casts to match the same type of addr. Detected by CoverityScan, CID#1463147 ("Unintended sign extension") Fixes: d52d7a1be02c ("soundwire: Add Slave status handling helpers") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19soundwire: Add slave status handlingVinod Koul1-0/+379
Add status handling API sdw_handle_slave_status() to handle Slave status changes. Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com> 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>
2017-12-19soundwire: Add Slave status handling helpersSanyog Kale1-0/+214
SoundWire Slaves report status to bus. Add helpers to handle the status changes. Signed-off-by: Hardik T Shah <hardik.t.shah@intel.com> 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>
2017-12-19soundwire: Add IO transferVinod Koul1-0/+272
SoundWire bus supports read or write register(s) for SoundWire Slave device. sdw_read() and sdw_write() APIs are provided for single register read/write. sdw_nread() and sdw_nwrite() for operations on contiguous registers. 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>
2017-12-19soundwire: Add MIPI DisCo property helpersVinod Koul1-0/+8
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>
2017-12-19soundwire: Add Master registrationVinod Koul1-0/+124
A Master adds a SoundWire bus instance which scans the firmware provided for device description. In this patch we scan ACPI namespaces and create SoundWire Slave devices based on ACPI description 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> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>