Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: atomisp: TODO: make it updated to the current issues

Now that this driver starting to show signals of real progress,
let's update its TODO list.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

+126 -65
+126 -65
drivers/staging/media/atomisp/TODO
··· 1 + For both Cherrytrail (CHT) and Baytrail (BHT) the driver 2 + requires the "candrpv_0415_20150521_0458" firmware version. 3 + It should be noticed that the firmware file is different, 4 + depending on the ISP model, so they're stored with different 5 + names: 6 + 7 + - for BHT: /lib/firmware/shisp_2400b0_v21.bin 8 + 9 + Warning: The driver was not tested yet for BHT. 10 + 11 + - for CHT: /lib/firmware/shisp_2401a0_v21.bin 12 + 13 + https://github.com/intel-aero/meta-intel-aero-base/blob/master/recipes-kernel/linux/linux-yocto/shisp_2401a0_v21.bin 14 + 1 15 NOTE: 2 16 ===== 3 17 4 - While the driver probes the hardware and reports itself as a 5 - V4L2 driver, there are still some issues preventing it to 6 - stream (at least it doesn't with the standard V4L2 applications. 7 - Didn't test yet with some custom-made app for this driver). 8 - Solving the related bugs and issues preventing it to work is 9 - needed (items 6 and 7 from the list below). 18 + This driver currently doesn't work with most V4L2 applications, 19 + as there are still some issues with regards to implementing 20 + certain APIs at the standard way. 21 + 22 + Also, currently only USERPTR streaming mode is working. 23 + 24 + In order to test, it is needed to know what's the sensor's 25 + resolution. This can be checked with: 26 + 27 + $ v4l2-ctl --get-fmt-video 28 + Format Video Capture: 29 + Width/Height : 1600/1200 30 + ... 31 + 32 + It is known to work with: 33 + 34 + - v4l2grab at contrib/test directory at https://git.linuxtv.org/v4l-utils.git/ 35 + 36 + The resolution should not be bigger than the max resolution 37 + supported by the sensor, or it will fail. So, if the sensor 38 + reports: 39 + 40 + The driver can be tested with: 41 + 42 + v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -u 43 + 44 + - NVT at https://github.com/intel/nvt 45 + 46 + $ ./v4l2n -o testimage_@.raw \ 47 + --device /dev/video2 \ 48 + --input 0 \ 49 + --exposure=30000,30000,30000,30000 \ 50 + --parm type=1,capturemode=CI_MODE_PREVIEW \ 51 + --fmt type=1,width=1600,height=1200,pixelformat=YUYV \ 52 + --reqbufs count=2,memory=USERPTR \ 53 + --parameters=wb_config.r=32768,wb_config.gr=21043,wb_config.gb=21043,wb_config.b=30863 \ 54 + --capture=20 55 + 56 + As the output is in raw format, images need to be converted with: 57 + 58 + $ for i in $(seq 0 19); do 59 + name="testimage_$(printf "%03i" $i)" 60 + ./raw2pnm -x$WIDTH -y$HEIGHT -f$FORMAT $name.raw $name.pnm 61 + rm $name.raw 62 + done 10 63 11 64 TODO 12 65 ==== 13 66 14 - 1. The atomisp doesn't rely at the usual i2c stuff to discover the 15 - sensors. Instead, it calls a function from atomisp_gmin_platform.c. 16 - There are some hacks added there for it to wait for sensors to be 17 - probed (with a timeout of 2 seconds or so). 18 - This should be converted to the usual way, using V4L2 async subdev 19 - framework to wait for cameras to be probed; 67 + 1. Fix support for MMAP streaming mode. This is required for most 68 + V4L2 applications; 20 69 21 - 2. Use ACPI _DSM table - DONE! 70 + 2. Implement and/or fix V4L2 ioctls in order to allow a normal app to 71 + use it; 22 72 23 - 3. Switch the driver to use pm_runtime stuff. Right now, it probes the 24 - existing PMIC code and sensors call it directly. 73 + 3. Ensure that the driver will pass v4l2-compliance tests; 25 74 26 - 4. There's a problem at the sensor drivers: when trying to set a video 27 - format, the atomisp main driver calls the sensor drivers with the 28 - sensor turned off. This causes them to fail. 75 + 4. Get manufacturer's authorization to redistribute the binaries for 76 + the firmware files; 29 77 30 - The only exception is the atomisp-ov2880, which has a hack inside it 31 - to turn it on when VIDIOC_S_FMT is called. 78 + 5. remove VIDEO_ATOMISP_ISP2401, making the driver to auto-detect the 79 + register address differences between ISP2400 and ISP2401; 32 80 33 - The right fix seems to power on the sensor when a video device is 34 - opened (or at the first VIDIOC_ ioctl - except for VIDIOC_QUERYCAP), 35 - powering it down at close() syscall. 81 + 6. Cleanup the driver code, removing the abstraction layers inside it; 36 82 37 - Such kind of control would need to be done inside the atomisp driver, 38 - not at the sensors code. 83 + 7. The atomisp doesn't rely at the usual i2c stuff to discover the 84 + sensors. Instead, it calls a function from atomisp_gmin_platform.c. 85 + There are some hacks added there for it to wait for sensors to be 86 + probed (with a timeout of 2 seconds or so). This should be converted 87 + to the usual way, using V4L2 async subdev framework to wait for 88 + cameras to be probed; 39 89 40 - 5. There are several issues related to memory management, causing 41 - crashes. The atomisp splits the memory management on three separate 42 - regions: 90 + 8. Switch to standard V4L2 sub-device API for sensor and lens. In 91 + particular, the user space API needs to support V4L2 controls as 92 + defined in the V4L2 spec and references to atomisp must be removed from 93 + these drivers. 94 + 95 + 9. Use LED flash API for flash LED drivers such as LM3554 (which already 96 + has a LED class driver). 97 + 98 + 10. Migrate the sensor drivers out of staging or re-using existing 99 + drivers; 100 + 101 + 11. Switch the driver to use pm_runtime stuff. Right now, it probes the 102 + existing PMIC code and sensors call it directly. 103 + 104 + 12. There's a problem on sensor drivers: when trying to set a video 105 + format, the atomisp main driver calls the sensor drivers with the 106 + sensor turned off. This causes them to fail. 107 + 108 + This was fixed at atomisp-ov2880, which has a hack inside it 109 + to turn it on when VIDIOC_S_FMT is called, but this has to be 110 + cheked on other drivers as well. 111 + 112 + The right fix seems to power on the sensor when a video device is 113 + opened (or at the first VIDIOC_ ioctl - except for VIDIOC_QUERYCAP), 114 + powering it down at close() syscall. 115 + 116 + Such kind of control would need to be done inside the atomisp driver, 117 + not at the sensors code. 118 + 119 + 13. There are several issues related to memory management, that can 120 + cause crashes and/or memory leaks. The atomisp splits the memory 121 + management on three separate regions: 43 122 44 123 - dynamic pool; 45 124 - reserved pool; 46 125 - generic pool 47 126 48 - The code implementing it is at: 127 + The code implementing it is at: 49 128 50 129 drivers/staging/media/atomisp/pci/hmm/ 51 130 52 - It also has a separate code for managing DMA buffers at: 131 + It also has a separate code for managing DMA buffers at: 53 132 54 133 drivers/staging/media/atomisp/pci/mmu/ 55 134 56 - The code there is really dirty, ugly and probably wrong. I fixed 57 - one bug there already, but the best would be to just trash it and use 58 - something else. Maybe the code from the newer intel driver could 59 - serve as a model: 135 + The code there is really dirty, ugly and probably wrong. I fixed 136 + one bug there already, but the best would be to just trash it and use 137 + something else. Maybe the code from the newer intel driver could 138 + serve as a model: 60 139 61 140 drivers/staging/media/ipu3/ipu3-mmu.c 62 141 63 - But converting it to use something like that is painful and may 64 - cause some breakages. 142 + But converting it to use something like that is painful and may 143 + cause some breakages. 65 144 66 - 6. There is some issues at the frame receive logic, causing the 67 - DQBUF ioctls to fail. 145 + 14. The file structure needs to get tidied up to resemble a normal Linux 146 + driver. 68 147 69 - 7. A single AtomISP driver needs to be implemented to support both 70 - Baytrail (BYT) and Cherrytail (CHT) platforms at the same time. 71 - The current driver is a mechanical and hand combined merge of the 72 - two using several runtime macros, plus some ifdef ISP2401 to select the 73 - CHT version. Yet, there are some ISP-specific headers that change the 74 - driver's behavior during compile time. 148 + 15. Lots of the midlayer glue. Unused code and abstraction needs removing. 75 149 76 - 8. The file structure needs to get tidied up to resemble a normal Linux 77 - driver. 78 - 79 - 9. Lots of the midlayer glue. unused code and abstraction needs removing. 80 - 81 - 10. The AtomISP driver includes some special IOCTLS (ATOMISP_IOC_XXXX_XXXX) 150 + 16. The AtomISP driver includes some special IOCTLS (ATOMISP_IOC_XXXX_XXXX) 82 151 and controls that require some cleanup. Some of those code may have 83 152 been removed during the cleanups. They could be needed in order to 84 - properly support 3A algorithms 153 + properly support 3A algorithms. 85 154 86 155 Such IOCTL interface needs more documentation. The better would 87 156 be to use something close to the interface used by the IPU3 IMGU driver. 88 157 89 - 11. The ISP code has some dependencies of the exact FW version. 158 + 17. The ISP code has some dependencies of the exact FW version. 90 159 The version defined in pci/sh_css_firmware.c: 91 160 92 161 BYT (isp2400): "irci_stable_candrpv_0415_20150521_0458" ··· 175 106 there are any specific things that can be done to fold in support for 176 107 multiple firmware versions. 177 108 178 - 12. Switch to standard V4L2 sub-device API for sensor and lens. In 179 - particular, the user space API needs to support V4L2 controls as 180 - defined in the V4L2 spec and references to atomisp must be removed from 181 - these drivers. 182 109 183 - 13. Use LED flash API for flash LED drivers such as LM3554 (which already 184 - has a LED class driver). 110 + 18. Switch from videobuf1 to videobuf2. Videobuf1 is being removed! 185 111 186 - 14. Switch from videobuf1 to videobuf2. Videobuf1 is being removed! 187 - 188 - 15. Correct Coding Style. Please refrain sending coding style patches 112 + 19. Correct Coding Style. Please refrain sending coding style patches 189 113 for this driver until the other work is done, as there will be a lot 190 114 of code churn until this driver becomes functional again. 191 115 192 - 16. Fix private ioctls to not need a compat_ioctl handler for running 193 - 32-bit tasks. The compat code has been removed because of bugs, 194 - and should not be needed for modern drivers. Fixing this properly 195 - unfortunately means an incompatible ABI change. 116 + 20. Remove the logic which sets up pipelines inside it, moving it to 117 + libcamera and implement MC support. 118 + 196 119 197 120 Limitations 198 121 ===========