Repository navigation
hi3520dv200: bring the NVP6134 analog decoder up - #3036
openipc-ai wants to merge 2 commits into
Conversation
On a Xiongmai Hi3520DV200 DVR (NVP6134 at I2C 0x60) no analog camera was ever seen, for three reasons found on the board: - load_hisilicon passed the NVP6114's parameters (vdec_mode, outmode) to nvp6134_ex.ko, whose only parameter is nvp6134_mode, so it never loaded and the NVP6114 driver found nothing. - The board holds the decoder in reset on GPIO1_2 (pin 72) until software drives it high, as its vendor driver does at load: until then nothing answers on the I2C bus at all. - The decoder is clocked from the SoC's VI_ADC_CLK, PERI_CRG11 bits 19:18: the 8D1 setting gives 54 MHz, at which the chip detects no camera; it needs 27 MHz. load_decoder now loads the NVP6134's driver without parameters; when no chip answers it releases GPIO1_2 and tries again, and puts the pin back when nothing answers then either. With an NVP6134 it sets 27 MHz and loads the driver again at that clock; without one, the NVP6114's driver as before. remove_ko unloads the 6134 driver under its module name, open_nvp6134_ex. Covered by test_load_hisilicon.sh Part 7.
PR Summary by Qodohi3520dv200: bring the NVP6134 analog decoder up
AI Description
Merge Risk
|
Code Review by Qodo
1. NVRs get a shared pin driven high
|
When no NVP6134 answers even after the Xiongmai reset, GPIO1_2 got its direction and function back but not its level: a pin that was an output driven low was left high. The level is saved with the rest and restored first. Part 7 checks a pin that was an output driven low.
|
Answers to Qodo's review:
|
On a Xiongmai Hi3520DV200 DVR (Nextchip NVP6134 at I2C 0x60, four BNC inputs) OpenIPC never saw an analog camera. Three things in
load_hisiliconwere wrong for this board:vdec_mode=1 outmode=3were passed tonvp6134_ex.ko, whose only parameter isnvp6134_mode. So the 6134 driver never loaded, and the NVP6114 driver found no chip.muxctrl_reg48) until software drives it high. The vendor's driver does that when it loads. Until then nothing answers on the I2C bus.VI_ADC_CLK, set byPERI_CRG11bits 19:18 (00 = 54 MHz, 01 = 27 MHz, per the Hi3520D data sheet). The 8D1 setting gives 54 MHz, and at that rate the chip detects no camera. It needs 27 MHz.load_decodernow:remove_konow unloads the 6134 driver under its real module name,open_nvp6134_ex.test_load_hisilicon.shPart 7 covers three cases: the chip answers at once, only after the reset, or never.On an NVR without a decoder, GPIO1_2 (whose other function is the
TEMPER_DQline) is driven high for one second, then restored.The vigil side (VI setup, the decoder's channel and port modes, tiles, encoder) is OpenIPC/vigil#29.
Tested on hardware
Board: the Xiongmai DVR above, freshly booted from flash (nightly 2026-11-29: NVP6114 driver loaded, no chip found, clock at 54 MHz). The NVP6114 and gpioi2c drivers were unloaded, then this branch's
load_decoderwas run, taken from the script:After the channels were set to AHD 720p (as vigil does), the camera on input 1 was detected: register 0xA8 changed from 0x0F to 0x0E. Its picture came through VI at 1280×720 (Y 1–254). In the vigil#29 run, the same bring-up (done by hand) gave all four inputs at 1280×720 H.264 25 fps, with the camera shown on the monitor.
bash .github/scripts/test_load_hisilicon.shandci-matrix.py --self-testpass.Not tested: