Beispiel #1
0
static int __init bq2419x_dev_init(void)
{
    int status, gpio, i;
    int enable = 0;

    if (get_hw_config_int(BQ2419X_INT, &gpio, NULL )){
        bq2419x_data.gpio_int = gpio;
    }

    if (get_hw_config_int(BQ2419X_CD, &gpio, NULL )){
        bq2419x_data.gpio_cd = gpio;
    }

    if (get_hw_config_int(BQ2419X_OTG, &gpio, NULL )){
        bq2419x_data.gpio_otg = gpio;
    }

    status = i2c_register_board_info(0,&bq2419x_i2c_bus_devs[0], ARRAY_SIZE(bq2419x_i2c_bus_devs));

    if(status)
    {
        printk(KERN_ERR "register bq2419x hardware device error!\n");
    }

    return status;
}
Beispiel #2
0
static int __init modem_boot_init(void)
{
    int ret = 0;

    int support_cbp = true;
    int cannot_sleep = 0;

    ret = get_hw_config_int("modem/viacbp82d", &support_cbp, NULL);

    if ((!ret) || (0 == support_cbp)) {
        pr_info("%s has no cbp support\n", __func__);
        return -ENXIO;
    }

    ret = get_hw_config_int("modem/cbp_cannot_sleep", &cannot_sleep, NULL);
    if ((ret) && (1 == cannot_sleep)) {
	pr_info("%s cbp cannot sleep\n", __func__);
	wake_lock_init(&cbp_wk_no_sleep, WAKE_LOCK_SUSPEND, "cbp_wk_no_sleep");
	wake_lock(&cbp_wk_no_sleep);
    }


    ret = platform_device_register(&platform_modem_device);
    if (ret)
    {
        printk("platform_device_register failed\n");
        goto err_platform_device_register;	
    }

    ret = platform_driver_register(&modem_boot_driver);
    if(ret < 0)
    {
        printk("platform_driver_register failed\n");
        goto err_platform_driver_register;
    }

    ret = misc_register(&misc_modem_device);
    if(ret < 0)
    {
        printk("misc regiser via modem failed\n");
        goto err_misc_device_register;
    }

    return ret;

err_misc_device_register:
	platform_driver_unregister(&modem_boot_driver);
err_platform_driver_register:
	platform_device_unregister(&platform_modem_device);
err_platform_device_register:

    return ret;
}
Beispiel #3
0
unsigned int mshci_hi_get_present_status(struct mshci_host *ms_host)
{
	struct himci_host * hi_host = (struct himci_host *)(ms_host->private);
	unsigned int status;

	unsigned int sdcard_flag;  /* 1 means support sd card */
	unsigned int present_flag; /* 1 means high vol is present, 0 means low vol is present */
	int ret;

	if (ms_host->quirks & MSHCI_QUIRK_WLAN_DETECTION) {
		if (ms_host->flags & MSHCI_DEVICE_DEAD)
			return 1;
		else
			return 0;
	} else if (ms_host->quirks & MSHCI_QUIRK_EXTERNAL_CARD_DETECTION) {
		status |= hi_host->ocp_flag;
		/* GPIO Low mean SD Card insert; ASIC IS opposite*/
#ifdef CONFIG_MACH_HI6620SFT
		status = gpio_get_value(hi_host->plat->cd_gpio);
#endif
#ifdef CONFIG_MACH_HI6620OEM

		/* support sd card? */
		ret = get_hw_config_int("sd_card/sdcard_support", &sdcard_flag, NULL);
		if ((0 == ret) || (0 == sdcard_flag)) {
			printk("%s : sd card is not supported\n", __FUNCTION__);
			status = 1;
		} else {
			/* 获取sd card在位电平 */
			ret = get_hw_config_int("sd_card/present_voltage", &present_flag, NULL);
			if (0 == ret) {
				printk("%s : get_hw_config sd_card/sdcard_voltage failed\n", __FUNCTION__);
				return 1;
			}
			/* 检测gpio电压 */
			if (1 == present_flag) {
				status = !gpio_get_value(hi_host->plat->cd_gpio);
			} else {
				status = gpio_get_value(hi_host->plat->cd_gpio);
			}
		}

#endif
		return status;
	} else {
		return 0;
	}
}
Beispiel #4
0
static void mshci_sd_lowpower(void)
{
    /* used for sd card low power  */
  
    int ret;
    int gpio_val;

    ret = get_hw_config_int("sd_card/sdcard_clk_pin", &gpio_val, NULL);
    if (false == ret) {
        printk("sdcard_clk_pin value not found !\n");
        gpio_val = GPIO_8_2;
    }

    ret = gpio_request(gpio_val,"SD_CLK");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    ++gpio_val;

    ret = gpio_request(gpio_val,"SD_CMD");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    ++gpio_val;

    ret = gpio_request(gpio_val,"SD_DATA0");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    ++gpio_val;

    ret = gpio_request(gpio_val,"SD_DATA1");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    ++gpio_val;

    ret = gpio_request(gpio_val,"SD_DATA2");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    ++gpio_val;

    ret = gpio_request(gpio_val,"SD_DATA3");
    if (ret < 0){
        printk("GPIO request failed\n");
    }
    gpio_direction_output(gpio_val, 0);
    gpio_free(gpio_val);
    gpio_free(--gpio_val);
    gpio_free(--gpio_val);
    gpio_free(--gpio_val);
    gpio_free(--gpio_val);
    gpio_free(--gpio_val);
}
Beispiel #5
0
static int hi_mci_resume(struct platform_device *dev)
{
	int ret = 0;
	struct mshci_host *ms_host = NULL;
	struct himci_host *hi_host = NULL;   
	int cbp_flag = 0;
	int cbp_ret = 0;
	unsigned int oldclock = 0;

	ms_host = platform_get_drvdata(dev);
	if (!ms_host) {
		printk(KERN_WARNING "the return value of platform_get_drvdata is NULL !\n");
		return -1;
	}
	hi_host = mshci_priv(ms_host);

	cbp_ret = get_hw_config_int("modem/viacbp82d", &cbp_flag, NULL);
	if ((!cbp_ret) || (0 == cbp_flag)) {
		pr_info("%s has no cbp support\n", __func__);
	}

	if ((1 == hi_host->pdev->id)&&(cbp_flag)){
		ret = blockmux_set(hi_host->piomux_block, hi_host->pblock_config, NORMAL);
		if (ret) {
			himci_error("failed to blockmux_set");
		}
	}

	printk(KERN_INFO "hi_mci_resume is called \n");
	mshci_resume_host(ms_host);

	if (ms_host->quirks & MSHCI_QUIRK_WLAN_DETECTION) {
		if (ms_host->mmc->ios.power_mode != MMC_POWER_OFF) {
			ret = mmc_sdio_resume_ext(ms_host->mmc);
			if (ret) {
				printk("%s, sdio resume error\n", __func__);
				return ret;
			}
		}
	}

	if ((1 == hi_host->pdev->id)&&(cbp_flag)){
		if (ms_host->mmc->ios.power_mode != MMC_POWER_OFF) {
			pr_info("%s cbp resume sdio maxclock = %d, cur_clk=%d\n", __func__, ms_host->max_clk, ms_host->clock);
			ms_host->mmc->ios.clock = ms_host->mmc->f_max;
			ms_host->mmc->ops->set_ios(ms_host->mmc, &ms_host->mmc->ios);
			ms_host->mmc->ops->enable_sdio_irq(ms_host->mmc, 1);
		}
		cbp_host_waked = 1;
		cbp_notifier_call_chain(1, NULL);
	}

    if(0 == hi_host->pdev->id)
    {
        g_ulmmc_suspend_flag = false;
        /*emmc resume 完毕*/
        printk("mmc_blk_resume, clr g_ulmmc_suspend_flag.\n");
    }
	return ret;
}
Beispiel #6
0
static int mshci_hi_set_clk_rate(struct mshci_host *ms_host, unsigned int clock)
{
    int ret;
    unsigned int wifi_clock_val = 50000000;

    if (MMC_CCLK_MAX_150M == clock){/* hs200 need to set dsppll clock 300M */
        ret = clk_set_rate( ms_host->clk_mmc_high, MMC_CCLK_MAX_300M );
    }
    else{
        ret = clk_set_rate( ms_host->clk_mmc_high, 2*MMC_CCLK_MAX_100M );
    }
    if (ret) {
        printk("Unable to set clock to the suited rate\n");
        return ret;	
    }
    if ((ms_host->hw_mmc_id == 1)&&(ms_host->quirks & MSHCI_QUIRK_CBP_DETECTION)){
	 ret = clk_set_rate( ms_host->clk_mmc_high, 240*1000*1000 );
        clock = 48*1000*1000;
    }

    if (ms_host->hw_mmc_id == 2){
        ret = get_hw_config_int("wifi/wifi_clock", &wifi_clock_val, NULL);
        if (false == ret) {
            printk(KERN_ERR "Error to find wifi_clock_val !\n");
        }
        clock = wifi_clock_val;
    }
    return clk_set_rate( ms_host->pclk, clock );
}
/*for Wi-Fi*/
int hsad_wifi_get_gpio(char *name)
{
    int gpio = 0;

    if (get_hw_config_int(name, &gpio, NULL ) == false)
        return -1;

    return gpio;
}
void init_ldo_ocp_mask(void)
{
    if (!get_hw_config_int("power/ldo_ocp_bit_mask", &ldo_dont_ocp_mask, NULL) ) {
        ldo_dont_ocp_mask = 0;
        pr_err("get ldo_ocp_bit_mask failed\n");
    }

    printk("ldo_dont_ocp_mask = %d\n", ldo_dont_ocp_mask);
}
int get_rgb_sensor_value(void)
{
	int value = 0;
	bool ret = get_hw_config_int("RGB_sensor/rgb_sensor_value", &value, NULL);
	if( ret == true)
		{
		 return value;
		}
	return 0;
}
int get_proximity_light_boardId_value(void)
{
	int value = 0;
	bool ret = get_hw_config_int("proximity/threshold", &value, NULL);
	if( ret == true)
       {
            return value;
        }
	return 0;
}
int get_usb_trim_value(void)
{
	int value = 0;
	bool ret = get_hw_config_int("usbeye/trim_value", &value, NULL);
	if( ret == true)
	{
	    return value;
	}
	return 0x24;
}
int get_touchkey_light_boardId_value(void)
{
	int value = 0;
	bool ret = get_hw_config_int("tklight/touchkeylight", &value, NULL);
	if( ret == true)
		{
		 return value;
		}
	return 0;
}
int get_if_use_3p75M_uart_clock(void)
{
	unsigned int value =0;
	bool ret = get_hw_config_int("clock/use_3p75Mbps_uart", &value, NULL);
	if (ret == true) {
		return value;
	}
	
	return 0;
}
int get_mhl_connect(void)
{
	int value = 0;
	bool ret = get_hw_config_int("mhl/mhl_connect", &value, NULL);
	if( ret == true)
		{
		 return value;
		}
	return 0;
}
/* Viva T1, Front T1 and previous board return false(no xmd_ready gpio), after that return true */
int get_hw_config_xmd_ready(void)
{
	int xmd_ready_conf = false;
	bool ret = get_hw_config_int("xmd/xmd_ready_gpio_enable", &xmd_ready_conf, NULL);
	if( ret == true )
	{
		return xmd_ready_conf;
	}
	return false;
}
int get_mhl_ci2ca_value(void)
{
	int value = 0;
	bool ret = get_hw_config_int("mhl/ci2ca_is_pull_up", &value, NULL);
	if( ret == true)
		{
		 return value;
		}
	return 0;
}
int get_nfc_product(void)
{
	unsigned int type = 0;
	bool ret = get_hw_config_int("nfc/nfc_product", &type, NULL);
	HW_CONFIG_DEBUG("hsad: nfc_product = %d\n", type);
	if (ret == true) {
	         return (int)type;
	}
	return 0;
}
bool get_sysen_value(void)
{
	int value = 0;
	get_hw_config_int("sysen/board_value", &value, NULL);
	if( 0x01 == value)
	{
	    return true;
	}
	return false;
}
/* get correct axis align for touch begin*/
int get_touchscreen_axis_align(void)
{
	bool ret;
	unsigned int type = 0;
	ret = get_hw_config_int("touchscreen/touchscreen_axis_align", &type, NULL);
	HW_CONFIG_DEBUG("hsad: get_touchscreen_axis_align = %d\n", type);
	if (true == ret)
		return type;

	return -1;
}
int get_sensor_iopower(void)
{
        unsigned int type = 0;

        bool ret = get_hw_config_int("camera/iopower", &type, NULL);
        HW_CONFIG_DEBUG("hsad: camera/iopower = %d\n", type);
        if (ret == true) {
                return type;
        }
        return -1;
}
int get_touchkey_sensitivity_glove(void)
{
    unsigned int type = 0;

    bool ret = get_hw_config_int("touchkey/key_sensitivity_glove", &type, NULL);
    HW_CONFIG_DEBUG("hsad: get_touchkey_sensitivity_glove = %d\n", type);
    if (ret == true) {
        return type;
    }
    return -1;
}
int get_touchscreen_fw_type(void)
{
	bool ret;
	unsigned int type = 0;
	ret = get_hw_config_int("touchscreen/firmware_type", &type, NULL);
	HW_CONFIG_DEBUG("hsad: get_touchscreen_fw_type = %d\n", type);
	if (ret == true)
		return type;

	return -1;
}
int get_vibrator_vout_max_voltage(void)
{
    unsigned int value = 0;

    bool ret = get_hw_config_int("audio/type_1_vout_max_voltage", &value, NULL);
    if (ret == true){
	return (int)value;
    }

    return -1;
}
int get_usbphy_tune(void)
{
	unsigned int value = 0;

	bool ret = get_hw_config_int("usbphy/usbphy_type", &value, NULL);
	HW_CONFIG_DEBUG("hsad: usbphy_type = %d,  ret = %d\n", value, ret);
	if (ret == true) {
		return value;
	}

	return -1;
}
int get_touchscreen_type(void)
{
	unsigned int type = 0;

	bool ret = get_hw_config_int("touchscreen/touchscreen_type", &type, NULL);
	HW_CONFIG_DEBUG("hsad: touchscreen_type = %d, ret = %d\n", type, ret);
	if (ret == true) {
		return type;
	}

	return -1;
}
Beispiel #26
0
int hsad_compass_softiron_type(void)
{
	unsigned int type = 0;

	bool ret = get_hw_config_int("sensor/compass_softiron_type", &type, NULL);
	HW_CONFIG_DEBUG("hsad: compass_softiron_type = %d,  ret = %d\n", type, ret);
	if (ret == true) {
		return type;
	}

	return -1;
}
Beispiel #27
0
int hsad_gyro_exist_info(void)
{
	unsigned int type = 0;

	bool ret = get_hw_config_int("sensor/gyro_exist_info", &type, NULL);
	HW_CONFIG_DEBUG("hsad: gyro_exist = %d,  ret = %d\n", type, ret);
	if (ret == true) {
		return type;
	}

	return -1;
}
Beispiel #28
0
int hsad_apds_get_type(void)
{
	unsigned int type = 0;

	bool ret = get_hw_config_int("apds/apds_type", &type, NULL);
	HW_CONFIG_DEBUG("hsad: apds_type = %d,  ret = %d\n", type, ret);
	if (ret == true) {
		return type;
	}

	return -1;
}
Beispiel #29
0
int hsad_get_hall_exist(void)
{
	bool ret;
	int value = 0;

	ret = get_hw_config_int("sensor/hall_exist", &value, NULL);
	if (ret == true) {
		return value;
	}

	return value;
}
Beispiel #30
0
int hsad_get_akm8963_type(void)
{
	bool ret;
	int value = 0;

	ret = get_hw_config_int("sensor/akm8963", &value, NULL);
	if (ret == true) {
		return value;
	}

	return value;
}