コード例 #1
0
static void gsbi1_quptable_i2c_gpio_config(int adap_id,int config_type)
{
    int rc;
	
    if (adap_id < 0 || adap_id > 1)
	return;

    printk("linxc %s  adap_id=%d, config_type=%d\n", __func__, adap_id, config_type); 
	
    if(config_type == 0)
    {
        rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
	 if(rc < 0){
	       printk("linxc %s  check 1111 \n", __func__); 	 	
    	 	msm_gpios_free(&qup_i2c_gpios_hw[adap_id*2], 2);
        	rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
	 }
    }
    else
    {
         rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
	  if(rc < 0){
	       printk("linxc %s  check 2222 \n", __func__); 	 	
         	msm_gpios_free(&qup_i2c_gpios_io[adap_id*2], 2);
         	rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
	  }
    }
    
    if (rc < 0)
		printk("QUP GPIO request/enable failed: %d\n", rc);
    
}
コード例 #2
0
static int msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
{
	int rc = 0;
	struct sdcc_gpio *curr;

	curr = &sdcc_cfg_data[dev_id - 1];
	if (!(test_bit(dev_id, &gpio_sts)^enable))
		return rc;

	if (enable) {
		set_bit(dev_id, &gpio_sts);
		rc = msm_gpios_request_enable(curr->cfg_data, curr->size);
		if (rc)
			pr_err("%s: Failed to turn on GPIOs for slot %d\n",
					__func__,  dev_id);
	} else {
		clear_bit(dev_id, &gpio_sts);
		if (curr->sleep_cfg_data) {
			rc = msm_gpios_enable(curr->sleep_cfg_data, curr->size);
			msm_gpios_free(curr->sleep_cfg_data, curr->size);
			return rc;
		}
		msm_gpios_disable_free(curr->cfg_data, curr->size);
	}
	return rc;
}
コード例 #3
0
int msm_gpios_request_enable(const struct msm_gpio *table, int size)
{
	int rc = msm_gpios_request(table, size);
	if (rc)
		return rc;
	rc = msm_gpios_enable(table, size);
	if (rc)
		msm_gpios_free(table, size);
	return rc;
}
コード例 #4
0
static void lcdc_config_gpios(int enable)
{
	if (enable) {
		msm_gpios_request_enable(lcdc_gpio_config_data,
					      ARRAY_SIZE(
						      lcdc_gpio_config_data));
	}
	else
		msm_gpios_free(lcdc_gpio_config_data,
					    ARRAY_SIZE(
						    lcdc_gpio_config_data));
}
コード例 #5
0
int msm_gpios_request(const struct msm_gpio *table, int size)
{
	int rc;
	int i;
	const struct msm_gpio *g;
	for (i = 0; i < size; i++) {
		g = table + i;
		rc = gpio_request(GPIO_PIN(g->gpio_cfg), g->label);
		if (rc) {
			pr_err("gpio_request(%d) <%s> failed: %d\n",
			       GPIO_PIN(g->gpio_cfg), g->label ?: "?", rc);
			goto err;
		}
	}
	return 0;
err:
	msm_gpios_free(table, i);
	return rc;
}
コード例 #6
0
void msm_gpios_disable_free(const struct msm_gpio *table, int size)
{
	msm_gpios_disable(table, size);
	msm_gpios_free(table, size);
}