Beispiel #1
0
static int __exit twl6030_usb_remove(struct platform_device *pdev)
{
    struct twl6030_usb *twl = platform_get_drvdata(pdev);

    struct twl4030_usb_data *pdata;
    struct device *dev = &pdev->dev;
    pdata = dev->platform_data;

    twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
                           REG_INT_MSK_LINE_C);
    twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
                           REG_INT_MSK_STS_C);
    free_irq(twl->irq1, twl);
    free_irq(twl->irq2, twl);
    regulator_put(twl->usb3v3);
    pdata->phy_exit(twl->dev);
    device_remove_file(twl->dev, &dev_attr_vbus);
    cancel_work_sync(&twl->set_vbus_work);

    /*                                         */
#if defined(CONFIG_MACH_LGE)
    cancel_work_sync(&twl->usb_irq_work);
#ifndef CONFIG_USB_MUSB_PERIPHERAL
    cancel_work_sync(&twl->usbotg_irq_work);
#endif
#endif

    kfree(twl);

    return 0;
}
Beispiel #2
0
static int __exit twl6030_bci_battery_remove(struct platform_device *pdev)
{
	struct twl6030_bci_device_info *di = platform_get_drvdata(pdev);
	int irq;

	twl6030_interrupt_mask(TWL6030_CHARGER_CTRL_INT_MASK,
						REG_INT_MSK_LINE_C);
	twl6030_interrupt_mask(TWL6030_CHARGER_CTRL_INT_MASK,
						REG_INT_MSK_STS_C);
	twl6030_interrupt_mask(TWL6030_CHARGER_FAULT_INT_MASK,
						REG_INT_MSK_LINE_C);
	twl6030_interrupt_mask(TWL6030_CHARGER_FAULT_INT_MASK,
						REG_INT_MSK_STS_C);

	irq = platform_get_irq(pdev, 0);
	free_irq(irq, di);

	irq = platform_get_irq(pdev, 1);
	free_irq(irq, di);

	cancel_delayed_work(&di->twl6030_bci_monitor_work);
	cancel_delayed_work(&di->twl6030_bk_bci_monitor_work);
	flush_scheduled_work();
	power_supply_unregister(&di->bat);
	power_supply_unregister(&di->bk_bat);
	platform_set_drvdata(pdev, NULL);
	kfree(di);

	return 0;
}
static int __devexit twl6030_thermal_remove(struct platform_device *pdev)
{
	int irq;

	twl6030_interrupt_mask(TWL6030_HOTDIE_INT_MASK, REG_INT_MSK_LINE_A);
	twl6030_interrupt_mask(TWL6030_HOTDIE_INT_MASK, REG_INT_MSK_STS_A);

	irq = platform_get_irq(pdev, 0);
	free_irq(irq, pdev);

	return 0;
}
Beispiel #4
0
/*
 * Disable all TWL RTC module interrupts.
 * Sets status flag to free.
 */
static int twl_rtc_remove(struct platform_device *pdev)
{
	/* leave rtc running, but disable irqs */
	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
	if (twl_class_is_6030()) {
		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
			REG_INT_MSK_LINE_A);
		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
			REG_INT_MSK_STS_A);
	}

	return 0;
}
static int twl6030_usb_remove(struct platform_device *pdev)
{
	struct twl6030_usb *twl = platform_get_drvdata(pdev);

	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
		REG_INT_MSK_LINE_C);
	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
			REG_INT_MSK_STS_C);
	free_irq(twl->irq1, twl);
	free_irq(twl->irq2, twl);
	regulator_put(twl->usb3v3);
	device_remove_file(twl->dev, &dev_attr_vbus);
	cancel_work_sync(&twl->set_vbus_work);

	return 0;
}
Beispiel #6
0
static int __exit twl6030_usb_remove(struct platform_device *pdev)
{
	struct twl6030_usb *twl = platform_get_drvdata(pdev);

	free_irq(twl->irq, twl);
	device_remove_file(twl->dev, &dev_attr_vbus);

	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
		REG_INT_MSK_LINE_C);
	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
			REG_INT_MSK_STS_C);
	kfree(twl);
	iounmap(ctrl_base);

	return 0;
}
/*
 * handle_twl6030_vlow() is a threaded BAT_VLOW interrupt handler. BAT_VLOW
 * is a secondary interrupt generated in twl6030_irq_thread().
 */
static irqreturn_t handle_twl6030_vlow(int irq, void *unused)
{
	pr_err("twl6030: BAT_VLOW interrupt; threshold=%dmV\n",
	       2300 + (vbatmin_hi_threshold - 0b110) * 50);

#if 1 /* temporary */
	pr_err("%s: disabling BAT_VLOW interrupt\n", __func__);
#if defined(CONFIG_WAKELOCK) && defined(CONFIG_LAB126)
	/*
	 * Prevent the system from going back to suspend,
	 * this should be enough to trigger a low battery shutdown
	 */
	wake_lock_timeout(&vlow_wakelock,
		msecs_to_jiffies(LOW_BATT_WAKELOCK_HOLD_TIME));
	/* Mask the low battery interrupt */
	twl6030_interrupt_mask(VLOW_INT_MASK, REG_INT_MSK_STS_A);
#else
	disable_irq_nosync(twl6030_irq_base + TWL_VLOW_INTR_OFFSET);
	WARN_ON(1);
#endif
#else
	pr_emerg("handle_twl6030_vlow: kernel_power_off()\n");
	kernel_power_off();
#endif
	return IRQ_HANDLED;
}
static int __exit twl6030_usb_remove(struct platform_device *pdev)
{
	struct twl6030_usb *twl = platform_get_drvdata(pdev);

	struct twl4030_usb_data *pdata;
	struct device *dev = &pdev->dev;
	pdata = dev->platform_data;

	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
		REG_INT_MSK_LINE_C);
	twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
			REG_INT_MSK_STS_C);
	free_irq(twl->irq1, twl);
	free_irq(twl->irq2, twl);
	regulator_put(twl->usb3v3);
	pdata->phy_exit(twl->dev);
	device_remove_file(twl->dev, &dev_attr_vbus);
	kfree(twl);

	return 0;
}
Beispiel #9
0
/*
 * Disable all TWL RTC module interrupts.
 * Sets status flag to free.
 */
static int __devexit twl_rtc_remove(struct platform_device *pdev)
{
	/* leave rtc running, but disable irqs */
	struct rtc_device *rtc = platform_get_drvdata(pdev);
	int irq = platform_get_irq(pdev, 0);

	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
	if (twl_class_is_6030()) {
		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
			REG_INT_MSK_LINE_A);
		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
			REG_INT_MSK_STS_A);
	}


	free_irq(irq, rtc);

	rtc_device_unregister(rtc);
	platform_set_drvdata(pdev, NULL);
	return 0;
}