Skip to contentSkip to conversation

radio-mr800: preserve radio state during suspend/resume

PATCH In review David Ellingsworth 1 participant 2 messages Sep 12, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/10 radio-mr800: preserve radio state during suspend/resume

From 31243088bd32d5568f06f2044f8ff782641e16b5 Mon Sep 17 00:00:00 2001
From: David Ellingsworth <[email protected]>
Date: Sat, 12 Sep 2009 02:05:57 -0400
Subject: [PATCH 09/10] mr800: preserve radio state during suspend/resume

---
drivers/media/radio/radio-mr800.c | 17 +++++++++++------

1 files changed, 11 insertions(+), 6 deletions(-)
drivers/media/radio/radio-mr800.c +11 -6
index 11db6ea..10bed62 100644
@@ -574,9 +574,12 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
 
    mutex_lock(&radio->lock);
 
-    retval = amradio_set_mute(radio, AMRADIO_STOP);
-    if (retval < 0)
-        dev_warn(&intf->dev, "amradio_stop failed\n");
+    if (!radio->muted) {
+        retval = amradio_set_mute(radio, AMRADIO_STOP);
+        if (retval < 0)
+            dev_warn(&intf->dev, "amradio_stop failed\n");
+        radio->muted = 0;
+    }
 
    dev_info(&intf->dev, "going into suspend..\n");
 
@@ -592,9 +595,11 @@ static int usb_amradio_resume(struct usb_interface *intf)
 
    mutex_lock(&radio->lock);
 
-    retval = amradio_set_mute(radio, AMRADIO_START);
-    if (retval < 0)
-        dev_warn(&intf->dev, "amradio_start failed\n");
+    if (!radio->muted) {
+        retval = amradio_set_mute(radio, AMRADIO_START);
+        if (retval < 0)
+            dev_warn(&intf->dev, "amradio_start failed\n");
+    }
 
    dev_info(&intf->dev, "coming out of suspend..\n");
 
Signature · 1 line
1.6.3.3
Quoted 1 line

From 31243088bd32d5568f06f2044f8ff782641e16b5 Mon Sep 17 00:00:00 2001

From: David Ellingsworth <[email protected]>
Date: Sat, 12 Sep 2009 02:05:57 -0400
Subject: [PATCH 09/10] mr800: preserve radio state during suspend/resume

---
 drivers/media/radio/radio-mr800.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
drivers/media/radio/radio-mr800.c +11 -6
index 11db6ea..10bed62 100644
@@ -574,9 +574,12 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
 
 	mutex_lock(&radio->lock);
 
-	retval = amradio_set_mute(radio, AMRADIO_STOP);
-	if (retval < 0)
-		dev_warn(&intf->dev, "amradio_stop failed\n");
+	if (!radio->muted) {
+		retval = amradio_set_mute(radio, AMRADIO_STOP);
+		if (retval < 0)
+			dev_warn(&intf->dev, "amradio_stop failed\n");
+		radio->muted = 0;
+	}
 
 	dev_info(&intf->dev, "going into suspend..\n");
 
@@ -592,9 +595,11 @@ static int usb_amradio_resume(struct usb_interface *intf)
 
 	mutex_lock(&radio->lock);
 
-	retval = amradio_set_mute(radio, AMRADIO_START);
-	if (retval < 0)
-		dev_warn(&intf->dev, "amradio_start failed\n");
+	if (!radio->muted) {
+		retval = amradio_set_mute(radio, AMRADIO_START);
+		if (retval < 0)
+			dev_warn(&intf->dev, "amradio_start failed\n");
+	}
 
 	dev_info(&intf->dev, "coming out of suspend..\n");
 
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 49 lines · David Ellingsworth

From 31243088bd32d5568f06f2044f8ff782641e16b5 Mon Sep 17 00:00:00 2001
From: David Ellingsworth <[email protected]>
Date: Sat, 12 Sep 2009 02:05:57 -0400
Subject: [PATCH 09/10] mr800: preserve radio state during suspend/resume

---
drivers/media/radio/radio-mr800.c |   17 +++++++++++------

1 files changed, 11 insertions(+), 6 deletions(-)
drivers/media/radio/radio-mr800.c +11 -7
index 11db6ea..10bed62 100644
@@ -574,9 +574,12 @@ static int usb_amradio_suspend(struct usb_interface
 *intf, pm_message_t message)
 
    mutex_lock(&radio->lock);
 
-    retval = amradio_set_mute(radio, AMRADIO_STOP);
-    if (retval < 0)
-        dev_warn(&intf->dev, "amradio_stop failed\n");
+    if (!radio->muted) {
+        retval = amradio_set_mute(radio, AMRADIO_STOP);
+        if (retval < 0)
+            dev_warn(&intf->dev, "amradio_stop failed\n");
+        radio->muted = 0;
+    }
 
    dev_info(&intf->dev, "going into suspend..\n");
@@ -592,9 +595,11 @@ static int usb_amradio_resume(struct usb_interface
 *intf)
 
    mutex_lock(&radio->lock);
 
-    retval = amradio_set_mute(radio, AMRADIO_START);
-    if (retval < 0)
-        dev_warn(&intf->dev, "amradio_start failed\n");
+    if (!radio->muted) {
+        retval = amradio_set_mute(radio, AMRADIO_START);
+        if (retval < 0)
+            dev_warn(&intf->dev, "amradio_start failed\n");
+    }
 
    dev_info(&intf->dev, "coming out of suspend..\n");
 
--
Quoted 3 lines

1.6.3.3

I'm going to rework this patch as well. I think the driver needs to do more than just turn the radio back on. It should also restore the set frequency and stereo mode.

Regards,

David Ellingsworth