1
0
Fork 0
Commit Graph

126 Commits (51ce02216d4ad4e8f6a58de81d6e803cf04c418e)

Author SHA1 Message Date
Linus Torvalds 8d7ead5c69 soundwire updates for v5.4-rc1
This includes DT support thanks to Srini and more work done by Intel
 (Pierre) on improving cadence and intel support.
 
 Details:
  - Add DT bindings and DT support in core
  - Add debugfs support for soundwire properties
  - Improvements on streaming handling to core
  - Improved handling of Cadence module
  - More updates and improvements to Intel driver
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJdgFDvAAoJEHwUBw8lI4NHv7wP/Ro1MQA0WQt8GqDENFdl+JJF
 KTbjn0YOD4eyFKncCiUoewQghPkJUVa8598t3rNn+lhEBePRYDPh0TV44ju2pk4E
 FNpWmkrXih4NvfCqSPWfLB/Xap6BDvX0xO5k7BoYJ08ktwlow6hWpB7FWoV+QTmk
 QqTypte5GTzYf+uo3UXRGPtu2bRlORtsoL8SSGcGaRERImPC0/VMlGRdMEvf2STA
 eyGk/ESi9s22Hl4sEKqk2uDmzUfc7uK6Ey6Ln/hhkQD7K+esmb0fFIU0JguiZo1O
 GAmbFsncV0Zk7bwU8oy4ZSo5Rjk2nuXMbEKWC+HLPA73skz09QyZJbqetimluzgl
 N7BFBVHFA0eLzFtUNieeQjcbNmOIW/rEJLO2iVPHvnOq4OLuEpFMPRhDFkMxD+cH
 7COoZNg8CXeXqceK+dgEe1A8W7ujWpXMN8fuV1ugbMDkZKy08pRL55RBGWcTroxw
 PakDXz5fnqthfvMwb6/jmg1WqzDe0qhIRWub+Sga1wmJMN5qm3iSAYZPqZe6SiNl
 is4zX6w9SO8S/qBI2Y64n1vgTsHbHvSrvPRIxDs9J6TfgeAoXtlJCsNpSa3LDqV9
 KxD+IV7D6MqAILUhlPK6PcMmoPBEOrFxONoOwzokd3NRQk4ZwffasXchwjDETvdc
 H3yzDAfUYvXPNHsHxw65
 =UILk
 -----END PGP SIGNATURE-----

Merge tag 'soundwire-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire

Pull soundwire updates from Vinod Koul:
 "This includes DT support thanks to Srini and more work done by Intel
  (Pierre) on improving cadence and intel support.

  Summary:

   - Add DT bindings and DT support in core

   - Add debugfs support for soundwire properties

   - Improvements on streaming handling to core

   - Improved handling of Cadence module

   - More updates and improvements to Intel driver"

* tag 'soundwire-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: (30 commits)
  soundwire: stream: make stream name a const pointer
  soundwire: Add compute_params callback
  soundwire: core: add device tree support for slave devices
  dt-bindings: soundwire: add slave bindings
  soundwire: bus: set initial value to port_status
  soundwire: intel: handle disabled links
  soundwire: intel: add debugfs register dump
  soundwire: cadence_master: add debugfs register dump
  soundwire: add debugfs support
  soundwire: intel: remove unused variables
  soundwire: intel: move shutdown() callback and don't export symbol
  soundwire: cadence_master: add kernel parameter to override interrupt mask
  soundwire: intel_init: add kernel module parameter to filter out links
  soundwire: cadence_master: fix divider setting in clock register
  soundwire: cadence_master: make use of mclk_freq property
  soundwire: intel: read mclk_freq property from firmware
  soundwire: add new mclk_freq field for properties
  soundwire: stream: remove unnecessary variable initializations
  soundwire: stream: fix disable sequence
  soundwire: include mod_devicetable.h to avoid compiling warnings
  ...
