Hi All,

I have got an issue when using GPIO6 for motion detection.

I am using GPIO6 for motion detection.

Whenever motion is detected interrupt is generated and IRQ handler is
called.

>From IRQ handler I just call tasklet_schedule()
below is code for IRQ:
static irqreturn_t vpfe_motion_isr(int irq, void *dev_id, struct pt_regs
*regs)
{
    vpfe_obj *vpfe = &vpfe_device;

    tasklet_schedule(&motion_night_isr_work);

    return IRQ_RETVAL(1);
}

In tasklet I do I2C Write and then I2C Read to get detection information and
based on the detection information I wake-up the thread. But I get kernel
panic error.
Below is code for tasklet:
[code]
static void motion_night_detection_handler(unsigned long info)
{
    int ret = 0;
    void *tmp = (void *)info;
    tw2835_interrupt_info   interrupt_info = { 0 };

    tw2835_params *tmp_device_info = (tw2835_params*)tmp;

    /// check what has caused the interrupt
    ret = tw2835_find_interrupt_cause(&interrupt_info);

    if(interrupt_info.motion_channel)
    {
        tmp_device_info->motion_detection_flag = 1;
        tmp_device_info->motion_channel = interrupt_info.motion_channel;
        wake_up_interruptible(&tw2835_motion_detection_queue);
    }
    if(interrupt_info.night_channel)
    {
        tmp_device_info->night_detection_flag = 1;
        tmp_device_info->night_channel = interrupt_info.night_channel;
        wake_up_interruptible(&tw2835_night_detection_queue);
    }
    if(interrupt_info.nvideo_channel)
    {
        tmp_device_info->nvideo_detection_flag = 1;
        tmp_device_info->nvideo_channel = interrupt_info.nvideo_channel;
        wake_up_interruptible(&tw2835_nvideo_detection_queue);
    }
    if(interrupt_info.blind_channel)
    {
        tmp_device_info->blind_detection_flag = 1;
        tmp_device_info->blind_channel = interrupt_info.blind_channel;
        wake_up_interruptible(&tw2835_blind_detection_queue);
    }
}

int tw2835_find_interrupt_cause(tw2835_interrupt_info   *info)
{
    int ret = 0;
    u8 data = 0;

    ret |= tw2835_write_value(PAGE1, 0x76, 0x00);

    info->motion_channel = 0;
    if(tw2835_global_motion_flag)
    {
        ret |= tw2835_read_value(PAGE1, 0x79, &data);
        info->motion_channel = (data & 0x0F);
    }
    return ret;
}
[\code]



Below is the dump of the error:

[error]
BUG: scheduling while atomic: swapper/0x00000103/0
caller is schedule+0xec/0x12c
BUG: scheduling from the idle thread!
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = c0004000
[00000004] *pgd=00000000
Internal error: Oops: 17 [#1]
Modules linked in:
CPU: 0
PC is at dequeue_task+0xc/0x78
LR is at deactivate_task+0x28/0x34
pc : [<c0048398>]    lr : [<c00486d4>]    Not tainted
sp : c02e9d28  ip : c02e9d38  fp : c02e9d34
r10: c02e8000  r9 : c0353810  r8 : c02ea0c0
r7 : c02fe14c  r6 : 40000013  r5 : c02fe144  r4 : c02ea0c0
r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : c02ea0c0
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  Segment kernel
Control: 5317F  Table: 85F90000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc02e81a0)
Stack: (0xc02e9d28 to 0xc02ea000)
9d20:                   c02e9d4c c02e9d38 c00486d4 c004839c c029f388
c029f388
9d40: c02e9d9c c02e9d50 c029ee44 c00486bc c02e9ddc c7297cd0 c036a9b4
00989680
9d60: d5905180 00989643 00000000 c02ea21c c02e9d94 c02e8000 c02fe144
40000013
9d80: c02fe14c c02ea0c0 c034eca0 c0358aa0 c02e9dbc c02e9da0 c029f388
c029ec70
9da0: 80000013 00000000 00000000 c02e8000 c02e9dfc c02e9dc0 c029e9dc
c029f2ac
9dc0: 00000001 c02ea0c0 c004927c c02fe14c c02fe14c 00000000 c02e9dfc
c02fe128
9de0: c02fe144 00000001 c0358af0 0000000a c02e9e2c c02e9e00 c029e88c
c029e900
9e00: c02fe128 c02e9e38 00000001 c018cb24 c02fe128 c018a888 00000001
00000042
9e20: c02e9e5c c02e9e30 c018d33c c018a84c c0007601 00000000 00000042
00000003
9e40: c02e9e30 00000006 c02e9e90 00000000 c02e9e6c c02e9e60 c018d5d8
c018d2d4
9e60: c02e9e8c c02e9e70 c0192bf8 c018d5c4 c02e8000 002e8000 c036b5e0
00000000
9e80: c02e9eac c02e9e90 c0197dc8 c0192bd8 00000000 c02e9ea0 00000000
c0358ac4
9ea0: c02e9ec4 c02e9eb0 c0052c78 c0197db4 c02e8000 00000103 c02e9eec
c02e9ec8
9ec0: c0052730 c0052c08 c02e8000 00000000 c0033f9c 00000002 c02e8000
c02e9f58
9ee0: c02e9f04 c02e9ef0 c005280c c00526ec c02e8000 c02e8000 c02e9f1c
c02e9f08
9f00: c00529c4 c00527e4 c0033f9c c02e9f8c c02e9f54 c02e9f20 c00334c0
c0052988
9f20: d32df780 00989643 00989680 c02e9f8c e1048000 c0033f9c 00000002
c02e8000
9f40: 00000001 8002a580 c02e9fb4 c02e9f58 c0031780 c00333b0 00000000
0005317f
9f60: 0005217f 60000013 c02e8000 60000093 c035b704 c037a764 8002a5b0
41069265
9f80: 8002a580 c02e9fb4 c02e9fa0 c02e9fa0 c0033f9c c0033fac 60000013
ffffffff
9fa0: c02e8000 c0033f34 c02e9fcc c02e9fb8 c0034004 c0033f44 00053175
c034e7dc
9fc0: c02e9ffc c02e9fd0 c00087d8 c0033fc4 c0008304 00000000 00000000
c034fc38
9fe0: 00000000 00053175 c034fc1c c02eafd0 00000000 c02ea000 8000809c
c0008660
Backtrace:
[<c004838c>] (dequeue_task+0x0/0x78) from [<c00486d4>]
(deactivate_task+0x28/0x34)
[<c00486ac>] (deactivate_task+0x0/0x34) from [<c029ee44>]
(__schedule+0x1e4/0x5ac)
 r4 = C029F388
