All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Patrik Gfeller <patrik.gfeller@gmail.com>,
	Francescodario Cuzzocrea 
	<francescodario.cuzzocrea@mail.polimi.it>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [GIT PULL] Ressurect the atomisp staging driver
Date: Tue, 19 May 2020 09:39:20 +0200	[thread overview]
Message-ID: <20200519093920.7bb22161@coco.lan> (raw)
In-Reply-To: <20200515114245.266a6fc8@coco.lan>

Em Fri, 15 May 2020 11:42:45 +0200
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Em Fri, 15 May 2020 11:10:21 +0200
> Hans de Goede <hdegoede@redhat.com> escreveu:
> 
> > Hi all,
> > 
> > On 5/15/20 10:32 AM, Mauro Carvalho Chehab wrote:  
> > > Em Mon, 4 May 2020 15:44:20 +0200
> > > Patrik Gfeller <patrik.gfeller@gmail.com> escreveu:
> > >     
> > >>>> Maybe this is related to my partial build (only the module to test if
> > >>>> it builds). I'll now do a full build of the kernel.    
> > >>>
> > >>> Yeah, either that or there are some config options with different values.
> > >>>
> > >>> I was able to do a full build here without the above errors, although
> > >>> I had to turn of some CONFIG options that were otherwise failing.    
> > >>
> > >> Strange - I do not get it :-/ ... can you send me the .config file and
> > >> Makefile you use; probably I missed something.    
> > > 
> > > I posted an alternate version, with the driver from the Yocto Aero tree
> > > ported to Kernel 5.7-rc2. The Kernel sources used are at this directory:
> > > 
> > > 	https://download.01.org/aero/deb/pool/main/l/linux-4.4.76-aero-1.3/
> > > 
> > > Such port is at the atomisp_yocto_v1:
> > > 
> > > 	https://git.linuxtv.org/mchehab/experimental.git/log/?h=atomisp_yocto_v1
> > > 
> > > The goal of this port is not for upstreaming it. Instead, it is meant
> > > to be used just for testing, using a version that should work - at least
> > > with the Intel Aero board with the Aero drone's camera (tests needed, as
> > > I don't have myself such hardware). This version is ISP2401 only.
> > > 
> > > The firmware for it is at:
> > > 	https://download.01.org/aero/deb/pool/main/f/firmware-atomisp/firmware-atomisp_0.1.orig.tar.xz
> > > 
> > > If the ISP revision is equal or bigger than rev 02, this file should be
> > > renamed to:
> > > 
> > > 	shisp_2401b0_v21.bin
> > > 
> > > Before getting excited, this version didn't work so far on my hardware:
> > > 
> > > 	atomisp: Loaded firmware version 'irci_stable_candrpv_0415_20150521_0458'.
> > > 	atomisp-isp2 0000:00:03.0: css load fw failed.
> > > 	atomisp-isp2 0000:00:03.0: Failed to init css.
> > > 
> > > (I didn't try to check why it is failing yet - maybe it is just
> > > some version port related issue)
> > > 
> > > If someone has access to the Intel Aero board, I'd appreciate if you
> > > could test it and send the results. If it fails too, it would be
> > > nice to have the dmesg output of this version and the dmesg from
> > > a version which works.    
> > 
> > Mauro, first of all thank you for working on this.
> > 
> > I wonder if you have tried to build and run the linux-4.4.76-aero-1.3
> > kernel on your T101HA ? It would be interesting to see if that one
> > does (not) have the "css load fw failed" errors and who knows you
> > might even be able to get that to actually show some sort of picture
> > from one of the 2 sensors on the T101HA ?  
> 
> Yes, I tried, but the Kernel doesn't even boot. Grub2 simply doesn't 
> show any messages when trying to boot a Kernel 4.4 Kernel on it.
> 
> As this device doesn't have any physical serial ports, and the only 
> USB cables I have are based on a chipset not supported by GRUB[1], I
> can't see where it is failing.
> 
> [1] A side note to myself: I need to spend some time checking what
> serial cables would work with grub2 and try to buy one such cable.

Eureka!

Looking at the Yocto's port, I noticed this comment:

	#ifdef CONFIG_INTEL_MID_ISP
	/* Moorefield lacks PCI PM, BYT advertises it but it's broken, use PUNIT */
	#define ATOMISP_INTERNAL_PM    (IS_MOFD || IS_BYT || IS_CHT)
	#endif

And some other codes like this:

	#ifdef CONFIG_INTEL_MID_ISP
	       if (ATOMISP_INTERNAL_PM) {
	               ret = atomisp_mrfld_power_up(isp);
	               if (ret)
	                       return ret;
	       }
	#endif


Basically, for some types of hardware, it has to disable the 
atomisp_mrfld_power_up() and atomisp_mrfld_power_down() calls.

So, a hack like this:

<code snip>
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 8c7b42221659..5c1f8bcc24f4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -824,12 +824,15 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */
 int atomisp_mrfld_power_down(struct atomisp_device *isp)
 {
+return 0;
+
 	return atomisp_mrfld_power(isp, false);
 }
 
 /* Workaround for pmu_nc_set_power_state not ready in MRFLD */
 int atomisp_mrfld_power_up(struct atomisp_device *isp)
 {
+return 0;
 	return atomisp_mrfld_power(isp, true);
 }
</code snip>
 