2019-09-22 10:52:23 -07:00
Srinivas Kandagatla dfcff3f8a5 soundwire: stream: make stream name a const pointer
Make stream name const pointer

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20190813083550.5877-3-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-09-04 14:57:28 +05:30
Vinod Koul c7578c1d62 soundwire: Add compute_params callback
This callback allows masters to compute the bus parameters required.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20190813083550.5877-2-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-09-04 14:57:19 +05:30
Srinivas Kandagatla a2e484585a soundwire: core: add device tree support for slave devices
This patch adds support to parsing device tree based
SoundWire slave devices.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20190829163514.11221-3-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-09-04 13:12:31 +05:30
Bard Liao f1fac63af6 soundwire: bus: set initial value to port_status
port_status[port_num] are assigned for each port_num in some if
conditions. So some of the port_status may not be initialized.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190829181135.16049-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-09-04 12:03:53 +05:30
Pierre-Louis Bossart 395713d8ca soundwire: intel: handle disabled links
On most hardware platforms, SoundWire interfaces are pin-muxed with
other interfaces (typically DMIC or I2S) and the status of each link
needs to be checked at boot time.

For Intel platforms, the BIOS provides a menu to enable/disable the
links separately, and the information is provided to the OS with an
Intel-specific _DSD property. The same capability will be added to
revisions of the MIPI DisCo specification.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190821185821.12690-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-23 12:02:56 +05:30
Pierre-Louis Bossart 79ee663126 soundwire: intel: add debugfs register dump
Add debugfs file to dump the Intel SoundWire registers

Credits: this patch is based on an earlier internal contribution by
Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190821185821.12690-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-23 12:01:02 +05:30
Pierre-Louis Bossart aa85066e5f soundwire: cadence_master: add debugfs register dump
Add debugfs file to dump the Cadence master registers.

Credits: this patch is based on an earlier internal contribution by
Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190821185821.12690-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-23 12:01:02 +05:30
Pierre-Louis Bossart bf03473d5b soundwire: add debugfs support
Add base debugfs mechanism for SoundWire bus by creating soundwire
root and master-N and slave-x hierarchy.

Also add SDW Slave SCP, DP0 and DP-N register debug file.

Registers not implemented will print as "XX"

Credits: this patch is based on an earlier internal contribution by
Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Sanyog Kale <sanyog.r.kale@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190821185821.12690-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-23 12:01:02 +05:30
Vinod Koul e87cf35835 soundwire: intel: remove unused variables
Variables 'nval' and 'i' are no longer used sdw_master_read_intel_prop()
so remove them.

drivers/soundwire/intel.c: In function 'sdw_master_read_intel_prop':
drivers/soundwire/intel.c:829:12: warning: unused variable 'i' [-Wunused-variable]
  int nval, i;
            ^
drivers/soundwire/intel.c:829:6: warning: unused variable 'nval' [-Wunused-variable]
  int nval, i;
      ^~~~

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 085f4ace10 ("soundwire: intel: read mclk_freq property from firmware")
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-22 11:51:46 +05:30
Pierre-Louis Bossart 183c768780 soundwire: intel: move shutdown() callback and don't export symbol
All DAI callbacks are in intel.c except for shutdown. Move and remove
export symbol

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:19 +05:30
Pierre-Louis Bossart 04592dced5 soundwire: cadence_master: add kernel parameter to override interrupt mask
The code has a set of defaults which may not be relevant in all cases,
add kernel parameter as a helper - mostly for early board bring-up.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:18 +05:30
Pierre-Louis Bossart 50302fc7b9 soundwire: intel_init: add kernel module parameter to filter out links
The hardware and ACPI info may report the presence of links that are
not physically enabled (e.g. due to pin-muxing or hardware reworks),
which in turn can result in errors being thrown. This shouldn't be the
case for production devices but will happen a lot on development
devices - even more so when they expose a connector.

Even when the ACPI information is correct, it's useful to be able to
only enable the links that need attention - mostly to filter out
dynamic debug messages.

