Example #1
0
static int wm8994_resume(struct device *dev)
{
	struct wm8994 *wm8994 = dev_get_drvdata(dev);
	int ret;

#if defined(CONFIG_MACH_STAR) || defined(CONFIG_MACH_BSSQ)
	if(in_call_state()
//                                                                                                            
	|| is_fmradio_state()
//                                                                                                            
	)
	    return 0;
#endif /* MOBII LP1 sleep */

	/* We may have lied to the PM core about suspending */
	if (!wm8994->suspended)
		return 0;

	ret = regulator_bulk_enable(wm8994->num_supplies,
				    wm8994->supplies);
	if (ret != 0) {
		printk("Failed to enable supplies: %d\n", ret);
		return ret;
	}

	ret = wm8994_bulk_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK,
                            WM8994_NUM_IRQ_REGS, &wm8994->irq_masks_cur);
	if (ret < 0)
		printk("Failed to restore interrupt masks: %d\n", ret);

	ret = wm8994_bulk_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS,
			   &wm8994->ldo_regs);
	if (ret < 0)
		printk("Failed to restore LDO registers: %d\n", ret);

	ret = wm8994_bulk_write(wm8994, WM8994_GPIO_1, WM8994_NUM_GPIO_REGS,
			   &wm8994->gpio_regs);
	if (ret < 0)
		printk("Failed to restore GPIO registers: %d\n", ret);
	printk("[chahee.kim] wm8994_resume in wm8994-core.c END !!\n");
	wm8994->suspended = false;

	return 0;
}
Example #2
0
static int touch_suspend(struct i2c_client *client, pm_message_t state)
{
	struct lge_touch_driver *touch = i2c_get_clientdata(client);
	
#if 0//defined(CONFIG_LU6500) || defined(CONFIG_KS1001)
	#ifndef CONFIG_HAS_EARLYSUSPEND
	touch->h_interrupt->disable(touch->h_touch);
	#endif

	already_call_state = false;
	if (!in_call_state()) {
		touch->h_powerCtrl->off(touch->h_touch);
		gp2a_power_control(0);
	} else
		already_call_state = true;
#else
	#ifndef CONFIG_HAS_EARLYSUSPEND
	touch->h_interrupt->disable(touch->h_touch);
	#endif
	touch->h_powerCtrl->off(touch->h_touch);
#endif
	return 0;
}
Example #3
0
static int wm8994_suspend(struct device *dev)
{
	struct wm8994 *wm8994 = dev_get_drvdata(dev);
	int ret;

#if defined(CONFIG_MACH_STAR) || defined(CONFIG_MACH_BSSQ)
	if(in_call_state()
//                                                                                                            
	|| is_fmradio_state()
//                                                                                                            
	)
	    return 0;
#endif /* MOBII LP1 sleep */
	/* Don't actually go through with the suspend if the CODEC is
	 * still active (eg, for audio passthrough from CP. */
//                                             
#if 0
	ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_1);
	if (ret < 0) {
		printk("[chahee.kim] Failed to read power status: %d\n", ret);
	} else if (ret & WM8994_VMID_SEL_MASK) {
		printk("[chahee.kim] CODEC still active, ignoring suspend\n");
		return 0;
	}
#endif
//                                             

	/* GPIO configuration state is saved here since we may be configuring
	 * the GPIO alternate functions even if we're not using the gpiolib
	 * driver for them.
	 */
	ret = wm8994_bulk_read(wm8994, WM8994_GPIO_1, WM8994_NUM_GPIO_REGS,
			  &wm8994->gpio_regs);
	if (ret < 0)
		printk("Failed to save GPIO registers: %d\n", ret);

	/* For similar reasons we also stash the regulator states */
	ret = wm8994_bulk_read(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS,
			  &wm8994->ldo_regs);
	if (ret < 0)
		printk("Failed to save LDO registers: %d\n", ret);

	/* Explicitly put the device into reset in case regulators
	 * don't get disabled in order to ensure consistent restart.
	 */
	wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, 0x8994);

	wm8994->suspended = true;

//                                             
	printk("[chahee.kim] wm8994_suspend in wm8994-core.c END !!\n");

//                                             

	ret = regulator_bulk_disable(wm8994->num_supplies,
				     wm8994->supplies);
	if (ret != 0) {
		dev_err(dev, "Failed to disable supplies: %d\n", ret);
		return ret;
	}

	return 0;
}