Wacom bringup issue i.MX7

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wacom bringup issue i.MX7

1,274 Views
arsadhusainmomi
Contributor I

Hi, 

I'm trying to run Wacom EMR sensor with the i.MX 7Dual SABRE Board. 

I'm able to detect the EMR on i2c bus at address 0x09. 

root@imx7dsabresd:~# i2cdetect -y 3 
0 1 2 3 4 5 6 7 8 9 a b c d e f 
00: -- -- -- -- -- -- 09 -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 


I'm using the wacom_i2c.c driver for driving the EMR sensor.

drivers/input/touchscreen/wacom_i2c.c - kernel/bcm - Git at Google 
The driver is probing fine. 


root@imx7dsabresd:~# insmod wacom_i2c.ko 
root@imx7dsabresd:~# echo WAC_I2C_EMR 0x09 > /sys/bus/i2c/devices/i2c-3/new_device 
input report length 15 
x_max:27040, y_max:20280, pressure:4095, fw:4434 
height:255, tilt_x:9000, tilt_y:9000 
wacom_i2c_probe feature_xmax: 27040 feature_ymax: 20280 
input: Wacom I2C Digitizer as /devices/platform/soc/30800000.aips-bus/30a50000.i2c/i2c-3/3-0009/input/input6 
i2c i2c-3: new_device: Instantiated device WAC_I2C_EMR at 0x09 


Now as soon as I try to use the stylus, I get an interrupt but the kernel crashes and I get a stack dump on the logs.

BUG: scheduling while atomic: swapper/0/0/0x00010002 
Modules linked in: wacom_i2c(O) 
Preemption disabled at:[< (null)>] (null) 

CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 4.1.15-2.1.0+g30278ab #165 
Hardware name: Freescale i.MX7 Dual (Device Tree) 
[<80015d78>] (unwind_backtrace) from [<8001271c>] (show_stack+0x10/0x14) 
[<8001271c>] (show_stack) from [<808048a8>] (dump_stack+0x84/0xc4) 
[<808048a8>] (dump_stack) from [<800530d4>] (__schedule_bug+0x6c/0xc0) 
[<800530d4>] (__schedule_bug) from [<808083f0>] (__schedule+0x450/0x508) 
[<808083f0>] (__schedule) from [<808084e8>] (schedule+0x40/0x98) 
[<808084e8>] (schedule) from [<80511d50>] (i2c_imx_bus_busy+0x64/0xec) 
[<80511d50>] (i2c_imx_bus_busy) from [<805123d0>] (i2c_imx_xfer+0x34c/0xe7c) 
[<805123d0>] (i2c_imx_xfer) from [<8050e4dc>] (__i2c_transfer+0x13c/0x278) 
[<8050e4dc>] (__i2c_transfer) from [<8050e6ac>] (i2c_transfer+0x94/0xc4) 
[<8050e6ac>] (i2c_transfer) from [<8050e768>] (i2c_master_recv+0x40/0x50) 
[<8050e768>] (i2c_master_recv) from [<7f0000a4>] (wacom_i2c_irq+0x1c/0x1ac [wacom_i2c]) 
[<7f0000a4>] (wacom_i2c_irq [wacom_i2c]) from [<8006f158>] (handle_irq_event_percpu+0x78/0x134) 
[<8006f158>] (handle_irq_event_percpu) from [<8006f250>] (handle_irq_event+0x3c/0x5c) 
[<8006f250>] (handle_irq_event) from [<80071db4>] (handle_level_irq+0xc4/0x13c) 
[<80071db4>] (handle_level_irq) from [<8006e7f8>] (generic_handle_irq+0x2c/0x3c) 
[<8006e7f8>] (generic_handle_irq) from [<802e3e90>] (mxc_gpio_irq_handler+0x38/0x100) 
[<802e3e90>] (mxc_gpio_irq_handler) from [<802e3fd8>] (mx3_gpio_irq_handler+0x80/0xcc) 
[<802e3fd8>] (mx3_gpio_irq_handler) from [<8006e7f8>] (generic_handle_irq+0x2c/0x3c) 
[<8006e7f8>] (generic_handle_irq) from [<8006eab0>] (__handle_domain_irq+0x7c/0xec) 
[<8006eab0>] (__handle_domain_irq) from [<8000944c>] (gic_handle_irq+0x24/0x5c) 
[<8000944c>] (gic_handle_irq) from [<80013200>] (__irq_svc+0x40/0x74) 
Exception stack(0x80b8ff18 to 0x80b8ff60) 
ff00: 00000000 ab722380 
ff20: 00000001 80b8e000 ab71eed0 00000002 43fec61a 00000014 4aa320a1 00000014 
ff40: 00000001 00000000 00000000 80b8ff60 8080ba34 8057a784 20060013 ffffffff 
[<80013200>] (__irq_svc) from [<8057a784>] (cpuidle_enter_state+0xd8/0x20c) 
[<8057a784>] (cpuidle_enter_state) from [<80066404>] (cpu_startup_entry+0x1fc/0x320) 
[<80066404>] (cpu_startup_entry) from [<80b20c6c>] (start_kernel+0x39c/0x3a8) 
BUG: scheduling while atomic: swapper/0/0/0x00010002 
Modules linked in: wacom_i2c(O) 
Preemption disabled at:[< (null)>] (null) 

 