Add a module parameter to filter out such links, e.g. adding the
following config to a file in /etc/modprobe.d will select the second
and third links only.

options soundwire_intel_init sdw_link_mask=0x6

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:18 +05:30
Rander Wang a50954e211 soundwire: cadence_master: fix divider setting in clock register
The existing code uses an OR operation which would mix the original
divider setting with the new one, resulting in an invalid
configuration that can make codecs hang.

Add the mask definition and use cdns_updatel to update divider

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:02 +05:30
Pierre-Louis Bossart 3859872f47 soundwire: cadence_master: make use of mclk_freq property
Now that the prototype and Intel implementation are enabled, use this
property to avoid hard-coded values.

For example for ICL the mclk_freq value is 38.4 MHz while on CNL/CML
it's 24 MHz. The mclk_freq should not be confused with the
max_clk_freq, which si the maximum bus clock. The mclk_freq is
typically tied to the oscillator frequency and does not change between
platforms. The max_clk_freq value is linked to the maximum bandwidth
needed and topology/trace length.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:02 +05:30
Pierre-Louis Bossart 085f4ace10 soundwire: intel: read mclk_freq property from firmware
The BIOS provides an Intel-specific property, let's use it to avoid
hard-coded clock dividers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:02 +05:30
Pierre-Louis Bossart 3a0be1a65b soundwire: stream: remove unnecessary variable initializations
A number of variables don't need to be initialized.

In a couple of cases where we loop on a list of runtimes, the code
handling of the 'bus' variable leads to warnings that it may not be
initialized. Add a specific error case to trap such cases.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart e0279b6b55 soundwire: stream: fix disable sequence
When we disable the stream and then call hw_free, two bank switches
will be handled and as a result we re-enable the stream on hw_free.

Make sure the stream is disabled on both banks.

TODO: we need to completely revisit all this and make sure we have a
mirroring mechanism between current and alternate banks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 05be59ac41 soundwire: cadence_master: use firmware defaults for frame shape
Remove hard-coding and use firmware (BIOS/DT) values. If they are
wrong use default 48x2 frame shape.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart fe4b70f2ce soundwire: export helpers to find row and column values
Add a prefix for common tables and export 2 helpers to set the frame
shapes based on row/col values.

These changes simplify bandwidth allocation algorithms as well as the
Cadence parts which all need to convert from frame shape to indices
used by the standard. These helpers are used in the following patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 6e0ac6a663 soundwire: bus: improve dynamic debug comments for enumeration
update comments to provide better understanding of enumeration flows.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 9b5884a0c6 soundwire: cadence_master: revisit interrupt settings
Adding missing interrupt masks (parity, etc) and missing checks.
Clarify which masks are for which usage.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 1804633564 soundwire: intel: fix channel number reported by hardware
On all released Intel controllers (CNL/CML/ICL), PDI2 reports an
invalid count, force the correct hardware-supported value

This may have to be revisited with platform-specific values if the
hardware changes, but for now this is good enough.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 05c8afe425 soundwire: intel: prevent possible dereference in hw_params
This should not happen in production systems but we should test for
all callback arguments before invoking the config_stream callback.

Update the prototype to clarify that the first argument is mandatory.

Also use local variable instead of multiple dereferences to improve
readability.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-21 14:36:01 +05:30
Pierre-Louis Bossart 8676b3ca46 soundwire: fix regmap dependencies and align with other serial links
The existing code has a mixed select/depend usage which makes no sense.

config SOUNDWIRE_BUS
       tristate
       select REGMAP_SOUNDWIRE

config REGMAP_SOUNDWIRE
        tristate
        depends on SOUNDWIRE_BUS

