6/02/2012

Accessory ( Headset , Headphone , ANC Headset etc ) Detection in 8660,8260 ( 8x60) Android Builds

The Accessories that can be detected by PMIC 8058 OTHC used in 8x60 are listed in
LINUX/android/kernel/include/linux/pmic8058-othc.h
enum othc_accessory_type {
OTHC_NO_DEVICE = 0,
OTHC_HEADSET = 1 << 0,
OTHC_HEADPHONE = 1 << 1,
OTHC_MICROPHONE = 1 << 2,
OTHC_ANC_HEADSET = 1 << 3,
OTHC_ANC_HEADPHONE = 1 << 4,
OTHC_ANC_MICROPHONE = 1 << 5,
OTHC_SVIDEO_OUT = 1 << 6,
};

The Logic to decide the type of accessory is based on the detect_flags that idetifies the Accessory type and other parameters as
specified in the othc_accessories array found in the file /LINUX/android/kernel/arch/arm/mach-msm/board-msm8x60.c


The Logic to decide the type of accessory is based on the detect_flags that idetifies the Accessory type and other parameters as
specified in the othc_accessories array found in the file /LINUX/android/kernel/arch/arm/mach-msm/board-msm8x60.c

static struct othc_accessory_info othc_accessories[] = {
{
.accessory = OTHC_SVIDEO_OUT,
.detect_flags = OTHC_MICBIAS_DETECT | OTHC_SWITCH_DETECT
| OTHC_ADC_DETECT,
.key_code = SW_VIDEOOUT_INSERT,
.enabled = false,
.adc_thres = {
.min_threshold = 20,
.max_threshold = 40,
},
},
{
.accessory = OTHC_ANC_HEADPHONE,
.detect_flags = OTHC_MICBIAS_DETECT | OTHC_GPIO_DETECT |
OTHC_SWITCH_DETECT,
.gpio = PM8058_LINE_IN_DET_GPIO,
.active_low = 1,
.key_code = SW_HEADPHONE_INSERT,
.enabled = true,
},
{
.accessory = OTHC_ANC_HEADSET,
.detect_flags = OTHC_MICBIAS_DETECT | OTHC_GPIO_DETECT,
.gpio = PM8058_LINE_IN_DET_GPIO,
.active_low = 1,
.key_code = SW_HEADPHONE_INSERT,
.enabled = true,
},
{
.accessory = OTHC_HEADPHONE,
.detect_flags = OTHC_MICBIAS_DETECT | OTHC_SWITCH_DETECT,
.key_code = SW_HEADPHONE_INSERT,
.enabled = true,
},
{
.accessory = OTHC_MICROPHONE,
.detect_flags = OTHC_GPIO_DETECT,
.gpio = PM8058_LINE_IN_DET_GPIO,
.active_low = 1,
.key_code = SW_MICROPHONE_INSERT,
.enabled = true,
},
{
.accessory = OTHC_HEADSET,
.detect_flags = OTHC_MICBIAS_DETECT,
.key_code = SW_HEADPHONE_INSERT,
.enabled = true,
},
};

If OEM want to disable the detection of any accessory then they can set .enabled = false for the Accessory they dont want to support in the above table .



The decision about which Acessory is inserted or removed is done in the function
static int pm8058_accessory_report(struct pm8058_othc *dd, int status) present in the file
LINUX/android/kernel/drivers/input/misc/pmic8058-othc.c

No comments:

Post a Comment