summaryrefslogtreecommitdiff
path: root/drivers/soundwire/cadence_master.c
AgeCommit message (Collapse)Author
2019-10-24soundwire: cadence_master: make clock stop exit configurable on initPierre-Louis Bossart
The use of clock stop is not a requirement, the IP can e.g. be completely power gated and not detect any wakes while in s2idle/deep sleep. For now clock-stop is not supported anyways so the control parameter is always false. This will be revisited when we add clock stop. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191022235448.17586-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-24soundwire: intel/cadence: add flag for interrupt enablePierre-Louis Bossart
Prepare for future PM support and fix error handling by disabling interrupts as needed. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191022235448.17586-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-24soundwire: cadence_master: add hw_reset capability in debugfsPierre-Louis Bossart
Provide debugfs capability to kick link and devices into hard-reset (as defined by MIPI). This capability is really useful when some devices are no longer responsive and/or to check the software handling of resynchronization. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191022235448.17586-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-24soundwire: intel/cadence: fix startup sequencePierre-Louis Bossart
Multiple changes squashed in single patch to avoid tick-tock effect and avoid breaking compilation/bisect 1. Per the hardware documentation, all changes to MCP_CONFIG, MCP_CONTROL, MCP_CMDCTRL and MCP_PHYCTRL need to be validated with a self-clearing write to MCP_CONFIG_UPDATE. Add a helper and do the update when the CONFIG is changed. 2. Move interrupt enable after interrupt handler registration 3. Add a new helper to start the hardware bus reset with maximum duration to make sure the Slave(s) correctly detect the reset pattern and to ensure electrical conflicts can be resolved. 4. flush command FIFOs Better error handling will be provided after interrupt disable is provided in follow-up patches. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191022235448.17586-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-21soundwire: cadence_master: improve PDI allocationBard Liao
PDI number should match dai->id, there is no need to track if a PDI is allocated or not. 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/20190916192348.467-7-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-21soundwire: intel: don't filter out PDI0/1Pierre-Louis Bossart
PDI0/1 are reserved for Bulk and filtered out in the existing code. That leads to endless confusions on whether the index is the raw or corrected one. In addition we will need support for Bulk at some point so it's just simpler to expose those PDIs and not use it for now than try to be smart unless we have to remove the smarts. This patch requires a topology change to use PDIs starting at offset 2 explicitly. Note that there is a known discrepancy between hardware documentation and what ALH stream works in practice, future fixes are likely. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20190916192348.467-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-10-21soundwire: cadence/intel: simplify PDI/port mappingPierre-Louis Bossart
The existing Linux code uses a 1:1 mapping between ports and PDIs, but still has an independent allocation of ports and PDIs. Let's simplify the code and remove the port layer by only using PDIs. This patch does not change any functionality, just removes unnecessary code. This will also allow for further simplifications where the PDIs are not dynamically allocated but instead described in a topology file. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20190916192348.467-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-09-22Merge tag 'soundwire-5.4-rc1' of ↵Linus Torvalds
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-08-23soundwire: cadence_master: add debugfs register dumpPierre-Louis Bossart
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-21soundwire: intel: move shutdown() callback and don't export symbolPierre-Louis Bossart
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-21soundwire: cadence_master: add kernel parameter to override interrupt maskPierre-Louis Bossart
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-21soundwire: cadence_master: fix divider setting in clock registerRander Wang
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-21soundwire: cadence_master: make use of mclk_freq propertyPierre-Louis Bossart
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-21soundwire: cadence_master: use firmware defaults for frame shapePierre-Louis Bossart
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-21soundwire: cadence_master: revisit interrupt settingsPierre-Louis Bossart
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-02soundwire: cadence_master: fix definitions for INTSTAT0/1Pierre-Louis Bossart
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-02soundwire: cadence_master: fix register definition for SLAVE_STATEPierre-Louis Bossart
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-02soundwire: cadence_master: simplify bus clash interrupt clearPierre-Louis Bossart
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-05-27soundwire: cadence_master: check the number of bidir PDIsPierre-Louis Bossart
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-27soundwire: cadence_master: log Slave status mask on errorsPierre-Louis Bossart
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-27soundwire: cadence_master: use rate_limited dynamic debugPierre-Louis Bossart
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-27soundwire: cdns: Fix compilation error on arm64Jan Kotas
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-02soundwire: cadence: remove empty line after bracesVinod Koul
Linux code style doesn't expect empty lines after braces and gives warning: CHECK: Blank lines aren't necessary after an open brace '{' Remove the empty line in cadence lib Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-02soundwire: add missing newlines in dynamic debug logsPierre-Louis Bossart
For some reason the newlines are not used everywhere. Fix as needed. Reported-by: Joe Perches <joe@perches.com> 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: cadence_master: remove spurious newlinePierre-Louis Bossart
Extra newline does not improve readability. 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: cadence_master: fix boolean comparisonsPierre-Louis Bossart
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: cadence_master: balance parenthesesPierre-Louis Bossart
While not strictly necessary, balanced parentheses help with code readability. 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: cadence_master: fix alignment issuesPierre-Louis Bossart
Use Linux style 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>
2018-05-11soundwire: cdns: Add stream routinesVinod Koul
Add support for Cadence stream initialization and implement stream APIs. Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com> Signed-off-by: Shreyas NC <shreyas.nc@intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-11soundwire: cdns: Add port routinesVinod Koul
Add support for Cadence port management and implement master port ops. Signed-off-by: Sanyog Kale <sanyog.r.kale@intel.com> Signed-off-by: Shreyas NC <shreyas.nc@intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-11soundwire: Remove cdns_master_opsShreyas NC
There can be instances where drivers using Cadence IP might want to set sdw_master_ops differently per instance of it's use, so remove the cdns_master_ops and export the APIs. Signed-off-by: Shreyas NC <shreyas.nc@intel.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2017-12-19soundwire: cdns: Add sdw_master_ops and IO transfer supportSanyog Kale
Implement sdw_master_ops with support for xfer_msg, xfer_msg_defer and reset_page_addr. Since Cadence module doesn't know the systems it will be used, set the read_prop to the bus helper. 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: cdns: Add cadence libraryVinod Koul
Cadence IP implements SoundWire Master. Add base cadence library initialization and interrupt handling 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>