mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
camsys_drv:v0.c.0 camsys_head:v0.7.0
This commit is contained in:
@@ -1179,6 +1179,12 @@
|
||||
rockchip,drive = <VALUE_DRV_DEFAULT>;
|
||||
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
|
||||
};
|
||||
isp_flash_trigger_as_gpio:isp_flash_trigger_as_gpio {
|
||||
rockchip,pins = <FUNC_TO_GPIO(ISP_FLASHTRIGOUTSPI1_CS0)>;
|
||||
rockchip,pull = <VALUE_PULL_DISABLE>;
|
||||
rockchip,drive = <VALUE_DRV_DEFAULT>;
|
||||
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -1208,17 +1208,20 @@
|
||||
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk_gates16 2>, <&clk_gates16 1>, <&clk_isp>, <&clk_isp_jpe>, <&clkin_isp>, <&clk_cif_out>, <&clk_gates5 15>, <&clk_cif_pll>, <&pd_isp>, <&clk_gates16 6>;
|
||||
clock-names = "aclk_isp", "hclk_isp", "clk_isp", "clk_isp_jpe", "pclkin_isp", "clk_cif_out", "clk_mipi_24m", "clk_cif_pll", "pd_isp", "hclk_mipiphy1";
|
||||
pinctrl-names = "default", "isp_dvp8bit2", "isp_dvp10bit", "isp_dvp12bit", "isp_dvp8bit0", "isp_mipi_fl", "isp_mipi_fl_prefl";
|
||||
pinctrl-names = "default", "isp_dvp8bit2", "isp_dvp10bit", "isp_dvp12bit", "isp_dvp8bit0", "isp_mipi_fl", "isp_mipi_fl_prefl","isp_flash_as_gpio","isp_flash_as_trigger_out";
|
||||
pinctrl-0 = <&isp_mipi>;
|
||||
pinctrl-1 = <&isp_mipi &isp_dvp_d2d9>;
|
||||
pinctrl-2 = <&isp_mipi &isp_dvp_d2d9 &isp_dvp_d0d1>;
|
||||
pinctrl-3 = <&isp_mipi &isp_dvp_d2d9 &isp_dvp_d0d1 &isp_dvp_d10d11>;
|
||||
pinctrl-4 = <&isp_mipi &isp_dvp_d0d7>;
|
||||
pinctrl-5 = <&isp_mipi &isp_flash_trigger>;
|
||||
pinctrl-6 = <&isp_mipi &isp_flash_trigger &isp_prelight>;
|
||||
pinctrl-5 = <&isp_mipi>;
|
||||
pinctrl-6 = <&isp_mipi &isp_prelight>;
|
||||
pinctrl-7 = <&isp_flash_trigger_as_gpio>;
|
||||
pinctrl-8 = <&isp_flash_trigger>;
|
||||
rockchip,isp,mipiphy = <2>;
|
||||
rockchip,isp,cifphy = <1>;
|
||||
rockchip,isp,mipiphy1,reg = <0xff968000 0x4000>;
|
||||
rockchip,gpios = <&gpio7 GPIO_B5 GPIO_ACTIVE_HIGH>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
||||
@@ -377,7 +377,11 @@ static int camsys_sysctl(camsys_sysctrl_t *devctl, camsys_dev_t *camsys_dev)
|
||||
{
|
||||
camsys_dev->reset_cb(camsys_dev, devctl->on);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CamSys_Flash_Trigger:
|
||||
{
|
||||
camsys_dev->flash_trigger_cb(camsys_dev, devctl->on);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/rockchip/cpu.h>
|
||||
#include <media/camsys_head.h>
|
||||
|
||||
@@ -76,8 +77,10 @@
|
||||
* 1) fix camsys_i2c_write and camsys_i2c_write can't support reg_size=0;
|
||||
*v0.b.0:
|
||||
1) control ddr freq by marvin self other than by clk unit.
|
||||
*v0.c.0:
|
||||
1) add flash_trigger_out control
|
||||
*/
|
||||
#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0,0xb,0)
|
||||
#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0,0xc,0)
|
||||
|
||||
|
||||
#define CAMSYS_PLATFORM_DRV_NAME "RockChip-CamSys"
|
||||
@@ -236,6 +239,7 @@ typedef struct camsys_dev_s {
|
||||
int (*phy_cb) (camsys_extdev_t *extdev, camsys_sysctrl_t *devctl, void* ptr);
|
||||
int (*iomux)(camsys_extdev_t *extdev,void *ptr);
|
||||
int (*platform_remove)(struct platform_device *pdev);
|
||||
int (*flash_trigger_cb)(void *ptr, unsigned int on);
|
||||
} camsys_dev_t;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "camsys_marvin.h"
|
||||
#include "camsys_soc_priv.h"
|
||||
#include "camsys_gpio.h"
|
||||
|
||||
#include <linux/rockchip/common.h>
|
||||
#include <dt-bindings/clock/rk_system_status.h>
|
||||
@@ -9,6 +10,7 @@ extern int rockchip_clear_system_status(unsigned long status);
|
||||
|
||||
static const char miscdev_name[] = CAMSYS_MARVIN_DEVNAME;
|
||||
|
||||
|
||||
static int camsys_mrv_iomux_cb(camsys_extdev_t *extdev,void *ptr)
|
||||
{
|
||||
struct pinctrl *pinctrl;
|
||||
@@ -110,11 +112,75 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int camsys_mrv_flash_trigger_cb(void *ptr,unsigned int on)
|
||||
{
|
||||
camsys_dev_t *camsys_dev = (camsys_dev_t*)ptr;
|
||||
struct device *dev = &(camsys_dev->pdev->dev);
|
||||
int flash_trigger_io ;
|
||||
struct pinctrl *pinctrl;
|
||||
struct pinctrl_state *state;
|
||||
char state_str[20] = {0};
|
||||
int retval = 0;
|
||||
enum of_gpio_flags flags;
|
||||
|
||||
if(!on){
|
||||
strcpy(state_str,"isp_flash_as_gpio");
|
||||
pinctrl = devm_pinctrl_get(dev);
|
||||
if (IS_ERR(pinctrl)) {
|
||||
camsys_err("devm_pinctrl_get failed!");
|
||||
}
|
||||
state = pinctrl_lookup_state(pinctrl,
|
||||
state_str);
|
||||
if (IS_ERR(state)){
|
||||
camsys_err("pinctrl_lookup_state failed!");
|
||||
}
|
||||
|
||||
if (!IS_ERR(state)) {
|
||||
retval = pinctrl_select_state(pinctrl, state);
|
||||
if (retval){
|
||||
camsys_err("pinctrl_select_state failed!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//get gpio index
|
||||
flash_trigger_io = of_get_named_gpio_flags(camsys_dev->pdev->dev.of_node, "rockchip,gpios", 0, &flags);
|
||||
if(gpio_is_valid(flash_trigger_io)){
|
||||
flash_trigger_io = of_get_named_gpio_flags(camsys_dev->pdev->dev.of_node, "rockchip,gpios", 0, &flags);
|
||||
gpio_request(flash_trigger_io,"camsys_gpio");
|
||||
gpio_direction_output(flash_trigger_io, 1);
|
||||
}
|
||||
|
||||
}else{
|
||||
strcpy(state_str,"isp_flash_as_trigger_out");
|
||||
pinctrl = devm_pinctrl_get(dev);
|
||||
if (IS_ERR(pinctrl)) {
|
||||
camsys_err("devm_pinctrl_get failed!");
|
||||
}
|
||||
state = pinctrl_lookup_state(pinctrl,
|
||||
state_str);
|
||||
if (IS_ERR(state)){
|
||||
camsys_err("pinctrl_lookup_state failed!");
|
||||
}
|
||||
|
||||
if (!IS_ERR(state)) {
|
||||
retval = pinctrl_select_state(pinctrl, state);
|
||||
if (retval){
|
||||
camsys_err("pinctrl_select_state failed!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static int camsys_mrv_reset_cb(void *ptr,unsigned int on)
|
||||
{
|
||||
camsys_dev_t *camsys_dev = (camsys_dev_t*)ptr;
|
||||
camsys_soc_priv_t *soc;
|
||||
|
||||
|
||||
if (camsys_dev->soc) {
|
||||
soc = (camsys_soc_priv_t*)camsys_dev->soc;
|
||||
if (soc->soc_cfg) {
|
||||
@@ -144,7 +210,7 @@ static int camsys_mrv_clkin_cb(void *ptr, unsigned int on)
|
||||
clk_prepare_enable(clk->clk_mipi_24m);
|
||||
clk_prepare_enable(clk->pclkin_isp);
|
||||
clk_prepare_enable(clk->pd_isp);
|
||||
|
||||
|
||||
clk->in_on = true;
|
||||
|
||||
camsys_trace(1, "%s clock in turn on",dev_name(camsys_dev->miscdev.this_device));
|
||||
@@ -154,7 +220,6 @@ static int camsys_mrv_clkin_cb(void *ptr, unsigned int on)
|
||||
|
||||
} else if (!on && clk->in_on) {
|
||||
|
||||
|
||||
clk_disable_unprepare(clk->aclk_isp);
|
||||
clk_disable_unprepare(clk->hclk_isp);
|
||||
clk_disable_unprepare(clk->isp);
|
||||
@@ -357,6 +422,7 @@ int camsys_mrv_probe_cb(struct platform_device *pdev, camsys_dev_t *camsys_dev)
|
||||
camsys_dev->clkout_cb = camsys_mrv_clkout_cb;
|
||||
camsys_dev->reset_cb = camsys_mrv_reset_cb;
|
||||
camsys_dev->iomux = camsys_mrv_iomux_cb;
|
||||
camsys_dev->flash_trigger_cb = camsys_mrv_flash_trigger_cb;
|
||||
|
||||
camsys_dev->miscdev.minor = MISC_DYNAMIC_MINOR;
|
||||
camsys_dev->miscdev.name = miscdev_name;
|
||||
|
||||
@@ -20,7 +20,12 @@
|
||||
#define MRV_MI_MIS (MRV_MI_BASE+0x100)
|
||||
#define MRV_MI_ICR (MRV_MI_BASE+0x104)
|
||||
|
||||
#define MRV_FLASH_CONFIG (0x664)
|
||||
|
||||
typedef enum IO_USE_TYPE_e{
|
||||
USE_AS_GPIO,
|
||||
USE_AS_ISP_INTERNAL,
|
||||
}IO_USE_TYPE_t;
|
||||
|
||||
typedef struct camsys_mrv_clk_s {
|
||||
struct clk *pd_isp;
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
*v0.6.0:
|
||||
* 1) add support mipi phy configuration;
|
||||
* 2) add support io domain and mclk driver strength configuration;
|
||||
*v0.7.0:
|
||||
1) add flash_trigger_out control
|
||||
*/
|
||||
#define CAMSYS_HEAD_VERSION KERNEL_VERSION(0,6,0)
|
||||
#define CAMSYS_HEAD_VERSION KERNEL_VERSION(0,7,0)
|
||||
|
||||
#define CAMSYS_MARVIN_DEVNAME "camsys_marvin"
|
||||
#define CAMSYS_CIF0_DEVNAME "camsys_cif0"
|
||||
@@ -111,7 +113,10 @@ typedef enum camsys_sysctrl_ops_e {
|
||||
|
||||
CamSys_Phy_Start_Tag,
|
||||
CamSys_Phy,
|
||||
CamSys_Phy_End_Tag
|
||||
CamSys_Phy_End_Tag,
|
||||
CamSys_Flash_Trigger_Start_Tag,
|
||||
CamSys_Flash_Trigger,
|
||||
CamSys_Flash_Trigger_End_Tag
|
||||
|
||||
} camsys_sysctrl_ops_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user