diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-11-05 22:02:56 +0100 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2016-11-21 15:05:08 +0100 |
commit | d6ab5bcf5f16ba7dcecbd54de4304cc977cba456 (patch) | |
tree | 536e757f3955436e2e495d14f196078c4068fc81 /arch | |
parent | 3b184a9ca00a16f509e710d03c570dc7dcbe44f1 (diff) |
AP1302 from ON Semiconductor support added
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/board-ardbeg-sensors.c | 85 |
1 files changed, 67 insertions, 18 deletions
diff --git a/arch/arm/mach-tegra/board-ardbeg-sensors.c b/arch/arm/mach-tegra/board-ardbeg-sensors.c index e34ea1c39559..37ba9ab3326c 100644 --- a/arch/arm/mach-tegra/board-ardbeg-sensors.c +++ b/arch/arm/mach-tegra/board-ardbeg-sensors.c @@ -341,24 +341,6 @@ static struct platform_device ardbeg_ar0330_soc_camera_device = { }; #endif -static struct regulator *ardbeg_vcmvdd; - -static int ardbeg_get_extra_regulators(void) -{ - if (!ardbeg_vcmvdd) { - ardbeg_vcmvdd = regulator_get(NULL, "avdd_af1_cam"); - if (WARN_ON(IS_ERR(ardbeg_vcmvdd))) { - pr_err("%s: can't get regulator avdd_af1_cam: %ld\n", - __func__, PTR_ERR(ardbeg_vcmvdd)); - regulator_put(ardbeg_vcmvdd); - ardbeg_vcmvdd = NULL; - return -ENODEV; - } - } - - return 0; -} - static struct tegra_io_dpd csia_io = { .name = "CSIA", .io_dpd_reg_index = 0, @@ -377,6 +359,68 @@ static struct tegra_io_dpd csie_io = { .io_dpd_bit = 12, }; +#if IS_ENABLED(CONFIG_SOC_CAMERA_AP1302) +static int ardbeg_ap1302_power(struct device *dev, int enable) +{ + if(enable) { + /* disable CSIA IOs DPD mode to turn on camera for ardbeg */ + tegra_io_dpd_disable(&csia_io); + tegra_io_dpd_disable(&csib_io); + } else { + tegra_io_dpd_enable(&csia_io); + tegra_io_dpd_enable(&csib_io); + } + return 0; +} + +static struct i2c_board_info ardbeg_ap1302_camera_i2c_device = { + I2C_BOARD_INFO("ap1302", 0x3c), +}; + +static struct tegra_camera_platform_data ardbeg_ap1302_camera_platform_data = { + .flip_v = 0, + .flip_h = 0, + .port = TEGRA_CAMERA_PORT_CSI_A, + .lanes = 4, + .continuous_clk = 0, +}; + +static struct soc_camera_link ap1302_iclink = { + .bus_id = 0, /* This must match the .id of tegra_vi01_device */ + .board_info = &ardbeg_ap1302_camera_i2c_device, + .module_name = "ap1302", + .i2c_adapter_id = 2, + .power = ardbeg_ap1302_power, + .priv = &ardbeg_ap1302_camera_platform_data, +}; + +static struct platform_device ardbeg_ap1302_soc_camera_device = { + .name = "soc-camera-pdrv", + .id = 2, + .dev = { + .platform_data = &ap1302_iclink, + }, +}; +#endif + +static struct regulator *ardbeg_vcmvdd; + +static int ardbeg_get_extra_regulators(void) +{ + if (!ardbeg_vcmvdd) { + ardbeg_vcmvdd = regulator_get(NULL, "avdd_af1_cam"); + if (WARN_ON(IS_ERR(ardbeg_vcmvdd))) { + pr_err("%s: can't get regulator avdd_af1_cam: %ld\n", + __func__, PTR_ERR(ardbeg_vcmvdd)); + regulator_put(ardbeg_vcmvdd); + ardbeg_vcmvdd = NULL; + return -ENODEV; + } + } + + return 0; +} + static int ardbeg_ar0330_front_power_on(struct ar0330_power_rail *pw) { int err; @@ -1556,9 +1600,14 @@ static int ardbeg_camera_init(void) #if IS_ENABLED(CONFIG_SOC_CAMERA_AR0261) platform_device_register(&ardbeg_ar0261_soc_camera_device); #endif + #if IS_ENABLED(CONFIG_SOC_CAMERA_AR0330) platform_device_register(&ardbeg_ar0330_soc_camera_device); #endif + +#if IS_ENABLED(CONFIG_SOC_CAMERA_AP1302) + platform_device_register(&ardbeg_ap1302_soc_camera_device); +#endif return 0; } |