Add dump_log cmd to mdm6600_ctrl
authorJohn Michelau <john.michelau@motorola.com>
Tue, 11 Jan 2011 22:52:25 +0000 (16:52 -0600)
committerBenoit Goby <benoit@android.com>
Tue, 1 Mar 2011 04:10:58 +0000 (20:10 -0800)
This command triggers a dump of the MDM6600 RAM log buffers
into non-volatile memory, so that they can be retrieved by
bugreport or the RIL when submitting error reports. It
provides a simple path for this which does not rely on the
typical (and more error-prone) IPC mechanism.

Change-Id: I17708704b94426b1541533978478192d3f4dab89

drivers/misc/radio_ctrl/mdm6600_ctrl.c

index a6fa4fb902f8d065eb6be4961e4bdb0a4d267b77..dd0ac242533d7388a6a58071f9ec7031b2e4303f 100644 (file)
@@ -94,6 +94,7 @@ static unsigned int bp_power_idx = 0;
 static void __devexit mdm_ctrl_shutdown(struct platform_device *pdev);
 static void mdm_ctrl_powerup(void);
 static void mdm_ctrl_set_bootmode(int mode);
+static void mdm_ctrl_dump_log(void);
 
 static const char *bp_status_string(unsigned int stat)
 {
@@ -142,6 +143,8 @@ static ssize_t mdm_user_command(struct radio_dev *rdev, char *post_strip)
                mdm_ctrl_set_bootmode(0);
        } else if (strcmp(post_strip,"bootmode_flash") == 0) {
                mdm_ctrl_set_bootmode(1);
+       } else if (strcmp(post_strip,"dump_log") == 0) {
+               mdm_ctrl_dump_log();
        } else {
                return -EINVAL;
        }
@@ -550,6 +553,23 @@ static void __devexit mdm_ctrl_shutdown(struct platform_device *pdev)
                pr_err("%s: Modem failed to power down.", mdmctrl);
 }
 
+static void mdm_ctrl_dump_log(void)
+{
+       pr_info("%s: Dumping modem log", mdmctrl);
+
+       /* To implement the dump, the BP expects BP_PWRON to be asserted
+        * while the AP status pins remain normal.
+        */
+       set_bp_pwron(1);
+       msleep(100);
+       set_bp_pwron(0);
+
+       /* Allow enough time for the log to dump fully to EFS on the BP,
+        * so that users of this don't have to wait themselves.
+        */
+       msleep(500);
+}
+
 static struct platform_driver mdm6x00_ctrl_driver = {
        .probe = mdm_ctrl_probe,
        .remove = __devexit_p(mdm_ctrl_remove),