Let's remove one layer of Kconfig definitions and align with the
solutions used by all other serial links.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190718230215.18675-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-09 10:20:40 +05:30
Pierre-Louis Bossart 15ed3ea228 soundwire: bus: split handling of Device0 events
Assigning a device number to a Slave will result in additional events
when it reports its status in a PING frame. There is no point in
dealing with all the other devices in a loop, this can be done when a
non-device0 event happens.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190725234032.21152-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02 22:29:38 +05:30
Pierre-Louis Bossart 664b16589f soundwire: cadence_master: fix definitions for INTSTAT0/1
Two off-by-one errors: INTSTAT0 missed BIT(31) and INTSTAT1 is only
defined on first 16 bits.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190725234032.21152-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02 17:52:16 +05:30
Pierre-Louis Bossart b07dd9b400 soundwire: cadence_master: fix register definition for SLAVE_STATE
wrong prefix and wrong macro.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190725234032.21152-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02 17:52:16 +05:30
Pierre-Louis Bossart 68acd85996 soundwire: cadence_master: simplify bus clash interrupt clear
The bus clash interrupts are generated when the status is one, and
also cleared by writing a one. It's overkill/useless to use an OR when
the bit is already set.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190725234032.21152-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02 17:36:47 +05:30
Pierre-Louis Bossart 0fc6041d7a soundwire: intel: remove BIOS work-arounds
the values passed by all existing BIOS are fine, let's use them as is.
The existing code must have been needed only on early prototypes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190725234032.21152-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-08-02 17:28:16 +05:30
Andy Shevchenko be46cfba54 soundwire: mipi_disco: Switch to use fwnode_property_count_uXX()
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-08-02 17:15:13 +05:30
Greg Kroah-Hartman 2f4281f4dc soundwire updates for v5.3-rc1
Updates for 5.3 include:
  - module_sdw_driver macro for drivers
  - Documentation updates for code-blocks
  - Improvement from Pierre on intel and cadence driver
  - Clarification of DisCo properties and updates
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJdHtldAAoJEHwUBw8lI4NHf6AP/2glTkehAHh0C/zW7pgTk8na
 7bHvEfp0kopdH+qcxyUwa7kBmI1x1ODBtrPIU++ZU7pPC1gXw0RUlOeOTa5HIw9/
 uFQKRjbNUJ7/cVuvJZ16WEp3q2Uv5UG5OXlnT/kBFE87T2Zwov5/LKSUQMiHstgn
 Ix6aS0GgmHY9/4iFlxafR6SDhZ7Y1wN2gqKAM09K5QguFgGbG/6r+ioEOHEfkCSn
 tMiMXy2Koazrq1dRqdWL9PscVe0Yz3JxUDv9lED4OkyIY4zGHM5/LgfLuxzdhqmF
 vn9ZorS1AxOt7u5ewxuY8BLc//vqol1bbGzHFNfaOZ6/lmEsIBdXYKTQl8iyTZJP
 p/tdp2t9vWs+dDJ9BYXQpIEI/72Gcuu7g2kcwutLaWymp/OdTAjPhQGPc3NPUXgV
 aJv1D0Xwktdo/9jMBMpP4e8paM4KcGFeL1QkD545nVhVmCxt8Myf6RgktFEFtgS4
 qLt6sl6ahea/0aAtOrQ9Uej3/dOG3S5dYpyXouyJ6mOkSNNAp3FSeNkQI1OayPBV
 owFqdnFeAJ9CR/Ae/Ua0yDMSeRIdk+a4WVS3vH9sxWJZtyIPfxQcoWamIMmzxrg7
 g9+HorQjz6uOX+o1MzwD70RR6Hosc+sZaNiUsq/yyNbiJ7Ol/to2REMWgT+3XoLE
 X9Eio/OZ0sF9fZvCp8cI
 =ZOYI
 -----END PGP SIGNATURE-----

Merge tag 'soundwire-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:

soundwire updates for v5.3-rc1

Updates for 5.3 include:
 - module_sdw_driver macro for drivers
 - Documentation updates for code-blocks
 - Improvement from Pierre on intel and cadence driver
 - Clarification of DisCo properties and updates