Made the firmware to properly load, and the driver now shows signs of life:

v4l2-ctl --all
Driver Info:
	Driver name      : atomisp
	Card type        : ATOM ISP
	Bus info         : PCI:0000:00:03.0
	Driver version   : 5.7.0
	Capabilities     : 0xa4200003
		Video Capture
		Video Output
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x24200003
		Video Capture
		Video Output
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : atomisp-isp2
	Model            : Intel Atom ISP
	Serial           : 
	Bus info         : 
	Media version    : 5.7.0
	Hardware revision: 0x00002010 (8208)
	Driver version   : 5.7.0
Interface Info:
	ID               : 0x03000016
	Type             : V4L Video
Entity Info:
	ID               : 0x00000014 (20)
	Name             : ATOMISP ISP CAPTURE output
	Function         : V4L2 I/O
	Pad 0x01000015   : 0: Sink
	  Link 0x02000062: from remote pad 0x1000010 of entity 'ATOMISP_SUBDEV_0': Data
Priority: 0
Video input : 0 (ATOMISP ISP CAPTURE output: ok)
Format Video Capture:
	Width/Height      : 0/0
	Pixel Format      : ''
	Field             : Any
	Bytes per Line    : 0
	Size Image        : 0
	Colorspace        : Default
	Transfer Function : Default (maps to Rec. 709)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
Streaming Parameters Video Capture:
	Frames per second: invalid (0/0)
	Read buffers     : 0
error 22 getting ctrl Automatic White Balance
error 22 getting ctrl Red Balance
error 22 getting ctrl Blue Balance
error 22 getting ctrl Gamma
error 22 getting ctrl exposure
error 22 getting ctrl Light frequency filter
             image_color_effect 0x0098091f (int)    : min=0 max=9 step=1 default=0 value=0
error 22 getting ctrl Image Color Effect CbCr
           bad_pixel_correction 0x08000000 (int)    : min=0 max=1 step=1 default=0 value=1
                        gdc_cac 0x08000001 (int)    : min=0 max=1 step=1 default=0 value=0
             video_stablization 0x08000002 (int)    : min=0 max=1 step=1 default=0 value=0
  fixed_pattern_noise_reduction 0x08000003 (int)    : min=0 max=1 step=1 default=0 value=0
         false_color_correction 0x08000004 (int)    : min=0 max=1 step=1 default=0 value=0
                 low_light_mode 0x08000005 (bool)   : default=1 value=0


It doesn't stream on yet:

	[ 1040.688130] atomisp-isp2 0000:00:03.0: sh_css_init success
	[ 1040.688748] BUG: unable to handle page fault for address: 0000000000004518
	[ 1040.688754] #PF: supervisor read access in kernel mode
	[ 1040.688757] #PF: error_code(0x0000) - not-present page
	[ 1040.688760] PGD 0 P4D 0 

But at least it is now showing some signals of life.

There are still lots of  work to do before it can run, but it sounds 
that we'll eventually get there.
Thanks,
Mauro

  reply	other threads:[~2020-05-19  7:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 19:57 [GIT PULL] Ressurect the atomisp staging driver Mauro Carvalho Chehab
2020-05-02  6:03 ` Greg KH
2020-05-20  7:48   ` Mauro Carvalho Chehab
2020-05-03  9:19 ` Francescodario Cuzzocrea
2020-05-03 10:07   ` Mauro Carvalho Chehab
2020-05-03 15:32   ` Mauro Carvalho Chehab
     [not found]     ` <CADnVkj96W0QfthukTKQ0a-i2fH1buooH3BEgfy22J9H9=_PcKA@mail.gmail.com>
2020-05-03 16:07       ` Patrik Gfeller
2020-05-04  8:16         ` Patrik Gfeller
2020-05-04  8:49           ` Mauro Carvalho Chehab
2020-05-04 10:45             ` Patrik Gfeller
2020-05-04 12:08               ` Mauro Carvalho Chehab
2020-05-04 13:44                 ` Patrik Gfeller
2020-05-15  8:32                   ` Mauro Carvalho Chehab
2020-05-15  9:10                     ` Hans de Goede
2020-05-15  9:42                       ` Mauro Carvalho Chehab
2020-05-19  7:39                         ` Mauro Carvalho Chehab [this message]
2020-05-19 17:36                           ` Mauro Carvalho Chehab
2020-05-22 10:46                             ` Hans de Goede
2020-05-22 11:42                               ` Mauro Carvalho Chehab
2020-05-23  8:00                                 ` Mauro Carvalho Chehab
2020-05-27 16:23                                   ` Hans de Goede
2020-05-27 17:36                                     ` Mauro Carvalho Chehab
2020-05-15  9:37                   ` Ressurect the atomisp staging driver - current progress Mauro Carvalho Chehab
2020-05-06 15:10                 ` [GIT PULL] Ressurect the atomisp staging driver Mauro Carvalho Chehab
2020-05-03  9:23 ` bosconovic
2020-05-16 13:23 [GIT,PULL] " Finn Rayment
     [not found] ` <20200516115459.4a24063b@coco.lan>
2020-05-16 19:53   ` Finn Rayment
2020-05-19 17:37     ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200519093920.7bb22161@coco.lan \
    --to=mchehab@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=francescodario.cuzzocrea@mail.polimi.it \
    --cc=hdegoede@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=patrik.gfeller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.