All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alfred E. Heggestad" <aeh@db.org>
To: Oliver Neukum <oliver@neukum.org>, Thomas Reitmayr <treitmayr@yahoo.com>
Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org,
	Henk.Vergonet@gmail.com
Subject: Re: [rft]suspend/resume support for yealink
Date: Mon, 30 Jun 2008 23:39:00 +0200	[thread overview]
Message-ID: <48695274.8040009@db.org> (raw)
In-Reply-To: <200806301608.03788.oliver@neukum.org>

Oliver Neukum wrote:
> This implements basic suspend/resume support for yealink.
> Could somebody test it?
> 

(copied Thomas)

Hi Thomas, could you please test this patch with your Yealink device?


/alfred

> 	Regards
> 		Oliver
> 
> ---
> 
> --- linux-2.6.26-sierra/drivers/input/misc/yealink.alt2.c	2008-06-30 14:13:58.000000000 +0200
> +++ linux-2.6.26-sierra/drivers/input/misc/yealink.c	2008-06-30 16:02:30.000000000 +0200
> @@ -120,6 +120,7 @@ struct yealink_dev {
>  	u8 lcdMap[ARRAY_SIZE(lcdMap)];	/* state of LCD, LED ... */
>  	int key_code;			/* last reported key	 */
>  	int shutdown:1;
> +	int open:1;
>  
>  	int	stat_ix;
>  	union {
> @@ -128,6 +129,7 @@ struct yealink_dev {
>  	} master, copy;
>  };
>  
> +static DECLARE_RWSEM(sysfs_rwsema);
>  
>  /*******************************************************************************
>   * Yealink lcd interface
> @@ -530,12 +532,16 @@ static int input_open(struct input_dev *
>  	yld->ctl_data->cmd	= CMD_INIT;
>  	yld->ctl_data->size	= 10;
>  	yld->ctl_data->sum	= 0x100-CMD_INIT-10;
> -	if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) {
> +	down_write(&sysfs_rwsema);
> +	if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0)
>  		dbg("%s - usb_submit_urb failed with result %d",
>  		     __FUNCTION__, ret);
> -		return ret;
> -	}
> -	return 0;
> +	else
> +		yld->open = 1;
> +
> +	up_write(&sysfs_rwsema);
> +
> +	return ret;
>  }
>  
>  static void stop_traffic(struct yealink_dev *yld)
> @@ -556,6 +562,9 @@ static void input_close(struct input_dev
>  {
>  	struct yealink_dev *yld = input_get_drvdata(dev);
>  
> +	down_write(&sysfs_rwsema);
> +	yld->open = 0;
> +	up_write(&sysfs_rwsema);
>  	stop_traffic(yld);
>  }
>  
> @@ -563,8 +572,6 @@ static void input_close(struct input_dev
>   * sysfs interface
>   ******************************************************************************/
>  
> -static DECLARE_RWSEM(sysfs_rwsema);
> -
>  /* Interface to the 7-segments translation table aka. char set.
>   */
>  static ssize_t show_map(struct device *dev, struct device_attribute *attr,
> @@ -856,6 +863,25 @@ static int usb_cleanup(struct yealink_de
>  	return err;
>  }
>  
> +static int usb_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> +	struct yealink_dev *yld = usb_get_intfdata(intf);
> +
> +	stop_traffic(yld);
> +	return 0;
> +}
> +
> +static int usb_resume(struct usb_interface *intf)
> +{
> +	struct yealink_dev *yld = usb_get_intfdata(intf);
> +	int rv = 0;
> +
> +	down_read(&sysfs_rwsema);
> +	if (yld->open)
> +		rv = usb_submit_urb(yld->urb_ctl, GFP_NOIO);
> +	up_read(&sysfs_rwsema);
> +	return rv;
> +}
>  static void usb_disconnect(struct usb_interface *intf)
>  {
>  	struct yealink_dev *yld;
> @@ -1002,6 +1028,8 @@ static struct usb_driver yealink_driver
>  	.name		= "yealink",
>  	.probe		= usb_probe,
>  	.disconnect	= usb_disconnect,
> +	.suspend	= usb_suspend,
> +	.resume		= usb_resume,
>  	.id_table	= usb_table,
>  };
>  


  reply	other threads:[~2008-06-30 21:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30 14:08 [rft]suspend/resume support for yealink Oliver Neukum
2008-06-30 21:39 ` Alfred E. Heggestad [this message]
     [not found] ` <200806301608.03788.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-06-30 21:47   ` Thomas Reitmayr
2008-07-01  6:04     ` Oliver Neukum
2008-07-02 14:26     ` Oliver Neukum
     [not found]       ` <200807021626.50883.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-07-03 18:27         ` Thomas Reitmayr
2008-07-09 20:33           ` Thomas Reitmayr

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=48695274.8040009@db.org \
    --to=aeh@db.org \
    --cc=Henk.Vergonet@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=treitmayr@yahoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.