orangepi lite mainline 设备树配置ov5640

orangepi lite 运行环境armbian focal,

配置设备树

sun8i-h3-orangepi-lite.dts 配置文件

/dts-v1/;
#include "sun8i-h3.dtsi"
#include "sunxi-common-regulators.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	model = "Xunlong Orange Pi Lite";
	compatible = "xunlong,orangepi-lite", "allwinner,sun8i-h3";

	aliases {
		/* The H3 emac is not used so the wifi is ethernet0 */
		ethernet0 = &rtl8189ftv;
		serial0 = &uart0;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		pwr_led {
			label = "orangepi:green:pwr";
			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};

		status_led {
			label = "orangepi:red:status";
			gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
		};
	};

	r_gpio_keys {
		compatible = "gpio-keys";

		sw4 {
			label = "sw4";
			linux,code = <BTN_0>;
			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
		};
	};

	reg_vdd_1v5_csi: vdd-1v5-csi {
	compatible = "regulator-fixed";
	regulator-name = "vdd1v5-csi";
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
	enable-active-high;
	regulator-boot-on;
	regulator-always-on;
	};

	reg_vcc_csi: vcc-csi {
		compatible = "regulator-fixed";
		regulator-name = "vcc-csi";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <2800000>;
		gpio = <&pio 0 17 GPIO_ACTIVE_HIGH>; /* PA17 */
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};

	reg_vcc_af_csi: vcc-af-csi {
		compatible = "regulator-fixed";
		regulator-name = "vcc-af-csi";
		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <2800000>;
		gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
		enable-active-high;
		regulator-boot-on;
		regulator-always-on;
	};
	/*
	/omit-if-no-ref/
	csi_mclk_pin: csi-mclk-pin {
		pins = "PE1";
		function = "csi";
	
	};
	*/

};

&de {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&ehci2 {
	status = "okay";
};

&hdmi {
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&ir {
	pinctrl-names = "default";
	pinctrl-0 = <&r_ir_rx_pin>;
	status = "okay";
};

&mmc0 {
	vmmc-supply = <&reg_vcc3v3>;
	bus-width = <4>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
	status = "okay";
};

&mmc1 {
	vmmc-supply = <&reg_vcc3v3>;
	bus-width = <4>;
	non-removable;
	status = "okay";

	/*
	 * Explicitly define the sdio device, so that we can add an ethernet
	 * alias for it (which e.g. makes u-boot set a mac-address).
	 */
	rtl8189ftv: sdio_wifi@1 {
		reg = <1>;
	};
};

&ohci1 {
	status = "okay";
};

&ohci2 {
	status = "okay";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pa_pins>;
	status = "okay";
};

&usbphy {
	/* USB VBUS is always on */
	status = "okay";
};


&ccu {
	/* Use a stable clock source with known fixed rate for MCLK */
	assigned-clocks = <&ccu CLK_CSI_MCLK>;
	assigned-clock-parents = <&osc24M>;
	assigned-clock-rates = <24000000>;
};


&csi {
	status = "okay";

	port {
		#address-cells = <1>;
		#size-cells = <0>;
		
		/* Parallel bus endpoint */
		csi_ep: endpoint {
			remote-endpoint = <&ov5640_ep>;
			bus-width = <8>;
			hsync-active = <1>; /* Active high */
			vsync-active = <0>; /* Active low */
			data-active = <1>;  /* Active high */
			pclk-sample = <1>;  /* Rising */
		};
	};
};

&i2c2_pins {
	bias-pull-up;
};

&i2c2 {
	status = "okay";
	
	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		/*
		pinctrl-names = "default";
		pinctrl-0 = <&csi_mclk_pin>;*/
		clocks = <&ccu CLK_CSI_MCLK>;
		clock-names = "xclk";

		AVDD-supply = <&reg_vcc_af_csi>;
		DOVDD-supply = <&reg_vdd_1v5_csi>;
		DVDD-supply = <&reg_vcc_csi>;
		reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE14 */
		powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE15 */

		port {
			ov5640_ep: endpoint {
				remote-endpoint = <&csi_ep>;
				bus-width = <8>;
				data-shift = <2>; /* lines 9:2 are used */
				hsync-active = <1>; /* Active high */
				vsync-active = <0>; /* Active low */
				data-active = <1>;  /* Active high */
				pclk-sample = <1>;  /* Rising */
			};
		};
	};
};

 sunxi-h3-h5.dtsi   csi_pins:csi-pins 内添加 "PE1"

			csi_pins: csi-pins {
				pins = "PE0", "PE2", "PE3", "PE4", "PE5",
				       "PE6", "PE7", "PE8", "PE9", "PE10",
				       "PE11","PE1";
				function = "csi";
			};

运行测试

配置好设备树,重启后,

root@orangepilite:~# v4l2-ctl --list-devices
sun6i-csi (platform:camera):
        /dev/video0

cedrus (platform:cedrus):
        /dev/video2
        /dev/media0

Allwinner Video Capture Device (platform:sun6i-csi):
        /dev/media1

sun8i-di (platform:sun8i-di):
        /dev/video1


使用fswebcam 保持图片

fswebcam -d /dev/video0 -r 640x480 --fps 30 -p UYVY -S 30 1.jpg

修改输出的格式为 1920x1080

media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY/1920x1080]'
fswebcam -d /dev/video1 -r 1920x1080 -D 3 --jpeg 100 1.jpg

 

