public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Roger Tseng <rogerable@realtek.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	driverdev-devel@linuxdriverproject.org, wei_wang@realsil.com.cn,
	micky_ching@realsil.com.cn
Subject: Re: [PATCH 2/2] mfd: rtsx_usb: Defer autosuspend while card exists
Date: Mon, 19 Jan 2015 09:47:04 +0000	[thread overview]
Message-ID: <20150119094704.GL21886@x1> (raw)
In-Reply-To: <1421306085-32254-3-git-send-email-rogerable@realtek.com>

On Thu, 15 Jan 2015, Roger Tseng wrote:

> A card insertion happens after the lastest polling before reader is
> suspended may never have a chance to be detected. Under current 1-HZ
> polling interval setting in mmc_core, the worst case of such
> undetectablility is about 1 second.
> 
> To further reduce the undetectability, detect card slot again in suspend
> method and defer the autosuspend if the slot is loaded. The default 2
> second autosuspend delay of USB subsystem should let the next polling
> detects the card.
> 
> Signed-off-by: Roger Tseng <rogerable@realtek.com>
> ---
>  drivers/mfd/rtsx_usb.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
> index 076694126e5d..63883fd025c0 100644
> --- a/drivers/mfd/rtsx_usb.c
> +++ b/drivers/mfd/rtsx_usb.c
> @@ -687,6 +687,20 @@ static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
>  	dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n",
>  			__func__, message.event);
>  
> +	if (PMSG_IS_AUTO(message)) {
> +		if (mutex_trylock(&ucr->dev_mutex)) {
> +			rtsx_usb_get_card_status(ucr, &val);
> +			mutex_unlock(&ucr->dev_mutex);
> +
> +			/* Defer the autosuspend if card exists */
> +			if (val & (SD_CD | MS_CD))
> +				return -EAGAIN;
> +		} else {
> +			/* There is an ongoing operation*/
> +			return -EAGAIN;
> +		}
> +	}
> +
>  	return 0;
>  }
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2015-01-19  9:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15  7:14 [PATCH 0/2] Fix PM deadlock and card detection problem Roger Tseng
2015-01-15  7:14 ` [PATCH 1/2] mfd: rtsx_usb: Fix runtime PM deadlock Roger Tseng
2015-01-19  9:45   ` Lee Jones
2015-01-20 11:04     ` Roger Tseng
2015-01-20 16:07       ` Lee Jones
2015-01-21  6:58         ` Roger Tseng
2015-01-21  7:38           ` Lee Jones
2015-01-15  7:14 ` [PATCH 2/2] mfd: rtsx_usb: Defer autosuspend while card exists Roger Tseng
2015-01-19  9:47   ` Lee Jones [this message]

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=20150119094704.GL21886@x1 \
    --to=lee.jones@linaro.org \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=micky_ching@realsil.com.cn \
    --cc=rogerable@realtek.com \
    --cc=sameo@linux.intel.com \
    --cc=wei_wang@realsil.com.cn \
    /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