1
0
Fork 0

LF-237 media: ov5640_mipi: fix regulator dump when i2c access for camera fail

in 5451781dad commit, it added the check that
the regulator need to be disabled before calling regulator_put().

when i2c access for camera fails in some case, need disable the regulator to
fix following dump message.

[    3.881140] i2c i2c-2: cannot deal with slave irq,i2c_imx->slave is null
[    3.981772] ov5640_mipi 2-003c: Write reg error: reg=3008, val=2
[    3.987841] ov5640_mipi 2-003c: Camera init failed
[    4.001224] ------------[ cut here ]------------
[    4.005949] WARNING: CPU: 2 PID: 189 at drivers/regulator/core.c:2042 _regulator_put.part.0+0x140/0x148
[    4.015363] Modules linked in:
[    4.018466] CPU: 2 PID: 189 Comm: kworker/2:2 Not tainted 5.4.0-rc7-5.4-zeus-next+g56a9ca3b7f4e #1
[    4.027434] Hardware name: FSL i.MX8MM EVK board (DT)
[    4.032554] Workqueue: events deferred_probe_work_func
[    4.037712] pstate: 80000005 (Nzcv daif -PAN -UAO)
[    4.042511] pc : _regulator_put.part.0+0x140/0x148
[    4.047316] lr : regulator_put+0x34/0x48
[    4.051248] sp : ffff8000129935f0
[    4.054571] x29: ffff8000129935f0 x28: ffff000079d39580
[    4.059891] x27: ffff000079d6cc80 x26: ffff80001206eae0
[    4.065213] x25: ffff8000120ab538 x24: ffff000079d3fc00
[    4.070534] x23: 0000000000000009 x22: ffff8000129936a8
[    4.075856] x21: ffff00007a47c4c0 x20: ffff8000120550c0
[    4.081174] x19: ffff000079d3ff00 x18: 0000000000000000
[    4.086495] x17: 0000000000000000 x16: 0000000000000000
[    4.091817] x15: 0000000000000000 x14: ffff00007b0aa940
[    4.097138] x13: ffff80006c0ef000 x12: 0000000034d4d91d
[    4.102460] x11: 071c71c71c71c71c x10: 0000000000000990
[    4.107780] x9 : 0000000000000000 x8 : ffff8000107ef620
[    4.113102] x7 : ffff000079d5e2b8 x6 : ffff000079d3fc00
[    4.118424] x5 : ffff000079d5e2b8 x4 : 0000000000000000
[    4.123745] x3 : ffff800012055490 x2 : ffff00007a47c4c0
[    4.129066] x1 : 0000000000000000 x0 : 0000000000000001
[    4.134397] Call trace:
[    4.136861]  _regulator_put.part.0+0x140/0x148
[    4.141318]  regulator_put+0x34/0x48
[    4.144917]  devm_regulator_release+0x10/0x18
[    4.149298]  release_nodes+0x1a8/0x220
[    4.153057]  devres_release_all+0x34/0x58
[    4.157078]  really_probe+0x1b8/0x308
[    4.160748]  driver_probe_device+0x54/0xe8
[    4.164851]  __device_attach_driver+0x80/0xb8
[    4.169225]  bus_for_each_drv+0x74/0xc0
[    4.173070]  __device_attach+0xdc/0x138
[    4.176916]  device_initial_probe+0x10/0x18
[    4.181105]  bus_probe_device+0x90/0x98
[    4.184954]  device_add+0x378/0x648
[    4.188450]  device_register+0x1c/0x28
[    4.192230]  i2c_new_client_device+0x134/0x270
[    4.196681]  i2c_new_device+0xc/0x20
[    4.200277]  of_i2c_register_device+0x70/0x98
[    4.204640]  of_i2c_register_devices+0x9c/0x164
[    4.209176]  i2c_register_adapter+0x14c/0x400
[    4.213545]  __i2c_add_numbered_adapter+0x58/0xa0
[    4.218259]  i2c_add_adapter+0x9c/0xc8
[    4.222015]  i2c_add_numbered_adapter+0x24/0x30
[    4.226580]  i2c_imx_probe+0x37c/0x840
[    4.230340]  platform_drv_probe+0x50/0xa0
[    4.234357]  really_probe+0xd4/0x308
[    4.237944]  driver_probe_device+0x54/0xe8
[    4.242050]  __device_attach_driver+0x80/0xb8
[    4.246414]  bus_for_each_drv+0x74/0xc0
[    4.250264]  __device_attach+0xdc/0x138
[    4.254111]  device_initial_probe+0x10/0x18
[    4.258304]  bus_probe_device+0x90/0x98
[    4.262147]  deferred_probe_work_func+0x64/0x98
[    4.266720]  process_one_work+0x198/0x320
[    4.270740]  worker_thread+0x1f0/0x420
[    4.274523]  kthread+0xf0/0x120
[    4.277694]  ret_from_fork+0x10/0x18
[    4.281291] ---[ end trace 429c2bceeb60ea02 ]---

Signed-off-by: Robby Cai <robby.cai@nxp.com>
Reviewed-by: Guoniu.zhou <guoniu.zhou@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Robby Cai 2019-12-02 16:33:47 +08:00
parent 5038699a88
commit 98e786bdbd
2 changed files with 2 additions and 0 deletions

View File

@ -1781,6 +1781,7 @@ static int ov5640_probe(struct i2c_client *client,
retval = init_device(sensor);
if (retval < 0) {
ov5640_regualtor_disable();
clk_disable_unprepare(sensor->sensor_clk);
dev_warn(dev, "Camera init failed\n");
ov5640_power_down(sensor, 1);

View File

@ -1867,6 +1867,7 @@ static int ov5640_probe(struct i2c_client *client,
retval = init_device();
if (retval < 0) {
ov5640_regualtor_disable();
clk_disable_unprepare(ov5640_data.sensor_clk);
pr_warning("camera ov5640 init failed\n");
ov5640_power_down(1);