Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600735 > unrolled thread

Re: [PATCH v5 00/39] i.MX Media Driver

Started bySteve Longerbeam <slongerbeam@gmail.com>
First post2017-03-14 18:30 +0100
Last post2017-03-18 21:20 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v5 00/39] i.MX Media Driver Steve Longerbeam <slongerbeam@gmail.com> - 2017-03-14 18:30 +0100
    Re: [PATCH v5 00/39] i.MX Media Driver Steve Longerbeam <slongerbeam@gmail.com> - 2017-03-18 21:20 +0100

#1600735 — Re: [PATCH v5 00/39] i.MX Media Driver

FromSteve Longerbeam <slongerbeam@gmail.com>
Date2017-03-14 18:30 +0100
SubjectRe: [PATCH v5 00/39] i.MX Media Driver
Message-ID<tkYqK-3pv-29@gated-at.bofh.it>

On 03/12/2017 02:09 PM, Russell King - ARM Linux wrote:
> On Sun, Mar 12, 2017 at 08:40:37PM +0000, Russell King - ARM Linux wrote:
>> On Sun, Mar 12, 2017 at 01:36:32PM -0700, Steve Longerbeam wrote:
>>> But hold on, if my logic is correct, then why did the CSI power-off
>>> get reached in your case, multiple times? Yes I think there is a bug,
>>> link_notify() is not checking if the link has already been disabled.
>>> I will fix this. But I'm surprised media core's link_notify handling
>>> doesn't do this.
>> Well, I think there's something incredibly fishy going on here.  I
>> turned that dev_dbg() at the top of the function into a dev_info(),
>> and I get:
>>
>> root@hbi2ex:~# dmesg |grep -A2 imx-ipuv3-csi
>> [   53.370949] imx-ipuv3-csi imx-ipuv3-csi.0: power OFF
>> [   53.371015] ------------[ cut here ]------------
>> [   53.371075] WARNING: CPU: 0 PID: 1515 at drivers/staging/media/imx/imx-media-csi.c:806 csi_s_power+0xb8/0xd0 [imx_media_csi]
>> --
>> [   53.372624] imx-ipuv3-csi imx-ipuv3-csi.0: power OFF
>> [   53.372637] ------------[ cut here ]------------
>> [   53.372663] WARNING: CPU: 0 PID: 1515 at drivers/staging/media/imx/imx-media-csi.c:806 csi_s_power+0xb8/0xd0 [imx_media_csi]
>>
>> There isn't a power on event being generated before these two power
>> off events.  I don't see a power on event even when I attempt to
>> start streaming either (which fails due to the lack of bayer
>> support.)
> Found it - my imx219 driver returns '1' from its s_power function when
> powering up, which triggers a bug in your code - when imx_media_set_power()
> fails to power up, you call imx_media_set_power() telling it to power
> everything off - including devices that are already powered off.

Yep, there's a bug in the error cleanup in imx_media_pipeline_set_power().
On error, it needs to backout by calling s_power(off) as it is doing, 
but not
through the whole pipeline, but needs to stop at the subdev encountered
just before the subdev that failed. This was causing the s_power() 
imbalance.
I will fix.


>
> This is really bad news - s_power() may be called via other paths,
> such as when the subdev is opened.

I don't think that is a problem, as long as power_count is working
as it should, and the caller from the other paths has not created an
imbalance.

Steve

[toc] | [next] | [standalone]


#1603850

FromSteve Longerbeam <slongerbeam@gmail.com>
Date2017-03-18 21:20 +0100
Message-ID<tmsZs-39k-3@gated-at.bofh.it>
In reply to#1600735
Hi Russell,


On 03/14/2017 10:29 AM, Steve Longerbeam wrote:
>
>
> On 03/12/2017 02:09 PM, Russell King - ARM Linux wrote:
>> On Sun, Mar 12, 2017 at 08:40:37PM +0000, Russell King - ARM Linux 
>> wrote:
>>> On Sun, Mar 12, 2017 at 01:36:32PM -0700, Steve Longerbeam wrote:
>>>> But hold on, if my logic is correct, then why did the CSI power-off
>>>> get reached in your case, multiple times? Yes I think there is a bug,
>>>> link_notify() is not checking if the link has already been disabled.
>>>> I will fix this. But I'm surprised media core's link_notify handling
>>>> doesn't do this.
>>> Well, I think there's something incredibly fishy going on here.  I
>>> turned that dev_dbg() at the top of the function into a dev_info(),
>>> and I get:
>>>
>>> root@hbi2ex:~# dmesg |grep -A2 imx-ipuv3-csi
>>> [   53.370949] imx-ipuv3-csi imx-ipuv3-csi.0: power OFF
>>> [   53.371015] ------------[ cut here ]------------
>>> [   53.371075] WARNING: CPU: 0 PID: 1515 at 
>>> drivers/staging/media/imx/imx-media-csi.c:806 csi_s_power+0xb8/0xd0 
>>> [imx_media_csi]
>>> -- 
>>> [   53.372624] imx-ipuv3-csi imx-ipuv3-csi.0: power OFF
>>> [   53.372637] ------------[ cut here ]------------
>>> [   53.372663] WARNING: CPU: 0 PID: 1515 at 
>>> drivers/staging/media/imx/imx-media-csi.c:806 csi_s_power+0xb8/0xd0 
>>> [imx_media_csi]
>>>
>>> There isn't a power on event being generated before these two power
>>> off events.  I don't see a power on event even when I attempt to
>>> start streaming either (which fails due to the lack of bayer
>>> support.)
>> Found it - my imx219 driver returns '1' from its s_power function when
>> powering up, which triggers a bug in your code - when 
>> imx_media_set_power()
>> fails to power up, you call imx_media_set_power() telling it to power
>> everything off - including devices that are already powered off.
>
> Yep, there's a bug in the error cleanup in 
> imx_media_pipeline_set_power().
> On error, it needs to backout by calling s_power(off) as it is doing, 
> but not
> through the whole pipeline, but needs to stop at the subdev encountered
> just before the subdev that failed. This was causing the s_power() 
> imbalance.
> I will fix.
>

Due to some fixes to ov5640 from version 4, v4l2_pipeline_pm APIs are 
working
now, so I've removed imx_media_pipeline_set_power() and switched to
v4l2_pipeline_pm_use() in capture device open/release and 
v4l2_pipeline_link_notify()
in imx_media_link_notify(), for the pipeline power management.

Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web