[<c029ec60>] (__schedule+0x0/0x5ac) from [<c029f388>] (schedule+0xec/0x12c)
[<c029f29c>] (schedule+0x0/0x12c) from [<c029e9dc>]
(__compat_down+0xec/0x188)
 r4 = C02E8000
[<c029e8f0>] (__compat_down+0x0/0x188) from [<c029e88c>]
(__compat_down_failed+0xc/0x20)
 r8 = 0000000A  r7 = C0358AF0  r6 = 00000001  r5 = C02FE144
 r4 = C02FE128
[<c018a83c>] (i2c_transfer+0x0/0x84) from [<c018d33c>]
(tw2835_i2c_write_reg+0x78/0xac)
 r5 = 00000042  r4 = 00000001
[<c018d2c4>] (tw2835_i2c_write_reg+0x0/0xac) from [<c018d5d8>]
(tw2835_write_value+0x24/0x4c)
 r5 = 00000000  r4 = C02E9E90
[<c018d5b4>] (tw2835_write_value+0x0/0x4c) from [<c0192bf8>]
(tw2835_find_interrupt_cause+0x30/0x120)
[<c0192bc8>] (tw2835_find_interrupt_cause+0x0/0x120) from [<c0197dc8>]
(motion_night_detection_handler+0x24/0xf0)
 r5 = 00000000  r4 = C036B5E0
[<c0197da4>] (motion_night_detection_handler+0x0/0xf0) from [<c0052c78>]
(tasklet_action+0x80/0xcc)
 r5 = C0358AC4  r4 = 00000000
[<c0052bf8>] (tasklet_action+0x0/0xcc) from [<c0052730>]
(___do_softirq+0x54/0xf8)
 r5 = 00000103  r4 = C02E8000
[<c00526dc>] (___do_softirq+0x0/0xf8) from [<c005280c>]
(__do_softirq+0x38/0x58)
[<c00527d4>] (__do_softirq+0x0/0x58) from [<c00529c4>] (irq_exit+0x4c/0x60)
 r5 = C02E8000  r4 = C02E8000
[<c0052978>] (irq_exit+0x0/0x60) from [<c00334c0>] (asm_do_IRQ+0x120/0x138)
 r4 = C02E9F8C
[<c00333a0>] (asm_do_IRQ+0x0/0x138) from [<c0031780>] (__irq_svc+0x40/0x6c)
[<c0033f34>] (default_idle+0x0/0x80) from [<c0034004>] (cpu_idle+0x50/0x88)
 r5 = C0033F34  r4 = C02E8000
[<c0033fb4>] (cpu_idle+0x0/0x88) from [<c00087d8>]
(start_kernel+0x188/0x1cc)
 r5 = C034E7DC  r4 = 00053175
[<c0008650>] (start_kernel+0x0/0x1cc) from [<8000809c>] (0x8000809c)
Code: e89da800 e1a0c00d e92dd800 e24cb004 (e5913004)
 <0>Kernel panic - not syncing: Aiee, killing interrupt handler!
[\error]



Please let me know what is wrong.

-Azam.
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to