static int cs42l73_set_mic_bias(struct snd_soc_codec *codec, int state) { mutex_lock(&codec->mutex); switch (state) { case MIC_BIAS_DISABLE: if (ctp_board_id() == CTP_BID_VV) snd_soc_dapm_disable_pin(&codec->dapm, "MIC1 Bias"); else snd_soc_dapm_disable_pin(&codec->dapm, "MIC2 Bias"); break; case MIC_BIAS_ENABLE: if (ctp_board_id() == CTP_BID_VV) snd_soc_dapm_force_enable_pin(&codec->dapm, "MIC1 Bias"); else snd_soc_dapm_force_enable_pin(&codec->dapm, "MIC2 Bias"); break; } snd_soc_dapm_sync(&codec->dapm); mutex_unlock(&codec->mutex); return 0; }
static void cloverview_sph_gpio_cleanup(void) { u32 board_id; board_id = ctp_board_id(); if (board_id == CTP_BID_PR0) { if (gpio_is_valid(SPH_CS_N)) gpio_free(SPH_CS_N); if (gpio_is_valid(SPH_RST_N)) gpio_free(SPH_RST_N); } }
static int cloverview_sph_gpio_init(void) { int retval = 0; u32 board_id; board_id = ctp_board_id(); /*Only ctp_pr0/pr1 phone need to do CS and PHY operation */ if (board_id == CTP_BID_PR0) { if (gpio_is_valid(SPH_CS_N)) { retval = gpio_request(SPH_CS_N, "SPH_CS_N"); if (retval < 0) { printk(KERN_INFO "Request GPIO %d with error %d\n", SPH_CS_N, retval); retval = -ENODEV; goto err; } } else { retval = -ENODEV; goto err; } if (gpio_is_valid(SPH_RST_N)) { retval = gpio_request(SPH_RST_N, "SPH_RST_N"); if (retval < 0) { printk(KERN_INFO "Request GPIO %d with error %d\n", SPH_RST_N, retval); retval = -ENODEV; goto err1; } } else { retval = -ENODEV; goto err1; } gpio_direction_output(SPH_CS_N, 0); gpio_direction_output(SPH_RST_N, 0); usleep_range(200, 500); gpio_set_value(SPH_RST_N, 1); } return retval; err1: gpio_free(SPH_CS_N); err: return retval; }