Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
On 24/08/11 21:12, Laurent Pinchart wrote: On Wednesday 24 August 2011 03:17:39 CJ wrote: On 23/08/11 19:47, Laurent Pinchart wrote: On Tuesday 23 August 2011 05:47:20 CJ wrote: On 22/08/11 22:15, Michael Jones wrote: I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? Check the kernel log for OMAP3 ISP-related messages. Here is the version running from SD card: # dmesg | grep isp [0.265502] omap-iommu omap-iommu.0: isp registered [2.986541] omap3isp omap3isp: Revision 2.0 found [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 [2.997406] omap3isp omap3isp: hist: DMA channel = 0 [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz From NAND using UBIFS: # dmesg | grep isp [3.457061] omap3isp omap3isp: Revision 2.0 found [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 [3.467620] omap3isp omap3isp: hist: DMA channel = 0 [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz Seems to be missing: omap-iommu omap-iommu.0: isp registered Is that the issue? Why would this not work when running from NAND? I'm not sure, either, but I had a similar problem before using Laurent's patch below. IIRC, usually udev would create /dev/media0 from a cached list of /dev/*. Later modutils would come along and load the modules in the proper order (iommu, then omap3-isp) and everybody was happy. Occasionally, udev would fail to use the cached version of /dev/, and look through /sys/devices to re-create the devices in /dev/. When media0 was found, omap3-isp.ko would be loaded, but iommu had not yet been, presumably because it doesn't have an entry in /sys/devices/. So maybe udev is behaving differently for you on NAND than it did on the card? Either way, as I said, using Laurent's patch below did the job for me. I'm not sure why it doesn't work from NAND, but the iommu2 module needs to be loaded before the omap3-isp module. Alternatively you can compile the iommu2 module in the kernel with diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 49a4c75..3c87644 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE module parameter). config OMAP_IOMMU - tristate + bool config OMAP_IOMMU_DEBUG tristate "Export OMAP IOMMU internals in DebugFS" Thanks for the help! For some reason dmesg does not read early kernel stuff when in UBIFS from NAND. So when I went back and had a look the line I thought was not there is actually included. [0.276977] omap-iommu omap-iommu.0: isp registered So I guess everything is loading fine. I tried the patch and it didn't make a difference. Regarding what Michael said /dev/media0 is not created by udev when boot from NAND. I tried creating it manually with: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 But this does not work - outputs: # media-ctl -r -l '"mt9p031 2-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) So is there a problem with udev? There could be. What's the output of ls /sys/class/video4linux #ls /sys/class/video4linux v4l-subdev0 v4l-subdev3 v4l-subdev6 video0 video3 video6 v4l-subdev1 v4l-subdev4 v4l-subdev7 video1 video4 v4l-subdev2 v4l-subdev5 v4l-subdev8 video2 video5 Devices are correctly registered with the Linux kernel. Does 'ls /dev/v4l- subdev*' show the same entries ? If not you probably have a udev issue. Slightly different.. # ls /dev/v4l-subdev* /dev/v4l-subdev0 /dev/v4l-subdev3 /dev/v4l-subdev6 /dev/v4l-subdev1 /dev/v4l-subdev4 /dev/v4l-subdev7 /dev/v4l-subdev2 /dev/v4l-subdev5 /dev/v4l-subdev8 I probably should have said this earlier .. but I am using mdev not udev. It does work fine with exactly the same system running from the card in EXT4. Any other thoughts? Cheers, Chris -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
On Wednesday 24 August 2011 03:17:39 CJ wrote: > On 23/08/11 19:47, Laurent Pinchart wrote: > > On Tuesday 23 August 2011 05:47:20 CJ wrote: > >> On 22/08/11 22:15, Michael Jones wrote: > >>> I am trying to get the mt9p031 working from nand with a ubifs file > >>> system and I am having a few problems. > >>> > >>> /dev/media0 is not present unless I run: > >>> #mknod /dev/media0 c 251 0 > >>> #chown root:video /dev/media0 > >>> > >>> #media-ctl -p > >>> Enumerating entities > >>> media_open: Unable to enumerate entities for device /dev/media0 > >>> (Inappropriate ioctl for device) > >>> > >>> With the same rig/files it works fine running from EXT4 on an SD > >>> card. Any idea why this does not work on nand with ubifs? > >> > >> Is the OMAP3 ISP driver loaded ? Has it probed the device > >> successfully ? Check the kernel log for OMAP3 ISP-related messages. > > > > Here is the version running from SD card: > > # dmesg | grep isp > > [0.265502] omap-iommu omap-iommu.0: isp registered > > [2.986541] omap3isp omap3isp: Revision 2.0 found > > [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 > > [2.997406] omap3isp omap3isp: hist: DMA channel = 0 > > [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > > 2160 Hz > > [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 > > Hz > > > >From NAND using UBIFS: > > # dmesg | grep isp > > [3.457061] omap3isp omap3isp: Revision 2.0 found > > [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 > > [3.467620] omap3isp omap3isp: hist: DMA channel = 0 > > [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > > 2160 Hz > > [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 > > Hz > > > > Seems to be missing: > > omap-iommu omap-iommu.0: isp registered > > > > Is that the issue? Why would this not work when running from NAND? > >>> > >>> I'm not sure, either, but I had a similar problem before using > >>> Laurent's patch below. IIRC, usually udev would create /dev/media0 > >>> from a cached list of /dev/*. Later modutils would come along and load > >>> the modules in the proper order (iommu, then omap3-isp) and everybody > >>> was happy. Occasionally, udev would fail to use the cached version of > >>> /dev/, and look through /sys/devices to re-create the devices in > >>> /dev/. When media0 was found, omap3-isp.ko would be loaded, but iommu > >>> had not yet been, presumably because it doesn't have an entry in > >>> /sys/devices/. So maybe udev is behaving differently for you on NAND > >>> than it did on the card? Either way, as I said, using Laurent's patch > >>> below did the job for me. > >>> > I'm not sure why it doesn't work from NAND, but the iommu2 module > needs to be loaded before the omap3-isp module. Alternatively you can > compile the iommu2 module in the kernel with > > diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > index 49a4c75..3c87644 100644 > --- a/arch/arm/plat-omap/Kconfig > +++ b/arch/arm/plat-omap/Kconfig > @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE > > module parameter). > > config OMAP_IOMMU > > - tristate > + bool > > config OMAP_IOMMU_DEBUG > > tristate "Export OMAP IOMMU internals in DebugFS" > >> > >> Thanks for the help! > >> > >> For some reason dmesg does not read early kernel stuff when in UBIFS > >> from NAND. > >> So when I went back and had a look the line I thought was not there is > >> actually included. > >> > >> [0.276977] omap-iommu omap-iommu.0: isp registered > >> > >> So I guess everything is loading fine. > >> > >> I tried the patch and it didn't make a difference. > >> > >> Regarding what Michael said /dev/media0 is not created by udev when boot > >> from NAND. > >> I tried creating it manually with: > >> #mknod /dev/media0 c 251 0 > >> #chown root:video /dev/media0 > >> > >> But this does not work - outputs: > >> > >> # media-ctl -r -l '"mt9p031 2-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP > >> CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP > >> resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' > >> media_open: Unable to enumerate entities for device /dev/media0 > >> (Inappropriate ioctl for device) > >> > >> So is there a problem with udev? > > > > There could be. What's the output of > > > > ls /sys/class/video4linux > > #ls /sys/class/video4linux > v4l-subdev0 v4l-subdev3 v4l-subdev6 video0 video3 video6 > v4l-subdev1 v4l-subdev4 v4l-subdev7 video1 video4 > v4l-subdev2 v4l-subdev5 v4l-subdev8 video2 video5 Devices are correctly registered with the Linux kernel. Does 'ls /dev
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Laurent, On 23/08/11 19:47, Laurent Pinchart wrote: Hi Chris, On Tuesday 23 August 2011 05:47:20 CJ wrote: On 22/08/11 22:15, Michael Jones wrote: I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? Check the kernel log for OMAP3 ISP-related messages. Here is the version running from SD card: # dmesg | grep isp [0.265502] omap-iommu omap-iommu.0: isp registered [2.986541] omap3isp omap3isp: Revision 2.0 found [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 [2.997406] omap3isp omap3isp: hist: DMA channel = 0 [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz From NAND using UBIFS: # dmesg | grep isp [3.457061] omap3isp omap3isp: Revision 2.0 found [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 [3.467620] omap3isp omap3isp: hist: DMA channel = 0 [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz Seems to be missing: omap-iommu omap-iommu.0: isp registered Is that the issue? Why would this not work when running from NAND? I'm not sure, either, but I had a similar problem before using Laurent's patch below. IIRC, usually udev would create /dev/media0 from a cached list of /dev/*. Later modutils would come along and load the modules in the proper order (iommu, then omap3-isp) and everybody was happy. Occasionally, udev would fail to use the cached version of /dev/, and look through /sys/devices to re-create the devices in /dev/. When media0 was found, omap3-isp.ko would be loaded, but iommu had not yet been, presumably because it doesn't have an entry in /sys/devices/. So maybe udev is behaving differently for you on NAND than it did on the card? Either way, as I said, using Laurent's patch below did the job for me. I'm not sure why it doesn't work from NAND, but the iommu2 module needs to be loaded before the omap3-isp module. Alternatively you can compile the iommu2 module in the kernel with diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 49a4c75..3c87644 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE module parameter). config OMAP_IOMMU - tristate + bool config OMAP_IOMMU_DEBUG tristate "Export OMAP IOMMU internals in DebugFS" Thanks for the help! For some reason dmesg does not read early kernel stuff when in UBIFS from NAND. So when I went back and had a look the line I thought was not there is actually included. [0.276977] omap-iommu omap-iommu.0: isp registered So I guess everything is loading fine. I tried the patch and it didn't make a difference. Regarding what Michael said /dev/media0 is not created by udev when boot from NAND. I tried creating it manually with: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 But this does not work - outputs: # media-ctl -r -l '"mt9p031 2-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) So is there a problem with udev? There could be. What's the output of ls /sys/class/video4linux #ls /sys/class/video4linux v4l-subdev0 v4l-subdev3 v4l-subdev6 video0 video3 video6 v4l-subdev1 v4l-subdev4 v4l-subdev7 video1 video4 v4l-subdev2 v4l-subdev5 v4l-subdev8 video2 video5 Cheers, Chris -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Chris, On Tuesday 23 August 2011 05:47:20 CJ wrote: > On 22/08/11 22:15, Michael Jones wrote: > > I am trying to get the mt9p031 working from nand with a ubifs file > > system and I am having a few problems. > > > > /dev/media0 is not present unless I run: > > #mknod /dev/media0 c 251 0 > > #chown root:video /dev/media0 > > > > #media-ctl -p > > Enumerating entities > > media_open: Unable to enumerate entities for device /dev/media0 > > (Inappropriate ioctl for device) > > > > With the same rig/files it works fine running from EXT4 on an SD > > card. Any idea why this does not work on nand with ubifs? > > Is the OMAP3 ISP driver loaded ? Has it probed the device successfully > ? Check the kernel log for OMAP3 ISP-related messages. > >>> > >>> Here is the version running from SD card: > >>> # dmesg | grep isp > >>> [0.265502] omap-iommu omap-iommu.0: isp registered > >>> [2.986541] omap3isp omap3isp: Revision 2.0 found > >>> [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 > >>> [2.997406] omap3isp omap3isp: hist: DMA channel = 0 > >>> [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > >>> 2160 Hz > >>> [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz > >>> > >>> From NAND using UBIFS: > >>> # dmesg | grep isp > >>> [3.457061] omap3isp omap3isp: Revision 2.0 found > >>> [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 > >>> [3.467620] omap3isp omap3isp: hist: DMA channel = 0 > >>> [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > >>> 2160 Hz > >>> [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz > >>> > >>> Seems to be missing: > >>> omap-iommu omap-iommu.0: isp registered > >>> > >>> Is that the issue? Why would this not work when running from NAND? > > > > I'm not sure, either, but I had a similar problem before using Laurent's > > patch below. IIRC, usually udev would create /dev/media0 from a cached > > list of /dev/*. Later modutils would come along and load the modules in > > the proper order (iommu, then omap3-isp) and everybody was happy. > > Occasionally, udev would fail to use the cached version of /dev/, and > > look through /sys/devices to re-create the devices in /dev/. When media0 > > was found, omap3-isp.ko would be loaded, but iommu had not yet been, > > presumably because it doesn't have an entry in /sys/devices/. So maybe > > udev is behaving differently for you on NAND than it did on the card? > > Either way, as I said, using Laurent's patch below did the job for me. > > > >> I'm not sure why it doesn't work from NAND, but the iommu2 module needs > >> to be loaded before the omap3-isp module. Alternatively you can compile > >> the iommu2 module in the kernel with > >> > >> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > >> index 49a4c75..3c87644 100644 > >> --- a/arch/arm/plat-omap/Kconfig > >> +++ b/arch/arm/plat-omap/Kconfig > >> @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE > >> > >> module parameter). > >> > >> config OMAP_IOMMU > >> > >> - tristate > >> + bool > >> > >> config OMAP_IOMMU_DEBUG > >> > >> tristate "Export OMAP IOMMU internals in DebugFS" > > Thanks for the help! > > For some reason dmesg does not read early kernel stuff when in UBIFS > from NAND. > So when I went back and had a look the line I thought was not there is > actually included. > > [0.276977] omap-iommu omap-iommu.0: isp registered > > So I guess everything is loading fine. > > I tried the patch and it didn't make a difference. > > Regarding what Michael said /dev/media0 is not created by udev when boot > from NAND. > I tried creating it manually with: > #mknod /dev/media0 c 251 0 > #chown root:video /dev/media0 > > But this does not work - outputs: > > # media-ctl -r -l '"mt9p031 2-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP > CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP > resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' > media_open: Unable to enumerate entities for device /dev/media0 > (Inappropriate ioctl for device) > > So is there a problem with udev? There could be. What's the output of ls /sys/class/video4linux -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Laurent and Michael, On 22/08/11 22:15, Michael Jones wrote: I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? Check the kernel log for OMAP3 ISP-related messages. Here is the version running from SD card: # dmesg | grep isp [0.265502] omap-iommu omap-iommu.0: isp registered [2.986541] omap3isp omap3isp: Revision 2.0 found [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 [2.997406] omap3isp omap3isp: hist: DMA channel = 0 [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz From NAND using UBIFS: # dmesg | grep isp [3.457061] omap3isp omap3isp: Revision 2.0 found [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 [3.467620] omap3isp omap3isp: hist: DMA channel = 0 [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz Seems to be missing: omap-iommu omap-iommu.0: isp registered Is that the issue? Why would this not work when running from NAND? I'm not sure, either, but I had a similar problem before using Laurent's patch below. IIRC, usually udev would create /dev/media0 from a cached list of /dev/*. Later modutils would come along and load the modules in the proper order (iommu, then omap3-isp) and everybody was happy. Occasionally, udev would fail to use the cached version of /dev/, and look through /sys/devices to re-create the devices in /dev/. When media0 was found, omap3-isp.ko would be loaded, but iommu had not yet been, presumably because it doesn't have an entry in /sys/devices/. So maybe udev is behaving differently for you on NAND than it did on the card? Either way, as I said, using Laurent's patch below did the job for me. -Michael I'm not sure why it doesn't work from NAND, but the iommu2 module needs to be loaded before the omap3-isp module. Alternatively you can compile the iommu2 module in the kernel with diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 49a4c75..3c87644 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE module parameter). config OMAP_IOMMU - tristate + bool config OMAP_IOMMU_DEBUG tristate "Export OMAP IOMMU internals in DebugFS" Thanks for the help! For some reason dmesg does not read early kernel stuff when in UBIFS from NAND. So when I went back and had a look the line I thought was not there is actually included. [0.276977] omap-iommu omap-iommu.0: isp registered So I guess everything is loading fine. I tried the patch and it didn't make a difference. Regarding what Michael said /dev/media0 is not created by udev when boot from NAND. I tried creating it manually with: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 But this does not work - outputs: # media-ctl -r -l '"mt9p031 2-0048":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) So is there a problem with udev? Cheers, Chris -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Chris, On 08/22/2011 11:41 AM, Laurent Pinchart wrote: > > Hi Chris, > > On Monday 22 August 2011 06:12:41 CJ wrote: >> On 19/08/11 22:12, Laurent Pinchart wrote: I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? >>> >>> Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? >>> Check the kernel log for OMAP3 ISP-related messages. >> >> Here is the version running from SD card: >> # dmesg | grep isp >> [0.265502] omap-iommu omap-iommu.0: isp registered >> [2.986541] omap3isp omap3isp: Revision 2.0 found >> [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 >> [2.997406] omap3isp omap3isp: hist: DMA channel = 0 >> [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to >> 2160 Hz >> [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz >> >> From NAND using UBIFS: >> # dmesg | grep isp >> [3.457061] omap3isp omap3isp: Revision 2.0 found >> [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 >> [3.467620] omap3isp omap3isp: hist: DMA channel = 0 >> [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to >> 2160 Hz >> [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz >> >> Seems to be missing: >> omap-iommu omap-iommu.0: isp registered >> >> Is that the issue? Why would this not work when running from NAND? I'm not sure, either, but I had a similar problem before using Laurent's patch below. IIRC, usually udev would create /dev/media0 from a cached list of /dev/*. Later modutils would come along and load the modules in the proper order (iommu, then omap3-isp) and everybody was happy. Occasionally, udev would fail to use the cached version of /dev/, and look through /sys/devices to re-create the devices in /dev/. When media0 was found, omap3-isp.ko would be loaded, but iommu had not yet been, presumably because it doesn't have an entry in /sys/devices/. So maybe udev is behaving differently for you on NAND than it did on the card? Either way, as I said, using Laurent's patch below did the job for me. -Michael > > I'm not sure why it doesn't work from NAND, but the iommu2 module needs to be > loaded before the omap3-isp module. Alternatively you can compile the iommu2 > module in the kernel with > > diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > index 49a4c75..3c87644 100644 > --- a/arch/arm/plat-omap/Kconfig > +++ b/arch/arm/plat-omap/Kconfig > @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE > module parameter). > > config OMAP_IOMMU > - tristate > + bool > > config OMAP_IOMMU_DEBUG > tristate "Export OMAP IOMMU internals in DebugFS" > MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler Registergericht: Amtsgericht Stuttgart, HRB 271090 Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Chris, On Monday 22 August 2011 06:12:41 CJ wrote: > On 19/08/11 22:12, Laurent Pinchart wrote: > >> I am trying to get the mt9p031 working from nand with a ubifs file > >> system and I am having a few problems. > >> > >> /dev/media0 is not present unless I run: > >> #mknod /dev/media0 c 251 0 > >> #chown root:video /dev/media0 > >> > >> #media-ctl -p > >> Enumerating entities > >> media_open: Unable to enumerate entities for device /dev/media0 > >> (Inappropriate ioctl for device) > >> > >> With the same rig/files it works fine running from EXT4 on an SD card. > >> Any idea why this does not work on nand with ubifs? > > > > Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? > > Check the kernel log for OMAP3 ISP-related messages. > > Here is the version running from SD card: > # dmesg | grep isp > [0.265502] omap-iommu omap-iommu.0: isp registered > [2.986541] omap3isp omap3isp: Revision 2.0 found > [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 > [2.997406] omap3isp omap3isp: hist: DMA channel = 0 > [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > 2160 Hz > [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz > > From NAND using UBIFS: > # dmesg | grep isp > [3.457061] omap3isp omap3isp: Revision 2.0 found > [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 > [3.467620] omap3isp omap3isp: hist: DMA channel = 0 > [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to > 2160 Hz > [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz > > Seems to be missing: > omap-iommu omap-iommu.0: isp registered > > Is that the issue? Why would this not work when running from NAND? I'm not sure why it doesn't work from NAND, but the iommu2 module needs to be loaded before the omap3-isp module. Alternatively you can compile the iommu2 module in the kernel with diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 49a4c75..3c87644 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -132,7 +132,7 @@ config OMAP_MBOX_KFIFO_SIZE module parameter). config OMAP_IOMMU - tristate + bool config OMAP_IOMMU_DEBUG tristate "Export OMAP IOMMU internals in DebugFS" -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi, On 19/08/11 22:12, Laurent Pinchart wrote: I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? Check the kernel log for OMAP3 ISP-related messages. Here is the version running from SD card: # dmesg | grep isp [0.265502] omap-iommu omap-iommu.0: isp registered [2.986541] omap3isp omap3isp: Revision 2.0 found [2.991577] omap-iommu omap-iommu.0: isp: version 1.1 [2.997406] omap3isp omap3isp: hist: DMA channel = 0 [3.006256] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.011932] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz From NAND using UBIFS: # dmesg | grep isp [3.457061] omap3isp omap3isp: Revision 2.0 found [3.462036] omap-iommu omap-iommu.0: isp: version 1.1 [3.467620] omap3isp omap3isp: hist: DMA channel = 0 [3.472564] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 2160 Hz [3.478027] omap3isp omap3isp: isp_set_xclk(): cam_xclka set to 0 Hz Seems to be missing: omap-iommu omap-iommu.0: isp registered Is that the issue? Why would this not work when running from NAND? Cheers, Chris -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi, On Friday 19 August 2011 04:13:23 CJ wrote: > Hi, > > I am trying to get the mt9p031 working from nand with a ubifs file > system and I am having a few problems. > > /dev/media0 is not present unless I run: > #mknod /dev/media0 c 251 0 > #chown root:video /dev/media0 > > #media-ctl -p > Enumerating entities > media_open: Unable to enumerate entities for device /dev/media0 > (Inappropriate ioctl for device) > > With the same rig/files it works fine running from EXT4 on an SD card. > Any idea why this does not work on nand with ubifs? Is the OMAP3 ISP driver loaded ? Has it probed the device successfully ? Check the kernel log for OMAP3 ISP-related messages. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi, I am trying to get the mt9p031 working from nand with a ubifs file system and I am having a few problems. /dev/media0 is not present unless I run: #mknod /dev/media0 c 251 0 #chown root:video /dev/media0 #media-ctl -p Enumerating entities media_open: Unable to enumerate entities for device /dev/media0 (Inappropriate ioctl for device) With the same rig/files it works fine running from EXT4 on an SD card. Any idea why this does not work on nand with ubifs? Regards, CJ On 13/06/11 22:39, javier Martin wrote: On 8 June 2011 18:24, Laurent Pinchart wrote: That works much better, thank you. -- Regards, Laurent Pinchart So, how is it going? Are you finally accepting the patches for mainline? Thank you, -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Javier, On Friday 17 June 2011 17:26:26 javier Martin wrote: > Laurent, > have you been able to successfully test the driver? > > I've found some issues and I don't know whether I should send a new version > or just wait for you to mainline the last one and send a patch later. Sorry for the late reply. I've briefly tested the driver but haven't been able to work on it. Please send a new version if you have one (with a description of the changes since the previous version). I'll then test that and push it to mainline through my tree (with a couple of changes if needed, I'll ask for your ack before pushing the driver). -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Laurent, have you been able to successfully test the driver? I've found some issues and I don't know whether I should send a new version or just wait for you to mainline the last one and send a patch later. -- Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
On 8 June 2011 18:24, Laurent Pinchart wrote: > That works much better, thank you. > > -- > Regards, > > Laurent Pinchart > So, how is it going? Are you finally accepting the patches for mainline? Thank you, -- Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Koen, On Wednesday 08 June 2011 14:47:13 Koen Kooi wrote: > Op 8 jun 2011, om 14:42 heeft javier Martin het volgende geschreven: > > On 8 June 2011 14:39, Guennadi Liakhovetski wrote: > >> On Wed, 8 Jun 2011, Koen Kooi wrote: > >>> Op 8 jun 2011, om 13:57 heeft Laurent Pinchart het volgende geschreven: > Hi Javier, > > I'm testing your patch on a 2.6.39 kernel. Here's what I get when > loading the omap3-isp module. > > root@arago:~# modprobe omap3-isp > [ 159.523681] omap3isp omap3isp: Revision 15.0 found > [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 > [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost > [ 159.881622] mt9p031 2-0048: Failed to reset the camera > [ 159.887054] omap3isp omap3isp: Failed to power on: -5 > [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 > [ 159.898956] isp_register_subdev_group: Unable to register subdev > mt9p031 > > Have you (or anyone else) seen that issue ? > >>> > >>> I build in both statically to avoid that problem. > >> > >> I used modules and it worked for me. > > > > Maybe u-boot version Laurent uses does not enable internal pull-up > > resistors for i2c2 interface. > > You could either use a different u-boot version or attach external > > pull-up resistors to that interface. > > http://dominion.thruhere.net/koen/angstrom/beagleboard/2.6.39/MLO > http://dominion.thruhere.net/koen/angstrom/beagleboard/2.6.39/u-boot.bin > > The above MLO and uboot enable the pullups and work will all released > versions of the beagleboard. That works much better, thank you. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Op 8 jun 2011, om 14:42 heeft javier Martin het volgende geschreven: > On 8 June 2011 14:39, Guennadi Liakhovetski wrote: >> On Wed, 8 Jun 2011, Koen Kooi wrote: >> >>> >>> Op 8 jun 2011, om 13:57 heeft Laurent Pinchart het volgende geschreven: >>> Hi Javier, I'm testing your patch on a 2.6.39 kernel. Here's what I get when loading the omap3-isp module. root@arago:~# modprobe omap3-isp [ 159.523681] omap3isp omap3isp: Revision 15.0 found [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost [ 159.881622] mt9p031 2-0048: Failed to reset the camera [ 159.887054] omap3isp omap3isp: Failed to power on: -5 [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 [ 159.898956] isp_register_subdev_group: Unable to register subdev mt9p031 Have you (or anyone else) seen that issue ? >>> >>> I build in both statically to avoid that problem. >> >> I used modules and it worked for me. > > Maybe u-boot version Laurent uses does not enable internal pull-up > resistors for i2c2 interface. > You could either use a different u-boot version or attach external > pull-up resistors to that interface. http://dominion.thruhere.net/koen/angstrom/beagleboard/2.6.39/MLO http://dominion.thruhere.net/koen/angstrom/beagleboard/2.6.39/u-boot.bin The above MLO and uboot enable the pullups and work will all released versions of the beagleboard. regards, Koen-- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
On 8 June 2011 14:39, Guennadi Liakhovetski wrote: > On Wed, 8 Jun 2011, Koen Kooi wrote: > >> >> Op 8 jun 2011, om 13:57 heeft Laurent Pinchart het volgende geschreven: >> >> > Hi Javier, >> > >> > I'm testing your patch on a 2.6.39 kernel. Here's what I get when loading >> > the >> > omap3-isp module. >> > >> > root@arago:~# modprobe omap3-isp >> > [ 159.523681] omap3isp omap3isp: Revision 15.0 found >> > [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 >> > [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost >> > [ 159.881622] mt9p031 2-0048: Failed to reset the camera >> > [ 159.887054] omap3isp omap3isp: Failed to power on: -5 >> > [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 >> > [ 159.898956] isp_register_subdev_group: Unable to register subdev mt9p031 >> > >> > Have you (or anyone else) seen that issue ? >> >> I build in both statically to avoid that problem. > > I used modules and it worked for me. Maybe u-boot version Laurent uses does not enable internal pull-up resistors for i2c2 interface. You could either use a different u-boot version or attach external pull-up resistors to that interface. -- Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
On Wed, 8 Jun 2011, Koen Kooi wrote: > > Op 8 jun 2011, om 13:57 heeft Laurent Pinchart het volgende geschreven: > > > Hi Javier, > > > > I'm testing your patch on a 2.6.39 kernel. Here's what I get when loading > > the > > omap3-isp module. > > > > root@arago:~# modprobe omap3-isp > > [ 159.523681] omap3isp omap3isp: Revision 15.0 found > > [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 > > [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost > > [ 159.881622] mt9p031 2-0048: Failed to reset the camera > > [ 159.887054] omap3isp omap3isp: Failed to power on: -5 > > [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 > > [ 159.898956] isp_register_subdev_group: Unable to register subdev mt9p031 > > > > Have you (or anyone else) seen that issue ? > > I build in both statically to avoid that problem. I used modules and it worked for me. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [beagleboard] Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Op 8 jun 2011, om 13:57 heeft Laurent Pinchart het volgende geschreven: > Hi Javier, > > I'm testing your patch on a 2.6.39 kernel. Here's what I get when loading the > omap3-isp module. > > root@arago:~# modprobe omap3-isp > [ 159.523681] omap3isp omap3isp: Revision 15.0 found > [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 > [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost > [ 159.881622] mt9p031 2-0048: Failed to reset the camera > [ 159.887054] omap3isp omap3isp: Failed to power on: -5 > [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 > [ 159.898956] isp_register_subdev_group: Unable to register subdev mt9p031 > > Have you (or anyone else) seen that issue ? I build in both statically to avoid that problem. regards, Koen-- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
Hi Javier, I'm testing your patch on a 2.6.39 kernel. Here's what I get when loading the omap3-isp module. root@arago:~# modprobe omap3-isp [ 159.523681] omap3isp omap3isp: Revision 15.0 found [ 159.528991] omap-iommu omap-iommu.0: isp: version 1.1 [ 159.875701] omap_i2c omap_i2c.2: Arbitration lost [ 159.881622] mt9p031 2-0048: Failed to reset the camera [ 159.887054] omap3isp omap3isp: Failed to power on: -5 [ 159.892425] mt9p031 2-0048: Failed to power on device: -5 [ 159.898956] isp_register_subdev_group: Unable to register subdev mt9p031 Have you (or anyone else) seen that issue ? -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v7 1/2] Add driver for Aptina (Micron) mt9p031 sensor.
This version fixes some cosmetic issues pointed out by Guennadi. Signed-off-by: Javier Martin --- drivers/media/video/Kconfig |7 + drivers/media/video/Makefile |1 + drivers/media/video/mt9p031.c | 763 + include/media/mt9p031.h | 23 ++ 4 files changed, 794 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/mt9p031.c create mode 100644 include/media/mt9p031.h diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 00f51dd..5f851f0 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -329,6 +329,13 @@ config VIDEO_OV7670 OV7670 VGA camera. It currently only works with the M88ALP01 controller. +config VIDEO_MT9P031 + tristate "Aptina MT9P031 support" + depends on I2C && VIDEO_V4L2 + ---help--- + This is a Video4Linux2 sensor-level driver for the Aptina + (Micron) mt9p031 5 Mpixel camera. + config VIDEO_MT9V011 tristate "Micron mt9v011 sensor support" depends on I2C && VIDEO_V4L2 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index ace5d8b..912b29b 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o +obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c new file mode 100644 index 000..36c47df --- /dev/null +++ b/drivers/media/video/mt9p031.c @@ -0,0 +1,763 @@ +/* + * Driver for MT9P031 CMOS Image Sensor from Aptina + * + * Copyright (C) 2011, Javier Martin + * + * Copyright (C) 2011, Guennadi Liakhovetski + * + * Based on the MT9V032 driver and Bastian Hecht's code. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define MT9P031_EXTCLK_FREQ2000 + +#define MT9P031_CHIP_VERSION 0x00 +#defineMT9P031_CHIP_VERSION_VALUE 0x1801 +#define MT9P031_ROW_START 0x01 +#defineMT9P031_ROW_START_MIN 1 +#defineMT9P031_ROW_START_MAX 2004 +#defineMT9P031_ROW_START_DEF 54 +#define MT9P031_COLUMN_START 0x02 +#defineMT9P031_COLUMN_START_MIN1 +#defineMT9P031_COLUMN_START_MAX2750 +#defineMT9P031_COLUMN_START_DEF16 +#define MT9P031_WINDOW_HEIGHT 0x03 +#defineMT9P031_WINDOW_HEIGHT_MIN 2 +#defineMT9P031_WINDOW_HEIGHT_MAX 2003 +#defineMT9P031_WINDOW_HEIGHT_DEF 2003 +#define MT9P031_WINDOW_WIDTH 0x04 +#defineMT9P031_WINDOW_WIDTH_MIN18 +#defineMT9P031_WINDOW_WIDTH_MAX2751 +#defineMT9P031_WINDOW_WIDTH_DEF2751 +#define MT9P031_H_BLANKING 0x05 +#defineMT9P031_H_BLANKING_VALUE0 +#define MT9P031_V_BLANKING 0x06 +#defineMT9P031_V_BLANKING_VALUE25 +#define MT9P031_OUTPUT_CONTROL 0x07 +#defineMT9P031_OUTPUT_CONTROL_CEN 2 +#defineMT9P031_OUTPUT_CONTROL_SYN 1 +#define MT9P031_SHUTTER_WIDTH_UPPER0x08 +#define MT9P031_SHUTTER_WIDTH 0x09 +#defineMT9P031_PLL_CONTROL 0x10 +#defineMT9P031_PLL_CONTROL_PWROFF 0x0050 +#defineMT9P031_PLL_CONTROL_PWRON 0x0051 +#defineMT9P031_PLL_CONTROL_USEPLL 0x0052 +#defineMT9P031_PLL_CONFIG_10x11 +#defineMT9P031_PLL_CONFIG_1_M_48MHZ0x5000 +#defineMT9P031_PLL_CONFIG_1_N_48MHZ0x05 +#defineMT9P031_PLL_CONFIG_1_M_96MHZ0x3600 +#defineMT9P031_PLL_CONFIG_1_N_96MHZ0x05 +#defineMT9P031_PLL_CONFIG_20x12 +#defineMT9P031_PLL_CONFIG_2_P1_48MHZ 5 +#defineMT9P031_PLL_CONFIG_2_P1_96MHZ 2 +#define MT9P031_PIXEL_CLOCK_CONTROL0x0a +#define MT9P031_FRAME_RESTART 0x0b +#define MT9P031_SHUTTER_DELAY 0x0c +#define MT9P031_RST0x0d +#defineMT9P031_RST_ENABLE 1 +#defi