mbox series

[0/4] media: atomisp: mt9m114: Make it work on Asus T100TA

Message ID 20241013154056.12532-1-hdegoede@redhat.com
Headers show
Series media: atomisp: mt9m114: Make it work on Asus T100TA | expand

Message

Hans de Goede Oct. 13, 2024, 3:40 p.m. UTC
Hi All,

Since there is some interest in getting the mt9m114 camera to work on
the Asus T100TA:

https://github.com/jfwells/linux-asus-t100ta/issues/4
https://lore.kernel.org/platform-driver-x86/e0c8c98f-64ec-4297-bbc8-de489414515c@zonnet.nl/

I have spend some time this weekend poking at this resulting in this
series which makes things work somewhat.

Note that for now this will only work if you modify the BIOS settings
to change the ISP to be listed as a PCI device in lspci:

00:03.0 Multimedia controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Camera ISP (rev 09)

If you do not have this in lspci then things will not work. The BIOS
does not allow changing this setting from its menu, so we need to
use the grub setup_var_3 command form a patched grub.

Note this requires your Asus T100TA to be at the latest v314 BIOS version,
this has not been tested with other versions!

Download grubia32.efi from here:

https://fedorapeople.org/~jwrdegoede/grub-efi-setup_var/grubia32.efi

Boot this once and then run:

setup_var_3 6f

If the ISP is not visible in lspci this should show 01 as value
for the 0x6f offset.

Now change this to 2:

setup_var_3 6f 02

and then reboot. After this the ISP should be visible in lspci.

For more details on how this works see:
https://hansdegoede.dreamwidth.org/25589.html

Note this series is just a quick hack, the proper fix would be to get
the new drivers/media/i2c/mt9m114 standard v4l2 driver to work and
atomisp does support standard v4l2 drivers for a while now.

I plan to take a shot at this as time permits, hopefully sometime
within a month but no promises.

Regards,

Hans


Hans de Goede (4):
  media: atomisp: Fix WARN_ON() in vb2_start_streaming() triggering
  media: atomisp: mt9m114: Disable V4L2_CID_3A_LOCK control
  media: atomisp: mt9m114: Add missing mutex_init() call
  media: atomisp: mt9m114: Fix fmt->code not getting set on try_fmt

 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 13 +++++++++----
 drivers/staging/media/atomisp/pci/atomisp_ioctl.c   |  5 ++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

Comments

Andy Shevchenko Oct. 14, 2024, 11:28 a.m. UTC | #1
On Sun, Oct 13, 2024 at 05:40:53PM +0200, Hans de Goede wrote:
> If atomisp fails to start the stream the buffers must be returned to
> the VB2_BUF_STATE_QUEUED state before returning an error from
> atomisp_start_streaming().
> 
> This fixes the following WARN_ON():
> [  250.313554] WARNING: CPU: 3 PID: 2178 at drivers/media/common/videobuf2/videobuf2-core.c:1801 vb2_start_streaming+0xcb/0x150 [videobuf2_common]

...

>  	if (ret) {
>  		dev_err(isp->dev, "Error starting mc pipeline: %d\n", ret);
> +		atomisp_flush_video_pipe(pipe, VB2_BUF_STATE_QUEUED, true);
>  		goto out_unlock;
>  	}

Seems like error message does not depend on the video pipe. Hence I would
first flush the pipe and then print a message.
Andy Shevchenko Oct. 14, 2024, 11:32 a.m. UTC | #2
On Sun, Oct 13, 2024 at 05:40:52PM +0200, Hans de Goede wrote:
> Hi All,
> 
> Since there is some interest in getting the mt9m114 camera to work on
> the Asus T100TA:
> 
> https://github.com/jfwells/linux-asus-t100ta/issues/4
> https://lore.kernel.org/platform-driver-x86/e0c8c98f-64ec-4297-bbc8-de489414515c@zonnet.nl/
> 
> I have spend some time this weekend poking at this resulting in this
> series which makes things work somewhat.
> 
> Note that for now this will only work if you modify the BIOS settings
> to change the ISP to be listed as a PCI device in lspci:
> 
> 00:03.0 Multimedia controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Camera ISP (rev 09)
> 
> If you do not have this in lspci then things will not work. The BIOS
> does not allow changing this setting from its menu, so we need to
> use the grub setup_var_3 command form a patched grub.
> 
> Note this requires your Asus T100TA to be at the latest v314 BIOS version,
> this has not been tested with other versions!
> 
> Download grubia32.efi from here:
> 
> https://fedorapeople.org/~jwrdegoede/grub-efi-setup_var/grubia32.efi
> 
> Boot this once and then run:
> 
> setup_var_3 6f
> 
> If the ISP is not visible in lspci this should show 01 as value
> for the 0x6f offset.
> 
> Now change this to 2:
> 
> setup_var_3 6f 02
> 
> and then reboot. After this the ISP should be visible in lspci.
> 
> For more details on how this works see:
> https://hansdegoede.dreamwidth.org/25589.html
> 
> Note this series is just a quick hack, the proper fix would be to get
> the new drivers/media/i2c/mt9m114 standard v4l2 driver to work and
> atomisp does support standard v4l2 drivers for a while now.
> 
> I plan to take a shot at this as time permits, hopefully sometime
> within a month but no promises.

