Пример #1
0
static void msm_camera_vreg_disable(void)
{
/* FIHTDC, Div2-SW2-BSP, Ming, LCM { */
/* TODO:  enable correct vreg to avoid damaging other components */
#if 0
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
	}
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
	}
	if (vreg_gp6) {
		/* Voting off gp6 causes touchscreen i2c issues */
		/* vreg_disable(vreg_gp6); */
		vreg_put(vreg_gp6);
	}
	if (vreg_gp16) {
		vreg_disable(vreg_gp16);
		vreg_put(vreg_gp16);
	}
#endif
/* } FIHTDC, Div2-SW2-BSP, Ming, LCM */
}
static void msm_camera_vreg_disable(void)
{
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
		vreg_gp2 = NULL;
	}
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
		vreg_lvsw1 = NULL;
	}
	if (vreg_gp6) {
		vreg_disable(vreg_gp6);
		vreg_put(vreg_gp6);
		vreg_gp6 = NULL;
	}
	if (vreg_gp16) {
		vreg_disable(vreg_gp16);
		vreg_put(vreg_gp16);
		vreg_gp16 = NULL;
	}
	if (fs_vfe) {
		regulator_disable(fs_vfe);
		regulator_put(fs_vfe);
	}
}
static int touchscreen_gpio_init(int flag)
{
	int ret = -EINVAL;


	//init
	if ( flag == 1 )
	{
		vdd = vbus = NULL;

		vdd = vreg_get(NULL, VREG_VDD_3V);
		if (!vdd) {
			pr_err("%s get failed\n", VREG_VDD_3V);
			return -1;
		}
		if ( vreg_set_level(vdd, 3050) ){
			pr_err("%s set failed\n", VREG_VDD_3V);
			return -1;
		}

		vbus =vreg_get(NULL, VREG_VBUS);
		if (!vbus) {
			pr_err("%s get failed\n", VREG_VBUS);
			return -1;
		}

		if ( vreg_set_level(vbus, 1800)) {
			pr_err(" %s set failed\n", VREG_VBUS);
			return -1;
		}

		ret = gpio_request(GPIO_7X30_TS_RST, "touch voltage");
		if (ret){
			pr_err(" gpio %d request is error!\n", GPIO_7X30_TS_RST);
			return -1;
		}

		ret = gpio_request(GPIO_7X30_TS_IRQ, "touch voltage");
		if (ret){
			pr_err("gpio %d request is error!\n", GPIO_7X30_TS_IRQ);
			return -1;
		}

	}


	//deinit
	if ( flag == 0)
	{
		vreg_put(vdd);
		vreg_put(vbus);
		gpio_free(GPIO_7X30_TS_IRQ);
		gpio_free(GPIO_7X30_TS_RST);
	}

	return 0;

}
void msm_pm_app_rpc_deinit(void)
{
	if (client) {
		msm_rpc_unregister_client(client);
		msm_pm_app_enable_usb_ldo(0);
		vreg_put(boost_vreg);
		vreg_put(usb_vreg);
	}
}
Пример #5
0
static void msm_camera_vreg_disable(void)
{
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
	}
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
	}
}
static void _put_vreg(struct vreg *vr)
{
	if (vr) {
		vreg_disable(vr);
		vreg_put(vr);
	}
}
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;
}
Пример #8
0
void board_exit(void) {
    int i;

    /* If we were able to bringup the refclk, turn it off now. */
    if (vreg_get_pwr_state(&refclk_main_vreg) == VREG_PWR_UP) {
        vreg_put(&refclk_main_vreg);
    }

    /*
     * Unregister the TCA64xx I/O Expanders and associated I2C
     * bus(ses).  Done in reverse order from registration to account
     * for IRQ chaining between I/O Expander chips.
     */
    for (i = evt1_board_info.nr_io_expanders - 1; i >= 0; i--) {
        struct io_expander_info *io_exp = &evt1_board_info.io_expanders[i];

        if (io_exp->io_exp_driver_data)
            tca64xx_deinit(io_exp->io_exp_driver_data);

        if (io_exp->i2c_dev)
            up_i2cuninitialize(io_exp->i2c_dev);
    }

    /* Lastly unregister the GPIO Chip driver */
    stm32_gpio_deinit();
}
Пример #9
0
static void msm_camera_vreg_enable(void)
{
	vreg_gp2 = vreg_get(NULL, "gp2");
	if (IS_ERR(vreg_gp2)) {
		pr_err("%s: VREG GP2 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp2));
		vreg_gp2 = NULL;
		return;
	}

	if (vreg_set_level(vreg_gp2, 2600)) {
		pr_err("%s: VREG GP2 set failed\n", __func__);
		goto gp2_put;
	}

	if (vreg_enable(vreg_gp2)) {
		pr_err("%s: VREG GP2 enable failed\n", __func__);
		goto gp2_put;
		}

	vreg_lvsw1 = vreg_get(NULL, "lvsw1");
	if (IS_ERR(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 get failed %ld\n", __func__,
			PTR_ERR(vreg_lvsw1));
		vreg_lvsw1 = NULL;
		goto gp2_disable;
		}
	if (vreg_set_level(vreg_lvsw1, 1800)) {
		pr_err("%s: VREG LVSW1 set failed\n", __func__);
		goto lvsw1_put;
	}
	if (vreg_enable(vreg_lvsw1))
		pr_err("%s: VREG LVSW1 enable failed\n", __func__);

	return;

lvsw1_put:
	vreg_put(vreg_lvsw1);
gp2_disable:
	vreg_disable(vreg_gp2);
gp2_put:
	vreg_put(vreg_gp2);
}
static int htckovsky_oj_remove(struct platform_device *pdev)
{
	htckovsky_oj_stop_polling();

	free_irq(gpio_to_irq(KOVS100_JOYSTICK_IRQ), pdev);
	gpio_free(KOVS100_JOYSTICK_IRQ);
	
	cancel_work_sync(&htckovsky_oj.oj_work);
	
	htckovsky_oj_power(false);
	vreg_put(htckovsky_oj.vreg_28v);
	vreg_put(htckovsky_oj.vreg_pwr);

	input_unregister_device(htckovsky_oj.input);
	input_free_device(htckovsky_oj.input);

	htckovsky_oj.client = NULL;
	return 0;
}
static int msm_hsusb_ldo_init(int init)
{
	if (init) {
		vreg_3p3 = vreg_get(NULL, "usb");
		if (IS_ERR(vreg_3p3))
			return PTR_ERR(vreg_3p3);
	} else
		vreg_put(vreg_3p3);

	return 0;
}
Пример #12
0
static void msm_camera_vreg_disable(void)
{
#if defined(CONFIG_SH_CAMERA)
#elif defined(CONFIG_T8EV4)
	/*----- v1.225 -----*/
	if (vreg_gp15) {
		vreg_disable(vreg_gp15);
		vreg_put(vreg_gp15);
		vreg_gp15 = NULL;
	}
	/*----- v3.0 -----*/
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
		vreg_gp2 = NULL;
	}
	/*----- v2.8 -----*/
	if (vreg_gp9) {
		vreg_disable(vreg_gp9);
		vreg_put(vreg_gp9);
		vreg_gp9 = NULL;
	}
	/*----- v1.8 -----*/
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
		vreg_lvsw1 = NULL;
	}
