media: rockchip: isp: Support for RK3326

Change-Id: Iceca3111e6fd03ea6cd64a3c1fcf9627acc4a8c6
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
This commit is contained in:
Hu Kejun
2018-04-09 16:08:10 +08:00
committed by Tao Huang
parent 75e03927ee
commit c16d640f8e
5 changed files with 55 additions and 22 deletions

View File

@@ -6,8 +6,9 @@ which contains image processing, scaling, and compression funcitons.
Required properties:
- compatible: value should be one of the following
"rockchip,rk3288-cif-isp";
"rockchip,rk3399-cif-isp";
"rockchip,rk3288-rkisp1";
"rockchip,rk3326-rkisp1";
"rockchip,rk3399-rkisp1";
- reg : offset and length of the register set for the device.
- interrupts: should contain ISP interrupt.
- clocks: phandle to the required clocks.

View File

@@ -50,6 +50,7 @@
struct isp_match_data {
const char * const *clks;
int size;
enum rkisp1_isp_ver isp_ver;
};
int rkisp1_debug;
@@ -422,14 +423,6 @@ err_cleanup_ctx:
return ret;
}
static const char * const rk3399_isp_clks[] = {
"clk_isp",
"aclk_isp",
"hclk_isp",
"aclk_isp_wrap",
"hclk_isp_wrap",
};
static const char * const rk3288_isp_clks[] = {
"clk_isp",
"aclk_isp",
@@ -438,23 +431,49 @@ static const char * const rk3288_isp_clks[] = {
"sclk_isp_jpe",
};
static const struct isp_match_data rk3288_isp_clk_data = {
.clks = rk3288_isp_clks,
.size = ARRAY_SIZE(rk3288_isp_clks),
static const char * const rk3326_isp_clks[] = {
"clk_isp",
"aclk_isp",
"hclk_isp",
"pclk_isp",
};
static const struct isp_match_data rk3399_isp_clk_data = {
static const char * const rk3399_isp_clks[] = {
"clk_isp",
"aclk_isp",
"hclk_isp",
"aclk_isp_wrap",
"hclk_isp_wrap",
};
static const struct isp_match_data rk3288_isp_match_data = {
.clks = rk3288_isp_clks,
.size = ARRAY_SIZE(rk3288_isp_clks),
.isp_ver = ISP_V10,
};
static const struct isp_match_data rk3326_isp_match_data = {
.clks = rk3326_isp_clks,
.size = ARRAY_SIZE(rk3326_isp_clks),
.isp_ver = ISP_V12,
};
static const struct isp_match_data rk3399_isp_match_data = {
.clks = rk3399_isp_clks,
.size = ARRAY_SIZE(rk3399_isp_clks),
.isp_ver = ISP_V10,
};
static const struct of_device_id rkisp1_plat_of_match[] = {
{
.compatible = "rockchip,rk3288-rkisp1",
.data = &rk3288_isp_clk_data,
.data = &rk3288_isp_match_data,
}, {
.compatible = "rockchip,rk3326-rkisp1",
.data = &rk3326_isp_match_data,
}, {
.compatible = "rockchip,rk3399-rkisp1",
.data = &rk3399_isp_clk_data,
.data = &rk3399_isp_match_data,
},
{},
};
@@ -565,7 +584,7 @@ static int rkisp1_plat_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct v4l2_device *v4l2_dev;
struct rkisp1_device *isp_dev;
const struct isp_match_data *clk_data;
const struct isp_match_data *match_data;
struct resource *res;
int i, ret, irq;
@@ -595,17 +614,18 @@ static int rkisp1_plat_probe(struct platform_device *pdev)
}
isp_dev->irq = irq;
clk_data = match->data;
for (i = 0; i < clk_data->size; i++) {
struct clk *clk = devm_clk_get(dev, clk_data->clks[i]);
match_data = match->data;
for (i = 0; i < match_data->size; i++) {
struct clk *clk = devm_clk_get(dev, match_data->clks[i]);
if (IS_ERR(clk)) {
dev_err(dev, "failed to get %s\n", clk_data->clks[i]);
dev_err(dev, "failed to get %s\n", match_data->clks[i]);
return PTR_ERR(clk);
}
isp_dev->clks[i] = clk;
}
isp_dev->clk_size = clk_data->size;
isp_dev->clk_size = match_data->size;
isp_dev->isp_ver = match_data->isp_ver;
atomic_set(&isp_dev->pipe.power_cnt, 0);
atomic_set(&isp_dev->pipe.stream_cnt, 0);

View File

@@ -56,6 +56,12 @@
#define RKISP1_MAX_SENSOR 2
#define RKISP1_MAX_PIPELINE 4
enum rkisp1_isp_ver {
ISP_V10 = 0,
ISP_V11,
ISP_V12
};
/*
* struct rkisp1_pipeline - An ISP hardware pipeline
*
@@ -116,6 +122,7 @@ struct rkisp1_device {
struct rkisp1_pipeline pipe;
struct vb2_alloc_ctx *alloc_ctx;
struct iommu_domain *domain;
enum rkisp1_isp_ver isp_ver;
};
#endif

View File

@@ -1290,6 +1290,9 @@
#define CIF_ISP_VSM_DELTA_H (CIF_ISP_VSM_BASE + 0x0000001C)
#define CIF_ISP_VSM_DELTA_V (CIF_ISP_VSM_BASE + 0x00000020)
#define CIF_ISP_CSI0_BASE 0x00007000
#define CIF_ISP_CSI0_CTRL0 (CIF_ISP_CSI0_BASE + 0x00000000)
void disable_dcrop(struct rkisp1_stream *stream, bool async);
void config_dcrop(struct rkisp1_stream *stream, struct v4l2_rect *rect,
bool async);

View File

@@ -302,6 +302,8 @@ static int rkisp1_config_mipi(struct rkisp1_device *dev)
CIF_MIPI_CTRL_CLOCKLANE_ENA;
writel(mipi_ctrl, base + CIF_MIPI_CTRL);
if (dev->isp_ver == ISP_V12)
writel(0, base + CIF_ISP_CSI0_CTRL0);
/* Configure Data Type and Virtual Channel */
writel(CIF_MIPI_DATA_SEL_DT(in_fmt->mipi_dt) | CIF_MIPI_DATA_SEL_VC(0),