* tag 'soundwire-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: add module_sdw_driver helper macro
  docs: soundwire: locking: fix tags for a code-block
  soundwire: intel_init: add checks on link numbers
  soundwire: fix typo in comments
  soundwire: Intel: add log for number of PCM and PDM PDIs
  soundwire: cadence_master: check the number of bidir PDIs
  soundwire: cadence_master: log Slave status mask on errors
  soundwire: cadence_master: use rate_limited dynamic debug
  soundwire: rename/clarify MIPI DisCo properties
  soundwire: clarify comment
  soundwire: mipi-disco: fix clock stop modes
  soundwire: rename 'freq' fields
  soundwire: mipi-disco: remove master_count property for masters
  soundwire: remove master data port properties
  soundwire: add port-related definitions
  soundwire: mipi_disco: fix master/link error
  soundwire: intel: filter SoundWire controller device search
  soundwire: cdns: Fix compilation error on arm64
2019-07-05 08:15:08 +02:00
Greg Kroah-Hartman b7108486d2 soundwire fixes for v5.2-rc4
Srinivas Kandagatla fixed by bunch of issues, two in core for locking
 and out of bound access and one in intel driver copy-paste
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJc+jOcAAoJEHwUBw8lI4NHvGgQAKqDZUy+NJ7x1s0CicIav5OK
 yV8V9rSZk8OfztFm2SuoyqFbEQgODvQwiVd4z4yfq+1KT21oUVO1rgU+u2IkQoaQ
 ki0oKOjydsH4ph6L6ZITCnNg/oBhvb9GRjDzXwVu/24BSrhTSeSqKVZplW8tbr/n
 h+6iHDogNm3cD+2tHcE1q2hFUh+6Os2n3dqnu8lRmKktFi+bYdR2UUZSQ7WYM2Dp
 u8jDVp0CmrP/s2cv0USEyif/Wmuy5CCv1L4PVS0Qb3opzGLdkiwF8wGhIhhnn22O
 YbtQOJDQvTZYGHnoBLcDXRbtIpaJ4YVg5ETK9Z6NR1l9Doi7aHo22q/durPOUYzF
 KGcFzkZFlgMW+CEaDeH/GAxtdz8PnchnwPnfFKu5K66MCNYSwokBdwn78qSZdXMX
 bqLmU95+ZLV3aq2iMjHGm8KegT5hiwhZElz77wZmbXcvleAyT8uXbgDRIPZVK/yF
 pBm8RnP1Bn1VZ0oWH9T/8rQBR9hMDmuabbbnF2xasUVXXV36alfEpOkoIcXwOZes
 7KFXweQ8ExM7ybX8rW0u/JkMIpXHy5Eys6CkkqntH/im8Nf6Eh0F9U+scN3NuNRU
 VPHPb8RD7aL9Banqqok5hKYfAhOmxDlRUgTFnB6XQ9HaPqHnPjle9oTHleXGLtzt
 jEPWVLIbReBf/YIDdf1z
 =zA8C
 -----END PGP SIGNATURE-----

Merge tag 'soundwire-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-linus

Vinod writes:

soundwire fixes for v5.2-rc4

Srinivas Kandagatla fixed by bunch of issues, two in core for locking
and out of bound access and one in intel driver copy-paste

* tag 'soundwire-5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: intel: set dai min and max channels correctly
  soundwire: stream: fix bad unlock balance
  soundwire: stream: fix out of boundary access on port properties
