mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
camera: add gc2145 mipi camera driver [1/2]
PD#SWPL-8903 Problem: S905D3 project need bring up gc2145 mipi camera Solution: bring up gc2145 mipi camera on S905D3-AC202 Verify: verify on S905D3-AC202 Change-Id: I5c7c3c551eca7ec20759e724c24d725f89641d96 Signed-off-by: Guosong Zhou <guosong.zhou@amlogic.com>
This commit is contained in:
10
MAINTAINERS
10
MAINTAINERS
@@ -14954,3 +14954,13 @@ F: arch/arm/boot/dts/amlogic/gxl_p281_1g.dts
|
||||
F: arch/arm/boot/dts/amlogic/gxl_p281_2g.dts
|
||||
F: arch/arm64/boot/dts/amlogic/gxl_p281_1g.dts
|
||||
F: arch/arm64/boot/dts/amlogic/gxl_p281_2g.dts
|
||||
|
||||
AMLOGIC CAMERA GC2145 MIPI DRIVER
|
||||
M: Guosong Zhou <guosong.zhou@amlogic.com>
|
||||
F: arch/arm/boot/dts/amlogic/sm1_s905d3_ac202.dts
|
||||
F: arch/arm/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
|
||||
F: arch/arm/configs/meson64_a32_defconfig
|
||||
F: arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202.dts
|
||||
F: arch/arm64/boot/dts/amlogic/sm1_s905d3_ac202_1g.dts
|
||||
F: arch/arm64/configs/meson64_defconfig
|
||||
F: drivers/amlogic/media/camera/gc2145_mipi.c
|
||||
@@ -339,11 +339,10 @@
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "ov5640";
|
||||
cam_name = "gc2145_mipi";
|
||||
front_back = <0>;
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
camvdd-gpios = <&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>;
|
||||
camera-i2c-bus = <&i2c0>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
@@ -1056,8 +1055,8 @@
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c0_master_pins2>;
|
||||
clock-frequency = <400000>;
|
||||
pinctrl-0=<&i2c0_master_pins1>;
|
||||
clock-frequency = <100000>;
|
||||
|
||||
gt9xx@5d {
|
||||
compatible = "goodix,gt9xx";
|
||||
@@ -1749,7 +1748,7 @@
|
||||
};
|
||||
|
||||
&sd_emmc_b {
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
sd {
|
||||
caps = "MMC_CAP_4_BIT_DATA",
|
||||
"MMC_CAP_MMC_HIGHSPEED",
|
||||
|
||||
@@ -339,11 +339,10 @@
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "ov5640";
|
||||
cam_name = "gc2145_mipi";
|
||||
front_back = <0>;
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
camvdd-gpios = <&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>;
|
||||
camera-i2c-bus = <&i2c0>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
@@ -1056,8 +1055,8 @@
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c0_master_pins2>;
|
||||
clock-frequency = <400000>;
|
||||
pinctrl-0=<&i2c0_master_pins1>;
|
||||
clock-frequency = <100000>;
|
||||
|
||||
gt9xx@5d {
|
||||
compatible = "goodix,gt9xx";
|
||||
@@ -1749,7 +1748,7 @@
|
||||
};
|
||||
|
||||
&sd_emmc_b {
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
sd {
|
||||
caps = "MMC_CAP_4_BIT_DATA",
|
||||
"MMC_CAP_MMC_HIGHSPEED",
|
||||
|
||||
@@ -335,7 +335,7 @@ CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_PRIME_SL=y
|
||||
CONFIG_AMLOGIC_MEDIA_GDC=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE=y
|
||||
CONFIG_AMLOGIC_VM_DISABLE_VIDEOLAYER=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_OV5640=y
|
||||
CONFIG_AMLOGIC_DTV_DEMOD=y
|
||||
CONFIG_AMLOGIC_MMC=y
|
||||
|
||||
@@ -337,11 +337,10 @@
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "ov5640";
|
||||
cam_name = "gc2145_mipi";
|
||||
front_back = <0>;
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
camvdd-gpios = <&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>;
|
||||
camera-i2c-bus = <&i2c0>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
@@ -1055,8 +1054,8 @@
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c0_master_pins2>;
|
||||
clock-frequency = <400000>;
|
||||
pinctrl-0=<&i2c0_master_pins1>;
|
||||
clock-frequency = <100000>;
|
||||
|
||||
gt9xx@5d {
|
||||
compatible = "goodix,gt9xx";
|
||||
@@ -1735,7 +1734,7 @@
|
||||
};
|
||||
|
||||
&sd_emmc_b {
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
sd {
|
||||
caps = "MMC_CAP_4_BIT_DATA",
|
||||
"MMC_CAP_MMC_HIGHSPEED",
|
||||
|
||||
@@ -337,11 +337,10 @@
|
||||
clocks = <&clkc CLKID_GEN_CLK>;
|
||||
clock-names = "g12a_24m";
|
||||
cam_0{
|
||||
cam_name = "ov5640";
|
||||
cam_name = "gc2145_mipi";
|
||||
front_back = <0>;
|
||||
camera-i2c-bus = <&i2c2>;
|
||||
camvdd-gpios = <&gpio GPIOZ_5 GPIO_ACTIVE_HIGH>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_6 GPIO_ACTIVE_HIGH>;
|
||||
camera-i2c-bus = <&i2c0>;
|
||||
gpio_pwdn-gpios = <&gpio GPIOZ_2 GPIO_ACTIVE_HIGH>;
|
||||
gpio_rst-gpios = <&gpio GPIOZ_12 GPIO_ACTIVE_HIGH>;
|
||||
mirror_flip = <1>;
|
||||
vertical_flip = <1>;
|
||||
@@ -1055,8 +1054,8 @@
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
pinctrl-names="default";
|
||||
pinctrl-0=<&i2c0_master_pins2>;
|
||||
clock-frequency = <400000>;
|
||||
pinctrl-0=<&i2c0_master_pins1>;
|
||||
clock-frequency = <100000>;
|
||||
|
||||
gt9xx@5d {
|
||||
compatible = "goodix,gt9xx";
|
||||
@@ -1736,7 +1735,7 @@
|
||||
};
|
||||
|
||||
&sd_emmc_b {
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
sd {
|
||||
caps = "MMC_CAP_4_BIT_DATA",
|
||||
"MMC_CAP_MMC_HIGHSPEED",
|
||||
|
||||
@@ -330,7 +330,7 @@ CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_PRIME_SL=y
|
||||
CONFIG_AMLOGIC_MEDIA_GDC=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE=y
|
||||
CONFIG_AMLOGIC_VM_DISABLE_VIDEOLAYER=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI=y
|
||||
CONFIG_AMLOGIC_VIDEO_CAPTURE_OV5640=y
|
||||
CONFIG_AMLOGIC_DTV_DEMOD=y
|
||||
CONFIG_AMLOGIC_MMC=y
|
||||
|
||||
@@ -186,6 +186,16 @@ config AMLOGIC_VIDEO_CAPTURE_GC2145
|
||||
Amlogic capture driver.
|
||||
Say Y here if you want this driver.
|
||||
|
||||
config AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI
|
||||
tristate "Amlogic Platform Capture Driver for GC2145_MIPI"
|
||||
depends on AMLOGIC_VIDEO_CAPTURE
|
||||
default n
|
||||
---help---
|
||||
Amlogic capture driver.
|
||||
Say Y here if you want this driver.
|
||||
Amlogic capture driver.
|
||||
Say Y here if you want this driver.
|
||||
|
||||
config AMLOGIC_VIDEO_CAPTURE_OV5640
|
||||
tristate "Amlogic Platform Capture Driver for OV5640"
|
||||
depends on AMLOGIC_VIDEO_CAPTURE
|
||||
|
||||
@@ -7,6 +7,7 @@ amlcamera-objs := common/plat_ctrl.o
|
||||
amlvm-objs := common/vm.o
|
||||
cam_prober-objs := common/cam_prober.o common/config_parser.o
|
||||
gc2145dri-objs := gc2145.o
|
||||
gc2145dri_mipi-objs := gc2145_mipi.o
|
||||
ov5640dri-objs := ov5640.o
|
||||
|
||||
obj-y += amlflash.o
|
||||
@@ -14,4 +15,5 @@ obj-y += amlvm.o
|
||||
obj-y += amlcamera.o
|
||||
obj-y += cam_prober.o
|
||||
obj-$(CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145) += gc2145dri.o
|
||||
obj-$(CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI) += gc2145dri_mipi.o
|
||||
obj-$(CONFIG_AMLOGIC_VIDEO_CAPTURE_OV5640) += ov5640dri.o
|
||||
@@ -611,6 +611,22 @@ int __init gc2145_v4l2_probe(struct i2c_adapter *adapter)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI
|
||||
int __init gc2145_mipi_v4l2_probe(struct i2c_adapter *adapter)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned char reg[2];
|
||||
|
||||
reg[0] = aml_i2c_get_byte_add8(adapter, 0x3c, 0xf0);
|
||||
reg[1] = aml_i2c_get_byte_add8(adapter, 0x3c, 0xf1);
|
||||
/*datasheet chip id is error*/
|
||||
if (reg[0] == 0x21 && reg[1] == 0x45)
|
||||
ret = 1;
|
||||
pr_info("%s, ret = %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct aml_cam_dev_info_s {
|
||||
unsigned char addr;
|
||||
char *name;
|
||||
@@ -896,6 +912,15 @@ static const struct aml_cam_dev_info_s cam_devs[] = {
|
||||
.probe_func = gc2145_v4l2_probe,
|
||||
},
|
||||
#endif
|
||||
#if CONFIG_AMLOGIC_VIDEO_CAPTURE_GC2145_MIPI
|
||||
{
|
||||
.addr = 0x3c,
|
||||
.name = "gc2145_mipi",
|
||||
.pwdn = 1,
|
||||
.max_cap_size = SIZE_1600X1200,
|
||||
.probe_func = gc2145_mipi_v4l2_probe,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct aml_cam_dev_info_s *get_cam_info_by_name(const char *name)
|
||||
@@ -1201,12 +1226,14 @@ static int fill_cam_dev(struct device_node *p_node,
|
||||
|
||||
cam_dev->cam_vdd = of_get_named_gpio(p_node, "camvdd-gpios", 0);
|
||||
pr_info("cam_dev->cam_vdd = %d\n", cam_dev->cam_vdd);
|
||||
if (cam_dev->cam_vdd == 0)
|
||||
if (cam_dev->cam_vdd > 0) {
|
||||
ret = gpio_request(cam_dev->cam_vdd, "camera");
|
||||
if (ret < 0)
|
||||
pr_info("aml_cam_init cam_vdd request failed\n");
|
||||
else
|
||||
gpio_direction_output(cam_dev->cam_vdd, 0);
|
||||
} else
|
||||
pr_info("%s: failed to map gpio_cam_vdd !\n", cam_dev->name);
|
||||
ret = gpio_request(cam_dev->cam_vdd, "camera");
|
||||
if (ret < 0)
|
||||
pr_info("aml_cam_init cam_vdd request failed\n");
|
||||
gpio_direction_output(cam_dev->cam_vdd, 0);
|
||||
|
||||
cam_dev->pwdn_pin = of_get_named_gpio(p_node, "gpio_pwdn-gpios", 0);
|
||||
if (cam_dev->pwdn_pin == 0) {
|
||||
|
||||
3397
drivers/amlogic/media/camera/gc2145_mipi.c
Normal file
3397
drivers/amlogic/media/camera/gc2145_mipi.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -74,6 +74,16 @@ enum resolution_size {
|
||||
SIZE_6400X4800, /* 30M 4:3 */
|
||||
};
|
||||
|
||||
enum ev_step {
|
||||
EV_COMP_n30 = 0,
|
||||
EV_COMP_n20,
|
||||
EV_COMP_n10,
|
||||
EV_COMP_00,
|
||||
EV_COMP_10,
|
||||
EV_COMP_20,
|
||||
EV_COMP_30,
|
||||
};
|
||||
|
||||
typedef int (*aml_cam_probe_fun_t)(struct i2c_adapter *);
|
||||
|
||||
struct aml_cam_info_s {
|
||||
@@ -108,7 +118,7 @@ struct aml_cam_info_s {
|
||||
/* gpio_t torch_ctrl_pin; */
|
||||
unsigned int pwdn_pin;
|
||||
unsigned int rst_pin;
|
||||
unsigned int cam_vdd;
|
||||
int cam_vdd;
|
||||
unsigned int flash_ctrl_pin;
|
||||
unsigned int torch_ctrl_pin;
|
||||
enum resolution_size max_cap_size;
|
||||
|
||||
Reference in New Issue
Block a user