linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	vkoul@kernel.org, broonie@kernel.org,
	srinivas.kandagatla@linaro.org, jank@cadence.com,
	slawomir.blauciak@intel.com,
	Sanyog Kale <sanyog.r.kale@intel.com>
Subject: Re: [alsa-devel] [RFC PATCH 36/40] soundwire: intel: disable interrupts on suspend
Date: Fri, 26 Jul 2019 17:55:20 +0200	[thread overview]
Message-ID: <20190726155520.GL16003@ubuntu> (raw)
In-Reply-To: <20190725234032.21152-37-pierre-louis.bossart@linux.intel.com>

On Thu, Jul 25, 2019 at 06:40:28PM -0500, Pierre-Louis Bossart wrote:
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  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/cadence_master.c b/drivers/soundwire/cadence_master.c
> index f486fe15fb46..fa7230b0f200 100644
> --- a/drivers/soundwire/cadence_master.c
> +++ b/drivers/soundwire/cadence_master.c
> @@ -814,33 +814,39 @@ EXPORT_SYMBOL(sdw_cdns_exit_reset);
>   * sdw_cdns_enable_interrupt() - Enable SDW interrupts and update config
>   * @cdns: Cadence instance
>   */
> -int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns)
> +int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state)
>  {
>  	u32 mask;
>  
> -	cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0,
> -		    CDNS_MCP_SLAVE_INTMASK0_MASK);
> -	cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1,
> -		    CDNS_MCP_SLAVE_INTMASK1_MASK);
> +	if (state) {
> +		cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0,
> +			    CDNS_MCP_SLAVE_INTMASK0_MASK);
> +		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 |
> -		CDNS_MCP_INT_SLAVE_ATTACH | CDNS_MCP_INT_SLAVE_NATTACH;
> +		/* enable detection of slave state changes */
> +		mask = CDNS_MCP_INT_SLAVE_RSVD | CDNS_MCP_INT_SLAVE_ALERT |
> +			CDNS_MCP_INT_SLAVE_ATTACH | CDNS_MCP_INT_SLAVE_NATTACH;
>  
> -	/* enable detection of bus issues */
> -	mask |= CDNS_MCP_INT_CTRL_CLASH | CDNS_MCP_INT_DATA_CLASH |
> -		CDNS_MCP_INT_PARITY;
> +		/* enable detection of bus issues */
> +		mask |= CDNS_MCP_INT_CTRL_CLASH | CDNS_MCP_INT_DATA_CLASH |
> +			CDNS_MCP_INT_PARITY;
>  
> -	/* no detection of port interrupts for now */
> +		/* no detection of port interrupts for now */
>  
> -	/* enable detection of RX fifo level */
> -	mask |= CDNS_MCP_INT_RX_WL;
> +		/* enable detection of RX fifo level */
> +		mask |= CDNS_MCP_INT_RX_WL;
>  
> -	/* now enable all of the above */
> -	mask |= CDNS_MCP_INT_IRQ;
> +		/* now enable all of the above */
> +		mask |= CDNS_MCP_INT_IRQ;
>  
> -	if (interrupt_mask) /* parameter override */
> -		mask = interrupt_mask;
> +		if (interrupt_mask) /* parameter override */
> +			mask = interrupt_mask;
> +	} else {
> +		cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0, 0);
> +		cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1, 0);
> +		mask = 0;
> +	}

Looks like this should be two functions? Especially since "state" is always a constant
when it is called. If there is still a lot of common code below, maybe make it a helper
function.

Thanks
Guennadi