参考

https://forum.armbian.com/topic/13238-ov5640-device-tree-overlay-for-orangepi-one-h3/

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解释下后面的代码: display_alert "Merging and packaging linux firmware" "@host" "info" local firmwaretempdir plugin_dir firmwaretempdir=$(mktemp -d) chmod 700 ${firmwaretempdir} trap "ret=\$?; rm -rf \"${firmwaretempdir}\" ; exit \$ret" 0 1 2 3 15 plugin_dir="orangepi-firmware${FULL}" mkdir -p "${firmwaretempdir}/${plugin_dir}/lib/firmware" [[ $IGNORE_UPDATES != yes ]] && fetch_from_repo "https://github.com/orangepi-xunlong/firmware" "${EXTER}/cache/sources/orangepi-firmware-git" "branch:master" if [[ -n $FULL ]]; then [[ $IGNORE_UPDATES != yes ]] && fetch_from_repo "$MAINLINE_FIRMWARE_SOURCE" "${EXTER}/cache/sources/linux-firmware-git" "branch:master" # cp : create hardlinks cp -af --reflink=auto "${EXTER}"/cache/sources/linux-firmware-git/* "${firmwaretempdir}/${plugin_dir}/lib/firmware/" fi # overlay our firmware # cp : create hardlinks cp -af --reflink=auto "${EXTER}"/cache/sources/orangepi-firmware-git/* "${firmwaretempdir}/${plugin_dir}/lib/firmware/" # cleanup what's not needed for sure rm -rf "${firmwaretempdir}/${plugin_dir}"/lib/firmware/{amdgpu,amd-ucode,radeon,nvidia,matrox,.git} cd "${firmwaretempdir}/${plugin_dir}" || exit # set up control file mkdir -p DEBIAN cat <<-END > DEBIAN/control Package: orangepi-firmware${FULL} Version: $REVISION Architecture: all Maintainer: $MAINTAINER <$MAINTAINERMAIL> Installed-Size: 1 Replaces: linux-firmware, firmware-brcm80211, firmware-ralink, firmware-samsung, firmware-realtek, orangepi-firmware${REPLACE} Section: kernel Priority: optional Description: Linux firmware${FULL} END cd "${firmwaretempdir}" || exit # pack mv "orangepi-firmware${FULL}" "orangepi-firmware${FULL}_${REVISION}_all" display_alert "Building firmware package" "orangepi-firmware${FULL}_${REVISION}_all" "info" fakeroot dpkg-deb -b -Z${DEB_COMPRESS} "orangepi-firmware${FULL}_${REVISION}_all" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 mv "orangepi-firmware${FULL}_${REVISION}_all" "orangepi-firmware${FULL}" rsync -rq "orangepi-firmware${FULL}_${REVISION}_all.deb" "${DEB_STORAGE}/" # remove temp directory rm -rf "${firmwaretempdir}"
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值