int sisi_get_host_wlan_irq(void)
{
  #ifdef CONFIG_FIH_MACH_TAMSUI_GUA
    return GUA_WL_HOST_WAKE;
  #elif defined(CONFIG_FIH_MACH_TAMSUI_TAP)
  if(fih_get_product_phase() < Phase_AP)
    return TAP_WL_HOST_WAKE;
  else
    return TAP_WL_HOST_WAKE_FIX;
  //MTD-COMM-CD-OOB_FOR_MES-00+[
  #elif defined(CONFIG_FIH_MACH_TAMSUI_MES)
  if(fih_get_product_phase() < Phase_SP)
    return MES_WL_HOST_WAKE;
  else
    return MES_WL_HOST_WAKE_FIX;
  //MTD-COMM-CD-OOB_FOR_MES-00+]
  #elif defined(CONFIG_FIH_MACH_TAMSUI_JLO)
  if(fih_get_product_phase() < Phase_SP2)
    return JLO_WL_HOST_WAKE;
  else
  	return JLO_WL_HOST_WAKE_FIX;
  #else
    return -1;
  #endif
}
Exemplo n.º 2
0
int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code,
		const struct pm8xxx_adc_properties *adc_properties,
		const struct pm8xxx_adc_chan_properties *chan_properties,
		struct pm8xxx_adc_chan_result *adc_chan_result)
{
	int64_t bat_voltage = 0;
	struct pm8xxx_adc_map_pt *adc_map = NULL;
	uint32_t						adc_map_array_size;
	unsigned int 					phaseid = 0;

	bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code,
			adc_properties, chan_properties);

	ext_bat_voltage = bat_voltage;

	if (phaseid == 0)
		phaseid = fih_get_product_phase();

	if (phaseid <= PHASE_SP) {
		adc_map = adcmap_btm_threshold;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold);
	}
	else {
		adc_map = adcmap_btm_threshold_pre_ap;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold_pre_ap);
	}

	return pm8xxx_adc_map_batt_therm(
			adc_map,
			adc_map_array_size,
			bat_voltage,
			&adc_chan_result->physical);
}
Exemplo n.º 3
0
static int phase_id_read_proc(char *page, char **start, off_t off,
                              int count, int *eof, void *data)
{
    int len;

    int pp = fih_get_product_phase();
    char ver[25]= {0};

    switch (pp) {
    case PHASE_EVM2:
        strncpy(ver, "EVM2", 4);
        ver[4]='\0';
        break;
    case PHASE_EVM:
        strncpy(ver, "EVM", 3);
        ver[3]='\0';
        break;
    case PHASE_PD:
        strncpy(ver, "PD", 2);
        ver[2]='\0';
        break;
    case PHASE_DP:
        strncpy(ver, "DP", 2);
        ver[2]='\0';
        break;
    case PHASE_SP:
        strncpy(ver, "SP", 2);
        ver[3]='\0';
        break;
    case PHASE_PreAP:
        strncpy(ver, "PreAP", 5);
        ver[5]='\0';
        break;
    case PHASE_AP:
        strncpy(ver, "AP", 2);
        ver[2]='\0';
        break;
    case PHASE_TP:
        strncpy(ver, "TP", 2);
        ver[2]='\0';
        break;
    case PHASE_PQ :
        strncpy(ver, "PQ", 2);
        ver[2]='\0';
        break;
    case PHASE_TP2_MP:
        strncpy(ver, "TP2_MP", 6);
        ver[6]='\0';
        break;
    default:
        strncpy(ver, "Unkonwn Baseband version",24);
        ver[24]='\0';
        break;
    }

    len = snprintf(page, count, "%s\n",
                   ver);  /* MTD-BSP-VT-PROC-00* */

    return proc_calc_metrics(page, start, off, count, eof, len);
}
int32_t pm8xxx_adc_batt_scaler(struct pm8xxx_adc_arb_btm_param *btm_param,
		const struct pm8xxx_adc_properties *adc_properties,
		const struct pm8xxx_adc_chan_properties *chan_properties)
{
	int rc;
	struct pm8xxx_adc_map_pt *adc_map = NULL;
	uint32_t						adc_map_array_size;
	static unsigned int 			phaseid = 0;

	/*
	 * this function is called by pm8xxx_adc_btm_configure which to configure 
	 * PMIC temperature IRQ and callback function, which alien battery
	 * doesn't need to, so here don't take alien battery into consideration
	 */

	if (phaseid == 0)
		phaseid = fih_get_product_phase();

	if (phaseid <= PHASE_SP) {
		adc_map = adcmap_btm_threshold;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold);
	}
	else {
		adc_map = adcmap_btm_threshold_pre_ap;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold_pre_ap);
	}

	rc = pm8xxx_adc_map_linear(
		adc_map,
		adc_map_array_size,
		(btm_param->low_thr_temp),
		&btm_param->low_thr_voltage);
	if (rc)
		return rc;

	btm_param->low_thr_voltage *=
		chan_properties->adc_graph[ADC_CALIB_RATIOMETRIC].dy;
	do_div(btm_param->low_thr_voltage, adc_properties->adc_vdd_reference);
	btm_param->low_thr_voltage +=
		chan_properties->adc_graph[ADC_CALIB_RATIOMETRIC].adc_gnd;

	rc = pm8xxx_adc_map_linear(
		adc_map,
		adc_map_array_size,
		(btm_param->high_thr_temp),
		&btm_param->high_thr_voltage);
	if (rc)
		return rc;

	btm_param->high_thr_voltage *=
		chan_properties->adc_graph[ADC_CALIB_RATIOMETRIC].dy;
	do_div(btm_param->high_thr_voltage, adc_properties->adc_vdd_reference);
	btm_param->high_thr_voltage +=
		chan_properties->adc_graph[ADC_CALIB_RATIOMETRIC].adc_gnd;


	return rc;
}
Exemplo n.º 5
0
/* FIH-SW3-KERNEL-EL-fix_coverity-issues-02*[ */
static ssize_t fih_hw_id_version_number_show(struct kobject *kobj, struct kobj_attribute *attr, char * buf)
{
	char *s = buf;

	unsigned int hw_id;
	hw_id = fih_get_product_phase();

	s += snprintf(s, PAGE_SIZE - ((size_t)(s-buf)), "%d", hw_id);
	s += snprintf(s, PAGE_SIZE - ((size_t)(s-buf)), "\n");

	return (s - buf);
}
static int support_sensor_read(char *page, char **start, off_t off,
				 int count, int *eof, void *data)
{
	int len;
	int project_id = fih_get_product_id();
	int phase_id = fih_get_product_phase(); //Div2D5-OwenHuang-FB0_Sensor_Proc_Read-01+
	int project_sensor = 0;
		
	switch (project_id){
	case Product_FB0:
		project_sensor = DEFAULT_SUPPORT_SENSOR;
		break;
	case Product_FD1:
		project_sensor = DEFAULT_SUPPORT_SENSOR;
		break;
	case Product_SF3:
		project_sensor = DEFAULT_SUPPORT_SENSOR;
		break;
	case Product_SF5:
		//Div2D5-OwenHuang-FB0_Sensor_Proc_Read-01+{
		if (phase_id == Product_PR1)
			project_sensor = BIT_ECOMPASS | BIT_GSENSOR | BIT_LIGHT; //not support proximity sensor at PR1 stage
		else
			project_sensor = DEFAULT_SUPPORT_SENSOR;
		//Div2D5-OwenHuang-FB0_Sensor_Proc_Read-01+}
		break;
	case Product_SF6:
		project_sensor = DEFAULT_SUPPORT_SENSOR; //DIV5-BSP-CH-SF6-SENSOR-PORTING04++
		break;
	case Product_SF8:
		project_sensor = DEFAULT_SUPPORT_SENSOR;
		break;
	default:
		project_sensor = DEFAULT_SUPPORT_SENSOR;
		break;
	}

	len = snprintf(page, PAGE_SIZE, "%d\n", project_sensor);
		
	return proc_calc_metrics(page, start, off, count, eof, len);
}
static int __init trout_h2w_init(void)
{
	/* FIH-SW2-MM-AY-hsed_type-03 [ */
    int product_id = fih_get_product_id();
	int product_phase = fih_get_product_phase();
	/* FIH-SW2-MM-AY-hsed_type-03 ] */

	H2W_DBG("trout_h2w_init:set interrupt trigger level\n ");

	/* FIH-SW2-MM-AY-hsed_type-03 [ */
	if (((product_id == Project_TAP) && ((product_phase == Phase_AP2) || (product_phase == Phase_MP))) 
		|| ((product_id == Project_MES) && (product_phase >= Phase_PreAP)) 
		|| ((product_id == Project_JLO) && (product_phase >= Phase_SP3))) 
		isCTIAheadset = true;
	else
		isCTIAheadset = false;
	/* FIH-SW2-MM-AY-hsed_type-03 ] */
	
	return platform_driver_register(&trout_h2w_driver);

}
int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code,
		const struct pm8xxx_adc_properties *adc_properties,
		const struct pm8xxx_adc_chan_properties *chan_properties,
		struct pm8xxx_adc_chan_result *adc_chan_result)
{
	int64_t bat_voltage = 0;
	struct pm8xxx_adc_map_pt *adc_map = NULL;
	uint32_t						adc_map_array_size;
	unsigned int 					phaseid = 0;

