/dev/video0 是 CCAP
/dev/video1 是 VC8000
/dev/video2 是 webcam
要用 HM1055 ,記得打開 device tree 的 ccap0 和 i2c3
&ccap0 {
status = "okay";
port {
/* Parallel bus endpoint */
ccap0_1: endpoint {
remote-endpoint = <&hm1055_0>;
hsync-active = <0>; /* Active low */
vsync-active = <0>; /* Active low */
pclk-sample = <1>; /* Rising */
};
};
};
&i2c3 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
hm1055@24 {
compatible = "himax,hm1055";
reg = <0x24>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ccap0>;
clocks = <&clk CCAP0_GATE>;
clock-names = "xclk";
reset-gpios = <&gpiom 1 GPIO_ACTIVE_LOW>; /* PM1 */
powerdown-gpios = <&gpiok 8 GPIO_ACTIVE_HIGH>; /* PK8 */
port {
hm1055_0: endpoint {
remote-endpoint = <&ccap0_1>;
};
};
};
};
...
ccap0 {
pinctrl_ccap0: ccap0grp{
nuvoton,pins =
<SYS_GPK_MFPH_PK9MFP_CCAP0_SCLK &pcfg_default>,
<SYS_GPK_MFPH_PK10MFP_CCAP0_PIXCLK &pcfg_default>,
<SYS_GPK_MFPH_PK11MFP_CCAP0_HSYNC &pcfg_default>,
<SYS_GPM_MFPL_PM0MFP_CCAP0_VSYNC &pcfg_default>,
<SYS_GPM_MFPL_PM2MFP_CCAP0_DATA0 &pcfg_default>,
<SYS_GPM_MFPL_PM3MFP_CCAP0_DATA1 &pcfg_default>,
<SYS_GPM_MFPL_PM4MFP_CCAP0_DATA2 &pcfg_default>,
<SYS_GPM_MFPL_PM5MFP_CCAP0_DATA3 &pcfg_default>,
<SYS_GPM_MFPL_PM6MFP_CCAP0_DATA4 &pcfg_default>,
<SYS_GPM_MFPL_PM7MFP_CCAP0_DATA5 &pcfg_default>,
<SYS_GPM_MFPH_PM8MFP_CCAP0_DATA6 &pcfg_default>,
<SYS_GPM_MFPH_PM9MFP_CCAP0_DATA7 &pcfg_default>;
};
};
...
i2c3 {
pinctrl_i2c3: i2c3grp{
nuvoton,pins =
<SYS_GPM_MFPH_PM14MFP_I2C3_SDA &pcfg_default>,
<SYS_GPM_MFPH_PM15MFP_I2C3_SCL &pcfg_default>;
};
};
...
Path : ma35d1.dtsi
雖然 ma35d1.dtsi 的 display 是 status = “disabled”; 但是 ma35d1-som-256m.dts 會繼承 ma35d1.dtsi 的參數並讓 status = “okay”;
注意以下 RGB interface 可以調整
新唐的 Driver 都是 2byte 2byte 往 LCD 送,所以 bits-per-pixel 是 32bits , 雖然是RGB888 3byte,但是送出去是 4 byte
display: display@40260000 {
compatible = "nuvoton,ma35d1-fb";
reg = <0x0 0x40260000 0x0 0x2000>;
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
nuvoton,clk = <&clk>;
clocks = <&clk DCU_GATE>, <&clk DCUP_DIV>;
clock-names = "dcu_gate", "dcup_div";
resets = <&reset MA35D1_RESET_DISP>;
//pwr-gpios = <&gpiok 5 GPIO_ACTIVE_HIGH>; //LVDS pwr-enable pin
status = "disabled";
reset_offset_en = "no";
//RGB interface
bits-per-pixel = <32>;
pixel-fmt = <6>; //4:RGB565 6:RGB888 8:UYVY 17:NV12
swizzle = <0>;//0:ARGB, 1:RGBA, 2:ABGR, 3:BGRA
dpi-config = <5>;//0:D16CFG1, 1:D16CFG2, 2:D16CFG3, 3:D18CFG1, 4:D18CFG2, 5:D24
buffer-num = <3>;
colorkey-en = <1>;
//Enable overlay function
overlay-en = <0>;
overlay-pixel-fmt = <6>;
overlay-width = <1024>;
overlay-height = <600>;
overlay-rect-tlx = <0>;
overlay-rect-tly = <0>;
display-timings {
native-mode = <&timing0>;
...
yocto 版本 ,RD 在 /usr/bin 下 有放capture 腳本,可以 streaming 也可以截圖。
以下為例 用 gst-launch-1.0 。
root@numaker-som-ma35d16a81:/usr/bin# cat capture.sh
#gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video0 ! jpegenc ! filesink location=$1
gst-launch-1.0 v4l2src device=/dev/video0 ! videoscale ! 'video/x-raw,width=640,height=480,framerate=15/1' ! videoconvert ! fbdevsink device=/dev/fb0 sync=false
執行方式 :
root@numaker-som-ma35d16a81:~# capture.sh root@numaker-som-ma35d16a81:~# capture.sh
[ 3549.350833] usb 2-1: reset high-speed USB device number 2 using ma35d1-ehci
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[ 3560.063053] usb 2-1: USB disconnect, device number 2