>  
>  	cdns_writel(cdns, CDNS_MCP_INTMASK, mask);
>  
> diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h
> index 2b551f9226f3..1a0ba36dd78f 100644
> --- a/drivers/soundwire/cadence_master.h
> +++ b/drivers/soundwire/cadence_master.h
> @@ -162,7 +162,7 @@ int sdw_cdns_init(struct sdw_cdns *cdns);
>  int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
>  		      struct sdw_cdns_stream_config config);
>  int sdw_cdns_exit_reset(struct sdw_cdns *cdns);
> -int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
> +int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state);
>  
>  void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);
>  
> diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
> index 9ebe38e4d979..1192d5775484 100644
> --- a/drivers/soundwire/intel.c
> +++ b/drivers/soundwire/intel.c
> @@ -1110,7 +1110,7 @@ static int intel_probe(struct platform_device *pdev)
>  		goto err_init;
>  	}
>  
> -	ret = sdw_cdns_enable_interrupt(&sdw->cdns);
> +	ret = sdw_cdns_enable_interrupt(&sdw->cdns, true);
>  
>  	ret = sdw_cdns_exit_reset(&sdw->cdns);
>  
> @@ -1169,6 +1169,8 @@ static int intel_suspend(struct device *dev)
>  		return 0;
>  	}
>  
> +	sdw_cdns_enable_interrupt(&sdw->cdns, false);
> +
>  	ret = intel_link_power_down(sdw);
>  	if (ret) {
>  		dev_err(dev, "Link power down failed: %d", ret);
> @@ -1199,7 +1201,7 @@ static int intel_resume(struct device *dev)
>  		return ret;
>  	}
>  
> -	sdw_cdns_enable_interrupt(&sdw->cdns);
> +	sdw_cdns_enable_interrupt(&sdw->cdns, true);
>  
>  	ret = sdw_cdns_exit_reset(&sdw->cdns);
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-07-26 15:55 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 23:39 [RFC PATCH 00/40] soundwire: updates for 5.4 Pierre-Louis Bossart
2019-07-25 23:39 ` [RFC PATCH 01/40] soundwire: add debugfs support Pierre-Louis Bossart
2019-07-25 22:15   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 13:43     ` Pierre-Louis Bossart
2019-07-26  9:22   ` Cezary Rojewski
2019-07-26 13:57     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-26 14:04   ` Greg KH
2019-07-26 15:29     ` Pierre-Louis Bossart
2019-07-25 23:39 ` [RFC PATCH 02/40] soundwire: cadence_master: add debugfs register dump Pierre-Louis Bossart
2019-07-26 14:09   ` Greg KH
2019-07-26 15:32     ` Pierre-Louis Bossart
2019-08-05  7:55   ` Sanyog Kale
2019-08-05 15:20     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:39 ` [RFC PATCH 03/40] soundwire: cadence_master: align debugfs to 8 digits Pierre-Louis Bossart
2019-07-26  9:38   ` Cezary Rojewski
2019-07-26 13:58     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 11:50   ` Vinod Koul
2019-07-25 23:39 ` [RFC PATCH 04/40] soundwire: intel: add debugfs register dump Pierre-Louis Bossart
2019-07-26  9:35   ` Cezary Rojewski
2019-07-26 14:00     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-26 14:11       ` Greg KH
2019-07-26 14:06   ` Greg KH
2019-07-26 14:09     ` Greg KH
2019-07-26 15:34     ` Pierre-Louis Bossart
2019-07-25 23:39 ` [RFC PATCH 05/40] soundwire: intel: move interrupt enable after interrupt handler registration Pierre-Louis Bossart
2019-08-02 11:53   ` Vinod Koul
2019-08-02 15:08     ` Pierre-Louis Bossart
2019-07-25 23:39 ` [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params Pierre-Louis Bossart
2019-07-26  9:45   ` Cezary Rojewski
2019-07-26 14:02     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 11:55   ` Vinod Koul
2019-08-02 15:16     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 15:57       ` Vinod Koul
2019-08-02 16:52         ` Pierre-Louis Bossart
2019-08-02 17:37           ` Vinod Koul
2019-07-25 23:39 ` [RFC PATCH 07/40] soundwire: intel: fix channel number reported by hardware Pierre-Louis Bossart
2019-08-02 11:57   ` Vinod Koul
2019-08-02 15:18     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 08/40] soundwire: intel: remove BIOS work-arounds Pierre-Louis Bossart
2019-08-02 11:58   ` Vinod Koul
2019-07-25 23:40 ` [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE Pierre-Louis Bossart
2019-07-25 22:23   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 14:05     ` Pierre-Louis Bossart
2019-07-26  2:11   ` Bard liao
2019-07-26 13:33     ` Pierre-Louis Bossart
2019-07-26  9:53   ` Cezary Rojewski
2019-07-26  9:54     ` Cezary Rojewski
2019-08-02 12:03   ` Vinod Koul
2019-08-02 15:18     ` Pierre-Louis Bossart
2019-08-05  8:51   ` Sanyog Kale
2019-07-25 23:40 ` [RFC PATCH 10/40] soundwire: cadence_master: remove useless wrapper Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 11/40] soundwire: cadence_master: simplify bus clash interrupt clear Pierre-Louis Bossart
2019-08-02 12:07   ` Vinod Koul
2019-07-25 23:40 ` [RFC PATCH 12/40] soundwire: cadence_master: revisit interrupt settings Pierre-Louis Bossart
2019-08-02 12:10   ` Vinod Koul
2019-08-02 15:23     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 13/40] soundwire: cadence_master: fix register definition for SLAVE_STATE Pierre-Louis Bossart
2019-08-02 12:12   ` Vinod Koul
2019-07-25 23:40 ` [RFC PATCH 14/40] soundwire: cadence_master: fix definitions for INTSTAT0/1 Pierre-Louis Bossart
2019-08-02 12:13   ` Vinod Koul
2019-07-25 23:40 ` [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave Pierre-Louis Bossart
2019-07-25 22:31   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 14:09     ` Pierre-Louis Bossart
2019-08-02 12:20   ` Vinod Koul
2019-08-02 15:29     ` Pierre-Louis Bossart
2019-08-02 16:01       ` Vinod Koul
2019-08-02 16:41         ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 16/40] soundwire: cadence_master: improve startup sequence with link hw_reset Pierre-Louis Bossart
2019-07-26  7:22   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 14:11     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled Pierre-Louis Bossart
2019-07-26  7:39   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26  7:47     ` Jan Kotas
2019-07-26  8:22       ` Guennadi Liakhovetski
2019-07-26  8:33         ` Jan Kotas
2019-07-26  8:42           ` Guennadi Liakhovetski
2019-07-26 18:08   ` Pierre-Louis Bossart
2019-07-26 18:25     ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 19:11       ` Andy Shevchenko
2019-07-26 19:08     ` Andy Shevchenko
2019-07-29 22:07       ` [alsa-devel] " Pierre-Louis Bossart
2019-07-30 11:21         ` Andy Shevchenko
2019-07-30 12:57           ` Pierre-Louis Bossart
2019-07-30 15:58             ` Andy Shevchenko
2019-07-30 15:59               ` Andy Shevchenko
2019-08-02 16:58   ` Vinod Koul
2019-08-02 17:20     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 18/40] soundwire: bus: split handling of Device0 events Pierre-Louis Bossart
2019-08-02 16:59   ` Vinod Koul
2019-07-25 23:40 ` [RFC PATCH 19/40] soundwire: bus: improve dynamic debug comments for enumeration Pierre-Louis Bossart
2019-08-02 17:00   ` Vinod Koul
2019-08-02 17:20     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 20/40] soundwire: prototypes for suspend/resume Pierre-Louis Bossart
2019-07-26 10:04   ` Cezary Rojewski
2019-07-26 14:15     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 17:03   ` Vinod Koul
2019-08-02 17:21     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 21/40] soundwire: export helpers to find row and column values Pierre-Louis Bossart
2019-07-26 14:43   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 15:26     ` Pierre-Louis Bossart
2019-08-02 17:04       ` Vinod Koul
2019-08-05  9:39   ` Sanyog Kale
2019-08-05 15:27     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 22/40] soundwire: include mod_devicetable.h to avoid compiling warnings Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 23/40] soundwire: stream: fix disable sequence Pierre-Louis Bossart
2019-07-26 10:14   ` Cezary Rojewski
2019-07-26 14:17     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-26 14:51   ` Guennadi Liakhovetski
2019-07-26 15:05     ` Pierre-Louis Bossart
2019-08-05  9:56   ` Sanyog Kale
2019-08-05 15:33     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-05 16:32       ` Sanyog Kale
2019-08-05 19:12         ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 24/40] soundwire: cadence_master: use BIOS defaults for frame shape Pierre-Louis Bossart
2019-07-26 10:20   ` Cezary Rojewski
2019-07-26 14:22     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 17:10   ` Vinod Koul
2019-08-02 17:24     ` Pierre-Louis Bossart
2019-08-05 10:01   ` Sanyog Kale
2019-07-25 23:40 ` [RFC PATCH 25/40] soundwire: intel: use BIOS information to set clock dividers Pierre-Louis Bossart
2019-08-02 17:17   ` Vinod Koul
2019-08-02 17:29     ` Pierre-Louis Bossart
2019-08-05 10:28   ` Sanyog Kale
2019-08-05 15:40     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register Pierre-Louis Bossart
2019-07-26  5:19   ` [alsa-devel] " Bard liao
2019-07-26  5:56     ` rander.wang
2019-07-26 14:24     ` Pierre-Louis Bossart
2019-08-02 17:19   ` Vinod Koul
2019-08-02 17:30     ` Pierre-Louis Bossart
2019-08-05 10:40   ` Sanyog Kale
2019-08-05 15:41     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 27/40] soundwire: Add Intel resource management algorithm Pierre-Louis Bossart
2019-07-26 11:07   ` Cezary Rojewski
2019-07-26 14:41     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-26 15:43   ` Guennadi Liakhovetski
2019-07-26 17:55     ` Pierre-Louis Bossart
2019-08-05 16:54   ` Sanyog Kale
2019-08-05 19:08     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 28/40] soundwire: intel: handle disabled links Pierre-Louis Bossart
2019-08-05 16:57   ` Sanyog Kale
2019-08-05 19:18     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 29/40] soundwire: intel_init: add kernel module parameter to filter out links Pierre-Louis Bossart
2019-07-26 10:30   ` Cezary Rojewski
2019-07-26 14:43     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 30/40] soundwire: cadence_master: add kernel parameter to override interrupt mask Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 31/40] soundwire: intel: move shutdown() callback and don't export symbol Pierre-Louis Bossart
2019-07-26 10:38   ` Cezary Rojewski
2019-07-26 14:46     ` [alsa-devel] " Pierre-Louis Bossart
2019-08-02 17:28       ` Vinod Koul
2019-08-02 17:42         ` Pierre-Louis Bossart
2019-08-14 19:31         ` Pierre-Louis Bossart
2019-08-23  7:34           ` Vinod Koul
2019-08-23 15:57             ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 32/40] soundwire: intel: add helper for initialization Pierre-Louis Bossart
2019-07-26 10:42   ` Cezary Rojewski
2019-07-26 14:55     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 33/40] soundwire: intel: Add basic power management support Pierre-Louis Bossart
2019-07-26 10:50   ` Cezary Rojewski
2019-07-26 14:57     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 34/40] soundwire: intel: ignore disabled links for suspend/resume Pierre-Louis Bossart
2019-08-02 17:30   ` Vinod Koul
2019-08-02 17:44     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 35/40] soundwire: intel: export helper to exit reset Pierre-Louis Bossart
2019-07-26 15:52   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 17:22     ` Pierre-Louis Bossart
2019-08-02 17:31   ` Vinod Koul
2019-08-02 17:44     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 36/40] soundwire: intel: disable interrupts on suspend Pierre-Louis Bossart
2019-07-26 15:55   ` Guennadi Liakhovetski [this message]
2019-07-26 17:26     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 37/40] soundwire: cadence_master: add hw_reset capability in debugfs Pierre-Louis Bossart
2019-07-26 14:07   ` Greg KH
2019-07-26 15:01     ` [alsa-devel] " Pierre-Louis Bossart
2019-07-26 15:57   ` Guennadi Liakhovetski
2019-07-26 17:31     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 38/40] soundwire: cadence_master: make clock stop exit configurable on init Pierre-Louis Bossart
2019-07-26 16:02   ` [alsa-devel] " Guennadi Liakhovetski
2019-07-26 17:35     ` Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 39/40] soundwire: intel: add pm_runtime support Pierre-Louis Bossart
2019-07-25 23:40 ` [RFC PATCH 40/40] soundwire: intel: add delay on restart for enumeration Pierre-Louis Bossart
2019-07-26 11:14 ` [RFC PATCH 00/40] soundwire: updates for 5.4 Cezary Rojewski
2019-07-26 15:23   ` [alsa-devel] " Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190726155520.GL16003@ubuntu \
    --to=guennadi.liakhovetski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jank@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=slawomir.blauciak@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).