mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
camera: support the dvp camera [1/1]
PD#SWPL-2133 Problem: don't support dvp camera Solution: add dvp camera driver Verify: verify by u200 Change-Id: I8517913e0c3724247b396e8d054d6a4541a1993a Signed-off-by: Guosong Zhou <guosong.zhou@amlogic.com>
This commit is contained in:
committed by
Dongjin Kim
parent
340349c245
commit
48b683dbf8
@@ -154,8 +154,8 @@
|
||||
vm0_cma_reserved:linux,vm0_cma {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
size = <0x2000000>;
|
||||
alignment = <0x400000>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
compatible = "amlogic, amvdec_656in";
|
||||
dev_name = "amvdec_656in";
|
||||
status = "disabled";
|
||||
reg = <0x0 0xffe02000 0x0 0x7c>;
|
||||
reg = <0xffe02000 0x7c>;
|
||||
clocks = <&clkc CLKID_BT656_COMP>,
|
||||
<&clkc CLKID_BT656>;
|
||||
clock-names = "cts_bt656_clk1",
|
||||
|
||||
@@ -155,6 +155,12 @@
|
||||
alignment = <0x400000>;
|
||||
alloc-ranges = <0x0 0x30000000>;
|
||||
};
|
||||
vm0_cma_reserved:linux,vm0_cma {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x2000000>;
|
||||
alignment = <0x400000>;
|
||||
};
|
||||
};
|
||||
|
||||
gpioleds {
|
||||
@@ -288,6 +294,54 @@
|
||||
dev_name = "ionvideo";
|
||||
status = "okay";
|
||||
};
|
||||
vm0 {
|
||||
compatible = "amlogic, vm";
|
||||
memory-region = <&vm0_cma_reserved>;
|
||||
dev_name = "vm0";
|
||||
status = "disabled";
|
||||
vm_id = <0>;
|
||||
};
|
||||
|
||||
amvdec_656in {
|
||||
/*bt656 gpio conflict with i2c0*/
|
||||
compatible = "amlogic, amvdec_656in";
|
||||
dev_name = "amvdec_656in";
|
||||
status = "disabled";
|
||||
reg = <0xffe02000 0x7c>;
|
||||
clocks = <&clkc CLKID_BT656_COMP>,
|
||||
<&clkc CLKID_BT656>;
|
||||
clock-names = "cts_bt656_clk1",
|
||||
"clk_gate_bt656";
|
||||
/* bt656in1, bt656in2 */
|
||||
bt656in1 {
|
||||
bt656_id = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
aml_cams {
|
||||
compatible = "amlogic, cams_prober";
|
||||
status = "disabled";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&cam_dvp_pins &gen_clk_ee_z>;
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "gc2145";
|
||||
front_back = <0>;
|
||||
/*u200 i2c2 gpio conflict with ethmac*/
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
spread_spectrum = <0>;
|
||||
bt_path = "gpio";
|
||||
bt_path_count = <1>;
|
||||
vdin_path = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keypad{
|
||||
compatible = "amlogic, gpio_keypad";
|
||||
@@ -793,6 +847,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
status = "disabled";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c2_master_pins2>;
|
||||
clock-frequency = <100000>;
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
@@ -1128,6 +1189,32 @@
|
||||
};
|
||||
};
|
||||
|
||||
clk12_24_z_pins:clk12_24_z_pins {
|
||||
mux {
|
||||
groups = "clk12_24_z";
|
||||
function = "clk12_24_ee";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
gen_clk_ee_z: gen_clk_ee_z {
|
||||
mux {
|
||||
groups="gen_clk_ee_z";
|
||||
function="gen_clk_ee";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
cam_dvp_pins:cam_dvp_pins {
|
||||
mux {
|
||||
groups = "bt656_a_vs", "bt656_a_hs", "bt656_a_clk",
|
||||
"bt656_a_din0", "bt656_a_din1", "bt656_a_din2",
|
||||
"bt656_a_din3", "bt656_a_din4", "bt656_a_din5",
|
||||
"bt656_a_din6", "bt656_a_din7";
|
||||
function = "bt656";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}; /* end of pinctrl_periphs */
|
||||
&pinctrl_aobus {
|
||||
|
||||
@@ -149,6 +149,12 @@
|
||||
size = <0x0 0x04000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
};
|
||||
vm0_cma_reserved:linux,vm0_cma {
|
||||
compatible = "shared-dma-pool";
|
||||
reusable;
|
||||
size = <0x0 0x2000000>;
|
||||
alignment = <0x0 0x400000>;
|
||||
};
|
||||
};
|
||||
|
||||
gpioleds {
|
||||
@@ -282,6 +288,54 @@
|
||||
dev_name = "ionvideo";
|
||||
status = "okay";
|
||||
};
|
||||
vm0 {
|
||||
compatible = "amlogic, vm";
|
||||
memory-region = <&vm0_cma_reserved>;
|
||||
dev_name = "vm0";
|
||||
status = "disabled";
|
||||
vm_id = <0>;
|
||||
};
|
||||
|
||||
amvdec_656in {
|
||||
/*bt656 gpio conflict with i2c0*/
|
||||
compatible = "amlogic, amvdec_656in";
|
||||
dev_name = "amvdec_656in";
|
||||
status = "disabled";
|
||||
reg = <0x0 0xffe02000 0x0 0x7c>;
|
||||
clocks = <&clkc CLKID_BT656_COMP>,
|
||||
<&clkc CLKID_BT656>;
|
||||
clock-names = "cts_bt656_clk1",
|
||||
"clk_gate_bt656";
|
||||
/* bt656in1, bt656in2 */
|
||||
bt656in1 {
|
||||
bt656_id = <1>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
aml_cams {
|
||||
compatible = "amlogic, cams_prober";
|
||||
status = "disabled";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&cam_dvp_pins &gen_clk_ee_z>;
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "gc2145";
|
||||
front_back = <0>;
|
||||
/*u200 i2c2 gpio conflict with ethmac*/
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
spread_spectrum = <0>;
|
||||
bt_path = "gpio";
|
||||
bt_path_count = <1>;
|
||||
vdin_path = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keypad{
|
||||
compatible = "amlogic, gpio_keypad";
|
||||
@@ -787,6 +841,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
status = "disabled";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c2_master_pins2>;
|
||||
clock-frequency = <100000>;
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
@@ -1122,6 +1183,32 @@
|
||||
};
|
||||
};
|
||||
|
||||
clk12_24_z_pins:clk12_24_z_pins {
|
||||
mux {
|
||||
groups = "clk12_24_z";
|
||||
function = "clk12_24_ee";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
gen_clk_ee_z: gen_clk_ee_z {
|
||||
mux {
|
||||
groups="gen_clk_ee_z";
|
||||
function="gen_clk_ee";
|
||||
drive-strength = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
cam_dvp_pins:cam_dvp_pins {
|
||||
mux {
|
||||
groups = "bt656_a_vs", "bt656_a_hs", "bt656_a_clk",
|
||||
"bt656_a_din0", "bt656_a_din1", "bt656_a_din2",
|
||||
"bt656_a_din3", "bt656_a_din4", "bt656_a_din5",
|
||||
"bt656_a_din6", "bt656_a_din7";
|
||||
function = "bt656";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}; /* end of pinctrl_periphs */
|
||||
&pinctrl_aobus {
|
||||
|
||||
@@ -1635,22 +1635,9 @@ static int simulate_task(void *data)
|
||||
***********************************************
|
||||
*/
|
||||
|
||||
int vm_buffer_init(struct vm_device_s *vdevp)
|
||||
int alloc_vm_canvas(struct vm_device_s *vdevp)
|
||||
{
|
||||
int i, j;
|
||||
u32 canvas_width, canvas_height;
|
||||
u32 decbuf_size;
|
||||
resource_size_t buf_start;
|
||||
unsigned int buf_size;
|
||||
int buf_num = 0;
|
||||
int local_pool_size = 0;
|
||||
|
||||
init_completion(&vdevp->vb_start_sema);
|
||||
init_completion(&vdevp->vb_done_sema);
|
||||
|
||||
buf_start = vdevp->buffer_start;
|
||||
buf_size = vdevp->buffer_size;
|
||||
|
||||
int j;
|
||||
if (vdevp->index == 0) {
|
||||
for (j = 0; j < MAX_CANVAS_INDEX; j++) {
|
||||
memset(&(vdevp->vm_canvas[j]), -1, sizeof(int));
|
||||
@@ -1673,6 +1660,25 @@ int vm_buffer_init(struct vm_device_s *vdevp)
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vm_buffer_init(struct vm_device_s *vdevp)
|
||||
{
|
||||
int i;
|
||||
u32 canvas_width, canvas_height;
|
||||
u32 decbuf_size;
|
||||
resource_size_t buf_start;
|
||||
unsigned int buf_size;
|
||||
int buf_num = 0;
|
||||
int local_pool_size = 0;
|
||||
|
||||
init_completion(&vdevp->vb_start_sema);
|
||||
init_completion(&vdevp->vb_done_sema);
|
||||
|
||||
buf_start = vdevp->buffer_start;
|
||||
buf_size = vdevp->buffer_size;
|
||||
|
||||
if (!buf_start || !buf_size)
|
||||
goto exit;
|
||||
|
||||
@@ -2199,6 +2205,11 @@ static int vm_driver_probe(struct platform_device *pdev)
|
||||
vm_device[vdevp->index] = vdevp;
|
||||
vdevp->pdev = pdev;
|
||||
platform_set_drvdata(pdev, vdevp);
|
||||
ret = alloc_vm_canvas(vdevp);
|
||||
if (ret != 0) {
|
||||
pr_err("alloc vm canvas failed\n");
|
||||
return ret;
|
||||
}
|
||||
vm_buffer_init(vdevp);
|
||||
ret = init_vm_device(vdevp, pdev);
|
||||
if (ret != 0)
|
||||
|
||||
@@ -95,6 +95,7 @@ struct display_frame_s {
|
||||
|
||||
int start_vm_task(struct vm_device_s *vdevp);
|
||||
int start_simulate_task(void);
|
||||
int alloc_vm_canvas(struct vm_device_s *vdevp);
|
||||
|
||||
extern int get_vm_status(void);
|
||||
extern void set_vm_status(int flag);
|
||||
|
||||
@@ -503,7 +503,8 @@ static struct v4l2_frmsize_discrete
|
||||
|
||||
static struct v4l2_frmsize_discrete gc2145_pic_resolution[] = {
|
||||
{1600, 1200},
|
||||
{800, 600}
|
||||
{800, 600},
|
||||
{640, 480}
|
||||
};
|
||||
|
||||
#ifndef GC2145_MIRROR
|
||||
@@ -1818,23 +1819,23 @@ void GC2145_set_resolution(struct gc2145_device *dev, int height, int width)
|
||||
|
||||
if ((width * height < 1600 * 1200)) {
|
||||
while (1) {
|
||||
buf[0] = gc2145_svga[i].addr;
|
||||
buf[1] = gc2145_svga[i].val;
|
||||
if (gc2145_svga[i].val == 0xff &&
|
||||
gc2145_svga[i].addr == 0xff) {
|
||||
pr_info("success in gc2145_svga.\n");
|
||||
buf[0] = gc2145_uxga[i].addr;
|
||||
buf[1] = gc2145_uxga[i].val;
|
||||
if (gc2145_uxga[i].val == 0xff &&
|
||||
gc2145_uxga[i].addr == 0xff) {
|
||||
pr_info("success in gc2145_uxga.\n");
|
||||
break;
|
||||
}
|
||||
if ((i2c_put_byte_add8(client, buf, 2)) < 0) {
|
||||
pr_err("fail in gc2145_svga.\n");
|
||||
pr_err("fail in gc2145_uxga.\n");
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
gc2145_frmintervals_active.numerator = 1;
|
||||
gc2145_frmintervals_active.denominator = 15;
|
||||
GC2145_h_active = 800;
|
||||
GC2145_v_active = 600;
|
||||
GC2145_h_active = 1600;
|
||||
GC2145_v_active = 1200;
|
||||
mdelay(80);
|
||||
} else if (width * height >= 1200 * 1600) {
|
||||
buf[0] = 0xfe;
|
||||
@@ -3403,6 +3404,7 @@ static int gc2145_probe(struct i2c_client *client,
|
||||
pr_err("Create class gc2145 fail.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
gc2145_dev = device_create(gc2145_class, NULL,
|
||||
MKDEV(0, 1), NULL, "dev");
|
||||
device_create_file(gc2145_dev, &dev_attr_gc2145);
|
||||
|
||||
Reference in New Issue
Block a user