	bat_voltage = pm8xxx_adc_scale_ratiometric_calib(adc_code,
			adc_properties, chan_properties);

	ext_bat_voltage = bat_voltage;

	if (ext_bat_voltage > 1700) {
		pr_err("[chg %s %d]ERROR!! Battery removed %lld", __func__, __LINE__, ext_bat_voltage);
		machine_power_off();
	}

	if (phaseid == 0)
		phaseid = fih_get_product_phase();

	if (phaseid <= PHASE_SP) {
		adc_map = adcmap_btm_threshold;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold);
	}
	else {
		adc_map = adcmap_btm_threshold_pre_ap;
		adc_map_array_size = ARRAY_SIZE(adcmap_btm_threshold_pre_ap);
	}

	return pm8xxx_adc_map_batt_therm(
			adc_map,
			adc_map_array_size,
			bat_voltage,
			&adc_chan_result->physical);
}
Exemplo n.º 9
0
static ssize_t fih_hw_id_version_name_show(struct kobject *kobj, struct kobj_attribute *attr, char * buf)
{
	char *s = buf;
	unsigned int hw_id;
	unsigned int i;  /* KERNEL-HC-Fix_Coverity-00* */
	
	hw_id = fih_get_product_phase();

/* FIH-SW3-KERNEL-EL-fix_coverity-issues-00*[ */
	for( i = 0 ; i < sizeof(hw_id_map_table)/sizeof(hw_id_number_name_map); i++)
	{
		if(hw_id_map_table[i].hw_id_number == hw_id)
		{
/* FIH-SW3-KERNEL-EL-fix_coverity-issues-02*[ */			
			s += snprintf(s, PAGE_SIZE - ((size_t)(s-buf)), "%s", hw_id_map_table[i].hw_id_name);
			s += snprintf(s, PAGE_SIZE - ((size_t)(s-buf)), "\r\n");
/* FIH-SW3-KERNEL-EL-fix_coverity-issues-02*] */
			break;
		}
	}
/* FIH-SW3-KERNEL-EL-fix_coverity-issues-00*] */

	return (s - buf);
}
static int baseband_read_proc(char *page, char **start, off_t off,
				 int count, int *eof, void *data)
{
	int len;

	int pp = fih_get_product_phase();
	char ver[24];
	
	switch (pp){
	case Product_PR1:
		strcpy(ver, "PR1");
		break; 
	case Product_PR2:
		strcpy(ver, "PR2");
		break; 
	case Product_PR2p5:
		strcpy(ver, "PR2p5");
		break; 
	case Product_PR230:
		strcpy(ver, "PR230");
		break; 
	case Product_PR231:
		if (fih_get_product_id() == Product_FD1) //Div2-SW2-BSP, JOE HSU,FD1 PR235 = FB0 PR231
				strcpy(ver, "PR235");
			else
		    strcpy(ver, "PR231");
		break; 
	case Product_PR232:
		strcpy(ver, "PR232");
		break; 
	case Product_PR3:
		strcpy(ver, "PR3");
		break;
  //Div252-AC-HARDWARE_ID_01+{
	case Product_PR1p5:
		strcpy(ver, "PR15");
		break; 
  //Div252-AC-HARDWARE_ID_01+}
	case Product_PR4:
		strcpy(ver, "PR4");
		break;
	case Product_PR5:
		strcpy(ver, "PR5");
		break;  
	case Product_PCR:
		strcpy(ver, "PCR");
		break;
	case Product_MP1:
		strcpy(ver, "MP1");
		break;				
	case Product_EVB:
		strcpy(ver, "EVB");
		break; 
	default:
		strcpy(ver, "Unkonwn Baseband version");
		break;
	}

	len = snprintf(page, PAGE_SIZE, "%s\n",
		ver);

	return proc_calc_metrics(page, start, off, count, eof, len);
}
/* FIH-SW-MM-VH-DISPLAY-JB00*[ */
static int msm_fb_dsi_client_msm_reset(int hold)
{
	int rc = 0;
	static int dsi_reset_initialized = 0;

	printk(KERN_INFO "[DISPLAY]%s: E, hold <%d>\n", __func__, hold);

	if (dsi_reset_initialized == 0) {
		rc = gpio_request(GPIO_LCM_RESET, "gpio_disp_pwr");
		if (rc < 0) {
			pr_err("[DISPLAY] %s: Failed to request lcm_reset, rc <%d>\n", __func__, rc);
			//return rc;
		}
		rc = gpio_tlmm_config(GPIO_CFG(GPIO_LCM_RESET, 0, GPIO_CFG_OUTPUT,
									GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);

		if (unlikely(fih_get_product_phase() < Phase_SP2)) {
			printk(KERN_ALERT "[DISPLAY]%s: <%d> < SP2\n", __func__, fih_get_product_phase());
			rc = gpio_request(GPIO_LCM_BKL_EN, "lcm_bkl_en");
			if (rc < 0) {
				pr_err("[DISPLAY] %s: Failed to request lcm_bkl_en\n", __func__);
				//goto gpio_error;
			}

			rc = gpio_tlmm_config(GPIO_CFG(GPIO_LCM_BKL_EN, 0, GPIO_CFG_OUTPUT,
										GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
									GPIO_CFG_ENABLE); 
			if (rc < 0) {
				pr_err("[DISPLAY] %s: Failed lcm_bkl_en enable\n", __func__);
				//goto gpio_error2;
			}
		}
		dsi_reset_initialized = 1;
	}

	if (hold) {
		gpio_direction_output(GPIO_LCM_RESET, 0);
	} else {
#ifdef CONFIG_FIH_HR_MSLEEP
		rc |= gpio_direction_output(GPIO_LCM_RESET, 1);
		hr_msleep(5);
		rc |= gpio_direction_output(GPIO_LCM_RESET, 0);
		hr_msleep(5);
		rc |= gpio_direction_output(GPIO_LCM_RESET, 1);
#else
		rc |= gpio_direction_output(GPIO_LCM_RESET, 1);
		msleep(5);
		rc |= gpio_direction_output(GPIO_LCM_RESET, 0);
		msleep(5);
		rc |= gpio_direction_output(GPIO_LCM_RESET, 1);
#endif
	}
#ifdef CONFIG_FIH_HR_MSLEEP
	hr_msleep(150);
#else
	msleep(150);
#endif
#if 0
	if (!rc) {
		if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()
				|| machine_is_msm8625_surf()) {
			lcdc_reset_ptr = ioremap_nocache(LCDC_RESET_PHYS,
				sizeof(uint32_t));
			printk(KERN_ERR "[DISPLAY]%s: surf\n", __func__);

			if (!lcdc_reset_ptr)
				return 0;
		}

		printk(KERN_ERR "[DISPLAY]%s: X, rc <%d>\n", __func__, rc);
		return rc;
	} else {
		//goto gpio_error;
	}
#endif
#if 0
gpio_error2:
	pr_err("Failed GPIO bridge pd\n");
	gpio_free(GPIO_LCDC_BRDG_PD);

gpio_error:
	pr_err("Failed GPIO bridge reset\n");
	gpio_free(GPIO_LCDC_BRDG_RESET_N);
#endif
	printk(KERN_INFO "[DISPLAY]%s: X, rc <%d>\n", __func__, rc);

	return rc;
}
Exemplo n.º 12
0
static int fbx_kybd_suspend(struct platform_device *pdev, pm_message_t state)
{
    struct pm8058_gpio button_configuration = {
        .direction      = PM_GPIO_DIR_OUT,
        .pull           = PM_GPIO_PULL_DN,
        .vin_sel        = 2,
        .out_strength   = PM_GPIO_STRENGTH_NO,
        .function       = PM_GPIO_FUNC_NORMAL,
        .inv_int_pol    = 0,
    };
    int rc = 0;

    printk(KERN_INFO "%s\n", __func__);

    rc = pm8058_gpio_config(rd->pmic_gpio_vol_up, &button_configuration);
    if (rc < 0) {
        dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_vol_up);
        return rc;
    } else {
        rc = gpio_direction_output(rd->sys_gpio_vol_up, 0);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_vol_up);
            return rc;
        }
    }
    
    rc = pm8058_gpio_config(rd->pmic_gpio_vol_dn, &button_configuration);
    if (rc < 0) {
        dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_vol_dn);
        return rc;
    } else {
        rc = gpio_direction_output(rd->sys_gpio_vol_dn, 0);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_vol_dn);
            return rc;
        }
    }
 
    if (rd->product_phase == Product_PR1 || rd->product_phase == Product_EVB) {
        rc = pm8058_gpio_config(rd->pmic_gpio_cam_t, &button_configuration);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_cam_t);
            return rc;
        } else {
            rc = gpio_direction_output(rd->sys_gpio_cam_t, 0);
            if (rc < 0) {
                dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_cam_t);
                return rc;
            }
        }
        
        rc = pm8058_gpio_config(rd->pmic_gpio_cam_f, &button_configuration);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_cam_f);
            return rc;
        } else {
            rc = gpio_direction_output(rd->sys_gpio_cam_f, 0); 
            if (rc < 0) {
                dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_cam_f);
                return rc;
            }
        }
    }
 
    return 0;
}

static int fbx_kybd_resume(struct platform_device *pdev)
{
    struct pm8058_gpio button_configuration = {
        .direction      = PM_GPIO_DIR_IN,
        .pull           = PM_GPIO_PULL_DN,
        .vin_sel        = 2,
        .out_strength   = PM_GPIO_STRENGTH_NO,
        .function       = PM_GPIO_FUNC_NORMAL,
        .inv_int_pol    = 0,
    };
    int rc = 0;

    printk(KERN_INFO "%s\n", __func__);

    rc = pm8058_gpio_config(rd->pmic_gpio_vol_up, &button_configuration);
    if (rc < 0) {
        dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_vol_up);
        return rc;
    } else {
        rc = gpio_direction_input(rd->sys_gpio_vol_up);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_vol_up);
            return rc;
        }
    }
    
    rc = pm8058_gpio_config(rd->pmic_gpio_vol_dn, &button_configuration);
    if (rc < 0) {
        dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_vol_dn);
        return rc;
    } else {
        rc = gpio_direction_input(rd->sys_gpio_vol_dn);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_vol_dn);
            return rc;
        }
    }

    if (rd->product_phase == Product_PR1 || rd->product_phase == Product_EVB) {
        rc = pm8058_gpio_config(rd->pmic_gpio_cam_t, &button_configuration);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_cam_t);
            return rc;
        } else {
            rc = gpio_direction_input(rd->sys_gpio_cam_t);
            if (rc < 0) {
                dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_cam_t);
                return rc;
            }
        }
        
        rc = pm8058_gpio_config(rd->pmic_gpio_cam_f, &button_configuration);
        if (rc < 0) {
            dev_err(rd->fbx_kybd_pdev, "%s: gpio %d configured failed\n", __func__, rd->pmic_gpio_cam_f);
            return rc;
        } else {
            rc = gpio_direction_input(rd->sys_gpio_cam_f); 
            if (rc < 0) {
                dev_err(rd->fbx_kybd_pdev, "%s: set gpio %d direction failed\n", __func__, rd->sys_gpio_cam_f);
                return rc;
            }
        }
    }
    
    return 0;
}

