Esempio n. 1
0
int  mi2s_unconfig_data_gpio(u32 direction, u8 sd_line_mask)
{
	int i;
	sd_line_mask &= MI2S_SD_LINE_MASK;

	if (direction == DIR_TX) {
		msm_gpios_disable_free(mi2s_tx_data_lines_gpios, 1);
		return 0;
	}

	if (direction != DIR_RX) {
		pr_err("%s: Invaild direction  direction = %u\n",
				__func__, direction);
		return -EINVAL;
	}

	i = 0;
	while (sd_line_mask) {

		if (sd_line_mask & 0x1)
			msm_gpios_disable_free(
					mi2s_rx_data_lines_gpios + i , 1);

		sd_line_mask = sd_line_mask >> 1;
		i++;
	}
	return 0;
}
static int a4_ts_hw_init(int on)
{
	int rc;

	if (on) {
		vreg_ts_ldo15 = vreg_get(NULL, "gp6");

		if (IS_ERR(vreg_ts_ldo15)) {
			pr_err("%s: vreg_ldo15 get failed (%ld)\n",
					__func__, PTR_ERR(vreg_ts_ldo15));
			return -ENOTSUPP;
		}

		rc = vreg_set_level(vreg_ts_ldo15, 2850);
		if (rc) {
			pr_err("%s: vreg set level failed (%d)\n",
					__func__, rc);
			return rc;
		}

		rc = vreg_enable(vreg_ts_ldo15);
		if (rc) {
			pr_err("%s: vreg enable failed (%d)\n",
					__func__, rc);
			return rc;
		}

		return msm_gpios_request_enable(ts_config_data,
				ARRAY_SIZE(ts_config_data));
	} else {
		msm_gpios_disable_free(ts_config_data,
				ARRAY_SIZE(ts_config_data));
		return 0;
	}
}
Esempio n. 3
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;
}
static int msm7200a_wl1251_remove(struct platform_device *pdev) {
#if MSM7200A_WL1251_HACK
    platform_device_unregister(&wl1251_device);
#endif
    msm_delete_sdcc(wl1251_priv.pdata->slot_number);
    msm_gpios_disable_free(wl1251_priv.gpios.off, wl1251_priv.gpios.off_length);
    if (wl1251_priv.vreg) {
        vreg_put(wl1251_priv.vreg);
        wl1251_priv.vreg = NULL;
    }
    if (wl1251_priv.pdata->gpio_irq >= 0) {
        gpio_free(wl1251_priv.pdata->gpio_irq);
    }
    if (wl1251_priv.pdata->gpio_enable) {
        gpio_free(wl1251_priv.pdata->gpio_enable);
    }
    if (wl1251_priv.pdata->gpio_reset) {
        gpio_free(wl1251_priv.pdata->gpio_reset);
    }
    if (wl1251_priv.pdata->gpio_32k_osc) {
        gpio_free(wl1251_priv.pdata->gpio_32k_osc);
    }
    wl1251_priv.pdata = NULL;
#if MSM7200A_WL1251_HACK
    wl1251_pdata.irq = 0;
#endif
    return 0;
}
static int msm7200a_mmc_remove(struct platform_device *pdev) {
    msm_delete_sdcc(sdslot_priv.pdata->slot_number);
    msm_gpios_disable_free(sdslot_priv.gpios.off, sdslot_priv.gpios.off_length);
    if (sdslot_priv.vreg) {
        vreg_put(sdslot_priv.vreg);
        sdslot_priv.vreg = NULL;
    }
    if (sdslot_priv.pdata->gpio_detection >= 0) {
        set_irq_wake(gpio_to_irq(sdslot_priv.pdata->gpio_detection), 0);
        gpio_free(sdslot_priv.pdata->gpio_detection);
    }
    sdslot_priv.pdata = NULL;
    return 0;
}
void pedestal_gpio_release(unsigned int pedestal_type)
{
	if(pedestal_type < PEDESTAL_TYPE_UNDEF)
	{
		spin_lock_irq(&g_pdriverdata->pedestal_lock); 
		if(g_gpio_irq_state.pedestal_gpio_req_state[pedestal_type] > 0)
		{
			msm_gpios_disable_free(&pedestal_gpio_cfg[pedestal_type],1);
			g_gpio_irq_state.pedestal_gpio_req_state[pedestal_type]--;
		}
		else
			PEDESTAL_ERR("pedestal_gpio_setup: request gpio again!\n");
		spin_unlock_irq(&g_pdriverdata->pedestal_lock);
	}
}
Esempio n. 7
0
static void msm7x27a_cfg_smsc911x(void)
{
	int res;

	res = msm_gpios_request_enable(smsc911x_gpios,
				 ARRAY_SIZE(smsc911x_gpios));
	if (res) {
		pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
		return;
	}

	/* ETH_FIFO_SEL */
	res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
	if (res) {
		pr_err("%s: unable to get direction for gpio %d\n", __func__,
							 ETH_FIFO_SEL_GPIO);
		msm_gpios_disable_free(smsc911x_gpios,
						 ARRAY_SIZE(smsc911x_gpios));
		return;
	}
	gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
}
Esempio n. 8
0
int mi2s_unconfig_clk_gpio(void)
{
	msm_gpios_disable_free(mi2s_clk_gpios, ARRAY_SIZE(mi2s_clk_gpios));
	return 0;
}