static inline void mc13783_set_peripheral(void)
{
	PMIC_STATUS rs = PMIC_ERROR;

	rs = pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDM_PD);
	rs |= pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDP_PD);

	rs |= pmic_convity_usb_set_speed(pmic_handle, USB_FULL_SPEED);
	rs |= pmic_convity_usb_otg_set_config(pmic_handle, USB_OTG_SE0CONN);
	rs |= pmic_convity_usb_otg_set_config(pmic_handle, USB_PU);

	if (rs != PMIC_SUCCESS)
		printk(KERN_ERR "mc13783_set_peripheral failed\n");
}
Beispiel #2
0
void mxc_pmic_mod_exit(struct otg_instance *otg)
{

        PMIC_STATUS rc;
        if (pmic_work_task) {
                otg_task_exit(pmic_work_task);
                pmic_work_task = NULL;
        }
        if (pmic_otg_task) {
                otg_task_exit(pmic_otg_task);
                pmic_otg_task = NULL;
        }
        //while (PENDING_WORK_ITEM(pmic_work_bh)) {
        //      printk(KERN_ERR "%s: waiting for mc13783_work_bh\n",
        //      __FUNCTION__);
        //      schedule_timeout(10 * HZ);
        //}
        //while (PENDING_WORK_ITEM(pmic_otg_wq)) {
        //      printk(KERN_ERR "%s: waiting for mc13783_otg_wq\n",
        //      __FUNCTION__);
        //      schedule_timeout(10 * HZ);
        //}


        pmic_convity_set_mode(pmic_handle, RS232_1);
        pmic_convity_usb_otg_set_config(pmic_handle, USB_PULL_OVERRIDE);
        pmic_convity_usb_otg_set_config(pmic_handle, USB_OTG_SE0CONN);
        pmic_convity_usb_otg_clear_config(pmic_handle, USB_USBCNTRL);

        pmic_convity_usb_otg_clear_config(pmic_handle, USB_PU);
        pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDP_PD);
        pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDM_PD);
        pmic_convity_clear_callback(pmic_handle);

        rc = pmic_convity_close(pmic_handle);
        if (rc != PMIC_SUCCESS) {
                pr_debug("pmic_convity_close() returned error %d", rc);
        }


}
Beispiel #3
0
/*! pmic_bh- work task bottom handler
 * @param data - otg_instance type pointer
 *
 */
void pmic_bh(void *data)
{
        struct otg_instance *otg = (struct otg_instance *) data;

        do {

//                printk(KERN_INFO"%s: AAAA\n", __FUNCTION__);
                TRACE_MSG0(REMOVE_TCD, "--");
                global_flag = global_flag_array[start_flag];
                if (global_flag & PUDP_FLAG_SET) {	//set DP pullup
                        pmic_convity_usb_set_speed(pmic_handle, USB_FULL_SPEED);
                        pmic_convity_usb_otg_set_config(pmic_handle, USB_PU);
                }
                if (global_flag & PUDP_FLAG_RESET) {    //reset DP pullup
                        pmic_convity_usb_set_speed(pmic_handle, USB_FULL_SPEED);
                        pmic_convity_usb_otg_clear_config(pmic_handle, USB_PU);
                }
                if (global_flag & PUDM_FLAG_SET) {      //set DM pullup
                        pmic_convity_usb_set_speed(pmic_handle, USB_LOW_SPEED);
                        pmic_convity_usb_otg_set_config(pmic_handle, USB_PU);
                }
                if (global_flag & PUDM_FLAG_RESET) {    //reset DM pullup
                        pmic_convity_usb_set_speed(pmic_handle, USB_LOW_SPEED);
                        pmic_convity_usb_otg_clear_config(pmic_handle, USB_PU);
                }
                if (global_flag & UPD_FLAG_SET) {       //set DP pulldown
                        pmic_convity_usb_otg_set_config(pmic_handle, USB_UDP_PD);       //DP pull down switch is on
                }
                if (global_flag & UPD_FLAG_RESET) {     //reset DP pulldown
                        pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDP_PD);     //DP pull down switch is off
                }
                if (global_flag & UDM_FLAG_SET) {       //set DM pulldown
                        pmic_convity_usb_otg_set_config(pmic_handle, USB_UDM_PD);       //DP pull down switch is on
                }
                if (global_flag & UDM_FLAG_RESET) {     //reset DM pulldown
                        pmic_convity_usb_otg_clear_config(pmic_handle, USB_UDM_PD);     //DP pull down switch is off
                }
                if (global_flag & DRV_VBUS_SET) {       //enable vbus voltage
                        pmic_convity_set_output(pmic_handle, TRUE, TRUE);       //enable VBUS
                }
                if (global_flag & DRV_VBUS_RESET) {     //disable vbus voltage
                        pmic_convity_set_output(pmic_handle, TRUE, FALSE);      //disable VBUS
                }
                if (global_flag & CHRG_VBUS_SET) {      //enable vbus
                        pmic_convity_usb_otg_set_config(pmic_handle,
                                        USB_VBUS_CURRENT_LIMIT_LOW_30MS);
                }
                if (global_flag & CHRG_VBUS_RESET) {    //disable vbus
                        pmic_convity_set_output(pmic_handle, TRUE, FALSE);      //disable VBUS
                }
                if (global_flag & DISCHRG_VBUS_SET) {   //discharge vbus
                        pmic_convity_set_output(pmic_handle, TRUE, FALSE);      //disable VBUS
                        pmic_convity_usb_otg_clear_config(pmic_handle,
                                        USB_VBUS_PULLDOWN);
                        pmic_convity_usb_set_power_source(pmic_handle,
                                        USB_POWER_INTERNAL,
                                        USB_POWER_3V3);
                        pmic_convity_set_output(pmic_handle, FALSE, TRUE);      //enable VUSB
                }
                if (global_flag & DISCHRG_VBUS_RESET) { //discharge vbus disable
                        pmic_convity_set_output(pmic_handle, TRUE, FALSE);      //disable VBUS
                        pmic_convity_usb_otg_set_config(pmic_handle, USB_VBUS_PULLDOWN);
                        pmic_convity_set_output(pmic_handle, FALSE, TRUE);      //enable VUSB
                }
#if 1
                TRACE_MSG3(REMOVE_TCD, "gloabl flag %d start_flag %d end_flag %d", global_flag,
                                start_flag, end_flag);
#endif
#if 0
                printk(KERN_INFO "%d %d %d %d %d %d %d %d\n",
                                (global_flag & PU_FLAG_SET), (global_flag & PU_FLAG_RESET),
                                (global_flag & UPD_FLAG_SET), (global_flag & UPD_FLAG_RESET),
                                (global_flag & UDM_FLAG_SET), (global_flag & UDM_FLAG_RESET),
                                (global_flag & VBUSPDENB_RESET),
                                (global_flag & VBUSREGEN_RESET));
#endif
                global_flag = 0;
                global_flag_array[start_flag] = 0;
                if (start_flag++ > 15)
                        start_flag = 0;
                //if (start_flag != end_flag)
                //      SCHEDULE_WORK(pmic_work_bh);

//                printk(KERN_INFO"%s: BBBB start: %d end: %d\n", __FUNCTION__, start_flag, end_flag);
        } while (start_flag != end_flag);

//        printk(KERN_INFO"%s: CCCC\n", __FUNCTION__);
}