Skip to content

Commit

Permalink
Debugging removed + Sensors back (With their wake locks disabled).
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGuy committed Feb 2, 2012
1 parent ca9c734 commit 7d9a085
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 92 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-tegra/Makefile
Expand Up @@ -191,7 +191,7 @@ obj-${CONFIG_MACH_ADAM} += board-adam-spi.o
obj-${CONFIG_MACH_ADAM} += board-adam-touch.o
obj-${CONFIG_MACH_ADAM} += board-adam-uart.o
#obj-${CONFIG_MACH_ADAM} += board-adam-usb.o
#obj-${CONFIG_MACH_ADAM} += board-adam-wake.o
obj-${CONFIG_MACH_ADAM} += board-adam-wake.o
obj-${CONFIG_MACH_ADAM} += board-adam-wdt.o
#obj-${CONFIG_MACH_ADAM} += board-adam-wlan.o
obj-${CONFIG_MACH_ADAM} += board-adam.o
Expand Down
78 changes: 39 additions & 39 deletions arch/arm/mach-tegra/board-adam-sensors.c
Expand Up @@ -30,28 +30,28 @@
#include "cpu-tegra.h"

static struct i2c_board_info __initdata adam_i2c_bus0_sensor_info[] = {
// {
// I2C_BOARD_INFO("bq20z75-battery", 0x0B),
// .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH2),
// },
// {
// I2C_BOARD_INFO("so340010_kbd", 0x2c),
// .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
// },
{
I2C_BOARD_INFO("bq20z75-battery", 0x0B),
.irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH2),
},
{
I2C_BOARD_INFO("so340010_kbd", 0x2c),
.irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
},
};

static struct i2c_board_info __initdata adam_i2c_bus2_sensor_info[] = {
// {
// I2C_BOARD_INFO("isl29023", 0x44),
// .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV5),
// },
// {
// I2C_BOARD_INFO("lis3lv02d", 0x1C),
// .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PJ0),
// },
// {
// I2C_BOARD_INFO("mmc31xx", 0x30),
// },
{
I2C_BOARD_INFO("isl29023", 0x44),
.irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV5),
},
{
I2C_BOARD_INFO("lis3lv02d", 0x1C),
.irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PJ0),
},
{
I2C_BOARD_INFO("mmc31xx", 0x30),
},
};