2019-06-10 18:07:39 +02:00
Srinivas Kandagatla 3919412870 soundwire: intel: set dai min and max channels correctly
Looks like there is a copy paste error.
This patch fixes it!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-06-06 22:48:41 +05:30
Srinivas Kandagatla 9315d904c7 soundwire: stream: fix bad unlock balance
the msg lock is taken for multi-link cases only but released
unconditionally, leading to an unlock balance warning for single-link usages
This patch fixes this.

 =====================================
 WARNING: bad unlock balance detected!
 5.1.0-16506-gc1c383a6f0a2-dirty #1523 Tainted: G        W
 -------------------------------------
 aplay/2954 is trying to release lock (&bus->msg_lock) at:
 do_bank_switch+0x21c/0x480
 but there are no more locks to release!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Sanyog Kale <sanyog.r.kale@intel.com>
[vkoul: edited the change log as suggested by Pierre]
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-06-06 22:46:04 +05:30
Pierre-Louis Bossart 432732b801 soundwire: intel_init: add checks on link numbers
Add mask to correctly read the SoundWire SHIM LCAP register. Only bits
2..0 are meaningful, the rest is about link synchronization and stream
channel mapping. Without this mask, the hardware information would
always be larger than whatever the BIOS would report.

Also trap the case with zero links.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart 27f14331a7 soundwire: fix typo in comments
Copy/paste of sdw_intel_res

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart 121f436137 soundwire: Intel: add log for number of PCM and PDM PDIs
This information will be reflected in debugfs but it's easier to see
as a dmesg log.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart 2d35526df9 soundwire: cadence_master: check the number of bidir PDIs
There is an assumption that the first two PDIs are reserved for Bulk,
so we need to make sure the number of bidir PDIs is indeed larger than
two. If the configuration provided is incorrect, this could lead to
allocating a huge amount of memory.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart a78b32d9c3 soundwire: cadence_master: log Slave status mask on errors
The Slave status mask exposes 4 sticky bits. When the device loses
sync, the IP will report two status but the log will only show that
the device lost sync. The status mask has all the information needed
so let's report it instead.

Also change the resolution of the mask, using 64 bits is not needed
when you need 4.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart eb7df4c86e soundwire: cadence_master: use rate_limited dynamic debug
When commands start failing, e.g. due to a bad electrical connection
or bus conflicts, the dmesg log is flooded. This should not happen for
production devices but it's quite frequent when bringing-up a new
platform.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:53:00 +05:30
Pierre-Louis Bossart 8acbbfec28 soundwire: rename/clarify MIPI DisCo properties
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-27 10:53:00 +05:30
Pierre-Louis Bossart 53d2e9c377 soundwire: mipi-disco: fix clock stop modes
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-27 10:53:00 +05:30
Pierre-Louis Bossart 3424305b8b soundwire: rename 'freq' fields
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-27 10:53:00 +05:30
Pierre-Louis Bossart eadc0049e1 soundwire: mipi_disco: fix master/link error
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-27 10:52:59 +05:30
Pierre-Louis Bossart 6f11586f48 soundwire: intel: filter SoundWire controller device search
The convention is that the SoundWire controller device is a child of
the HDAudio controller. However there can be more than one child
exposed in the DSDT table, and the current namespace walk returns the
last (incorrect) device.

Intel documentation states that bits 28..31 of the _ADR field
represent the link type, with SoundWire assigned the value 4.

Add a filter and terminate early when a valid _ADR is provided,
otherwise keep iterating to find the next child.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:52:59 +05:30
Jan Kotas 18de65d9e7 soundwire: cdns: Fix compilation error on arm64
On arm64 the cadence_master.c file doesn't compile.

readl and writel are undefined.
This patch fixes that by including io.h.

Signed-off-by: Jan Kotas <jank@cadence.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:36:28 +05:30
Srinivas Kandagatla 03ecad90d3 soundwire: stream: fix out of boundary access on port properties
Assigning local iterator to array element and using it again for
indexing would cross the array boundary.
Fix this by directly referring array element without using the local
variable.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-05-27 10:34:12 +05:30
Thomas Gleixner ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Vinod Koul 897fe40e52 soundwire: add a blank line between functions
For improving code readability it helps to have a blank line between
function so add when missing.

Checkpatch complains:
CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-02 17:17:51 +02:00