[ARM] mfd: cpcap-whisper: Add interface to update audio switch
authorGreg Meiste <w30289@motorola.com>
Wed, 15 Sep 2010 18:55:22 +0000 (13:55 -0500)
committerColin Cross <ccross@android.com>
Thu, 7 Oct 2010 00:01:29 +0000 (17:01 -0700)
The Motorola HID driver needs an interface to call when an audio cable
is inserted/removed from a Smart Dock.  The interface should update
the audio switch so the audio driver can properly route audio.

Change-Id: Ifad06400c5895f7545f702cdb09be02fe716412a
Signed-off-by: Greg Meiste <w30289@motorola.com>
Signed-off-by: Iliyan Malchev <malchev@google.com>
drivers/mfd/cpcap-whisper.c
include/linux/spi/cpcap.h

index 06cb9a5b828de6e189fe2f8a69e083a49c50ed62..0d7dae5e6245faf06f7d9d22858d31d2e8d9f62c 100644 (file)
@@ -120,6 +120,8 @@ struct cpcap_whisper_data {
        struct otg_transceiver *otg;
 };
 
+static struct cpcap_whisper_data *whisper_di;
+
 static int whisper_debug;
 module_param(whisper_debug, int, S_IRUGO | S_IWUSR | S_IWGRP);
 
@@ -607,6 +609,21 @@ int cpcap_accy_whisper(struct cpcap_device *cpcap, unsigned int cmd,
        return retval;
 }
 
+void cpcap_accy_whisper_spdif_set_state(int state)
+{
+       if (!whisper_di)
+               return;
+
+       if (!switch_get_state(&whisper_di->dsdev))
+               return;
+
+       state = ((state > 0) ? 1 : 0);
+       switch_set_state(&whisper_di->asdev, state);
+
+       pr_info("%s: Audio cable %s present\n", __func__,
+               (state ? "is" : "not"));
+}
+
 static int cpcap_whisper_probe(struct platform_device *pdev)
 {
        int retval;
@@ -683,6 +700,7 @@ static int cpcap_whisper_probe(struct platform_device *pdev)
 #endif
 
        data->cpcap->accydata = data;
+       whisper_di = data;
        dev_info(&pdev->dev, "CPCAP Whisper detection probed\n");
 
        /* Perform initial detection */
index 4b71450cf0ebbaca59ecab7ca4c35715b7f691b8..4774dbb3fbae47b2f24b93b990e754caf0cffebc 100644 (file)
@@ -782,6 +782,8 @@ unsigned char cpcap_uc_status(struct cpcap_device *cpcap,
 int cpcap_accy_whisper(struct cpcap_device *cpcap, unsigned int cmd,
                       char *dock_id);
 
+void cpcap_accy_whisper_spdif_set_state(int state);
+
 #define  cpcap_driver_register platform_driver_register
 #define  cpcap_driver_unregister platform_driver_unregister