static struct adt7461_platform_data adam_adt7461_pdata = {
Expand All @@ -69,34 +69,34 @@ static struct adt7461_platform_data adam_adt7461_pdata = {


static struct i2c_board_info __initdata adam_i2c_bus4_sensor_info[] = {
// {
// I2C_BOARD_INFO("adt7461", 0x4C),
// .irq = TEGRA_GPIO_TO_IRQ(ADAM_TEMP_ALERT),
// .platform_data = &adam_adt7461_pdata,
// },
{
I2C_BOARD_INFO("adt7461", 0x4C),
.irq = TEGRA_GPIO_TO_IRQ(ADAM_TEMP_ALERT),
.platform_data = &adam_adt7461_pdata,
},
};

int __init adam_sensors_register_devices(void)
{
// tegra_gpio_enable(TEGRA_GPIO_PV5);
// gpio_request(TEGRA_GPIO_PV5, "isl29023_irq");
// gpio_direction_input(TEGRA_GPIO_PV5);
tegra_gpio_enable(TEGRA_GPIO_PV5);
gpio_request(TEGRA_GPIO_PV5, "isl29023_irq");
gpio_direction_input(TEGRA_GPIO_PV5);

// tegra_gpio_enable(TEGRA_GPIO_PH2);
// gpio_request(TEGRA_GPIO_PH2, "ac_present_irq");
// gpio_direction_input(TEGRA_GPIO_PH2);
tegra_gpio_enable(TEGRA_GPIO_PH2);
gpio_request(TEGRA_GPIO_PH2, "ac_present_irq");
gpio_direction_input(TEGRA_GPIO_PH2);

// tegra_gpio_enable(TEGRA_GPIO_PJ0);
// gpio_request(TEGRA_GPIO_PJ0, "lis33de_irq");
// gpio_direction_input(TEGRA_GPIO_PJ0);
tegra_gpio_enable(TEGRA_GPIO_PJ0);
gpio_request(TEGRA_GPIO_PJ0, "lis33de_irq");
gpio_direction_input(TEGRA_GPIO_PJ0);

// tegra_gpio_enable(TEGRA_GPIO_PV6);
// gpio_request(TEGRA_GPIO_PV6, "so340010_kbd_irq");
// gpio_direction_input(TEGRA_GPIO_PV6);
tegra_gpio_enable(TEGRA_GPIO_PV6);
gpio_request(TEGRA_GPIO_PV6, "so340010_kbd_irq");
gpio_direction_input(TEGRA_GPIO_PV6);

// tegra_gpio_enable(ADAM_TEMP_ALERT);
// gpio_request(ADAM_TEMP_ALERT, "adt7461_temp_alert_irq");
// gpio_direction_input(ADAM_TEMP_ALERT);
tegra_gpio_enable(ADAM_TEMP_ALERT);
gpio_request(ADAM_TEMP_ALERT, "adt7461_temp_alert_irq");
gpio_direction_input(ADAM_TEMP_ALERT);

i2c_register_board_info(0, adam_i2c_bus0_sensor_info,
ARRAY_SIZE(adam_i2c_bus0_sensor_info));
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-tegra/cpuidle-t2.c
Expand Up @@ -68,15 +68,15 @@ static inline unsigned int time_to_bin(unsigned int time)
{
return fls(time);
}
static s64 tegra_cpu1_wake_by_time = LLONG_MAX;

#ifdef CONFIG_SMP

#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX 0x4C
#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR 0x344

static void __iomem *clk_rst = IO_ADDRESS(TEGRA_CLK_RESET_BASE);
static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
// static s64 tegra_cpu1_wake_by_time = LLONG_MAX;
static s64 tegra_cpu1_wake_by_time = LLONG_MAX;

static int tegra2_reset_sleeping_cpu(int cpu)
{
Expand Down
5 changes: 1 addition & 4 deletions arch/arm/mach-tegra/sleep.h
Expand Up @@ -66,10 +66,7 @@
#define FLOW_CTRL_HALT_CPU0_EVENTS 0x0
#define FLOW_CTRL_WAITEVENT (2 << 29)
#define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29)
#define FLOW_CTRL_WAIT_SEC (1 << 23)
#define FLOW_CTRL_WAIT_SCLK (1 << 27)
#define FLOW_CTRL_JTAG_RESUME (1 << 28)
#define FLOW_CTRL_TEN_SECONDS (0xA << 0)
#define FLOW_CTRL_JTAG_RESUME (1 << 28)
#define FLOW_CTRL_HALT_CPU_IRQ (1 << 10)
#define FLOW_CTRL_HALT_CPU_FIQ (1 << 8)
#define FLOW_CTRL_CPU0_CSR 0x8
Expand Down
3 changes: 0 additions & 3 deletions drivers/base/power/main.c
Expand Up @@ -625,13 +625,11 @@ static void dpm_drv_timeout(unsigned long data)
static void dpm_resume(pm_message_t state)
{
struct device *dev;
printk("dpm_resume, entering\n");
ktime_t starttime = ktime_get();

mutex_lock(&dpm_list_mtx);
pm_transition = state;
async_error = 0;
printk("dpm_resume, before list\n");

list_for_each_entry(dev, &dpm_suspended_list, power.entry) {
INIT_COMPLETION(dev->power.completion);
Expand All @@ -640,7 +638,6 @@ static void dpm_resume(pm_message_t state)
async_schedule(async_resume, dev);
}
}
printk("dpm_resume, entering while loop\n");

while (!list_empty(&dpm_suspended_list)) {
dev = to_device(dpm_suspended_list.next);
Expand Down
31 changes: 26 additions & 5 deletions drivers/input/evdev.c
Expand Up @@ -43,6 +43,7 @@ struct evdev_client {
unsigned int head;
unsigned int tail;
spinlock_t buffer_lock; /* protects access to buffer, head and tail */
bool use_wakelock; /* Some devices should NOT use a wakelock - Sensors are good examples of this */
struct wake_lock wake_lock;
char name[28];
struct fasync_struct *fasync;
Expand All @@ -61,7 +62,9 @@ static void evdev_pass_event(struct evdev_client *client,
/* Interrupts are disabled, just acquire the lock. */
spin_lock(&client->buffer_lock);

wake_lock_timeout(&client->wake_lock, 5 * HZ);
if (client->use_wakelock)
wake_lock_timeout(&client->wake_lock, 5 * HZ);

client->buffer[client->head++] = *event;
client->head &= client->bufsize - 1;

Expand Down Expand Up @@ -258,7 +261,8 @@ static int evdev_release(struct inode *inode, struct file *file)
mutex_unlock(&evdev->mutex);

evdev_detach_client(evdev, client);
wake_lock_destroy(&client->wake_lock);
if (client->use_wakelock)
wake_lock_destroy(&client->wake_lock);
kfree(client);

evdev_close_device(evdev);
Expand All @@ -276,6 +280,18 @@ static unsigned int evdev_compute_buffer_size(struct input_dev *dev)
return roundup_pow_of_two(n_events);
}


static bool evdev_is_continuous_reporting_sensor(struct input_dev *dev)
{
/* If it has keys of any kind, probably not a sensor ... */
if (test_bit(EV_KEY,dev->evbit))
return false;

/* Otherwise, assume it is a sensor */
return true;
}


static int evdev_open(struct inode *inode, struct file *file)
{
struct evdev *evdev;
Expand Down Expand Up @@ -308,11 +324,15 @@ static int evdev_open(struct inode *inode, struct file *file)
goto err_put_evdev;
}

/* Use a wakelock ONLY if not using a continuos reporting sensor */
client->use_wakelock = !evdev_is_continuous_reporting_sensor(evdev->handle.dev);

client->bufsize = bufsize;
spin_lock_init(&client->buffer_lock);
snprintf(client->name, sizeof(client->name), "%s-%d",
dev_name(&evdev->dev), task_tgid_vnr(current));
wake_lock_init(&client->wake_lock, WAKE_LOCK_SUSPEND, client->name);
if (client->use_wakelock)
wake_lock_init(&client->wake_lock, WAKE_LOCK_SUSPEND, client->name);
client->evdev = evdev;
evdev_attach_client(evdev, client);

Expand All @@ -327,7 +347,8 @@ static int evdev_open(struct inode *inode, struct file *file)

err_free_client:
evdev_detach_client(evdev, client);
wake_lock_destroy(&client->wake_lock);
if (client->use_wakelock)
wake_lock_destroy(&client->wake_lock);
kfree(client);
err_put_evdev:
put_device(&evdev->dev);
Expand Down Expand Up @@ -381,7 +402,7 @@ static int evdev_fetch_next_event(struct evdev_client *client,
if (have_event) {
*event = client->buffer[client->tail++];
client->tail &= client->bufsize - 1;
if (client->head == client->tail)
if (client->head == client->tail && client->use_wakelock)
wake_unlock(&client->wake_lock);
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/input/keyboard/gpio_keys.c
Expand Up @@ -583,8 +583,7 @@ static int gpio_keys_suspend(struct device *dev)
struct gpio_keys_button *button = &pdata->buttons[i];
if (button->wakeup) {
int irq = gpio_to_irq(button->gpio);
printk("%s, DEBUG: Enabling IRQ wake for GPIO: %d, IRQ: %d, Result = %d", __func__, button->gpio, irq, enable_irq_wake(irq));
// enable_irq_wake(irq);
enable_irq_wake(irq);
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions drivers/misc/lis3lv02d/lis3lv02d.c
Expand Up @@ -593,23 +593,6 @@ static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
return fasync_helper(fd, file, on, &lis3_dev.async_queue);
}

long lis3lv02d_misc_ioctl (struct file *filp, unsigned int cmd,
unsigned long arg) {

switch (cmd) {
case LIS3LV02D_POWEROFF:
lis3lv02d_poweroff(&lis3_dev);
break;
case LIS3LV02D_POWERON:
lis3lv02d_poweron(&lis3_dev);
break;
default:
break;
}

return 0;
}

static const struct file_operations lis3lv02d_misc_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
Expand All @@ -618,7 +601,6 @@ static const struct file_operations lis3lv02d_misc_fops = {
.release = lis3lv02d_misc_release,
.poll = lis3lv02d_misc_poll,
.fasync = lis3lv02d_misc_fasync,
.unlocked_ioctl = lis3lv02d_misc_ioctl,
};

static struct miscdevice lis3lv02d_misc_device = {
Expand Down Expand Up @@ -895,8 +877,6 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)

dev->whoami = lis3lv02d_read_8(dev, WHO_AM_I);

printk("DEBUG: Using IOCTL %d for poweron and %d for poweroff", LIS3LV02D_POWERON, LIS3LV02D_POWEROFF);

switch (dev->whoami) {
case WAI_12B:
pr_info("12 bits sensor found\n");
Expand Down
6 changes: 1 addition & 5 deletions drivers/misc/lis3lv02d/lis3lv02d_i2c.c
Expand Up @@ -192,12 +192,8 @@ static int lis3lv02d_i2c_suspend(struct device *dev)
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
struct lis3lv02d *lis3 = i2c_get_clientdata(client);

if (!lis3->pdata || !lis3->pdata->wakeup_flags) {
printk("Suspending Accel");
if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweroff(lis3);
} else {
printk("Not suspending Accel");
}
return 0;
}

Expand Down
9 changes: 1 addition & 8 deletions drivers/rtc/rtc-tps6586x.c
Expand Up @@ -140,14 +140,7 @@ static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
u8 rbuff[6];
int err;
int i;
static int debug = 0;

if (debug == 2000) {
dump_stack();
debug = 0;
}
debug++;


if (rtc->irq == -1)
return -EIO;

Expand Down
3 changes: 0 additions & 3 deletions include/linux/lis3lv02d.h
@@ -1,9 +1,6 @@
#ifndef __LIS3LV02D_H_
#define __LIS3LV02D_H_

#define majorNum 0xF0
#define LIS3LV02D_POWEROFF _IO(majorNum, 0)
#define LIS3LV02D_POWERON _IO(majorNum, 1)
/**
* struct lis3lv02d_platform_data - lis3 chip family platform data
* @click_flags: Click detection unit configuration
Expand Down

0 comments on commit 7d9a085

Please sign in to comment.