LGTM, some nit-picks in the individual replies.
Reviewed-by: Andy Shevchenko <andy@kernel.org>

P.S. Can you consider my patch to apply (that removes GPL text
     in the top comments)?
Hans de Goede Oct. 14, 2024, 12:09 p.m. UTC | #3
Hi,

On 14-Oct-24 1:32 PM, Andy Shevchenko wrote:
> On Sun, Oct 13, 2024 at 05:40:52PM +0200, Hans de Goede wrote:
>> Hi All,
>>
>> Since there is some interest in getting the mt9m114 camera to work on
>> the Asus T100TA:
>>
>> https://github.com/jfwells/linux-asus-t100ta/issues/4
>> https://lore.kernel.org/platform-driver-x86/e0c8c98f-64ec-4297-bbc8-de489414515c@zonnet.nl/
>>
>> I have spend some time this weekend poking at this resulting in this
>> series which makes things work somewhat.
>>
>> Note that for now this will only work if you modify the BIOS settings
>> to change the ISP to be listed as a PCI device in lspci:
>>
>> 00:03.0 Multimedia controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Camera ISP (rev 09)
>>
>> If you do not have this in lspci then things will not work. The BIOS
>> does not allow changing this setting from its menu, so we need to
>> use the grub setup_var_3 command form a patched grub.
>>
>> Note this requires your Asus T100TA to be at the latest v314 BIOS version,
>> this has not been tested with other versions!
>>
>> Download grubia32.efi from here:
>>
>> https://fedorapeople.org/~jwrdegoede/grub-efi-setup_var/grubia32.efi
>>
>> Boot this once and then run:
>>
>> setup_var_3 6f
>>
>> If the ISP is not visible in lspci this should show 01 as value
>> for the 0x6f offset.
>>
>> Now change this to 2:
>>
>> setup_var_3 6f 02
>>
>> and then reboot. After this the ISP should be visible in lspci.
>>
>> For more details on how this works see:
>> https://hansdegoede.dreamwidth.org/25589.html
>>
>> Note this series is just a quick hack, the proper fix would be to get
>> the new drivers/media/i2c/mt9m114 standard v4l2 driver to work and
>> atomisp does support standard v4l2 drivers for a while now.
>>
>> I plan to take a shot at this as time permits, hopefully sometime
>> within a month but no promises.
> 
> LGTM, some nit-picks in the individual replies.
> Reviewed-by: Andy Shevchenko <andy@kernel.org>

Thank you.

> P.S. Can you consider my patch to apply (that removes GPL text
>      in the top comments)?

Yes I'll pick this up together with other atomisp patches
the next time I do a round of atomisp patch merging.

Regards,

Hans
Hans de Goede Nov. 4, 2024, 11:06 a.m. UTC | #4
Hi,

On 13-Oct-24 5:40 PM, Hans de Goede wrote:
> Hi All,
> 
> Since there is some interest in getting the mt9m114 camera to work on
> the Asus T100TA:
> 
> https://github.com/jfwells/linux-asus-t100ta/issues/4
> https://lore.kernel.org/platform-driver-x86/e0c8c98f-64ec-4297-bbc8-de489414515c@zonnet.nl/
> 
> I have spend some time this weekend poking at this resulting in this
> series which makes things work somewhat.
> 
> Note that for now this will only work if you modify the BIOS settings
> to change the ISP to be listed as a PCI device in lspci:
> 
> 00:03.0 Multimedia controller: Intel Corporation Atom Processor Z36xxx/Z37xxx Series Camera ISP (rev 09)
> 
> If you do not have this in lspci then things will not work. The BIOS
> does not allow changing this setting from its menu, so we need to
> use the grub setup_var_3 command form a patched grub.
> 
> Note this requires your Asus T100TA to be at the latest v314 BIOS version,
> this has not been tested with other versions!
> 
> Download grubia32.efi from here:
> 
> https://fedorapeople.org/~jwrdegoede/grub-efi-setup_var/grubia32.efi
> 
> Boot this once and then run:
> 
> setup_var_3 6f
> 
> If the ISP is not visible in lspci this should show 01 as value
> for the 0x6f offset.
> 
> Now change this to 2:
> 
> setup_var_3 6f 02
> 
> and then reboot. After this the ISP should be visible in lspci.
> 
> For more details on how this works see:
> https://hansdegoede.dreamwidth.org/25589.html
> 
> Note this series is just a quick hack, the proper fix would be to get
> the new drivers/media/i2c/mt9m114 standard v4l2 driver to work and
> atomisp does support standard v4l2 drivers for a while now.
> 
> I plan to take a shot at this as time permits, hopefully sometime
> within a month but no promises.

Thank you for your patch(es).

I have merged this/these in my media-atomisp branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomisp

And this/these will be included in my next pull-request to
Mauro (to media subsystem maintainer)

Regards,

Hans