static int mdm9615_configure_headset_mic_gpios(void) { int ret; struct pm_gpio param = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_BUF_CMOS, .output_value = 1, .pull = PM_GPIO_PULL_NO, .vin_sel = PM_GPIO_VIN_S4, .out_strength = PM_GPIO_STRENGTH_MED, .function = PM_GPIO_FUNC_NORMAL, }; ret = gpio_request(PM8018_GPIO_PM_TO_SYS(23), "AV_SWITCH"); if (ret) { pr_err("%s: Failed to request gpio %d\n", __func__, PM8018_GPIO_PM_TO_SYS(23)); return ret; } ret = pm8xxx_gpio_config(PM8018_GPIO_PM_TO_SYS(23), ¶m); if (ret) pr_err("%s: Failed to configure gpio %d\n", __func__, PM8018_GPIO_PM_TO_SYS(23)); else gpio_direction_output(PM8018_GPIO_PM_TO_SYS(23), 0); ret = gpio_request(PM8018_GPIO_PM_TO_SYS(35), "US_EURO_SWITCH"); if (ret) { pr_err("%s: Failed to request gpio %d\n", __func__, PM8018_GPIO_PM_TO_SYS(35)); gpio_free(PM8018_GPIO_PM_TO_SYS(23)); return ret; } ret = pm8xxx_gpio_config(PM8018_GPIO_PM_TO_SYS(35), ¶m); if (ret) pr_err("%s: Failed to configure gpio %d\n", __func__, PM8018_GPIO_PM_TO_SYS(35)); else gpio_direction_output(PM8018_GPIO_PM_TO_SYS(35), 0); return 0; } static void mdm9615_free_headset_mic_gpios(void) { if (mdm9615_headset_gpios_configured) { gpio_free(PM8018_GPIO_PM_TO_SYS(23)); gpio_free(PM8018_GPIO_PM_TO_SYS(35)); } } static int __init mdm9615_audio_init(void) { int ret; if (!cpu_is_msm9615()) { pr_err("%s: Not the right machine type\n", __func__); return -ENODEV ; } tabla_mbhc_cal = def_tabla_mbhc_cal(); if (!tabla_mbhc_cal) { pr_err("Calibration data allocation failed\n"); return -ENOMEM; } mdm9615_snd_device = platform_device_alloc("soc-audio", 0); if (!mdm9615_snd_device) { pr_err("Platform device allocation failed\n"); kfree(tabla_mbhc_cal); return -ENOMEM; } memcpy(mdm9615_dai, mdm9615_dai_common, sizeof(mdm9615_dai_common)); memcpy(mdm9615_dai + ARRAY_SIZE(mdm9615_dai_common), mdm9615_dai_delta_tabla, sizeof(mdm9615_dai_delta_tabla)); platform_set_drvdata(mdm9615_snd_device, &snd_soc_card_mdm9615); ret = platform_device_add(mdm9615_snd_device); if (ret) { platform_device_put(mdm9615_snd_device); kfree(tabla_mbhc_cal); return ret; } if (mdm9615_configure_headset_mic_gpios()) { pr_err("%s Fail to configure headset mic gpios\n", __func__); mdm9615_headset_gpios_configured = 0; } else mdm9615_headset_gpios_configured = 1; return ret; }
}; static struct pm8xxx_adc_platform_data pm8018_adc_pdata = { .adc_channel = pm8018_adc_channels_data, .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data), .adc_prop = &pm8018_adc_data, }; static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = { .irq_base = PM8018_IRQ_BASE, .devirq = MSM_GPIO_TO_INT(87), .irq_trigger_flag = IRQF_TRIGGER_LOW, }; static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = { .gpio_base = PM8018_GPIO_PM_TO_SYS(1), }; static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = { .mpp_base = PM8018_MPP_PM_TO_SYS(1), }; static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = { .rtc_write_enable = false, .rtc_alarm_powerup = false, }; static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = { .pull_up = 1, .kpd_trigger_delay_us = 15625, .wakeup = 1,
#define BOTTOM_SPK_AMP_POS 0x1 #define BOTTOM_SPK_AMP_NEG 0x2 #define TOP_SPK_AMP_POS 0x4 #define TOP_SPK_AMP_NEG 0x8 #define GPIO_AUX_PCM_DOUT 63 #define GPIO_AUX_PCM_DIN 64 #define GPIO_AUX_PCM_SYNC 65 #define GPIO_AUX_PCM_CLK 66 #define TABLA_EXT_CLK_RATE 12288000 #define TABLA_MBHC_DEF_BUTTONS 8 #define TABLA_MBHC_DEF_RLOADS 5 static u32 top_spk_pamp_gpio = PM8018_GPIO_PM_TO_SYS(18); static u32 bottom_spk_pamp_gpio = PM8018_GPIO_PM_TO_SYS(19); static int mdm9615_spk_control; static int mdm9615_ext_bottom_spk_pamp; static int mdm9615_ext_top_spk_pamp; static int mdm9615_slim_0_rx_ch = 1; static int mdm9615_slim_0_tx_ch = 1; static int mdm9615_btsco_rate = BTSCO_RATE_8KHZ; static int mdm9615_btsco_ch = 1; static struct clk *codec_clk; static int clk_users; static int mdm9615_headset_gpios_configured;