#else
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
		vreg_gp2 = NULL;
	}
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
		vreg_lvsw1 = NULL;
	}
	if (vreg_gp6) {
		vreg_disable(vreg_gp6);
		vreg_put(vreg_gp6);
		vreg_gp6 = NULL;
	}
	if (vreg_gp16) {
		vreg_disable(vreg_gp16);
		vreg_put(vreg_gp16);
		vreg_gp16 = NULL;
	}
#endif	/* CONFIG_SH_CAMERA */
}
Пример #13
0
int msm_pm_app_rpc_init(void)
{

#if 1
	/* allow qsd8650 */
#else
	if (!machine_is_qsd8x50_ffa() && !machine_is_msm7x27_ffa())
		return -ENOTSUPP;
#endif

	boost_vreg = vreg_get(NULL, "boost");
	if (IS_ERR(boost_vreg)) {
		pr_err("%s: boost vreg get failed\n", __func__);
		return PTR_ERR(boost_vreg);
	}

	usb_vreg = vreg_get(NULL, "usb");
	if (IS_ERR(usb_vreg)) {
		pr_err("%s: usb vreg get failed\n", __func__);
		vreg_put(usb_vreg);
		return PTR_ERR(usb_vreg);
	}

	client = msm_rpc_register_client("pmapp_usb",
			PM_APP_USB_PROG,
			PM_APP_USB_VERS_2_1, 1,
			pm_app_usb_cb_func);
	if (!IS_ERR(client)) {
		rpc_pmapp_init_rpc_ids(PM_APP_USB_VERS_2_1);
		goto done;
	}

	client = msm_rpc_register_client("pmapp_usb",
			PM_APP_USB_PROG,
			PM_APP_USB_VERS_1_2, 1,
			pm_app_usb_cb_func);
	if (!IS_ERR(client)) {
		rpc_pmapp_init_rpc_ids(PM_APP_USB_VERS_1_2);
		goto done;
	}

	client = msm_rpc_register_client("pmapp_usb",
			PM_APP_USB_PROG,
			PM_APP_USB_VERS_1_1, 1,
			pm_app_usb_cb_func);
	if (!IS_ERR(client))
		rpc_pmapp_init_rpc_ids(PM_APP_USB_VERS_1_1);
	else
		return PTR_ERR(client);

done:
	return 0;
}
Пример #14
0
static void __exit snddev_icodec_exit(void)
{
	struct snddev_icodec_drv_state *icodec_drv = &snddev_icodec_drv;

#ifdef CONFIG_DEBUG_FS
	debugfs_remove(debugfs_afelb);
	debugfs_remove(debugfs_adielb);
	debugfs_remove(debugfs_sdev_dent);
#endif
	platform_driver_unregister(&snddev_icodec_driver);

	vreg_put(icodec_drv->vreg_gp16);
	vreg_put(icodec_drv->vreg_ncp);
	vreg_put(icodec_drv->vreg_msme);
	vreg_put(icodec_drv->vreg_rf2);

	clk_put(icodec_drv->rx_sclk);
	clk_put(icodec_drv->rx_mclk);
	clk_put(icodec_drv->tx_sclk);
	clk_put(icodec_drv->tx_mclk);
	return;
}
static void msm_camera_vreg_disable(void)
{
	if (vreg_gp2) {
		vreg_disable(vreg_gp2);
		vreg_put(vreg_gp2);
		vreg_gp2 = NULL;
	}
	if (vreg_lvsw1) {
		vreg_disable(vreg_lvsw1);
		vreg_put(vreg_lvsw1);
		vreg_lvsw1 = NULL;
	}
	if (vreg_gp6) {
		vreg_disable(vreg_gp6);
		vreg_put(vreg_gp6);
		vreg_gp6 = NULL;
	}
	if (vreg_gp16) {
		vreg_disable(vreg_gp16);
		vreg_put(vreg_gp16);
		vreg_gp16 = NULL;
	}
}
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;
}
Пример #17
0
/**
 * @brief Turn off the power to this interface
 * @returns: 0 on success, <0 on error
 */
