[ARM] mfd: cpcap-whisper: Add interface to update audio switch

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>
This commit is contained in:
Greg Meiste
2010-09-15 13:55:22 -05:00
committed by Colin Cross
parent 4720a83f9c
commit 82bd615a2d
2 changed files with 20 additions and 0 deletions

View 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 */

View 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