Skip to content

Commit

Permalink
Reworked "drivers:modemctl: fix issues with push/device sync wakelocks"
Browse files Browse the repository at this point in the history
The new sources from Samsung have a potential battery drain bug.
Revert the updated sources and bring in the former fix.
  • Loading branch information
dhiru1602 committed Sep 23, 2012
1 parent d13248a commit 5a76f7c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
11 changes: 0 additions & 11 deletions drivers/phone_svn/ipc_spi/ipc_spi.c
Expand Up @@ -55,7 +55,6 @@
#include <linux/irq.h>

#include <linux/workqueue.h>
#include <linux/wakelock.h>


#define DRVNAME "onedram"
Expand Down Expand Up @@ -102,8 +101,6 @@ enum {
#define MAX_BUF_SIZE 2044
#define DEF_BUF_SIZE MAX_BUF_SIZE

#define DEFAULT_ISR_WAKE_TIME (HZ/2)

static struct spi_device *p_ipc_spi = NULL;

typedef struct spi_protocol_header_rec {
Expand Down Expand Up @@ -168,8 +165,6 @@ struct ipc_spi {
int irq;
struct tasklet_struct tasklet;

struct wake_lock wlock;

struct completion comp;
atomic_t ref_sem;
unsigned long flags;
Expand Down Expand Up @@ -574,8 +569,6 @@ static irqreturn_t ipc_spi_irq_handler( int irq, void *data ) // SRDY Rising EDG
disable_irq_nosync( od->irq );
dev_dbg( od->dev, "(%d) disable irq.\n", __LINE__ );

wake_lock_timeout(&od->wlock, DEFAULT_ISR_WAKE_TIME);

#if 0
struct list_head *l;
unsigned long flags;
Expand Down Expand Up @@ -3619,10 +3612,6 @@ static int __devinit ipc_spi_platform_probe( struct platform_device *pdev )

pdata->cfg_gpio();

/* make wake lock for SRDY isr event
* to prevent to sleep before run thread */
wake_lock_init(&od->wlock, WAKE_LOCK_SUSPEND, "ipc_spi");

tasklet_init( &od->tasklet, do_spi_tasklet, ( unsigned long )od );

r = request_irq( irq, ipc_spi_irq_handler, IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, "IpcSpi", od );
Expand Down
7 changes: 5 additions & 2 deletions drivers/phone_svn/modemctl/modemctl.c
Expand Up @@ -47,14 +47,14 @@
#endif

#ifdef CONFIG_SVNET_WHITELIST
#include "portlist.h"
#include <linux/phone_svn/portlist.h>
#endif /* CONFIG_SVNET_WHITELIST */

#define DRVNAME "modemctl"

//#define USE_EARLYSUSPEND_TO_CTRL_PDAACTIVE_LOW
/* #define USE_LATERESUME_TO_CTRL_PDAACTIVE_HIGH */
#define USE_EARLYSUSPEND_TO_CTRL_WHITELIST
//#define USE_EARLYSUSPEND_TO_CTRL_WHITELIST

//#define SIM_DEBOUNCE_TIME_HZ (HZ)

Expand Down Expand Up @@ -969,13 +969,15 @@ static int modemctl_suspend(struct platform_device *pdev, pm_message_t state)
pda_off(mc);
#endif

#if 0
#if defined( CONFIG_SVNET_WHITELIST ) && \
!defined( USE_EARLYSUSPEND_TO_CTRL_WHITELIST )
// call process white list
retval = process_whilte_list();
if( unlikely( retval !=0 ) ) {
printk( "fail to send whitelist : %d\n", retval );
}
#endif
#endif

return 0;
Expand Down Expand Up @@ -1027,3 +1029,4 @@ module_exit(modemctl_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Suchang Woo <suchang.woo@samsung.com>");
MODULE_DESCRIPTION("Modem control");

File renamed without changes.
27 changes: 27 additions & 0 deletions kernel/power/wakelock.c
Expand Up @@ -24,6 +24,10 @@
#endif
#include "power.h"

#ifdef CONFIG_SVNET_WHITELIST
#include <linux/phone_svn/portlist.h>
#endif /* CONFIG_SVNET_WHITELIST */

enum {
DEBUG_EXIT_SUSPEND = 1U << 0,
DEBUG_WAKEUP = 1U << 1,
Expand Down Expand Up @@ -262,6 +266,10 @@ long has_wake_lock(int type)
return ret;
}

#ifdef CONFIG_SVNET_WHITELIST
/* to use samsung bootmode */
extern sec_bootmode;
#endif /* CONFIG_SVNET_WHITELIST */
static void suspend(struct work_struct *work)
{
int ret;
Expand All @@ -273,6 +281,24 @@ static void suspend(struct work_struct *work)
return;
}

#ifdef CONFIG_SVNET_WHITELIST
if (likely(sec_bootmode != 5)) {
/* unless charging mode */
// call process white list
ret = process_whilte_list();
if (unlikely(ret !=0)) {
printk("fail to send whitelist\n");
return;
} else {
if (has_wake_lock(WAKE_LOCK_SUSPEND)) {
if (debug_mask & DEBUG_SUSPEND)
pr_info("suspend: abort suspend after processing white list\n");
return;
}
}
}
#endif /* CONFIG_SVNET_WHITELIST */

entry_event_num = current_event_num;
sys_sync();
if (debug_mask & DEBUG_SUSPEND)
Expand Down Expand Up @@ -614,3 +640,4 @@ static void __exit wakelocks_exit(void)

core_initcall(wakelocks_init);
module_exit(wakelocks_exit);

0 comments on commit 5a76f7c

Please sign in to comment.