mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Wentong Wu <wentong.wu@intel.com>
Cc: tomas.winkler@intel.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, hao.yao@intel.com,
	stable@vger.kernel.org, Jason Chen <jason.z.chen@intel.com>
Subject: Re: [PATCH] mei: vsc: Don't stop/restart mei device during system suspend/resume
Date: Thu, 23 May 2024 10:45:19 +0000	[thread overview]
Message-ID: <Zk8eP2-UEPSxv42v@kekkonen.localdomain> (raw)
In-Reply-To: <20240516015400.3281634-1-wentong.wu@intel.com>

Hi Wentong,

Thanks for the patch. I thought something like this would indeed have been
possible.

On Thu, May 16, 2024 at 09:54:00AM +0800, Wentong Wu wrote:
> The dynamically created mei client device (mei csi) is used as one V4L2
> sub device of the whole video pipeline, and the V4L2 connection graph is
> built by software node. The mei_stop() and mei_restart() will delete the
> old mei csi client device and create a new mei client device, which will
> cause the software node information saved in old mei csi device lost and
> the whole video pipeline will be broken.
> 
> Removing mei_stop()/mei_restart() during system suspend/resume can fix
> the issue above and won't impact hardware actual power saving logic.
> 
> Fixes: 386a766c4169 ("mei: Add MEI hardware support for IVSC device")

I think this should be instead:

Fixes: f6085a96c973 ("mei: vsc: Unregister interrupt handler for system suspend")

As this fix depends on the previous not-quite-as-good fix.

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> Cc: stable@vger.kernel.org # for 6.8+
> Reported-by: Hao Yao <hao.yao@intel.com>
> Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> Tested-by: Jason Chen <jason.z.chen@intel.com>
> ---
>  drivers/misc/mei/platform-vsc.c | 39 +++++++++++++--------------------
>  1 file changed, 15 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/misc/mei/platform-vsc.c b/drivers/misc/mei/platform-vsc.c
> index b543e6b9f3cf..1ec65d87488a 100644
> --- a/drivers/misc/mei/platform-vsc.c
> +++ b/drivers/misc/mei/platform-vsc.c
> @@ -399,41 +399,32 @@ static void mei_vsc_remove(struct platform_device *pdev)
>  
>  static int mei_vsc_suspend(struct device *dev)
>  {
> -	struct mei_device *mei_dev = dev_get_drvdata(dev);
> -	struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
> +	struct mei_device *mei_dev;
> +	int ret = 0;
>  
> -	mei_stop(mei_dev);
> +	mei_dev = dev_get_drvdata(dev);
> +	if (!mei_dev)
> +		return -ENODEV;
>  
> -	mei_disable_interrupts(mei_dev);
> +	mutex_lock(&mei_dev->device_lock);
>  
> -	vsc_tp_free_irq(hw->tp);
> +	if (!mei_write_is_idle(mei_dev))
> +		ret = -EAGAIN;
>  
> -	return 0;
> +	mutex_unlock(&mei_dev->device_lock);
> +
> +	return ret;
>  }
>  
>  static int mei_vsc_resume(struct device *dev)
>  {
> -	struct mei_device *mei_dev = dev_get_drvdata(dev);
> -	struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
> -	int ret;
> -
> -	ret = vsc_tp_request_irq(hw->tp);
> -	if (ret)
> -		return ret;
> -
> -	ret = mei_restart(mei_dev);
> -	if (ret)
> -		goto err_free;
> +	struct mei_device *mei_dev;
>  
> -	/* start timer if stopped in suspend */
> -	schedule_delayed_work(&mei_dev->timer_work, HZ);
> +	mei_dev = dev_get_drvdata(dev);
> +	if (!mei_dev)
> +		return -ENODEV;
>  
>  	return 0;
> -
> -err_free:
> -	vsc_tp_free_irq(hw->tp);
> -
> -	return ret;
>  }
>  
>  static DEFINE_SIMPLE_DEV_PM_OPS(mei_vsc_pm_ops, mei_vsc_suspend, mei_vsc_resume);

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2024-05-23 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  1:54 Wentong Wu
2024-05-23 10:45 ` Sakari Ailus [this message]
2024-05-23 13:02   ` Wu, Wentong

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=Zk8eP2-UEPSxv42v@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hao.yao@intel.com \
    --cc=jason.z.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=wentong.wu@intel.com \
    /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

all inboxes | Powered by JetHome®