From babaf1bc827ae074dbce533830128e17ec3be74c Mon Sep 17 00:00:00 2001 From: khaled98 Date: Thu, 14 Nov 2024 09:54:27 +0400 Subject: [PATCH 1/5] Update imx477.c --- drivers/media/i2c/imx477.c | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/media/i2c/imx477.c b/drivers/media/i2c/imx477.c index dce7f2b4fa5768..92985515b53944 100644 --- a/drivers/media/i2c/imx477.c +++ b/drivers/media/i2c/imx477.c @@ -25,6 +25,22 @@ static int dpc_enable = 1; module_param(dpc_enable, int, 0644); MODULE_PARM_DESC(dpc_enable, "Enable on-sensor DPC"); +static int fstrobe_enable; +module_param(fstrobe_enable, int, 0644); +MODULE_PARM_DESC(fstrobe_enable, "Enable fstrobe signal"); + +static int fstrobe_cont_trig; +module_param(fstrobe_cont_trig, int, 0644); +MODULE_PARM_DESC(fstrobe_cont_trig, "Configure fstrobe to be one-shot (0) or continuous (1)"); + +static int fstrobe_width = 1; +module_param(fstrobe_width, int, 0644); +MODULE_PARM_DESC(fstrobe_width, "Set fstrobe pulse width in units of INCK"); + +static int fstrobe_delay; +module_param(fstrobe_delay, int, 0644); +MODULE_PARM_DESC(fstrobe_delay, "Set fstrobe delay from end all lines starting to expose and the start of the strobe pulse"); + static int trigger_mode; module_param(trigger_mode, int, 0644); MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 1=source, 2=sink"); @@ -1183,6 +1199,9 @@ static int imx477_read_reg(struct imx477 *imx477, u16 reg, u32 len, u32 *val) { struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd); struct i2c_msg msgs[2]; + unsigned int fst_width; + unsigned int fst_mult; + u8 addr_buf[2] = { reg >> 8, reg & 0xff }; u8 data_buf[4] = { 0, }; int ret; @@ -1741,6 +1760,29 @@ static int imx477_start_streaming(struct imx477 *imx477) return ret; } + fst_width = max((unsigned int)fstrobe_width, 1U); + fst_mult = 1; + + while (fst_width / fst_mult > 0xffff && fst_mult < 255) + fst_mult++; + + fst_width /= fst_mult; + + // FLASH_MD_RS + imx477_write_reg(imx477, 0x0c1A, IMX477_REG_VALUE_08BIT, + ((fstrobe_cont_trig ? 1 : 0) << 0) | (1 << 1)); + // FLASH_STRB_WIDTH + imx477_write_reg(imx477, 0x0c18, IMX477_REG_VALUE_16BIT, fst_width); + // FLASH_STRB_WIDTH adjust + imx477_write_reg(imx477, 0x0c12, IMX477_REG_VALUE_08BIT, fst_mult); + // FLASH_STRB_START_POINT + imx477_write_reg(imx477, 0x0c14, IMX477_REG_VALUE_16BIT, fstrobe_delay); + // FLASH_STRB_DLY_RS + imx477_write_reg(imx477, 0x0c16, IMX477_REG_VALUE_16BIT, 0); + // FLASH_TRIG_RS + imx477_write_reg(imx477, 0x0c1B, IMX477_REG_VALUE_08BIT, + fstrobe_enable ? 1 : 0); + /* Set on-sensor DPC. */ imx477_write_reg(imx477, 0x0b05, IMX477_REG_VALUE_08BIT, !!dpc_enable); imx477_write_reg(imx477, 0x0b06, IMX477_REG_VALUE_08BIT, !!dpc_enable); From 8989636ebf564e1a6398a2273b9387ae584d9fd3 Mon Sep 17 00:00:00 2001 From: khaled98 Date: Thu, 14 Nov 2024 09:57:16 +0400 Subject: [PATCH 2/5] Create kernel-build.yml --- .github/workflow/kernel-build.yml | 102 ++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflow/kernel-build.yml diff --git a/.github/workflow/kernel-build.yml b/.github/workflow/kernel-build.yml new file mode 100644 index 00000000000000..8f9d8fd21d190e --- /dev/null +++ b/.github/workflow/kernel-build.yml @@ -0,0 +1,102 @@ +name: Pi kernel build tests + +on: + pull_request: + paths-ignore: + - '.github/**' + branches: [ "rpi-*" ] + push: + paths-ignore: + - '.github/**' + branches: [ "rpi-*" ] + workflow_dispatch: + +env: + NUM_JOBS: 3 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: bcm2835 + arch: arm + defconfig: bcm2835_defconfig + kernel: kernel + + - name: arm64 + arch: arm64 + defconfig: defconfig + kernel: kernel8 + + - name: bcmrpi + arch: arm + defconfig: bcmrpi_defconfig + kernel: kernel + + - name: bcm2709 + arch: arm + defconfig: bcm2709_defconfig + kernel: kernel7 + + - name: bcm2711 + arch: arm + defconfig: bcm2711_defconfig + kernel: kernel7l + + - name: bcm2711_arm64 + arch: arm64 + defconfig: bcm2711_defconfig + kernel: kernel8 + + steps: + - name: Update install + run: + sudo apt-get update + + - name: Install toolchain + run: + if [[ "${{matrix.arch}}" == "arm64" ]]; then + sudo apt-get install gcc-aarch64-linux-gnu; + else + sudo apt-get install gcc-arm-linux-gnueabihf; + fi + timeout-minutes: 5 + + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + clean: true + + - name: Build kernel ${{matrix.name}} + run: | + mkdir ${{github.workspace}}/build + export ARCH=${{matrix.arch}} + if [[ "$ARCH" == "arm64" ]]; then + export CROSS_COMPILE=aarch64-linux-gnu- + export DTS_SUBDIR=broadcom + export IMAGE=Image.gz + else + export CROSS_COMPILE=arm-linux-gnueabihf- + export DTS_SUBDIR= + export IMAGE=zImage + fi + make O=${{github.workspace}}/build ${{matrix.defconfig}} + scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y + make O=${{github.workspace}}/build -j ${{env.NUM_JOBS}} $IMAGE modules dtbs + mkdir -p ${{github.workspace}}/install/boot/overlays + make O=${{github.workspace}}/build INSTALL_MOD_PATH=${{github.workspace}}/install modules_install + cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/${DTS_SUBDIR}/*.dtb ${{github.workspace}}/install/boot/ + cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/overlays/*.dtb* ${{github.workspace}}/install/boot/overlays/ + cp ${{github.workspace}}/arch/${ARCH}/boot/dts/overlays/README ${{github.workspace}}/install/boot/overlays/ + cp ${{github.workspace}}/build/arch/${ARCH}/boot/$IMAGE ${{github.workspace}}/install/boot/${{matrix.kernel}}.img + - name: Tar build + run: tar -cvf ${{matrix.name}}_build.tar -C ${{github.workspace}}/install . + + - name: Upload results + uses: actions/upload-artifact@v3 + with: + name: ${{matrix.name}}_build + path: ${{matrix.name}}_build.tar + retention-days: 90 From 34b74c4b6189f7275f45a159e39cdceec04e631c Mon Sep 17 00:00:00 2001 From: khaled98 Date: Thu, 14 Nov 2024 10:05:21 +0400 Subject: [PATCH 3/5] Create kernel-build2.yml --- .github/workflows/kernel-build2.yml | 103 ++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/kernel-build2.yml diff --git a/.github/workflows/kernel-build2.yml b/.github/workflows/kernel-build2.yml new file mode 100644 index 00000000000000..87eb13939be6a4 --- /dev/null +++ b/.github/workflows/kernel-build2.yml @@ -0,0 +1,103 @@ +name: Pi kernel build tests + +on: + pull_request: + paths-ignore: + - '.github/**' + branches: [ "rpi-*" ] + push: + paths-ignore: + - '.github/**' + branches: [ "rpi-*" ] + workflow_dispatch: + +env: + NUM_JOBS: 3 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: bcm2835 + arch: arm + defconfig: bcm2835_defconfig + kernel: kernel + + - name: arm64 + arch: arm64 + defconfig: defconfig + kernel: kernel8 + + - name: bcmrpi + arch: arm + defconfig: bcmrpi_defconfig + kernel: kernel + + - name: bcm2709 + arch: arm + defconfig: bcm2709_defconfig + kernel: kernel7 + + - name: bcm2711 + arch: arm + defconfig: bcm2711_defconfig + kernel: kernel7l + + - name: bcm2711_arm64 + arch: arm64 + defconfig: bcm2711_defconfig + kernel: kernel8 + + steps: + - name: Update install + run: + sudo apt-get update + + - name: Install toolchain + run: + if [[ "${{matrix.arch}}" == "arm64" ]]; then + sudo apt-get install gcc-aarch64-linux-gnu; + else + sudo apt-get install gcc-arm-linux-gnueabihf; + fi + timeout-minutes: 5 + + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + clean: true + + - name: Build kernel ${{matrix.name}} + run: | + mkdir ${{github.workspace}}/build + export ARCH=${{matrix.arch}} + if [[ "$ARCH" == "arm64" ]]; then + export CROSS_COMPILE=aarch64-linux-gnu- + export DTS_SUBDIR=broadcom + export IMAGE=Image.gz + else + export CROSS_COMPILE=arm-linux-gnueabihf- + export DTS_SUBDIR= + export IMAGE=zImage + fi + make O=${{github.workspace}}/build ${{matrix.defconfig}} + scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y + make O=${{github.workspace}}/build -j ${{env.NUM_JOBS}} $IMAGE modules dtbs + mkdir -p ${{github.workspace}}/install/boot/overlays + make O=${{github.workspace}}/build INSTALL_MOD_PATH=${{github.workspace}}/install modules_install + cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/${DTS_SUBDIR}/*.dtb ${{github.workspace}}/install/boot/ + cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/overlays/*.dtb* ${{github.workspace}}/install/boot/overlays/ + cp ${{github.workspace}}/arch/${ARCH}/boot/dts/overlays/README ${{github.workspace}}/install/boot/overlays/ + cp ${{github.workspace}}/build/arch/${ARCH}/boot/$IMAGE ${{github.workspace}}/install/boot/${{matrix.kernel}}.img + + - name: Tar build + run: tar -cvf ${{matrix.name}}_build.tar -C ${{github.workspace}}/install . + + - name: Upload results + uses: actions/upload-artifact@v3 + with: + name: ${{matrix.name}}_build + path: ${{matrix.name}}_build.tar + retention-days: 90 From e6d38021004328275e8b07f309eb3226d6af7ebb Mon Sep 17 00:00:00 2001 From: khaled98 Date: Thu, 14 Nov 2024 11:01:41 +0400 Subject: [PATCH 4/5] Delete .github/workflow directory --- .github/workflow/kernel-build.yml | 102 ------------------------------ 1 file changed, 102 deletions(-) delete mode 100644 .github/workflow/kernel-build.yml diff --git a/.github/workflow/kernel-build.yml b/.github/workflow/kernel-build.yml deleted file mode 100644 index 8f9d8fd21d190e..00000000000000 --- a/.github/workflow/kernel-build.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Pi kernel build tests - -on: - pull_request: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] - push: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] - workflow_dispatch: - -env: - NUM_JOBS: 3 - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - name: bcm2835 - arch: arm - defconfig: bcm2835_defconfig - kernel: kernel - - - name: arm64 - arch: arm64 - defconfig: defconfig - kernel: kernel8 - - - name: bcmrpi - arch: arm - defconfig: bcmrpi_defconfig - kernel: kernel - - - name: bcm2709 - arch: arm - defconfig: bcm2709_defconfig - kernel: kernel7 - - - name: bcm2711 - arch: arm - defconfig: bcm2711_defconfig - kernel: kernel7l - - - name: bcm2711_arm64 - arch: arm64 - defconfig: bcm2711_defconfig - kernel: kernel8 - - steps: - - name: Update install - run: - sudo apt-get update - - - name: Install toolchain - run: - if [[ "${{matrix.arch}}" == "arm64" ]]; then - sudo apt-get install gcc-aarch64-linux-gnu; - else - sudo apt-get install gcc-arm-linux-gnueabihf; - fi - timeout-minutes: 5 - - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - clean: true - - - name: Build kernel ${{matrix.name}} - run: | - mkdir ${{github.workspace}}/build - export ARCH=${{matrix.arch}} - if [[ "$ARCH" == "arm64" ]]; then - export CROSS_COMPILE=aarch64-linux-gnu- - export DTS_SUBDIR=broadcom - export IMAGE=Image.gz - else - export CROSS_COMPILE=arm-linux-gnueabihf- - export DTS_SUBDIR= - export IMAGE=zImage - fi - make O=${{github.workspace}}/build ${{matrix.defconfig}} - scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y - make O=${{github.workspace}}/build -j ${{env.NUM_JOBS}} $IMAGE modules dtbs - mkdir -p ${{github.workspace}}/install/boot/overlays - make O=${{github.workspace}}/build INSTALL_MOD_PATH=${{github.workspace}}/install modules_install - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/${DTS_SUBDIR}/*.dtb ${{github.workspace}}/install/boot/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/overlays/*.dtb* ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/arch/${ARCH}/boot/dts/overlays/README ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/$IMAGE ${{github.workspace}}/install/boot/${{matrix.kernel}}.img - - name: Tar build - run: tar -cvf ${{matrix.name}}_build.tar -C ${{github.workspace}}/install . - - - name: Upload results - uses: actions/upload-artifact@v3 - with: - name: ${{matrix.name}}_build - path: ${{matrix.name}}_build.tar - retention-days: 90 From 20b337f2f00cff7a770220977594e554d143938a Mon Sep 17 00:00:00 2001 From: khaled98 Date: Thu, 14 Nov 2024 11:02:04 +0400 Subject: [PATCH 5/5] Delete .github/workflows/kernel-build2.yml --- .github/workflows/kernel-build2.yml | 103 ---------------------------- 1 file changed, 103 deletions(-) delete mode 100644 .github/workflows/kernel-build2.yml diff --git a/.github/workflows/kernel-build2.yml b/.github/workflows/kernel-build2.yml deleted file mode 100644 index 87eb13939be6a4..00000000000000 --- a/.github/workflows/kernel-build2.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Pi kernel build tests - -on: - pull_request: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] - push: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] - workflow_dispatch: - -env: - NUM_JOBS: 3 - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - name: bcm2835 - arch: arm - defconfig: bcm2835_defconfig - kernel: kernel - - - name: arm64 - arch: arm64 - defconfig: defconfig - kernel: kernel8 - - - name: bcmrpi - arch: arm - defconfig: bcmrpi_defconfig - kernel: kernel - - - name: bcm2709 - arch: arm - defconfig: bcm2709_defconfig - kernel: kernel7 - - - name: bcm2711 - arch: arm - defconfig: bcm2711_defconfig - kernel: kernel7l - - - name: bcm2711_arm64 - arch: arm64 - defconfig: bcm2711_defconfig - kernel: kernel8 - - steps: - - name: Update install - run: - sudo apt-get update - - - name: Install toolchain - run: - if [[ "${{matrix.arch}}" == "arm64" ]]; then - sudo apt-get install gcc-aarch64-linux-gnu; - else - sudo apt-get install gcc-arm-linux-gnueabihf; - fi - timeout-minutes: 5 - - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - clean: true - - - name: Build kernel ${{matrix.name}} - run: | - mkdir ${{github.workspace}}/build - export ARCH=${{matrix.arch}} - if [[ "$ARCH" == "arm64" ]]; then - export CROSS_COMPILE=aarch64-linux-gnu- - export DTS_SUBDIR=broadcom - export IMAGE=Image.gz - else - export CROSS_COMPILE=arm-linux-gnueabihf- - export DTS_SUBDIR= - export IMAGE=zImage - fi - make O=${{github.workspace}}/build ${{matrix.defconfig}} - scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y - make O=${{github.workspace}}/build -j ${{env.NUM_JOBS}} $IMAGE modules dtbs - mkdir -p ${{github.workspace}}/install/boot/overlays - make O=${{github.workspace}}/build INSTALL_MOD_PATH=${{github.workspace}}/install modules_install - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/${DTS_SUBDIR}/*.dtb ${{github.workspace}}/install/boot/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/overlays/*.dtb* ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/arch/${ARCH}/boot/dts/overlays/README ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/$IMAGE ${{github.workspace}}/install/boot/${{matrix.kernel}}.img - - - name: Tar build - run: tar -cvf ${{matrix.name}}_build.tar -C ${{github.workspace}}/install . - - - name: Upload results - uses: actions/upload-artifact@v3 - with: - name: ${{matrix.name}}_build - path: ${{matrix.name}}_build.tar - retention-days: 90