static ssize_t fbx_kybd_gpio_status_show(struct device *dev,
                    struct device_attribute *attr, char *buf)
{
    
    return sprintf(buf, "%u\n", 0);
}

static ssize_t fbx_kybd_gpio_status_store(struct device *dev, 
        struct device_attribute *attr, const char *buf, size_t count)
{
    return count;
}

static DEVICE_ATTR(gpio_status, 0644, fbx_kybd_gpio_status_show, fbx_kybd_gpio_status_store);

static int fbx_kybd_probe(struct platform_device *pdev)
{
    struct fbx_kybd_platform_data *setup_data = pdev->dev.platform_data;
    int rc = -ENOMEM;

    rd = kzalloc(sizeof(struct fbx_kybd_record), GFP_KERNEL);
    if (!rd) {
        dev_err(&pdev->dev, "record memory allocation failed!!\n");
        return rc;
    }
    
    rd->product_phase           = fih_get_product_phase();
    rd->fbx_kybd_pdev           = &pdev->dev;
    rd->pmic_gpio_vol_up        = setup_data->pmic_gpio_vol_up;
    rd->pmic_gpio_vol_dn        = setup_data->pmic_gpio_vol_dn;
    rd->sys_gpio_vol_up         = setup_data->sys_gpio_vol_up;
    rd->sys_gpio_vol_dn         = setup_data->sys_gpio_vol_dn;
    if (rd->product_phase == Product_PR1 || rd->product_phase == Product_EVB) {
        rd->pmic_gpio_cam_f = setup_data->pmic_gpio_cam_f;
        rd->pmic_gpio_cam_t = setup_data->pmic_gpio_cam_t;
        rd->sys_gpio_cam_f  = setup_data->sys_gpio_cam_f;
        rd->sys_gpio_cam_t  = setup_data->sys_gpio_cam_t;
    }
    /* Div1-FW3-BSP-AUDIO */
    rd->hook_sw_pin             = setup_data->hook_sw_pin;
    rd->hooksw_irq_enable = false;
    headset_hook_wq = create_singlethread_workqueue("headset_hook");
    if (!headset_hook_wq) {
        printk("%s: create workque failed \n", __func__);       
        return -EBUSY;
    }
    
    //Request GPIOs
    rc = fbx_kybd_config_gpio();
    if (rc) {
        goto failexit1;
    } else {
        dev_info(&pdev->dev,
               "%s: GPIOs configured SUCCESSFULLY!!\n", __func__);
    }

    //Initialize WORKs
    INIT_WORK(&rd->qkybd_volup, fbx_kybd_volup);
    INIT_WORK(&rd->qkybd_voldn, fbx_kybd_voldn);
    if (rd->product_phase == Product_PR1 || rd->product_phase == Product_EVB) {
        INIT_WORK(&rd->qkybd_camf, fbx_kybd_camf);
        INIT_WORK(&rd->qkybd_camt, fbx_kybd_camt);
    }
    /* Div1-FW3-BSP-AUDIO */
    INIT_WORK(&rd->hook_switchkey, fbx_kybd_hooksw);
    
    //Request IRQs
    rc = fbx_kybd_irqsetup();
    if (rc)  
        goto failexit2;

    //Register Input Device to Input Subsystem
    fbx_kybd_connect2inputsys();
    if (rd->fbx_kybd_idev == NULL)
        goto failexit2;
        
    rc = device_create_file(&pdev->dev, &dev_attr_gpio_status);
    if (rc) {
        dev_err(&pdev->dev,
               "%s: dev_attr_gpio_status failed\n", __func__);
    }
    
    return 0;

failexit2:
    fbx_kybd_free_irq();
    fbx_kybd_flush_work();
    
failexit1:
    fbx_kybd_release_gpio();
    kfree(rd);

    return rc;
}

static struct platform_driver fbx_kybd_driver = {
    .driver = {
        .owner = THIS_MODULE,
        .name  = fbx_kybd_name,
    },
    .probe    = fbx_kybd_probe,
    .remove   = __devexit_p(fbx_kybd_remove),
    .suspend  = fbx_kybd_suspend,
    .resume   = fbx_kybd_resume,
};

static int __init fbx_kybd_init(void)
{
    return platform_driver_register(&fbx_kybd_driver);
}

static void __exit fbx_kybd_exit(void)
{
    platform_driver_unregister(&fbx_kybd_driver);
}
static int mipi_dsi_panel_power(int on)
{
	int rc = 0, retVal = 0;
	static struct regulator *reg_vdd, *reg_iovdd, *reg_vdd_mipi;
	static bool dsi_power_on = false;
	unsigned int phaseid = 0;

	pr_info("[DISPLAY] +%s(%d)\n", __func__, on);

	if (!dsi_power_on) {

		/* INIT VDD_MIPI */
		reg_vdd_mipi = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdda");
		if (IS_ERR(reg_vdd_mipi)) {
			pr_err("[DISPLAY]could not get reg_vdd_mipi, rc = %ld\n",
				PTR_ERR(reg_vdd_mipi));
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_set_voltage(reg_vdd_mipi, 1200000, 1200000);
		if (rc) {
			pr_err("[DISPLAY]set_voltage VDD_MIPI failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}

		/* INIT VDD FOR LCD*/
		reg_vdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"dsi_vdc");
		if (IS_ERR(reg_vdd)) {
			pr_err("[DISPLAY]could not get reg_vdd, rc = %ld\n",
				PTR_ERR(reg_vdd));
			retVal = -ENODEV;
			goto error;
		}

		rc = regulator_set_voltage(reg_vdd, 2800000, 2800000);
		if (rc) {
			pr_err("[DISPLAY]set_voltage reg_vdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}

		/* INIT IOVDD FOR LCD*/
		phaseid = fih_get_product_phase();
		if(phaseid == PHASE_EVM ){
		pr_info("[DISPLAY]Get L18\n");
			reg_iovdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"lcd_iovdd");
		}else{
			pr_info("[DISPLAY]Get LVS2\n");
			reg_iovdd = regulator_get(&msm_mipi_dsi1_device.dev,
				"lcd_lvs2");
		}
		if (IS_ERR(reg_iovdd)) {
			pr_err("[DISPLAY]could not get reg_iovdd, rc = %ld\n",
				PTR_ERR(reg_iovdd));
			retVal = -ENODEV;
			goto error;
		}

		if(phaseid == PHASE_EVM ){
			rc = regulator_set_voltage(reg_iovdd, 1800000, 1800000);
			if (rc) {
				pr_err("[DISPLAY]set_voltage reg_iovdd failed, rc=%d\n", rc);
				rc = -ENODEV;
				goto error;
			}
		}

		dsi_power_on = true;
	}

	if (on) {
		rc = regulator_set_optimum_mode(reg_vdd_mipi, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode VDD_MIPI failed, rc=%d\n", rc);
			retVal =  -EINVAL;
			goto error;
		}
		rc = regulator_set_optimum_mode(reg_vdd, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_vdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
		rc = regulator_set_optimum_mode(reg_iovdd, 100000);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_iovdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
		rc = regulator_enable(reg_vdd_mipi);
		if (rc) {
			pr_err("[DISPLAY]enable VDD_MIPI failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_enable(reg_iovdd);
		if (rc) {
			pr_err("[DISPLAY]enable l18 failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_enable(reg_vdd);
		if (rc) {
			pr_err("[DISPLAY]enable l8 failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}

	} else {
		rc = regulator_disable(reg_iovdd);
		if (rc) {
			pr_err("[DISPLAY]disable reg_vdd failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_disable(reg_vdd);
		if (rc) {
			pr_err("[DISPLAY]disable reg_vdd failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}
		rc = regulator_disable(reg_vdd_mipi);
		if (rc) {
			pr_err("[DISPLAY]disable reg_vdd_mipi failed, rc=%d\n", rc);
			retVal = -ENODEV;
			goto error;
		}

		rc = regulator_set_optimum_mode(reg_vdd_mipi, 100);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_vdd_mipi failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
		rc = regulator_set_optimum_mode(reg_vdd, 100);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_vdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}

		rc = regulator_set_optimum_mode(reg_iovdd, 100);
		if (rc < 0) {
			pr_err("[DISPLAY]set_optimum_mode reg_iovdd failed, rc=%d\n", rc);
			retVal = -EINVAL;
			goto error;
		}
	}

error:

	return retVal;
}
Exemplo n.º 14
0
static int baseband_read_proc(char *page, char **start, off_t off,
				 int count, int *eof, void *data)
{
	int len;

	int pp = fih_get_product_phase();
	char ver[25]={0};
	
	switch (pp){
	case Phase_EVB:
		strncpy(ver, "EVB", 3);
		ver[3]='\0';
		break; 
	case Phase_DP:
		strncpy(ver, "DP", 2);
		ver[2]='\0';
		break; 
	case Phase_SP:
		strncpy(ver, "SP", 2);
		ver[3]='\0';
		break; 
	/* MTD-BSP-VT-HWID-02+[ */
	case Phase_SP2:
		strncpy(ver, "SP2", 3);
		ver[3]='\0';
		break;
	/* MTD-BSP-VT-HWID-02+] */
	case Phase_SP3:
		strncpy(ver, "SP3", 3);
		ver[3]='\0';
		break;
	case Phase_AP:
		strncpy(ver, "AP", 2);
		ver[2]='\0';
		break;
	case Phase_AP2:
		strncpy(ver, "AP2", 3);
		ver[3]='\0';
		break;
	case Phase_PreAP:
		strncpy(ver, "PreAP", 5);
		ver[5]='\0';
		break;
	case Phase_TP:
		strncpy(ver, "TP", 2);
		ver[2]='\0';
		break;
	case Phase_TP2:
		strncpy(ver, "TP2", 3);
		ver[3]='\0';
		break;
	case Phase_TP3:
		strncpy(ver, "TP3", 3);
		ver[3]='\0';
		break;
	case Phase_PQ :
		strncpy(ver, "PQ", 2);
		ver[2]='\0';
		break; 
	case Phase_MP:
		strncpy(ver, "MP", 2);
		ver[2]='\0';
		break; 
	default:
		strncpy(ver, "Unkonwn Baseband version",24);
		ver[24]='\0';
		break;
	}

	len = snprintf(page, count, "%s\n",
		ver);  /* MTD-BSP-VT-PROC-00* */

	return proc_calc_metrics(page, start, off, count, eof, len);
}