diff --git a/Makefile b/Makefile index 3a77f3f..f8d427a 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,12 @@ maintainer-clean : clean $(RM) $(DTBS) %.dtbo : %.dts - dtc -Wno-avoid_default_addr_size -Wno-avoid_unnecessary_addr_size \ +ifndef KERNEL_PATH + $(error KERNEL_PATH is not set) +else + $(CC) -E -nostdinc -I$(KERNEL_PATH)/include/ -x assembler-with-cpp $< | \ + $(KERNEL_PATH)/scripts/dtc/dtc -Wno-avoid_default_addr_size \ -Wno-reg_format -Wno-unit_address_vs_reg -Odtb\ -o $@ \ - -@ $< + -@ +endif diff --git a/scripts/db410c/enable-d3-mezzanine.sh b/scripts/db410c/enable-d3-mezzanine.sh deleted file mode 100755 index 5b9e24c..0000000 --- a/scripts/db410c/enable-d3-mezzanine.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -BOOTIMG=${1:-/dev/disk/by-partlabel/boot} -DT_ROOT=`dirname $0`/../.. -DBOOTIMG=`which dbootimg` -DBOOTIMG=${DBOOTIMG:-${DT_ROOT}/tools/dbootimg/dbootimg} -DTBTOOL=`which dtbtool` -DTBTOOL=${DTBTOOL:-${DT_ROOT}/tools/dtbtool/dtbtool} - -if [ ! -f ${BOOTIMG} ]; then - echo "Invalid bootimg: ${BOOTIMG}" - exit 1 -fi - -# Check DTB already has camera subsystem node present -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -n camss@1b00000 -p > /dev/null -if [ "$?" -ne 0 ]; then - echo "Failed to enable D3 mezzanine, no camss node, upgrade your bootimg." - exit 1 -fi - -# Check rear camera node is already defined -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -n camera_rear@3b -p > /dev/null -if [ "$?" -ne 0 ]; then - echo "Failed to enable D3 mezzanine, no rear camera node, upgrade your bootimg." - return -1 -fi - -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -m `dirname $0`/overlays/db410c-d3-mezzanine.dtbo | ${DBOOTIMG} ${BOOTIMG} -u dtb - -if [ "$?" -ne 0 ]; then - echo "Failed to update DTB" - exit 1 -fi - -echo "D3 mezzanine enabled, please reboot" -sync diff --git a/scripts/db410c/enable-ov5645.sh b/scripts/db410c/enable-ov5645.sh deleted file mode 100755 index e7b0643..0000000 --- a/scripts/db410c/enable-ov5645.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -BOOTIMG=${1:-/dev/disk/by-partlabel/boot} -DT_ROOT=`dirname $0`/../.. -DBOOTIMG=`which dbootimg` -DBOOTIMG=${DBOOTIMG:-${DT_ROOT}/tools/dbootimg/dbootimg} -DTBTOOL=`which dtbtool` -DTBTOOL=${DTBTOOL:-${DT_ROOT}/tools/dtbtool/dtbtool} - -# Check DTB already has camera subsystem node present -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -n camss@1b00000 -p > /dev/null -if [ "$?" -ne 0 ]; then - echo "Failed to enable ov5645, no camss node, upgrade your bootimg." - exit 1 -fi - -# Check rear camera node is already defined -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -n camera_rear@3b -p > /dev/null -if [ "$?" -ne 0 ]; then - echo "Failed to enable ov5645, no rear camera node, upgrade your bootimg." - return -1 -fi - -${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -m `dirname $0`/overlays/db410c-ov5645.dtbo | ${DBOOTIMG} ${BOOTIMG} -u dtb - -if [ "$?" -ne 0 ]; then - echo "Failed to update DTB" - exit 1 -fi - -echo "ov5645 enabled, please reboot" -sync diff --git a/scripts/db410c/overlays/db410c-d3-mezzanine.dtbo b/scripts/db410c/overlays/db410c-d3-mezzanine.dtbo deleted file mode 100644 index 94d5443..0000000 Binary files a/scripts/db410c/overlays/db410c-d3-mezzanine.dtbo and /dev/null differ diff --git a/scripts/db410c/overlays/db410c-d3-mezzanine.dts b/scripts/db410c/overlays/db410c-d3-mezzanine.dts deleted file mode 100644 index 006c7ec..0000000 --- a/scripts/db410c/overlays/db410c-d3-mezzanine.dts +++ /dev/null @@ -1,34 +0,0 @@ -/dts-v1/; -/plugin/; -/ { - compatible = "qcom,msm8916"; - - /* db410c dtb already includes default camera nodes (ov5645), here - * we just enable these nodes and replace the sensor model (ov5640). - */ - fragment@0 { - target-path = "/soc/cci@1b0c000"; - __overlay__ { - status = "ok"; - camera_rear@3b { - compatible = "ovti,ov5640"; - reg = <0x78>; - status = "ok"; - }; - }; - }; - - fragment@1 { - target-path = "/soc/camss@1b00000"; - __overlay__ { - status = "ok"; - ports { - port@0 { - endpoint { - status = "ok"; - }; - }; - }; - }; - }; -}; diff --git a/scripts/db410c/overlays/db410c-d3-rear-ov5640.dtbo b/scripts/db410c/overlays/db410c-d3-rear-ov5640.dtbo new file mode 100644 index 0000000..97735f4 Binary files /dev/null and b/scripts/db410c/overlays/db410c-d3-rear-ov5640.dtbo differ diff --git a/scripts/db410c/overlays/db410c-d3-rear-ov5640.dts b/scripts/db410c/overlays/db410c-d3-rear-ov5640.dts new file mode 100644 index 0000000..7c8e336 --- /dev/null +++ b/scripts/db410c/overlays/db410c-d3-rear-ov5640.dts @@ -0,0 +1,93 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "qcom,msm8916"; + + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_rear_vdddo: fixedregulator_camera_rear@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_rear_vdda: fixedregulator_camera_rear@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_rear_vddd: fixedregulator_camera_rear@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@1b0c000"; + __overlay__ { + status = "ok"; + + camera_rear@3c { + compatible = "ovti,ov5640"; + reg = <0x3c>; + + powerdown-gpios = <&msmgpio 34 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 35 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_rear_default>; + + clocks = <&gcc GCC_CAMSS_MCLK0_CLK>; + clock-names = "xclk"; + + DOVDD-supply = <&camera_rear_vdddo>; + AVDD-supply = <&camera_rear_vdda>; + DVDD-supply = <&camera_rear_vddd>; + + status = "ok"; + + port { + camera_rear_ep: endpoint { + clock-lanes = <0>; + data-lanes = <1 2>; + remote-endpoint = <&csiphy0_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@1b00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + csiphy0_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&camera_rear_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db410c/overlays/db410c-ov5645.dtbo b/scripts/db410c/overlays/db410c-ov5645.dtbo deleted file mode 100644 index a1419af..0000000 Binary files a/scripts/db410c/overlays/db410c-ov5645.dtbo and /dev/null differ diff --git a/scripts/db410c/overlays/db410c-ov5645.dts b/scripts/db410c/overlays/db410c-ov5645.dts deleted file mode 100644 index 85072e6..0000000 --- a/scripts/db410c/overlays/db410c-ov5645.dts +++ /dev/null @@ -1,29 +0,0 @@ -/dts-v1/; -/plugin/; -/ { - compatible = "qcom,msm8916"; - - fragment@0 { - target-path = "/soc/cci@1b0c000"; - __overlay__ { - status = "ok"; - camera_rear@3b { - status = "ok"; - }; - }; - }; - - fragment@1 { - target-path = "/soc/camss@1b00000"; - __overlay__ { - status = "ok"; - ports { - port@0 { - endpoint { - status = "ok"; - }; - }; - }; - }; - }; -}; diff --git a/scripts/db410c/overlays/db410c-stm32-front-ov5645.dtbo b/scripts/db410c/overlays/db410c-stm32-front-ov5645.dtbo new file mode 100644 index 0000000..43a0280 Binary files /dev/null and b/scripts/db410c/overlays/db410c-stm32-front-ov5645.dtbo differ diff --git a/scripts/db410c/overlays/db410c-stm32-front-ov5645.dts b/scripts/db410c/overlays/db410c-stm32-front-ov5645.dts new file mode 100644 index 0000000..64f7d27 --- /dev/null +++ b/scripts/db410c/overlays/db410c-stm32-front-ov5645.dts @@ -0,0 +1,94 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "qcom,msm8916"; + + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_front_vdddo: fixedregulator_camera_front@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_front_vdda: fixedregulator_camera_front@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_front_vddd: fixedregulator_camera_front@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@1b0c000"; + __overlay__ { + status = "ok"; + + camera_front@3a { + compatible = "ovti,ov5645"; + reg = <0x3a>; + + enable-gpios = <&msmgpio 33 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 28 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_front_default>; + + clocks = <&gcc GCC_CAMSS_MCLK1_CLK>; + clock-names = "xclk"; + clock-frequency = <23880000>; + + vdddo-supply = <&camera_front_vdddo>; + vdda-supply = <&camera_front_vdda>; + vddd-supply = <&camera_front_vddd>; + + status = "ok"; + + port { + camera_front_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&csiphy1_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@1b00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@1 { + reg = <1>; + csiphy1_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&camera_front_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dtbo b/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dtbo new file mode 100644 index 0000000..97bb230 Binary files /dev/null and b/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dtbo differ diff --git a/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dts b/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dts new file mode 100644 index 0000000..fba2e1f --- /dev/null +++ b/scripts/db410c/overlays/db410c-stm32-rear-ov5645.dts @@ -0,0 +1,94 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "qcom,msm8916"; + + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_rear_vdddo: fixedregulator_camera_rear@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_rear_vdda: fixedregulator_camera_rear@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_rear_vddd: fixedregulator_camera_rear@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@1b0c000"; + __overlay__ { + status = "ok"; + + camera_rear@3b { + compatible = "ovti,ov5645"; + reg = <0x3b>; + + enable-gpios = <&msmgpio 34 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 35 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_rear_default>; + + clocks = <&gcc GCC_CAMSS_MCLK0_CLK>; + clock-names = "xclk"; + clock-frequency = <23880000>; + + vdddo-supply = <&camera_rear_vdddo>; + vdda-supply = <&camera_rear_vdda>; + vddd-supply = <&camera_rear_vddd>; + + status = "ok"; + + port { + camera_rear_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&csiphy0_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@1b00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + csiphy0_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&camera_rear_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db820c/overlays/db820c-board-ov5645.dtbo b/scripts/db820c/overlays/db820c-board-ov5645.dtbo new file mode 100644 index 0000000..684474e Binary files /dev/null and b/scripts/db820c/overlays/db820c-board-ov5645.dtbo differ diff --git a/scripts/db820c/overlays/db820c-board-ov5645.dts b/scripts/db820c/overlays/db820c-board-ov5645.dts new file mode 100644 index 0000000..16a8ac7 --- /dev/null +++ b/scripts/db820c/overlays/db820c-board-ov5645.dts @@ -0,0 +1,92 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_board_vdddo: fixedregulator_camera_board@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_board_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_board_vdda: fixedregulator_camera_board@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_board_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_board_vddd: fixedregulator_camera_board@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_board_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@a0c000"; + __overlay__ { + status = "ok"; + + camera_board@39 { + compatible = "ovti,ov5645"; + reg = <0x39>; + + enable-gpios = <&msmgpio 98 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 104 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_board_default>; + + clocks = <&mmcc CAMSS_MCLK1_CLK>; + clock-names = "xclk"; + clock-frequency = <24000000>; + + vdddo-supply = <&camera_board_vdddo>; + vdda-supply = <&camera_board_vdda>; + vddd-supply = <&camera_board_vddd>; + + status = "ok"; + + port { + camera_board_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&csiphy1_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@a00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@1 { + reg = <1>; + csiphy1_ep: endpoint { + clock-lanes = <7>; + data-lanes = <0 1>; + remote-endpoint = <&camera_board_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db820c/overlays/db820c-d3-rear-ov5640.dtbo b/scripts/db820c/overlays/db820c-d3-rear-ov5640.dtbo new file mode 100644 index 0000000..1c22da8 Binary files /dev/null and b/scripts/db820c/overlays/db820c-d3-rear-ov5640.dtbo differ diff --git a/scripts/db820c/overlays/db820c-d3-rear-ov5640.dts b/scripts/db820c/overlays/db820c-d3-rear-ov5640.dts new file mode 100644 index 0000000..645ef4b --- /dev/null +++ b/scripts/db820c/overlays/db820c-d3-rear-ov5640.dts @@ -0,0 +1,91 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_rear_vdddo: fixedregulator_camera_rear@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_rear_vdda: fixedregulator_camera_rear@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_rear_vddd: fixedregulator_camera_rear@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@a0c000"; + __overlay__ { + status = "ok"; + + camera_rear@3c { + compatible = "ovti,ov5640"; + reg = <0x3c>; + + powerdown-gpios = <&msmgpio 26 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 25 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_rear_default>; + + clocks = <&mmcc CAMSS_MCLK0_CLK>; + clock-names = "xclk"; + + DOVDD-supply = <&camera_rear_vdddo>; + AVDD-supply = <&camera_rear_vdda>; + DVDD-supply = <&camera_rear_vddd>; + + status = "ok"; + + port { + camera_rear_ep: endpoint { + clock-lanes = <0>; + data-lanes = <1 2>; + remote-endpoint = <&csiphy0_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@a00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + csiphy0_ep: endpoint { + clock-lanes = <7>; + data-lanes = <0 1>; + remote-endpoint = <&camera_rear_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db820c/overlays/db820c-stm32-front-ov5645.dtbo b/scripts/db820c/overlays/db820c-stm32-front-ov5645.dtbo new file mode 100644 index 0000000..9b68042 Binary files /dev/null and b/scripts/db820c/overlays/db820c-stm32-front-ov5645.dtbo differ diff --git a/scripts/db820c/overlays/db820c-stm32-front-ov5645.dts b/scripts/db820c/overlays/db820c-stm32-front-ov5645.dts new file mode 100644 index 0000000..b218304 --- /dev/null +++ b/scripts/db820c/overlays/db820c-stm32-front-ov5645.dts @@ -0,0 +1,92 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_front_vdddo: fixedregulator_camera_front@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_front_vdda: fixedregulator_camera_front@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_front_vddd: fixedregulator_camera_front@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_front_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@a0c000"; + __overlay__ { + status = "ok"; + + camera_front@3a { + compatible = "ovti,ov5645"; + reg = <0x3a>; + + enable-gpios = <&msmgpio 133 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 23 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_front_default>; + + clocks = <&mmcc CAMSS_MCLK2_CLK>; + clock-names = "xclk"; + clock-frequency = <24000000>; + + vdddo-supply = <&camera_front_vdddo>; + vdda-supply = <&camera_front_vdda>; + vddd-supply = <&camera_front_vddd>; + + status = "ok"; + + port { + camera_front_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&csiphy2_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@a00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@2 { + reg = <2>; + csiphy2_ep: endpoint { + clock-lanes = <7>; + data-lanes = <0 1>; + remote-endpoint = <&camera_front_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dtbo b/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dtbo new file mode 100644 index 0000000..35cb460 Binary files /dev/null and b/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dtbo differ diff --git a/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dts b/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dts new file mode 100644 index 0000000..19f4664 --- /dev/null +++ b/scripts/db820c/overlays/db820c-stm32-rear-ov5645.dts @@ -0,0 +1,92 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/ { + fragment@0 { + target-path = "/soc"; + __overlay__ { + camera_rear_vdddo: fixedregulator_camera_rear@0 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdddo"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + camera_rear_vdda: fixedregulator_camera_rear@1 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vdda"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-always-on; + }; + + camera_rear_vddd: fixedregulator_camera_rear@2 { + compatible = "regulator-fixed"; + regulator-name = "camera_rear_vddd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + }; + }; + }; + + fragment@1 { + target-path = "/soc/cci@a0c000"; + __overlay__ { + status = "ok"; + + camera_rear@3b { + compatible = "ovti,ov5645"; + reg = <0x3b>; + + enable-gpios = <&msmgpio 26 GPIO_ACTIVE_HIGH>; + reset-gpios = <&msmgpio 25 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&camera_rear_default>; + + clocks = <&mmcc CAMSS_MCLK0_CLK>; + clock-names = "xclk"; + clock-frequency = <24000000>; + + vdddo-supply = <&camera_rear_vdddo>; + vdda-supply = <&camera_rear_vdda>; + vddd-supply = <&camera_rear_vddd>; + + status = "ok"; + + port { + camera_rear_ep: endpoint { + clock-lanes = <1>; + data-lanes = <0 2>; + remote-endpoint = <&csiphy0_ep>; + }; + }; + }; + }; + }; + + fragment@2 { + target-path = "/soc/camss@a00000"; + __overlay__ { + status = "ok"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + csiphy0_ep: endpoint { + clock-lanes = <7>; + data-lanes = <0 1>; + remote-endpoint = <&camera_rear_ep>; + status = "ok"; + }; + }; + }; + }; + }; +}; diff --git a/scripts/overlay-apply.sh b/scripts/overlay-apply.sh new file mode 100755 index 0000000..b66b5ad --- /dev/null +++ b/scripts/overlay-apply.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +OVERLAY=${1} +BOOTIMG=${2:-/dev/disk/by-partlabel/boot} +DT_ROOT=`dirname $0`/../.. +DBOOTIMG=`which dbootimg` +DBOOTIMG=${DBOOTIMG:-${DT_ROOT}/tools/dbootimg/dbootimg} +DTBTOOL=`which dtbtool` +DTBTOOL=${DTBTOOL:-${DT_ROOT}/tools/dtbtool/dtbtool} + +usage() +{ + echo "usage: ${0} overlay.dtbo [boot-image]" + echo "boot-image defaults to ${BOOTIMG}" +} + +if [ $# -lt 1 ]; then + usage + exit 2 +fi + +if [ ! -e ${OVERLAY} ]; then + echo "${OVERLAY} doesn't exist." + exit 3 +fi + +if [ ! -e ${BOOTIMG} ]; then + echo "${BOOTIMG} doesn't exist." + exit 4 +fi + +${DBOOTIMG} ${BOOTIMG} -x dtb | ${DTBTOOL} -m ${OVERLAY} | ${DBOOTIMG} ${BOOTIMG} -u dtb + +if [ "$?" -ne 0 ]; then + echo "Failed to apply ${OVERLAY} to ${BOOTIMG}" + exit 1 +fi + +sync +echo "${OVERLAY} applied to ${BOOTIMG}"