int interface_pwr_disable(struct interface *iface)
{
    if (!iface) {
        return -ENODEV;
    }

    dbg_verbose("Disabling interface %s.\n",
                iface->name ? iface->name : "unknown");
    vreg_put(iface->vreg);

    /* Update state */
    iface->power_state = false;

    return 0;
}
Пример #18
0
/*static*/ int ts_set_vreg(unsigned char onoff) //for touch download
{

	int rc = 0;
	struct vreg *vreg_l1 = NULL;

	vreg_l1 = vreg_get(NULL, "rfrx1");
	if (IS_ERR(vreg_l1)) {
		pr_err("%s: vreg_get failed (%ld)\n", __func__, PTR_ERR(vreg_l1));
		return PTR_ERR(vreg_l1);
	}

	printk(KERN_INFO "ts_set_veg : %d\n", onoff);
	if(onoff){

		/* LGE_CHANGE_S: E0 [email protected] [2011-12-19] 
		: Changed the touchscreen operating power 3V into 3.05V*/
		rc = vreg_set_level(vreg_l1, 3050);
		/* LGE_CHANGE_E: E0 [email protected] [2011-12-19] 
		: Changed the touchscreen operating power 3V into 3.05V*/

		if (rc < 0) {
			pr_err("%s: vreg_set_level failed (%d)\n", __func__, rc);
			goto vreg_touch_fail;
		}
		rc = vreg_enable(vreg_l1);
		if (rc < 0) {
			pr_err("%s: vreg_enable failed (%d)\n", __func__, rc);
			goto vreg_touch_fail;
		}
	} else {
		rc = vreg_disable(vreg_l1);
			if (rc < 0) {
			pr_err("%s: vreg_disable failed (%d)\n", __func__, rc);
			goto vreg_touch_fail;
		}
	}

	return rc;

vreg_touch_fail:
	vreg_put(vreg_l1);
	return rc;
}
static unsigned int ft5306_power_down(void)
{
	int rc = 0;
	struct vreg *vreg = NULL;
	vreg= vreg_get(NULL, "gp2");
	if (IS_ERR(vreg)) {
		pr_err("%s: vreg get failed (%ld)\n",
			__func__, PTR_ERR(vreg));
		return PTR_ERR(vreg);
	}
	rc = vreg_disable(vreg);
	if (rc) {
		pr_err("%s: vreg disable failed (%d)\n",
		       __func__, rc);
		vreg_put(vreg);
		return rc;
	}
	return rc;
}
static int msm_hsusb_ldo_init(int init)
{
	if (init) {
		/*
		 * PHY 3.3V analog domain(VDDA33) is powered up by
		 * an always enabled power supply (LP5900TL-3.3).
		 * USB VREG default source is VBUS line. Turning
		 * on USB VREG has a side effect on the USB suspend
		 * current. Hence USB VREG is explicitly turned
		 * off here.
		 */
		vreg_3p3 = vreg_get(NULL, "usb");
		if (IS_ERR(vreg_3p3))
			return PTR_ERR(vreg_3p3);
		vreg_enable(vreg_3p3);
		vreg_disable(vreg_3p3);
		vreg_put(vreg_3p3);
	}

	return 0;
}
Пример #21
0
void board_exit(void) {
    int i;
    /*
     * First unregister the TCA64xx I/O Expanders and associated I2C bus(ses).
     * Done in reverse order from registration to account for IRQ chaining
     * between I/O Expander chips.
     */
    for (i = sdb_board_info.nr_io_expanders - 1; i >= 0; i--) {
        struct io_expander_info *io_exp = &sdb_board_info.io_expanders[i];

        if (io_exp->io_exp_driver_data)
            tca64xx_deinit(io_exp->io_exp_driver_data);

        if (io_exp->i2c_dev)
            up_i2cuninitialize(io_exp->i2c_dev);
    }

    /* Disable the I/O Expanders power */
    vreg_put(&ioexp_vreg);

    /* Lastly unregister the GPIO Chip driver */
    stm32_gpio_deinit();
}
Пример #22
0
static int zeebo_bt_init(struct platform_device *pdev)
{
	int rc;

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

	vreg_bt = vreg_get_by_id(0, 11); // rftx
	if (IS_ERR(vreg_bt)) {
		rc = PTR_ERR(vreg_bt);
		goto fail_vreg_bt;
	}
	rc = gpio_request(TOPA100_BT_RST, "BT Power");
	if (rc)
		goto fail_power_gpio;

	return 0;

fail_power_gpio:
	vreg_put(vreg_bt);
fail_vreg_bt:
	printk(KERN_ERR "%s: failed with %d\n", __func__, rc);
	return rc;
}
static unsigned int runnymede_audio_2v85_power_on(int en)
{
	struct vreg *vreg_2v85;
	int ret;
	pr_aud_info("%s %d", __func__, en);

	vreg_2v85 = vreg_get(NULL, "gp9");

	if (IS_ERR(vreg_2v85)) {
		pr_aud_err("%s: vreg_get(%s) failed (%ld)\n",
		__func__, "vreg_2v85", PTR_ERR(vreg_2v85));
		return -ENODEV;
	}

	if (en) {
		ret = vreg_enable(vreg_2v85);
	} else {
		ret = vreg_disable(vreg_2v85);
	}
	vreg_put(vreg_2v85);
	pr_aud_info("%s %d ret %d\n",__func__, en, ret);

	return ret;
}
Пример #24
0
static int pp2106_vreg_set(unsigned char onoff)
{
	int rc = 0;
	struct vreg *vreg_l12 = NULL;

	vreg_l12 = vreg_get(NULL, "gp2");
	if (IS_ERR(vreg_l12)) {
		pr_err("%s: vreg_get failed (%ld)\n", __func__, PTR_ERR(vreg_l12));
		return PTR_ERR(vreg_l12);
	}

	if (onoff) {
		rc = vreg_set_level(vreg_l12, 2850);
		if (rc < 0) {
			pr_err("%s: vreg_set_level failed (%d)\n", __func__, rc);
			goto vreg_fail;
		}
		rc = vreg_enable(vreg_l12);
		if (rc < 0) {
			pr_err("%s: vreg_enable failed (%d)\n", __func__, rc);
			goto vreg_fail;
		}
	} else {
		rc = vreg_disable(vreg_l12);
		if (rc < 0) {
			pr_err("%s: vreg_disable failed (%d)\n", __func__, rc);
			goto vreg_fail;
		}
	}

	return rc;

vreg_fail:
	vreg_put(vreg_l12);
	return rc;
}
Пример #25
0
static int mipi_dsi_panel_power(int on)
{
	int rc = 0;
	struct vreg *vreg_mipi_dsi_v28;

	printk("mipi_dsi_panel_power : %d \n", on);

	if (!dsi_gpio_initialized) {

		/*Resetting LCD Panel*/
		rc = gpio_request(GPIO_LCD_RESET, "lcd_reset");
		if (rc) {
			pr_err("%s: gpio_request GPIO_LCD_RESET failed\n", __func__);
		}
		rc = gpio_tlmm_config(GPIO_CFG(GPIO_LCD_RESET, 0, GPIO_CFG_OUTPUT,
				GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		if (rc) {
			printk(KERN_ERR "%s: Failed to configure GPIO %d\n",
					__func__, rc);
		}

		dsi_gpio_initialized = 1;
	}

	vreg_mipi_dsi_v28 = vreg_get(0, "emmc");
	if (IS_ERR(vreg_mipi_dsi_v28)) {
		pr_err("%s: vreg_get for emmc failed\n", __func__);
		return PTR_ERR(vreg_mipi_dsi_v28);
	}

	if (on) {
		rc = vreg_set_level(vreg_mipi_dsi_v28, 2800);
		if (rc) {
			pr_err("%s: vreg_set_level failed for mipi_dsi_v28\n", __func__);
			goto vreg_put_dsi_v28;
		}
		rc = vreg_enable(vreg_mipi_dsi_v28);
		if (rc) {
			pr_err("%s: vreg_enable failed for mipi_dsi_v28\n", __func__);
			goto vreg_put_dsi_v28;
		}

		rc = gpio_direction_output(GPIO_LCD_RESET, 1);
		if (rc) {
			pr_err("%s: gpio_direction_output failed for lcd_reset\n", __func__);
			goto vreg_put_dsi_v28;
		}
		if (Isfirstbootend) {
			printk("gpio lcd reset on...\n");
			msleep(10);
			gpio_set_value(GPIO_LCD_RESET, 0);
			msleep(10);
			gpio_set_value(GPIO_LCD_RESET, 1);
		} else {
			Isfirstbootend = 1;
		}
		msleep(10);
	} else {
		rc = vreg_disable(vreg_mipi_dsi_v28);
		if (rc) {
			pr_err("%s: vreg_disable failed for mipi_dsi_v28\n", __func__);
			goto vreg_put_dsi_v28;
		}
	}

vreg_put_dsi_v28:
	vreg_put(vreg_mipi_dsi_v28);

	return rc;
}
Пример #26
0
static void zeebo_bt_exit(struct platform_device *pdev) {
	printk(KERN_DEBUG "%s\n", __func__);

	gpio_free(TOPA100_BT_RST);
	vreg_put(vreg_bt);
}
static void msm_camera_vreg_enable(struct platform_device *pdev)
{
	vreg_gp2 = vreg_get(NULL, "gp2");
	if (IS_ERR(vreg_gp2)) {
		pr_err("%s: VREG GP2 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp2));
		vreg_gp2 = NULL;
		return;
	}

	if (vreg_set_level(vreg_gp2, 2600)) {
		pr_err("%s: VREG GP2 set failed\n", __func__);
		goto gp2_put;
	}

	if (vreg_enable(vreg_gp2)) {
		pr_err("%s: VREG GP2 enable failed\n", __func__);
		goto gp2_put;
	}

	vreg_lvsw1 = vreg_get(NULL, "lvsw1");
	if (IS_ERR(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 get failed %ld\n", __func__,
			PTR_ERR(vreg_lvsw1));
		vreg_lvsw1 = NULL;
		goto gp2_disable;
		}
	if (vreg_set_level(vreg_lvsw1, 1800)) {
		pr_err("%s: VREG LVSW1 set failed\n", __func__);
		goto lvsw1_put;
	}
	if (vreg_enable(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 enable failed\n", __func__);
		goto lvsw1_put;
	}

	if (!strcmp(pdev->name, "msm_camera_sn12m0pz")) {
		vreg_gp6 = vreg_get(NULL, "gp6");
		if (IS_ERR(vreg_gp6)) {
			pr_err("%s: VREG GP6 get failed %ld\n", __func__,
				PTR_ERR(vreg_gp6));
			vreg_gp6 = NULL;
			goto lvsw1_disable;
		}

		if (vreg_set_level(vreg_gp6, 3050)) {
			pr_err("%s: VREG GP6 set failed\n", __func__);
			goto gp6_put;
		}

		if (vreg_enable(vreg_gp6)) {
			pr_err("%s: VREG GP6 enable failed\n", __func__);
			goto gp6_put;
		}
		vreg_gp16 = vreg_get(NULL, "gp16");
		if (IS_ERR(vreg_gp16)) {
			pr_err("%s: VREG GP16 get failed %ld\n", __func__,
				PTR_ERR(vreg_gp16));
			vreg_gp16 = NULL;
			goto gp6_disable;
		}

		if (vreg_set_level(vreg_gp16, 1200)) {
			pr_err("%s: VREG GP16 set failed\n", __func__);
			goto gp16_put;
		}

		if (vreg_enable(vreg_gp16)) {
			pr_err("%s: VREG GP16 enable failed\n", __func__);
			goto gp16_put;
		}
	}
	return;

gp16_put:
	vreg_put(vreg_gp16);
	vreg_gp16 = NULL;
gp6_disable:
	 vreg_disable(vreg_gp6);
gp6_put:
	vreg_put(vreg_gp6);
	vreg_gp6 = NULL;
lvsw1_disable:
	vreg_disable(vreg_lvsw1);
lvsw1_put:
	vreg_put(vreg_lvsw1);
	vreg_lvsw1 = NULL;
gp2_disable:
	vreg_disable(vreg_gp2);
gp2_put:
	vreg_put(vreg_gp2);
	vreg_gp2 = NULL;
}
static int fm_radio_setup(struct marimba_fm_platform_data *pdata)
{
	int rc = 0;
	const char *id = "FMPW";
	uint32_t irqcfg;
	struct marimba config = { .mod_id =  SLAVE_ID_BAHAMA};
	u8 value;

	/* Voting for 1.8V Regulator */
	fm_regulator = vreg_get(NULL , "msme1");
	if (IS_ERR(fm_regulator)) {
		pr_err("%s: vreg get failed with : (%ld)\n",
			__func__, PTR_ERR(fm_regulator));
		return -EINVAL;
	}

	/* Set the voltage level to 1.8V */
	rc = vreg_set_level(fm_regulator, 1800);
	if (rc < 0) {
		pr_err("%s: set regulator level failed with :(%d)\n",
			__func__, rc);
		goto fm_vreg_fail;
	}

	/* Enabling the 1.8V regulator */
	rc = vreg_enable(fm_regulator);
	if (rc) {
		pr_err("%s: enable regulator failed with :(%d)\n",
			__func__, rc);
		goto fm_vreg_fail;
	}

	/* Voting for 19.2MHz clock */
	rc = pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
			PMAPP_CLOCK_VOTE_ON);
	if (rc < 0) {
		pr_err("%s: clock vote failed with :(%d)\n",
			 __func__, rc);
		goto fm_clock_vote_fail;
	}

	rc = bt_set_gpio(1);
	if (rc) {
		pr_err("%s: bt_set_gpio = %d", __func__, rc);
		goto fm_gpio_config_fail;
	}
	/*re-write FM Slave Id, after reset*/
	value = BAHAMA_SLAVE_ID_FM_ADDR;
	rc = marimba_write_bit_mask(&config,
			BAHAMA_SLAVE_ID_FM_REG, &value, 1, 0xFF);
	if (rc < 0) {
		pr_err("%s: FM Slave ID rewrite Failed = %d", __func__, rc);
		goto fm_gpio_config_fail;
	}

	/* Configuring the FM GPIO */
	irqcfg = GPIO_CFG(FM_GPIO, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
			GPIO_CFG_2MA);

	rc = gpio_tlmm_config(irqcfg, GPIO_CFG_ENABLE);
	if (rc) {
		pr_err("%s: gpio_tlmm_config(%#x)=%d\n",
			 __func__, irqcfg, rc);
		goto fm_gpio_config_fail;
	}

	return 0;

fm_gpio_config_fail:
	pmapp_clock_vote(id, PMAPP_CLOCK_ID_D1,
		PMAPP_CLOCK_VOTE_OFF);
	bt_set_gpio(0);
fm_clock_vote_fail:
	vreg_disable(fm_regulator);

fm_vreg_fail:
	vreg_put(fm_regulator);

	return rc;
};
static int htckovsky_oj_probe(struct platform_device *pdev)
{
	struct input_dev *input = NULL;
	struct i2c_client *client;
	int ret = 0;

	pr_info(MODULE_NAME ": Initializing MicroP Optical Joystick driver\n");

	client = dev_get_drvdata(&pdev->dev);

	if (!client) {
		pr_err(MODULE_NAME ": failed to get i2c_client via drvdata\n");
		ret = -EINVAL;
		goto fail_invalid_data;
	}
	htckovsky_oj.client = client;

	if (pdev->id != -1) {
		pr_err(MODULE_NAME ": device id != -1, aborting\n");
		ret = -EINVAL;
		goto fail_invalid_data;
	}

	mutex_init(&htckovsky_oj.lock);
	INIT_WORK(&htckovsky_oj.oj_work, htckovsky_oj_work);
	// Initialize input device
	input = input_allocate_device();
	if (!input) {
		ret = -ENODEV;
		goto fail_input_alloc;
	}

	input->name = MODULE_NAME;
	input->phys = client->adapter->name;
	input->id.bustype = BUS_I2C;
	input->id.vendor = 0x0001;
	input->id.product = 0x0001;
	input->id.version = 0x0100;

	__set_bit(EV_REL, input->evbit);
	__set_bit(EV_KEY, input->evbit);
	input_set_capability(input, EV_REL, REL_X);
	input_set_capability(input, EV_REL, REL_Y);
	
	input_set_capability(input, EV_KEY, KEY_UP);
	input_set_capability(input, EV_KEY, KEY_DOWN);
	input_set_capability(input, EV_KEY, KEY_LEFT);
	input_set_capability(input, EV_KEY, KEY_RIGHT);

	ret = input_register_device(input);
	if (ret) {
		goto fail_input_register;
	}

	htckovsky_oj.pdev = pdev;
	htckovsky_oj.input = input;
	platform_set_drvdata(pdev, &htckovsky_oj);

	ret = gpio_request(KOVS100_JOYSTICK_IRQ, "Joystick IRQ");
	if (ret) {
		goto fail_gpio_request;
	}
	gpio_direction_input(KOVS100_JOYSTICK_IRQ);

	htckovsky_oj.vreg_pwr = vreg_get_by_id(&pdev->dev, 11);
	if (!htckovsky_oj.vreg_pwr) {
		goto fail_vreg_pwr;
	}

	htckovsky_oj.vreg_28v = vreg_get_by_id(&pdev->dev, 17);
	if (!htckovsky_oj.vreg_28v) {
		goto fail_vreg_28v;
	}

	htckovsky_oj_power(false);
	htckovsky_oj_power(true);

	ret = request_irq(gpio_to_irq(KOVS100_JOYSTICK_IRQ),
		htckovsky_oj_interrupt, IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
		"Joystick IRQ", NULL);
	if (ret) {
		pr_err("Couldn't request joystick IRQ error: %d\n", ret);
		goto fail_irq;
	}

	device_init_wakeup(&pdev->dev, 1);
	htckovsky_oj_start_polling();

	return 0;

fail_irq:
	vreg_put(htckovsky_oj.vreg_28v);
fail_vreg_28v:
	vreg_put(htckovsky_oj.vreg_pwr);
fail_vreg_pwr:
	gpio_free(KOVS100_JOYSTICK_IRQ);
fail_gpio_request:
	input_unregister_device(input);
fail_input_register:
	input_free_device(input);
fail_input_alloc:
fail_invalid_data:
	return ret;
}
Пример #30
0
static void msm_camera_vreg_enable(struct platform_device *pdev)
{
#if defined(CONFIG_SH_CAMERA)
#elif defined(CONFIG_T8EV4)
	/*----- 1.8v -----*/
	vreg_lvsw1 = vreg_get(NULL, "lvsw1");
	if (IS_ERR(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 get failed %ld\n", __func__,
		PTR_ERR(vreg_lvsw1));
		vreg_lvsw1 = NULL;
		return;
	}
	if (vreg_set_level(vreg_lvsw1, 1800)) {
		pr_err("%s: VREG LVSW1 set failed\n", __func__);
		goto lvsw1_put;
	}
	if (vreg_enable(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 enable failed\n", __func__);
		goto lvsw1_put;
	}

	/*----- 2.8v -----*/
	vreg_gp9 = vreg_get(NULL, "gp9");
	if (IS_ERR(vreg_gp9)) {
		pr_err("%s: VREG GP9 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp9));
		vreg_gp9 = NULL;
		goto lvsw1_disable;
	}
	if (vreg_set_level(vreg_gp9, 2800)) {
		pr_err("%s: VREG GP9 set failed\n", __func__);
		goto gp9_put;
	}
	if (vreg_enable(vreg_gp9)) {
		pr_err("%s: VREG GP9 enable failed\n", __func__);
		goto gp9_put;
	}

	/*----- 3.0v -----*/
	vreg_gp2 = vreg_get(NULL, "gp2");
	if (IS_ERR(vreg_gp2)) {
		pr_err("%s: VREG GP2 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp2));
		vreg_gp2 = NULL;
		goto gp9_disable;
	}
	if (vreg_set_level(vreg_gp2, 3000)) {
		pr_err("%s: VREG GP2 set failed\n", __func__);
		goto gp2_put;
	}
	if (vreg_enable(vreg_gp2)) {
		pr_err("%s: VREG GP2 enable failed\n", __func__);
		goto gp2_put;
	}

	/*----- 1.225v -----*/
	vreg_gp15 = vreg_get(NULL, "gp15");
	if (IS_ERR(vreg_gp15)) {
		pr_err("%s: VREG GP15 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp15));
		vreg_gp15 = NULL;
		goto gp2_disable;
	}
	if (vreg_set_level(vreg_gp15, 1230)) {
		pr_err("%s: VREG GP15 set failed\n", __func__);
		goto gp15_put;
	}
	if (vreg_enable(vreg_gp15))
		pr_err("%s: VREG GP15 enable failed\n", __func__);

	return;

gp15_put:
	vreg_put(vreg_gp15);
	vreg_gp15 = NULL;
gp2_disable:
	vreg_disable(vreg_gp2);
gp2_put:
	vreg_put(vreg_gp2);
	vreg_gp2 = NULL;
gp9_disable:
	vreg_disable(vreg_gp9);
gp9_put:
	vreg_put(vreg_gp9);
	vreg_gp9 = NULL;
lvsw1_disable:
	vreg_disable(vreg_lvsw1);
lvsw1_put:
	vreg_put(vreg_lvsw1);
	vreg_lvsw1 = NULL;

#else

	vreg_gp2 = vreg_get(NULL, "gp2");
	if (IS_ERR(vreg_gp2)) {
		pr_err("%s: VREG GP2 get failed %ld\n", __func__,
			PTR_ERR(vreg_gp2));
		vreg_gp2 = NULL;
		return;
	}

	if (vreg_set_level(vreg_gp2, 2600)) {
		pr_err("%s: VREG GP2 set failed\n", __func__);
		goto gp2_put;
	}

	if (vreg_enable(vreg_gp2)) {
		pr_err("%s: VREG GP2 enable failed\n", __func__);
		goto gp2_put;
	}

	vreg_lvsw1 = vreg_get(NULL, "lvsw1");
	if (IS_ERR(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 get failed %ld\n", __func__,
			PTR_ERR(vreg_lvsw1));
		vreg_lvsw1 = NULL;
		goto gp2_disable;
		}
	if (vreg_set_level(vreg_lvsw1, 1800)) {
		pr_err("%s: VREG LVSW1 set failed\n", __func__);
		goto lvsw1_put;
	}
	if (vreg_enable(vreg_lvsw1)) {
		pr_err("%s: VREG LVSW1 enable failed\n", __func__);
		goto lvsw1_put;
	}

	if (!strcmp(pdev->name, "msm_camera_sn12m0pz")) {
		vreg_gp6 = vreg_get(NULL, "gp6");
		if (IS_ERR(vreg_gp6)) {
			pr_err("%s: VREG GP6 get failed %ld\n", __func__,
				PTR_ERR(vreg_gp6));
			vreg_gp6 = NULL;
			goto lvsw1_disable;
		}

		if (vreg_set_level(vreg_gp6, 3050)) {
			pr_err("%s: VREG GP6 set failed\n", __func__);
			goto gp6_put;
		}

		if (vreg_enable(vreg_gp6)) {
			pr_err("%s: VREG GP6 enable failed\n", __func__);
			goto gp6_put;
		}
		vreg_gp16 = vreg_get(NULL, "gp16");
		if (IS_ERR(vreg_gp16)) {
			pr_err("%s: VREG GP16 get failed %ld\n", __func__,
				PTR_ERR(vreg_gp16));
			vreg_gp16 = NULL;
			goto gp6_disable;
		}

		if (vreg_set_level(vreg_gp16, 1200)) {
			pr_err("%s: VREG GP16 set failed\n", __func__);
			goto gp16_put;
		}

		if (vreg_enable(vreg_gp16)) {
			pr_err("%s: VREG GP16 enable failed\n", __func__);
			goto gp16_put;
		}
	}
	return;

gp16_put:
	vreg_put(vreg_gp16);
	vreg_gp16 = NULL;
gp6_disable:
	 vreg_disable(vreg_gp6);
gp6_put:
	vreg_put(vreg_gp6);
	vreg_gp6 = NULL;
lvsw1_disable:
	vreg_disable(vreg_lvsw1);
lvsw1_put:
	vreg_put(vreg_lvsw1);
	vreg_lvsw1 = NULL;
gp2_disable:
	vreg_disable(vreg_gp2);
gp2_put:
	vreg_put(vreg_gp2);
	vreg_gp2 = NULL;
#endif	/* CONFIG_SH_CAMERA */
}