I see a few spikes on SDA line as shown in the image.

IMG_20180109_154808.jpg
 

But after that I receive nothing.

The processor loses its I2C clock.

I'm not sure if it's a processor side issue or slave device issue.

I've setup everything as per the datasheet.

I've tried it with modified I2C clock from 10Khz to 500Khz and ended up with same results.

Anyone have any idea about what could be wrong here.

Please help.

Thanks.

Labels (4)
0 Kudos
3 Replies

839 Views
snehix
Contributor II

Hi Arshad,

 I have ordered an imx7 sabre board, yet to receive. I am going to try the same, connecting epd screen and wacom sensor. I could not find the i2c ports or gpio ports , since you have already done, will you please help me letting me know how you did the connection.

Thanks in advance !

Best Regards,

Surajit

surajit.sinha@snehix.com

0 Kudos

916 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello arsadhusain,

         See suggestions below for you, please!

(1) Adding your sensor to device tree of linux BSP for i.MX7D SabreSD

On i.MX7D SabreSD board, there are several sensors, and they are supported in device tree, please refer to them and add your sensor to device tree. (sensors on board: Gyroscope, Accelerometer & Magnetometer etc)

two points you should pay attention to:

---I2C bus you want to use

---interrupt (should be GPIO pin)

(2) Compiling your sensor driver to Linux kernel.

please compiling your sensor driver together with kernel! 

Then try it on your board, please!


Have a great day,
TIC  Weidong Sun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

916 Views
arsadhusainmomi
Contributor I

Thank you for your input.

1) Instead of changing the device tree, I've added support for RESET and IRQ pins in the driver.

error = gpio_request(2, "wac_reset");
if(error < 0)
{
printk(KERN_INFO "wac gpio reset request error\n");
goto err_free_mem;
}
else
{
gpio_direction_output(2, 0);
msleep(100);
gpio_direction_output(2, 1);
msleep(100);
}

client->irq = gpio_to_irq(174);
error = request_irq(client->irq, wacom_i2c_irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "wacom_i2c", wac_i2c);
if(0 != error){
printk("%s: request_irq failed.\n", __func__);
goto err_free_mem;
}
else
printk("request_irq success.\n");

Is this enough for the device to work? Or I still have to make changes to the device tree?

Please share your insights.

2) The driver is probing fine even with the external .ko module. Can you explain what difference would it make to add it as a built-in module?

BTW, I've tried it on three different I2C buses and ended up with same results.

Please help asap.

0 Kudos