From patchwork Sat Aug 8 17:46:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 40187 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n78Hjao7009537 for ; Sat, 8 Aug 2009 17:46:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752729AbZHHRqM (ORCPT ); Sat, 8 Aug 2009 13:46:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752741AbZHHRqL (ORCPT ); Sat, 8 Aug 2009 13:46:11 -0400 Received: from mail-ew0-f214.google.com ([209.85.219.214]:51190 "EHLO mail-ew0-f214.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbZHHRqL (ORCPT ); Sat, 8 Aug 2009 13:46:11 -0400 Received: by mail-ew0-f214.google.com with SMTP id 10so2174216ewy.37 for ; Sat, 08 Aug 2009 10:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=uj+3G+79kCVsQu9YBmlEKZ4Q6Y4ViRoRgSstPiNJTkY=; b=gaOohQ6FHcZNv9gRZ6VIJYynPspiHiZh4QzjCKacns24/0PT+kO6Qhti+qWIKNl5uG QtW738g2/YHk7a3GA8XaVfRky1pFuXGwSe3LWEWvIP0B66MDGR0XW3rADY3LrICDpXQn cIHfBdtlBzg7L8qxLYssifVnI9nuY3RCL8pGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=vOnib3SrWoiwbw/NnJUXbRvrjOvgIQjo8urSDFDlwyPG9bYUVyQiOKW1SG6gTgwdBK 9qGlTBSPQmuCoOzviKm6UNkoIG7JnT7kN41xCeaIaCufoHVqdsINT4T+YvQYf71aA+o+ mxxhBXzZRqdx33x9wlm1oV3gKm0ZihnXy7nNk= Received: by 10.210.53.1 with SMTP id b1mr892115eba.62.1249753571813; Sat, 08 Aug 2009 10:46:11 -0700 (PDT) Received: from ?95.78.132.126? ([95.78.132.126]) by mx.google.com with ESMTPS id 24sm6291407eyx.53.2009.08.08.10.46.11 (version=SSLv3 cipher=RC4-MD5); Sat, 08 Aug 2009 10:46:11 -0700 (PDT) Subject: [patch review 5/6] radio-mr800: update suspend/resume procedure From: Alexey Klimov To: Douglas Schilling Landgraf Cc: linux-media@vger.kernel.org Date: Sat, 08 Aug 2009 21:46:12 +0400 Message-Id: <1249753572.15160.250.camel@tux.localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Patch fixes suspend/resume procedure. Signed-off-by: Alexey Klimov diff -r 05754a500f80 linux/drivers/media/radio/radio-mr800.c --- a/linux/drivers/media/radio/radio-mr800.c Sat Aug 08 20:06:36 2009 +0400 +++ b/linux/drivers/media/radio/radio-mr800.c Sat Aug 08 20:22:05 2009 +0400 @@ -564,11 +564,23 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) { struct amradio_device *radio = usb_get_intfdata(intf); - int retval; - retval = amradio_set_mute(radio, AMRADIO_STOP); - if (retval < 0) - dev_warn(&intf->dev, "amradio_stop failed\n"); + if (radio->status == AMRADIO_START) { + int retval; + retval = amradio_set_mute(radio, AMRADIO_STOP); + if (retval < 0) + dev_warn(&intf->dev, "amradio_stop failed\n"); + + /* After stopping radio status set to AMRADIO_STOP. + * If we want driver to start radio on resume + * we set status equal to AMRADIO_START. + * On resume we will check status and run radio if needed. + */ + + mutex_lock(&radio->lock); + radio->status = AMRADIO_START; + mutex_unlock(&radio->lock); + } dev_info(&intf->dev, "going into suspend..\n"); @@ -579,11 +591,24 @@ static int usb_amradio_resume(struct usb_interface *intf) { struct amradio_device *radio = usb_get_intfdata(intf); - int retval; - retval = amradio_set_mute(radio, AMRADIO_START); - if (retval < 0) - dev_warn(&intf->dev, "amradio_start failed\n"); + if (radio->status == AMRADIO_START) { + int retval; + retval = amradio_set_mute(radio, AMRADIO_START); + if (retval < 0) + dev_warn(&intf->dev, "amradio_start failed\n"); + retval = amradio_setfreq(radio); + if (retval < 0) + dev_warn(&intf->dev, + "set frequency failed\n"); + + if (radio->stereo) { + retval = amradio_set_stereo(radio, WANT_STEREO); + if (retval < 0) + dev_warn(&intf->dev, "set stereo failed\n"); + } + + } dev_info(&intf->dev, "coming out of suspend..\n");