[RFC PATCH 04/40] soundwire: intel: add debugfs register dump

2019-07-25 Thread Pierre-Louis Bossart
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. The main change is the use of scnprintf to avoid known issues with snprintf. Signed-off-by: Pierre-Louis Bossart

[RFC PATCH 14/40] soundwire: cadence_master: fix definitions for INTSTAT0/1

2019-07-25 Thread Pierre-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 --- drivers/soundwire/cadence_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers

[RFC PATCH 05/40] soundwire: intel: move interrupt enable after interrupt handler registration

2019-07-25 Thread Pierre-Louis Bossart
Not sure why the existing code would enable interrupts without the ability to deal with them. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index

[RFC PATCH 21/40] soundwire: export helpers to find row and column values

2019-07-25 Thread Pierre-Louis Bossart
Add a prefix for common tables and export 2 helpers to set the frame shapes based on row/col values. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.h| 7 +-- drivers/soundwire/stream.c | 14 -- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a

[RFC PATCH 23/40] soundwire: stream: fix disable sequence

2019-07-25 Thread Pierre-Louis Bossart
alternate banks. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/stream.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 53f5e790fcd7..75b9ad1fb1a6 100644 --- a/drivers/soundwire/stream.c

[RFC PATCH 38/40] soundwire: cadence_master: make clock stop exit configurable on init

2019-07-25 Thread Pierre-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. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 15 --- drivers/soundwire/cadence_master.h | 2 +- drivers

[RFC PATCH 18/40] soundwire: bus: split handling of Device0 events

2019-07-25 Thread Pierre-Louis Bossart
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 --- drivers/soundwire/bus.c

[RFC PATCH 39/40] soundwire: intel: add pm_runtime support

2019-07-25 Thread Pierre-Louis Bossart
: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 38 ++ 1 file changed, 38 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index db7bf2912767..1394a2322553 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c

[RFC PATCH 20/40] soundwire: prototypes for suspend/resume

2019-07-25 Thread Pierre-Louis Bossart
Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h index c0bf6ff00a44..d375bbfead18 100644 --- a/drivers/soundwire/cadence_master.h +++ b

[RFC PATCH 31/40] soundwire: intel: move shutdown() callback and don't export symbol

2019-07-25 Thread Pierre-Louis Bossart
All DAI callbacks are in intel.c except for shutdown. Move and remove export symbol Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 14 -- drivers/soundwire/cadence_master.h | 2 -- drivers/soundwire/intel.c | 17 +++-- 3 files

[RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register

2019-07-25 Thread Pierre-Louis Bossart
: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 10ebcef2e84e..18c6ac026e85 100644 --- a/drivers/soundwire/cadence_master.c +++ b

[RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled

2019-07-25 Thread Pierre-Louis Bossart
Not all platforms support runtime_pm for now, let's use runtime_pm only when enabled. Suggested-by: Srinivas Kandagatla Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/dr

[RFC PATCH 27/40] soundwire: Add Intel resource management algorithm

2019-07-25 Thread Pierre-Louis Bossart
arg is almost always a bug + group->rates = krealloc(group->rates, Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/Makefile | 2 +- drivers/soundwire/algo_dynamic_allocation.c | 403 drivers/soundwire

[RFC PATCH 22/40] soundwire: include mod_devicetable.h to avoid compiling warnings

2019-07-25 Thread Pierre-Louis Bossart
From: Bard liao Reported-by: kbuild test robot Signed-off-by: Bard liao Signed-off-by: Pierre-Louis Bossart --- include/linux/soundwire/sdw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index a49028e9d666..31d1e8acf25b

[RFC PATCH 28/40] soundwire: intel: handle disabled links

2019-07-25 Thread Pierre-Louis Bossart
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 --- drivers/soundwire/intel.c | 26 ++ include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 24 insertions

[RFC PATCH 24/40] soundwire: cadence_master: use BIOS defaults for frame shape

2019-07-25 Thread Pierre-Louis Bossart
Remove hard-coding and use BIOS values. If they are wrong use default 48x2 frame shape. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b

[RFC PATCH 32/40] soundwire: intel: add helper for initialization

2019-07-25 Thread Pierre-Louis Bossart
Move code to helper for reuse in power management routines Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index c40ab443e723

[RFC PATCH 02/40] soundwire: cadence_master: add debugfs register dump

2019-07-25 Thread Pierre-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. The main change is the use of scnprintf to avoid known issues with snprintf. Signed-off-by: Pierre-Louis Bossart

[RFC PATCH 13/40] soundwire: cadence_master: fix register definition for SLAVE_STATE

2019-07-25 Thread Pierre-Louis Bossart
wrong prefix and wrong macro. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 0f3b9c160b01..d9d9e3d964dd 100644 --- a

[RFC PATCH 36/40] soundwire: intel: disable interrupts on suspend

2019-07-25 Thread Pierre-Louis Bossart
Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 42 +- drivers/soundwire/cadence_master.h | 2 +- drivers/soundwire/intel.c | 6 +++-- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/drivers/soundwire

[RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave

2019-07-25 Thread Pierre-Louis Bossart
When a Slave reports multiple status in the sticky bits, find the latest configuration from the mirror of the PING frame status and update the status directly. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 34 -- 1 file changed, 28

[RFC PATCH 19/40] soundwire: bus: improve dynamic debug comments for enumeration

2019-07-25 Thread Pierre-Louis Bossart
update comments to provide better understanding of enumeration flows. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index bca378806d00..2354675ef104 100644

[RFC PATCH 03/40] soundwire: cadence_master: align debugfs to 8 digits

2019-07-25 Thread Pierre-Louis Bossart
SQUASHME Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 91e8bacb83e3..9f611a1fff0a 100644 --- a/drivers/soundwire

[RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params

2019-07-25 Thread Pierre-Louis Bossart
This should not happen in production systems but we should test for all callback arguments before invoking the config_stream callback. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/intel.c

[RFC PATCH 25/40] soundwire: intel: use BIOS information to set clock dividers

2019-07-25 Thread Pierre-Louis Bossart
The BIOS provides an Intel-specific property, let's use it to avoid hard-coded clock dividers. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 26 ++ drivers/soundwire/intel.c | 26 ++ include/linux/soun

[RFC PATCH 07/40] soundwire: intel: fix channel number reported by hardware

2019-07-25 Thread Pierre-Louis Bossart
PDI2 reports an invalid count, force the correct hardware-supported value Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 497879dd9c0d..51990b192dc0 100644

[RFC PATCH 12/40] soundwire: cadence_master: revisit interrupt settings

2019-07-25 Thread Pierre-Louis Bossart
Adding missing interrupt masks (parity, etc) and missing checks. Clarify which masks are for which usage. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff

[RFC PATCH 34/40] soundwire: intel: ignore disabled links for suspend/resume

2019-07-25 Thread Pierre-Louis Bossart
Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 1477c35f616f..a976480d6f36 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c

[RFC PATCH 29/40] soundwire: intel_init: add kernel module parameter to filter out links

2019-07-25 Thread Pierre-Louis Bossart
re so when they expose a connector. 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 --- drivers/soun

[RFC PATCH 35/40] soundwire: intel: export helper to exit reset

2019-07-25 Thread Pierre-Louis Bossart
Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 9 +++-- drivers/soundwire/cadence_master.h | 1 + drivers/soundwire/intel.c | 4 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire

[RFC PATCH 16/40] soundwire: cadence_master: improve startup sequence with link hw_reset

2019-07-25 Thread Pierre-Louis Bossart
attachment does not generate any interrupt, despite the status showing them being attached. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 35 +- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire

[RFC PATCH 01/40] soundwire: add debugfs support

2019-07-25 Thread Pierre-Louis Bossart
Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah. The main change is the use of scnprintf to avoid known issues with snprintf. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/Makefile| 4 +- drivers/soundwire/bus.c | 6 ++ drivers/soundwire/bus.h | 24 ++ drivers

[RFC PATCH 08/40] soundwire: intel: remove BIOS work-arounds

2019-07-25 Thread Pierre-Louis Bossart
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 --- drivers/soundwire/intel.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/soundwire/inte

[RFC PATCH 10/40] soundwire: cadence_master: remove useless wrapper

2019-07-25 Thread Pierre-Louis Bossart
Now that we've removed the update config, there's no need for a wrapper. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers

[RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE

2019-07-25 Thread Pierre-Louis Bossart
update when the CONFIG is changed. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 29 + 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 9f611a1fff0a

[RFC PATCH 37/40] soundwire: cadence_master: add hw_reset capability in debugfs

2019-07-25 Thread Pierre-Louis Bossart
This is to kick devices into reset and see what software does Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index

[RFC PATCH 40/40] soundwire: intel: add delay on restart for enumeration

2019-07-25 Thread Pierre-Louis Bossart
We have a conceptual issue on restart: the interaction with the slaves can start before (re) enumeration is complete. Add a delay for now but we will need to have an async notification that all devices are back on the bus. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 5

[RFC PATCH 30/40] soundwire: cadence_master: add kernel parameter to override interrupt mask

2019-07-25 Thread Pierre-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 --- drivers/soundwire/cadence_master.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/soundwire

[RFC PATCH 11/40] soundwire: cadence_master: simplify bus clash interrupt clear

2019-07-25 Thread Pierre-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 --- drivers/soundwire/cadence_master.c | 2 -- 1 file changed, 2 deletions(-) diff --

[RFC PATCH 33/40] soundwire: intel: Add basic power management support

2019-07-25 Thread Pierre-Louis Bossart
Implement suspend/resume capabilities (not runtime_pm for now) Credits: this patch is based on an earlier internal contribution by Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 102

Re: [alsa-devel] [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE

2019-07-26 Thread Pierre-Louis Bossart
@@ -758,15 +774,9 @@ static int _cdns_enable_interrupt(struct sdw_cdns *cdns)    */   int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns)   { -    int ret; -   _cdns_enable_interrupt(cdns); -    ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, - CDNS_MCP_CONFIG_UPDATE_BI

Re: [alsa-devel] [RFC PATCH 01/40] soundwire: add debugfs support

2019-07-26 Thread Pierre-Louis Bossart
On 7/25/19 5:15 PM, Guennadi Liakhovetski wrote: Hi Pierre, A couple of nitpicks: Thanks for the feedback! create mode 100644 drivers/soundwire/debugfs.c [snip] diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h index 3048ca153f22..06ac4adb0074 100644 --- a/drivers/sound

Re: [alsa-devel] [RFC PATCH 01/40] soundwire: add debugfs support

2019-07-26 Thread Pierre-Louis Bossart
Thanks for the feedback Cezary. +static ssize_t sdw_slave_reg_read(struct file *file, char __user *user_buf, +  size_t count, loff_t *ppos) +{ +    struct sdw_slave *slave = file->private_data; +    unsigned int reg; +    char *buf; +    ssize_t ret; +    int i, j; + +    buf =

Re: [alsa-devel] [RFC PATCH 03/40] soundwire: cadence_master: align debugfs to 8 digits

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 4:38 AM, Cezary Rojewski wrote: On 2019-07-26 01:39, Pierre-Louis Bossart wrote: SQUASHME Signed-off-by: Pierre-Louis Bossart ---   drivers/soundwire/cadence_master.c | 2 +-   1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/cadence_master.c b

Re: [alsa-devel] [RFC PATCH 04/40] soundwire: intel: add debugfs register dump

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 4:35 AM, Cezary Rojewski wrote: On 2019-07-26 01:39, Pierre-Louis Bossart wrote: +static void intel_debugfs_init(struct sdw_intel *sdw) +{ +    struct dentry *root = sdw->cdns.bus.debugfs; + +    if (!root) +    return; + +    sdw->fs = debugfs_create_dir("intel

Re: [alsa-devel] [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params

2019-07-26 Thread Pierre-Louis Bossart
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 68832e613b1e..497879dd9c0d 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -509,7 +509,7 @@ static int intel_config_stream(struct sdw_intel *sdw, struct snd_soc_dai *dai,

Re: [alsa-devel] [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE

2019-07-26 Thread Pierre-Louis Bossart
@@ -943,7 +953,10 @@ int sdw_cdns_init(struct sdw_cdns *cdns) cdns_writel(cdns, CDNS_MCP_CONFIG, val); - return 0; + /* commit changes */ + ret = cdns_update_config(cdns); + + return ret; + return cdns_update_config(cdns); yes, will fix. thanks!

Re: [alsa-devel] [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave

2019-07-26 Thread Pierre-Louis Bossart
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 889fa2cd49ae..25d5c7267c15 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -643,13 +643,35 @@ static int cdns_update_slave_status(struct sdw_cdns *cdns,

Re: [alsa-devel] [RFC PATCH 16/40] soundwire: cadence_master: improve startup sequence with link hw_reset

2019-07-26 Thread Pierre-Louis Bossart
+static int do_reset(struct sdw_cdns *cdns) +{ + int ret; + + /* program maximum length reset to be safe */ + cdns_updatel(cdns, CDNS_MCP_CONTROL, +CDNS_MCP_CONTROL_RST_DELAY, +CDNS_MCP_CONTROL_RST_DELAY); + + /* use hardware gener

Re: [alsa-devel] [RFC PATCH 20/40] soundwire: prototypes for suspend/resume

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 5:04 AM, Cezary Rojewski wrote: On 2019-07-26 01:40, Pierre-Louis Bossart wrote: Signed-off-by: Pierre-Louis Bossart ---   drivers/soundwire/cadence_master.h | 3 +++   1 file changed, 3 insertions(+) diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire

Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 5:14 AM, Cezary Rojewski wrote: On 2019-07-26 01:40, Pierre-Louis Bossart wrote: -    return do_bank_switch(stream); +    ret = do_bank_switch(stream); +    if (ret < 0) { +    dev_err(bus->dev, "Bank switch failed: %d\n", ret); +    return ret; +    } + +

Re: [alsa-devel] [RFC PATCH 24/40] soundwire: cadence_master: use BIOS defaults for frame shape

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 5:20 AM, Cezary Rojewski wrote: On 2019-07-26 01:40, Pierre-Louis Bossart wrote: +static u32 cdns_set_default_frame_shape(int n_rows, int n_cols) +{ +    u32 val; +    int c; +    int r; + +    r = sdw_find_row_index(n_rows); +    c = sdw_find_col_index(n_cols); + +    val = (r

Re: [alsa-devel] [RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register

2019-07-26 Thread Pierre-Louis Bossart
On 7/26/19 12:19 AM, Bard liao wrote: On 7/26/2019 7:40 AM, Pierre-Louis Bossart wrote: From: Rander 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

Re: [RFC PATCH 05/40] soundwire: intel: move interrupt enable after interrupt handler registration

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 6:53 AM, Vinod Koul wrote: On 25-07-19, 18:39, Pierre-Louis Bossart wrote: Not sure why the existing code would enable interrupts without the ability to deal with them. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 4 ++-- 1 file changed, 2 insertions

Re: [alsa-devel] [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 6:55 AM, Vinod Koul wrote: On 25-07-19, 18:39, Pierre-Louis Bossart wrote: This should not happen in production systems but we should test for all callback arguments before invoking the config_stream callback. so you are saying callback arg is mandatory, if so please document

Re: [RFC PATCH 07/40] soundwire: intel: fix channel number reported by hardware

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 6:57 AM, Vinod Koul wrote: On 25-07-19, 18:39, Pierre-Louis Bossart wrote: PDI2 reports an invalid count, force the correct hardware-supported value Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 9 + 1 file changed, 9 insertions(+) diff --git a

Re: [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 7:03 AM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) { - int ret; - _cdns_enable_interrupt(cdns); - ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE

Re: [RFC PATCH 12/40] soundwire: cadence_master: revisit interrupt settings

2019-08-02 Thread Pierre-Louis Bossart
@@ -761,10 +769,21 @@ int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1, CDNS_MCP_SLAVE_INTMASK1_MASK); + /* enable detection of slave state changes */ mask = CDNS_MCP_INT_SLAVE_RSVD | CDNS_MCP_INT_SLAVE_ALERT

Re: [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 7:20 AM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: When a Slave reports multiple status in the sticky bits, find the latest configuration from the mirror of the PING frame status and update the status directly. Signed-off-by: Pierre-Louis Bossart

Re: [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 11:01 AM, Vinod Koul wrote: On 02-08-19, 10:29, Pierre-Louis Bossart wrote: On 8/2/19 7:20 AM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: + status[i] = SDW_SLAVE_UNATTACHED; + break

Re: [alsa-devel] [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 10:57 AM, Vinod Koul wrote: On 02-08-19, 10:16, Pierre-Louis Bossart wrote: On 8/2/19 6:55 AM, Vinod Koul wrote: On 25-07-19, 18:39, Pierre-Louis Bossart wrote: This should not happen in production systems but we should test for all callback arguments before invoking the

Re: [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 11:58 AM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: Not all platforms support runtime_pm for now, let's use runtime_pm only when enabled. We discussed this with Ulf sometime back and it was a consensus the core should handle it, but that may take a while

Re: [RFC PATCH 19/40] soundwire: bus: improve dynamic debug comments for enumeration

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:00 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: update comments to provide better understanding of enumeration flows. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

Re: [RFC PATCH 20/40] soundwire: prototypes for suspend/resume

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:03 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: Please do provide the changelog on why this change is needed. not needed for now, will remove. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.h | 3 +++ 1 file changed, 3

Re: [RFC PATCH 24/40] soundwire: cadence_master: use BIOS defaults for frame shape

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:10 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: Remove hard-coding and use BIOS values. If they are wrong use default BIOS :) this is cadence, am sure this can be used outside BIOS :D It would be better to say firmware (ACPI/DT) yes 48x2 frame

Re: [RFC PATCH 25/40] soundwire: intel: use BIOS information to set clock dividers

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:17 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: The BIOS provides an Intel-specific property, let's use it to avoid hard-coded clock dividers. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c

Re: [RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:19 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: From: Rander 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. This looked fine but

Re: [alsa-devel] [RFC PATCH 31/40] soundwire: intel: move shutdown() callback and don't export symbol

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:28 PM, Vinod Koul wrote: On 26-07-19, 09:46, Pierre-Louis Bossart wrote: On 7/26/19 5:38 AM, Cezary Rojewski wrote: On 2019-07-26 01:40, Pierre-Louis Bossart wrote: +void intel_shutdown(struct snd_pcm_substream *substream, +    struct snd_soc_dai *dai) +{ +    struct

Re: [RFC PATCH 34/40] soundwire: intel: ignore disabled links for suspend/resume

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:30 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: Please add explanation why.. yes missed this Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/soundwire

Re: [RFC PATCH 35/40] soundwire: intel: export helper to exit reset

2019-08-02 Thread Pierre-Louis Bossart
On 8/2/19 12:31 PM, Vinod Koul wrote: On 25-07-19, 18:40, Pierre-Louis Bossart wrote: Here as well I squashed this with earlier patches to fix the init sequence in one shot Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 9 +++-- drivers/soundwire

Re: [alsa-devel] [RFC PATCH 02/40] soundwire: cadence_master: add debugfs register dump

2019-08-05 Thread Pierre-Louis Bossart
+static ssize_t cdns_reg_read(struct file *file, char __user *user_buf, +size_t count, loff_t *ppos) +{ + struct sdw_cdns *cdns = file->private_data; + char *buf; + ssize_t ret; + int i, j; + + buf = kzalloc(RD_BUF, GFP_KERNEL); +

Re: [alsa-devel] [RFC PATCH 21/40] soundwire: export helpers to find row and column values

2019-08-05 Thread Pierre-Louis Bossart
On 8/5/19 4:39 AM, Sanyog Kale wrote: On Thu, Jul 25, 2019 at 06:40:13PM -0500, Pierre-Louis Bossart wrote: Add a prefix for common tables and export 2 helpers to set the frame shapes based on row/col values. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.h| 7

Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence

2019-08-05 Thread Pierre-Louis Bossart
On 8/5/19 4:56 AM, Sanyog Kale wrote: On Thu, Jul 25, 2019 at 06:40:15PM -0500, Pierre-Louis Bossart wrote: 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. I didnt quite get why there will be two bank

Re: [alsa-devel] [RFC PATCH 25/40] soundwire: intel: use BIOS information to set clock dividers

2019-08-05 Thread Pierre-Louis Bossart
On 8/5/19 5:28 AM, Sanyog Kale wrote: On Thu, Jul 25, 2019 at 06:40:17PM -0500, Pierre-Louis Bossart wrote: The BIOS provides an Intel-specific property, let's use it to avoid hard-coded clock dividers. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c

Re: [alsa-devel] [RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register

2019-08-05 Thread Pierre-Louis Bossart
@@ -988,9 +989,11 @@ int sdw_cdns_init(struct sdw_cdns *cdns) /* Set clock divider */ divider = (prop->mclk_freq / prop->max_clk_freq) - 1; val = cdns_readl(cdns, CDNS_MCP_CLK_CTRL0); reg read of CLK_CTRL0 can be removed. yes for both comments. Thanks for the review

Re: [alsa-devel] [RFC PATCH 27/40] soundwire: Add Intel resource management algorithm

2019-08-05 Thread Pierre-Louis Bossart
+static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq) +{ + struct sdw_master_prop *prop = &bus->prop; + int frame_int, frame_freq; + int r, c; + + for (c = 0; c < SDW_FRAME_COLS; c++) { + for (r = 0; r < SDW_FRAME_ROWS; r++) { +

Re: [alsa-devel] [RFC PATCH 23/40] soundwire: stream: fix disable sequence

2019-08-05 Thread Pierre-Louis Bossart
On 8/5/19 11:32 AM, Sanyog Kale wrote: On Mon, Aug 05, 2019 at 10:33:25AM -0500, Pierre-Louis Bossart wrote: On 8/5/19 4:56 AM, Sanyog Kale wrote: On Thu, Jul 25, 2019 at 06:40:15PM -0500, Pierre-Louis Bossart wrote: When we disable the stream and then call hw_free, two bank switches

Re: [alsa-devel] [RFC PATCH 28/40] soundwire: intel: handle disabled links

2019-08-05 Thread Pierre-Louis Bossart
On 8/5/19 11:57 AM, Sanyog Kale wrote: On Thu, Jul 25, 2019 at 06:40:20PM -0500, Pierre-Louis Bossart wrote: 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

[PATCH 00/17] soundwire: fixes for 5.4

2019-08-05 Thread Pierre-Louis Bossart
Pierre-Louis Bossart (15): soundwire: intel: prevent possible dereference in hw_params soundwire: intel: fix channel number reported by hardware soundwire: cadence_master: revisit interrupt settings soundwire: bus: improve dynamic debug comments for enumeration soundwire: export helpers to

[PATCH 04/17] soundwire: bus: improve dynamic debug comments for enumeration

2019-08-05 Thread Pierre-Louis Bossart
update comments to provide better understanding of enumeration flows. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 89d5f1537d9b..40f7d0dc59a6 100644

[PATCH 02/17] soundwire: intel: fix channel number reported by hardware

2019-08-05 Thread Pierre-Louis Bossart
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 --- drivers

[PATCH 16/17] soundwire: cadence_master: add kernel parameter to override interrupt mask

2019-08-05 Thread Pierre-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 --- drivers/soundwire/cadence_master.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/soundwire

[PATCH 15/17] soundwire: intel_init: add kernel module parameter to filter out links

2019-08-05 Thread Pierre-Louis Bossart
modprobe.d will select the second and third links only. options soundwire_intel_init sdw_link_mask=0x6 Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel_init.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/in

[PATCH 17/17] soundwire: intel: move shutdown() callback and don't export symbol

2019-08-05 Thread Pierre-Louis Bossart
All DAI callbacks are in intel.c except for shutdown. Move and remove export symbol Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 14 -- drivers/soundwire/cadence_master.h | 2 -- drivers/soundwire/intel.c | 17 +++-- 3 files

[PATCH 09/17] soundwire: stream: remove unnecessary variable initializations

2019-08-05 Thread Pierre-Louis Bossart
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 Bossar

[PATCH 11/17] soundwire: intel: read mclk_freq property from firmware

2019-08-05 Thread Pierre-Louis Bossart
The BIOS provides an Intel-specific property, let's use it to avoid hard-coded clock dividers. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/in

[PATCH 13/17] soundwire: cadence_master: fix divider setting in clock register

2019-08-05 Thread Pierre-Louis Bossart
: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 049ecfad2c00..fb198a806efd 100644 --- a/drivers/soundwire/cadence_master.c

[PATCH 10/17] soundwire: add new mclk_freq field for properties

2019-08-05 Thread Pierre-Louis Bossart
To help pass platform-specific values, add a new field that can either be set by the Master driver or read from firmware (BIOS/DT). Signed-off-by: Pierre-Louis Bossart --- include/linux/soundwire/sdw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/soundwire/sdw.h b/include

[PATCH 03/17] soundwire: cadence_master: revisit interrupt settings

2019-08-05 Thread Pierre-Louis Bossart
Adding missing interrupt masks (parity, etc) and missing checks. Clarify which masks are for which usage. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 29 + 1 file changed, 25 insertions(+), 4 deletions

[PATCH 07/17] soundwire: include mod_devicetable.h to avoid compiling warnings

2019-08-05 Thread Pierre-Louis Bossart
ct sdw_device_id *id); ^ Fix by adding the relevant include Reported-by: kbuild test robot Signed-off-by: Bard liao Signed-off-by: Pierre-Louis Bossart --- include/linux/soundwire/sdw.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/soundwire

[PATCH 08/17] soundwire: stream: fix disable sequence

2019-08-05 Thread Pierre-Louis Bossart
alternate banks. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/stream.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 53f5e790fcd7..75b9ad1fb1a6 100644 --- a/drivers/soundwire/stream.c

[PATCH 12/17] soundwire: cadence_master: make use of mclk_freq property

2019-08-05 Thread Pierre-Louis Bossart
eq 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 --- drivers/soundwire/cadence_master.c | 14 ++ 1 file change

[PATCH 06/17] soundwire: cadence_master: use firmware defaults for frame shape

2019-08-05 Thread Pierre-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 --- drivers/soundwire/cadence_master.c | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire

[PATCH 14/17] soundwire: intel: handle disabled links

2019-08-05 Thread Pierre-Louis Bossart
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 --- drivers/soundwire/intel.c | 26 ++ include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 24 insertions

[PATCH 05/17] soundwire: export helpers to find row and column values

2019-08-05 Thread Pierre-Louis Bossart
following patch. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/bus.h| 7 +-- drivers/soundwire/stream.c | 14 -- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h index 648436a995a3..89e74adf96fa 100644

[PATCH 01/17] soundwire: intel: prevent possible dereference in hw_params

2019-08-05 Thread Pierre-Louis Bossart
-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 6 -- include/linux/soundwire/sdw_intel.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 3d9ca6479e94..a906789c7f78 100644 --- a/drivers

Re: [alsa-devel] [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled

2019-07-29 Thread Pierre-Louis Bossart
On 7/26/19 2:08 PM, Andy Shevchenko wrote: On Fri, Jul 26, 2019 at 01:08:57PM -0500, Pierre-Louis Bossart wrote: This thread became unreadable with interleaved top-posting, allow me restate the options and ask PM folks what they think On 7/25/19 6:40 PM, Pierre-Louis Bossart wrote: Not all

Re: [alsa-devel] [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled

2019-07-30 Thread Pierre-Louis Bossart
On 7/30/19 6:21 AM, Andy Shevchenko wrote: On Mon, Jul 29, 2019 at 05:07:39PM -0500, Pierre-Louis Bossart wrote: On 7/26/19 2:08 PM, Andy Shevchenko wrote: On Fri, Jul 26, 2019 at 01:08:57PM -0500, Pierre-Louis Bossart wrote: - if (ret < 0) + if (ret < 0 &&

Re: [alsa-devel] [PATCH 06/17] soundwire: cadence_master: use firmware defaults for frame shape

2019-08-06 Thread Pierre-Louis Bossart
On 8/6/19 10:27 AM, Cezary Rojewski wrote: On 2019-08-06 02:55, Pierre-Louis Bossart wrote: diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 5d9729b4d634..89c55e4bb72c 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire

Re: [PATCH 09/17] soundwire: stream: remove unnecessary variable initializations

2019-08-06 Thread Pierre-Louis Bossart
On 8/6/19 10:31 AM, Cezary Rojewski wrote: On 2019-08-06 02:55, Pierre-Louis Bossart wrote: @@ -1493,6 +1493,11 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream)   }   } +    if (!bus) { +    pr_err("Configuration error in %s\n", __func__); +

<    3   4   5   6   7   8   9   10   11   12   >