void mt_usb_init_drvvbus(void) { #if !(defined(SWITCH_CHARGER) || defined(FPGA_PLATFORM)) #ifdef CONFIG_OF #if defined(CONFIG_MTK_LEGACY) mt_set_gpio_mode(drvvbus_pin, drvvbus_pin_mode); /* should set GPIO2 as gpio mode. */ mt_set_gpio_dir(drvvbus_pin, GPIO_DIR_OUT); mt_get_gpio_pull_enable(drvvbus_pin); mt_set_gpio_pull_select(drvvbus_pin, GPIO_PULL_UP); #else int ret = 0; pr_debug("****%s:%d before Init Drive VBUS KS!!!!!\n", __func__, __LINE__); pinctrl_drvvbus = pinctrl_lookup_state(pinctrl, "drvvbus_init"); if (IS_ERR(pinctrl_drvvbus)) { ret = PTR_ERR(pinctrl_drvvbus); dev_err(mtk_musb->controller, "Cannot find usb pinctrl drvvbus\n"); } pinctrl_drvvbus_low = pinctrl_lookup_state(pinctrl, "drvvbus_low"); if (IS_ERR(pinctrl_drvvbus_low)) { ret = PTR_ERR(pinctrl_drvvbus_low); dev_err(mtk_musb->controller, "Cannot find usb pinctrl drvvbus_low\n"); } pinctrl_drvvbus_high = pinctrl_lookup_state(pinctrl, "drvvbus_high"); if (IS_ERR(pinctrl_drvvbus_high)) { ret = PTR_ERR(pinctrl_drvvbus_high); dev_err(mtk_musb->controller, "Cannot find usb pinctrl drvvbus_high\n"); } pinctrl_select_state(pinctrl, pinctrl_drvvbus); pr_debug("****%s:%d end Init Drive VBUS KS!!!!!\n", __func__, __LINE__); #endif #else mt_set_gpio_mode(GPIO_OTG_DRVVBUS_PIN, GPIO_OTG_DRVVBUS_PIN_M_GPIO); /* should set GPIO2 as gpio mode. */ mt_set_gpio_dir(GPIO_OTG_DRVVBUS_PIN, GPIO_DIR_OUT); mt_get_gpio_pull_enable(GPIO_OTG_DRVVBUS_PIN); mt_set_gpio_pull_select(GPIO_OTG_DRVVBUS_PIN, GPIO_PULL_UP); #endif #endif }
static int get_lcd_id(void) { mt_set_gpio_mode(GPIO_LCD_ID_PIN,0); mt_set_gpio_dir(GPIO_LCD_ID_PIN,0); mt_set_gpio_pull_enable(GPIO_LCD_ID_PIN,1); mt_set_gpio_pull_select(GPIO_LCD_ID_PIN,1); MDELAY(1); return mt_get_gpio_in(GPIO_LCD_ID_PIN); }
ssize_t gpio_TORCH_Enable(void) { static struct pwm_easy_config pwm_setting; mt_set_gpio_mode(48, GPIO_MODE_00); mt_set_gpio_dir(48, GPIO_DIR_OUT); mt_set_gpio_out(48, GPIO_OUT_ZERO); mt_set_gpio_mode(66, GPIO_MODE_01); pwm_setting.pwm_no = fl_pwm_num; pwm_setting.clk_div = fl_div; pwm_setting.clk_src = PWM_CLK_OLD_MODE_32K; pwm_setting.duty = strobe_width; pwm_setting.duration = 0; pwm_set_easy_config(&pwm_setting); return 0; }
INT32 wmt_plat_bgf_eint_ctrl(ENUM_PIN_STATE state) { #if defined(CONFIG_MTK_GPIO_LEGACY) #ifdef GPIO_COMBO_BGF_EINT_PIN switch (state) { case PIN_STA_INIT: /*set to gpio input low, pull down enable */ mt_set_gpio_mode(GPIO_COMBO_BGF_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_GPIO); mt_set_gpio_dir(GPIO_COMBO_BGF_EINT_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_ENABLE); WMT_PLAT_DBG_FUNC("WMT-PLAT:BGFInt init(in pd)\n"); break; case PIN_STA_MUX: mt_set_gpio_mode(GPIO_COMBO_BGF_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_GPIO); mt_set_gpio_pull_enable(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_UP); mt_set_gpio_mode(GPIO_COMBO_BGF_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_EINT); WMT_PLAT_DBG_FUNC("WMT-PLAT:BGFInt mux (eint)\n"); break; case PIN_STA_IN_L: case PIN_STA_DEINIT: /*set to gpio input low, pull down enable */ mt_set_gpio_mode(GPIO_COMBO_BGF_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_GPIO); mt_set_gpio_dir(GPIO_COMBO_BGF_EINT_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_COMBO_BGF_EINT_PIN, GPIO_PULL_ENABLE); WMT_PLAT_DBG_FUNC("WMT-PLAT:BGFInt deinit(in pd)\n"); break; default: WMT_PLAT_WARN_FUNC("WMT-PLAT:Warnning, invalid state(%d) on BGF EINT\n", state); break; } #else WMT_PLAT_INFO_FUNC("WMT-PLAT:BGF EINT not defined\n"); #endif #else /* #if defined(CONFIG_MTK_GPIO_LEGACY) */ #endif return 0; }
static kal_uint32 charging_hw_init(void *data) { kal_uint32 status = STATUS_OK; upmu_set_rg_bc11_bb_ctrl(1); //BC11_BB_CTRL upmu_set_rg_bc11_rst(1); //BC11_RST #if 0 //no use //pull PSEL low mt_set_gpio_mode(GPIO_CHR_PSEL_PIN,GPIO_MODE_GPIO); mt_set_gpio_dir(GPIO_CHR_PSEL_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_CHR_PSEL_PIN,GPIO_OUT_ZERO); #endif //pull CE low #if 0 //no use mt_set_gpio_mode(GPIO_CHR_CE_PIN,GPIO_MODE_GPIO); mt_set_gpio_dir(GPIO_CHR_CE_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_CHR_CE_PIN,GPIO_OUT_ZERO); #endif //battery_xlog_printk(BAT_LOG_FULL, "gpio_number=0x%x,gpio_on_mode=%d,gpio_off_mode=%d\n", gpio_number, gpio_on_mode, gpio_off_mode); bq24196_set_en_hiz(0x0); bq24196_set_vindpm(0xA); //VIN DPM check 4.68V bq24196_set_reg_rst(0x0); bq24196_set_wdt_rst(0x1); //Kick watchdog bq24196_set_sys_min(0x5); //Minimum system voltage 3.5V bq24196_set_iprechg(0x3); //Precharge current 512mA bq24196_set_iterm(0x0); //Termination current 128mA bq24196_set_vreg(0x2C); //VREG 4.208V bq24196_set_batlowv(0x1); //BATLOWV 3.0V bq24196_set_vrechg(0x0); //VRECHG 0.1V (4.108V) bq24196_set_en_term(0x1); //Enable termination bq24196_set_term_stat(0x0); //Match ITERM bq24196_set_watchdog(0x1); //WDT 40s bq24196_set_en_timer(0x0); //Disable charge timer bq24196_set_int_mask(0x0); //Disable fault interrupt return status; }
bool Speaker_Init(void) { PRINTK("+Speaker_Init Success"); mt_set_gpio_mode(GPIO_SPEAKER_EN_PIN,GPIO_MODE_00); // gpio mode mt_set_gpio_pull_enable(GPIO_SPEAKER_EN_PIN,GPIO_PULL_ENABLE); mt_set_gpio_dir(GPIO_SPEAKER_EN_PIN,GPIO_DIR_OUT); // output mt_set_gpio_out(GPIO_SPEAKER_EN_PIN,GPIO_OUT_ZERO); // high PRINTK("-Speaker_Init Success"); return true; }
static void lcm_resume(void) { mt_set_gpio_mode(GPIO_DISP_PWR_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_DISP_PWR_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_DISP_PWR_EN, GPIO_OUT_ONE); MDELAY(20); mt_set_gpio_mode(GPIO_PWR_3V3_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_PWR_3V3_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_PWR_3V3_EN, GPIO_OUT_ONE); MDELAY(20); mt_set_gpio_mode(GPIO_LCD_LDO_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCD_LDO_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCD_LDO_EN, GPIO_OUT_ONE); MDELAY(20); mt_set_gpio_mode(GPIO_LVDS_SHUTDOWN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LVDS_SHUTDOWN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LVDS_SHUTDOWN, GPIO_OUT_ONE); MDELAY(20); }
static void tpd_hw_enable(void) { /* CTP_CE */ mt_set_gpio_mode(GPIO21, 0); mt_set_gpio_dir(GPIO21, GPIO_DIR_OUT); mt_set_gpio_out(GPIO21, GPIO_OUT_ONE); mdelay(20); }
static unsigned int lcm_compare_id() { unsigned int id = 0; unsigned char buffer[6], buffer1[2]; unsigned int array[16]; #ifdef BUILD_LK upmu_set_rg_vgp6_vosel(6); upmu_set_rg_vgp6_en(1); #else hwPowerOn(MT65XX_POWER_LDO_VGP6, VOL_3300, "LCM"); #endif mt_set_gpio_mode(GPIO_LCD_RST_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCD_RST_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(10); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ZERO); MDELAY(10); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(100); array[0]=0x00023902; array[1]=0x00000000; dsi_set_cmdq(array, 2, 1); array[0]=0x00043902; array[1]=0x010980ff; dsi_set_cmdq(array, 2, 1); array[0]=0x00023902; array[1]=0x00008000; dsi_set_cmdq(array, 2, 1); array[0]=0x00033902; array[1]=0x000980ff; dsi_set_cmdq(array, 2, 1); array[0] = 0x00053700;// set return byte number dsi_set_cmdq(array, 1, 1); read_reg_v2(0xA1, &buffer, 5); array[0] = 0x00013700;// set return byte number dsi_set_cmdq(array, 1, 1); array[0]=0x00023902; array[1]=0x00005000; dsi_set_cmdq(array, 2, 1); MDELAY(1); read_reg_v2(0xF8, &buffer1, 1); id = (buffer[2] << 16) | (buffer[3] << 8) | buffer1[0]; #if defined(BUILD_LK) printf ("%s, buffer[0]=0x%x,buffer[1]=0x%x,buffer[2]=0x%x,buffer[3]=0x%x buffer[4]=0x%x buffer1[0]=0x%x id = 0x%x\n", __func__, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer1[0], id); #endif return (LCM_OTM8009A_HSD45_JQ_ID == id) ? 1 : 0; }
static kal_uint32 charging_hw_init(void *data) { kal_uint32 status = STATUS_OK; battery_xlog_printk(BAT_LOG_FULL,"[charging_hw_init] From Zax\n"); bq24261_config_interface(bq24261_CON0, 0x1, 0x1, 7); // wdt reset bq24261_config_interface(bq24261_CON0, 0x0, 0x1, 6); // OTG boost bq24261_config_interface(bq24261_CON6, 0x3, 0x3, 5); // Safty timer //set after charger type detection //bq24261_config_interface(bq24261_CON1, 0x2, 0x7, 4); // USB current limit at 500mA //bq24261_config_interface(bq24261_CON1, 0x6, 0x7, 4); // IN current limit //in bq24261_set_ichg //bq24261_config_interface(bq24261_CON4, 0xF, 0x1F,3); // ICHG to BAT bq24261_config_interface(bq24261_CON4, 0x2, 0x7, 0); // ITERM to BAT //in bq24261_set_vbreg //bq24261_config_interface(bq24261_CON2, 0x23,0x3F,2); // VBAT_CV bq24261_config_interface(bq24261_CON6, 0x0, 0x1, 0); // VINDPM_OFF bq24261_config_interface(bq24261_CON5, 0x4, 0x7, 0); // VINDPM bq24261_config_interface(bq24261_CON6, 0x0, 0x1, 3); // Thermal sense #if defined(MTK_WIRELESS_CHARGER_SUPPORT) if(wireless_charger_gpio_number!=0) { mt_set_gpio_mode(wireless_charger_gpio_number,0); // 0:GPIO mode mt_set_gpio_dir(wireless_charger_gpio_number,0); // 0: input, 1: output } #endif #ifdef MTK_DUAL_INPUT_CHARGER_SUPPORT mt_set_gpio_mode(vin_sel_gpio_number,0); // 0:GPIO mode mt_set_gpio_dir(vin_sel_gpio_number,0); // 0: input, 1: output #endif return status; }
INT32 wmt_plat_ldo_ctrl(ENUM_PIN_STATE state) { #ifdef GPIO_COMBO_6620_LDO_EN_PIN switch (state) { case PIN_STA_INIT: /*set to gpio output low, disable pull */ mt_set_gpio_pull_enable(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_PULL_DISABLE); mt_set_gpio_dir(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_DIR_OUT); mt_set_gpio_mode(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_MODE_GPIO); mt_set_gpio_out(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_OUT_ZERO); WMT_DBG_FUNC("WMT-PLAT:LDO init (out 0)\n"); break; case PIN_STA_OUT_H: mt_set_gpio_out(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_OUT_ONE); WMT_DBG_FUNC("WMT-PLAT:LDO (out 1)\n"); break; case PIN_STA_OUT_L: mt_set_gpio_out(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_OUT_ZERO); WMT_DBG_FUNC("WMT-PLAT:LDO (out 0)\n"); break; case PIN_STA_IN_L: case PIN_STA_DEINIT: /*set to gpio input low, pull down enable */ mt_set_gpio_mode(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_COMBO_6620_LDO_EN_PIN_M_GPIO); mt_set_gpio_dir(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_COMBO_6620_LDO_EN_PIN, GPIO_PULL_ENABLE); WMT_DBG_FUNC("WMT-PLAT:LDO deinit (in pd)\n"); break; default: WMT_WARN_FUNC("WMT-PLAT:Warnning, invalid state(%d) on LDO\n", state); break; } #else WMT_INFO_FUNC("WMT-PLAT:LDO is not used\n"); #endif return 0; }
void Sound_Hac_Turnon(void) { PRINTK("Sound_Hac_Turnon\n"); if(hac_on) return; mt_set_gpio_mode(106, GPIO_MODE_00); mt_set_gpio_dir(106, GPIO_DIR_OUT); mt_set_gpio_out(106, GPIO_OUT_ONE); msleep(SPK_WARM_UP_TIME); hac_on = true; }
static int lcm_reset(void) { mt_set_gpio_mode(LCM_RESET_PIN, GPIO_MODE_GPIO); mt_set_gpio_dir(LCM_RESET_PIN, GPIO_DIR_OUT); mt_set_gpio_out(LCM_RESET_PIN, 1); mdelay(1); mt_set_gpio_out(LCM_RESET_PIN, 0); mdelay(1); mt_set_gpio_out(LCM_RESET_PIN, 1); return 0; }
void tinno_tp_power_off(void) { mt_set_gpio_mode(TPIO_WAKEUP, 0x00); //GPIO mode mt_set_gpio_dir(TPIO_WAKEUP,1); mt_set_gpio_pull_enable(TPIO_WAKEUP, 1); //external pull up??? mt_set_gpio_pull_select(TPIO_WAKEUP, GPIO_PULL_DOWN); mt_set_gpio_out(TPIO_WAKEUP,0); msleep(10); mt_set_gpio_mode(TPIO_RESET, 0x00); //GPIO mode mt_set_gpio_dir(TPIO_RESET,1); mt_set_gpio_pull_enable(TPIO_RESET, 1); //external pull up??? mt_set_gpio_pull_select(TPIO_RESET, GPIO_PULL_DOWN); mt_set_gpio_out(TPIO_RESET,0); //output low hwPowerDown(TPD_POWER_SOURCE, "TP"); msleep(50); }
static void lcm_suspend(void) { mt_set_gpio_mode(GPIO52, GPIO_MODE_00); mt_set_gpio_dir(GPIO52, GPIO_DIR_OUT); mt_set_gpio_out(GPIO52, GPIO_OUT_ZERO); // LVDS_SHUTDOWN_N MDELAY(50); mt_set_gpio_mode(GPIO70, GPIO_MODE_00); mt_set_gpio_dir(GPIO70, GPIO_DIR_OUT); mt_set_gpio_out(GPIO70, GPIO_OUT_ZERO); //MDELAY(10); //mt_set_gpio_mode(GPIO12, GPIO_MODE_00); //mt_set_gpio_dir(GPIO12, GPIO_DIR_OUT); //mt_set_gpio_out(GPIO12, GPIO_OUT_ZERO); // LCM_STBY //MDELAY(50); //mt_set_gpio_mode(GPIO14, GPIO_MODE_00); //mt_set_gpio_dir(GPIO14, GPIO_DIR_OUT); //mt_set_gpio_out(GPIO14, GPIO_OUT_ZERO); // LCM_RST //SET_RESET_PIN(0); // LCM_RST MDELAY(60); // avoid LCD resume transint }
void disable_32k_rtc(void) { #ifndef GPIO_BT_CLK_PIN_CLK rtc_gpio_disable_32k(RTC_GPIO_USER_WIFI); #else mt_set_gpio_mode(GPIO_BT_CLK_PIN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_BT_CLK_PIN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_BT_CLK_PIN, 0); #endif msleep(50); }
static unsigned int lcm_compare_id() { unsigned int id=0; mt_set_gpio_mode(50,0); // gpio mode high mt_set_gpio_pull_enable(50,0); mt_set_gpio_dir(50,0); //input mt_set_gpio_mode(47,0); // gpio mode low mt_set_gpio_pull_enable(47,0); mt_set_gpio_dir(47,0); id = (mt_get_gpio_in(50) <<4) | mt_get_gpio_in(47); #if defined(BUILD_LK) || defined(BUILD_UBOOT) printf("%s,second source id1 = 0x%08x\n", __func__, id); #endif return (LCM_ID == id) ? 1 : 0; }
void tpd_resume(struct early_suspend *h) { /* added in android 2.2, for configuring EINT2 to GPIO mode */ mt_set_gpio_mode(GPIO61, 0x00); mt_set_gpio_pull_enable(GPIO61, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(GPIO61,GPIO_PULL_UP); mt_set_gpio_dir(GPIO61, GPIO_DIR_OUT); mt_set_gpio_out(GPIO61, GPIO_OUT_ZERO); hwPowerOn(TPD_POWER_SOURCE,VOL_3300,"TP"); mdelay(20); /* added in android 2.2, for configuring EINT2 to EINT mode */ mt_set_gpio_mode(GPIO61, 0x01); mt_set_gpio_pull_enable(GPIO61, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(GPIO61,GPIO_PULL_UP); MT6516_IRQUnmask(MT6516_TOUCH_IRQ_LINE); MT6516_EINTIRQUnmask(CUST_EINT_TOUCH_PANEL_NUM); tpd_halt = 0; }
static int8_t fan5405_check_chgstat_pin(struct fan5405_struct *fan_struct){ int8_t ret = 0; if(Enable_BATDRV_LOG >= 1) printk(KERN_INFO "jrd %s: enter!\n",__func__); mt_set_gpio_mode(GPIO200, 0); /*mode 0 as gpio*/ mt_set_gpio_dir(GPIO200, GPIO_DIR_IN); /*griffin:(DPIVSYNC)GPIO21; martell:GPIO200; get STAT pin status FIXME*/ ret = mt_get_gpio_in(GPIO200); /*FIXME*/ return ret; }
static kal_uint32 charging_enable(void *data) { kal_uint32 status = STATUS_OK; kal_uint32 enable = *(kal_uint32*)(data); printk("\ncharging_enable= %d\n",enable); if(KAL_TRUE == enable) { mt_set_gpio_mode(GPIO_CHR_CE_PIN,GPIO_MODE_00); mt_set_gpio_dir(GPIO_CHR_CE_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_CHR_CE_PIN,GPIO_OUT_ZERO); } else { mt_set_gpio_mode(GPIO_CHR_CE_PIN,GPIO_MODE_00); mt_set_gpio_dir(GPIO_CHR_CE_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_CHR_CE_PIN,GPIO_OUT_ONE); } return status; }
void apply_post_md_run_setting(void) { #if defined(GPIO_UART_UTXD3_PIN) && defined(GPIO_UART_URXD3_PIN) && defined(GPIO_UART_UTXD3_PIN_M_GPIO) && defined(GPIO_UART_URXD3_PIN_M_GPIO) printk("[EEMCS/PLAT] Disable UART pin\n"); mt_set_gpio_out(GPIO_UART_UTXD3_PIN, GPIO_OUT_ZERO); mt_set_gpio_dir(GPIO_UART_UTXD3_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_UART_UTXD3_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_UART_UTXD3_PIN, 1); mt_set_gpio_mode(GPIO_UART_UTXD3_PIN, GPIO_UART_UTXD3_PIN_M_GPIO); mt_set_gpio_out(GPIO_UART_URXD3_PIN, GPIO_OUT_ZERO); mt_set_gpio_dir(GPIO_UART_URXD3_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_UART_URXD3_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_UART_URXD3_PIN, 1); mt_set_gpio_mode(GPIO_UART_URXD3_PIN, GPIO_UART_URXD3_PIN_M_GPIO); #else printk("[EEMCS/PLAT] Disable UART pin dummy\n"); #endif }
static void lcm_resume(void) { mt_set_gpio_mode(GPIO70, GPIO_MODE_00); mt_set_gpio_dir(GPIO70, GPIO_DIR_OUT); mt_set_gpio_out(GPIO70, GPIO_OUT_ONE); MDELAY(50); mt_set_gpio_mode(GPIO12, GPIO_MODE_00); mt_set_gpio_dir(GPIO12, GPIO_DIR_OUT); mt_set_gpio_out(GPIO12, GPIO_OUT_ONE); // LCM_STBY MDELAY(50); mt_set_gpio_mode(GPIO14, GPIO_MODE_00); mt_set_gpio_dir(GPIO14, GPIO_DIR_OUT); mt_set_gpio_out(GPIO14, GPIO_OUT_ONE); // LCM_RST //SET_RESET_PIN(1); // LCM_RST MDELAY(50); mt_set_gpio_mode(GPIO52, GPIO_MODE_00); mt_set_gpio_dir(GPIO52, GPIO_DIR_OUT); mt_set_gpio_out(GPIO52, GPIO_OUT_ONE); // LVDS_SHUTDOWN_N MDELAY(120); }
/*---------------------------------------------------------------------------*/ static int mpu_gpio_config(void) { /* because we donot use EINT ,to support low power */ /* config to GPIO input mode + PD */ /* set GPIO_MSE_EINT_PIN */ mt_set_gpio_mode(GPIO_GYRO_EINT_PIN, GPIO_GYRO_EINT_PIN_M_GPIO); mt_set_gpio_dir(GPIO_GYRO_EINT_PIN, GPIO_DIR_IN); mt_set_gpio_pull_enable(GPIO_GYRO_EINT_PIN, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(GPIO_GYRO_EINT_PIN, GPIO_PULL_DOWN); return 0; }
bool Speaker_Init(void) { PRINTK("+jacob Speaker_Init Success"); mt_set_gpio_mode(GPIO_SPEAKER_EN_PIN,GPIO_MODE_00); // gpio mode mt_set_gpio_pull_enable(GPIO_SPEAKER_EN_PIN,GPIO_PULL_ENABLE); mt_set_gpio_dir(GPIO_SPEAKER_EN_PIN,GPIO_DIR_OUT); // output mt_set_gpio_out(GPIO_SPEAKER_EN_PIN,GPIO_OUT_ZERO); // low msleep(SPK_WARM_UP_TIME); PRINTK("-jacob Speaker_Init Success"); return true; }
static int eamp_init() { EAMP_PRINTK("eamp_init"); eamp_poweron(); mt_set_gpio_mode(GPIO_HEADSET_AMP_EN, GPIO_HEADSET_AMP_EN_M_GPIO); mt_set_gpio_pull_enable(GPIO_HEADSET_AMP_EN, GPIO_PULL_ENABLE); mt_set_gpio_dir(GPIO_HEADSET_AMP_EN, GPIO_DIR_OUT); mt_set_gpio_mode(GPIO_SPK_AMP_L_EN, GPIO_SPK_AMP_L_EN_M_GPIO); mt_set_gpio_pull_enable(GPIO_SPK_AMP_L_EN, GPIO_PULL_ENABLE); mt_set_gpio_dir(GPIO_SPK_AMP_L_EN, GPIO_DIR_OUT); mt_set_gpio_mode(GPIO_SPK_AMP_R_EN, GPIO_SPK_AMP_R_EN_M_GPIO); mt_set_gpio_pull_enable(GPIO_SPK_AMP_R_EN, GPIO_PULL_ENABLE); mt_set_gpio_dir(GPIO_SPK_AMP_R_EN, GPIO_DIR_OUT); return 0; }
void Sound_Hac_Turnoff(void) { PRINTK("Sound_Hac_Turnoff\n"); if(!hac_on) return; mt_set_gpio_mode(106, GPIO_MODE_00); mt_set_gpio_dir(106, GPIO_DIR_OUT); mt_set_gpio_out(106, GPIO_OUT_ZERO); msleep(SPK_WARM_UP_TIME); hac_on = false; }
static void lcd_reset(unsigned char enabled) { #ifdef BUILD_LK printf("%s, %d LK \n", __func__, enabled); #else printk("%s, %d kernel \n", __func__, enabled); #endif if (enabled) { mt_set_gpio_mode(GPIO_LCM_RST, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCM_RST, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCM_RST, GPIO_OUT_ONE); } else { mt_set_gpio_mode(GPIO_LCM_RST, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCM_RST, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCM_RST, GPIO_OUT_ZERO); } }
INT32 wmt_plat_wifi_eint_ctrl(ENUM_PIN_STATE state) { #if 0 /*def GPIO_WIFI_EINT_PIN*/ switch(state) { case PIN_STA_INIT: mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_DISABLE); mt_set_gpio_dir(GPIO_WIFI_EINT_PIN, GPIO_DIR_OUT); mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_MODE_GPIO); mt_set_gpio_out(GPIO_WIFI_EINT_PIN, GPIO_OUT_ONE); break; case PIN_STA_MUX: mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_WIFI_EINT_PIN_M_GPIO); mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_ENABLE); mt_set_gpio_pull_select(GPIO_WIFI_EINT_PIN, GPIO_PULL_UP); mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_WIFI_EINT_PIN_M_EINT); break; case PIN_STA_EINT_EN: mt_eint_unmask(CUST_EINT_WIFI_NUM); break; case PIN_STA_EINT_DIS: mt_eint_mask(CUST_EINT_WIFI_NUM); break; case PIN_STA_IN_L: case PIN_STA_DEINIT: /*set to gpio input low, pull down enable*/ mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_GPIO); mt_set_gpio_dir(GPIO_WIFI_EINT_PIN, GPIO_DIR_IN); mt_set_gpio_pull_select(GPIO_WIFI_EINT_PIN, GPIO_PULL_DOWN); mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_ENABLE); break; default: WMT_WARN_FUNC("WMT-PLAT:Warnning, invalid state(%d) on WIFI EINT\n", state); break; } #else WMT_INFO_FUNC("WMT-PLAT:WIFI EINT is controlled by MSDC driver \n"); #endif return 0; }
static INT32 wmt_plat_tdm_req_ctrl(ENUM_PIN_STATE state) { #ifdef GPIO_TDM_REQ switch (state) { case PIN_STA_INIT: case PIN_STA_DEINIT: mt_set_gpio_mode(GPIO_TDM_REQ, GPIO_TDM_REQ_M_GPIO); mt_set_gpio_dir(GPIO_TDM_REQ, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_TDM_REQ, GPIO_OUT_ZERO); break; case PIN_STA_MUX: mt_set_gpio_mode(GPIO_TDM_REQ, GPIO_TDM_REQ_M_ANT_SEL); break; default: break; } #endif return 0; }
static u32 SetGPIOMode(u32 pin, u32 mode) //set GPIO to I2S { u32 temp = -1; temp = mt_get_gpio_mode(pin); printk("MHL GPIO Mode 1 is %d", temp); if(temp != mode) temp = mt_set_gpio_mode(pin, mode); printk("MHL GPIO Mode 2 is %d", temp); return temp; }