mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
gpu: ipu-v3: Add Camera Sensor Interface unit
Adds the Camera Sensor Interface (CSI) unit required for video capture. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Removed the unused clk_get_rate in ipu_csi_init_interface and the ipu_csi_ccir_err_detection_enable/disable functions. Checkpatch cleanup. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
committed by
Philipp Zabel
parent
c2d670fd3b
commit
2ffd48f2e7
@@ -1,4 +1,4 @@
|
||||
obj-$(CONFIG_IMX_IPUV3_CORE) += imx-ipu-v3.o
|
||||
|
||||
imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-dc.o ipu-di.o \
|
||||
imx-ipu-v3-objs := ipu-common.o ipu-cpmem.o ipu-csi.o ipu-dc.o ipu-di.o \
|
||||
ipu-dp.o ipu-dmfc.o ipu-smfc.o
|
||||
|
||||
@@ -217,18 +217,6 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ipu_module_disable);
|
||||
|
||||
int ipu_csi_enable(struct ipu_soc *ipu, int csi)
|
||||
{
|
||||
return ipu_module_enable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ipu_csi_enable);
|
||||
|
||||
int ipu_csi_disable(struct ipu_soc *ipu, int csi)
|
||||
{
|
||||
return ipu_module_disable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ipu_csi_disable);
|
||||
|
||||
int ipu_smfc_enable(struct ipu_soc *ipu)
|
||||
{
|
||||
return ipu_module_enable(ipu, IPU_CONF_SMFC_EN);
|
||||
@@ -439,6 +427,8 @@ struct ipu_devtype {
|
||||
unsigned long cpmem_ofs;
|
||||
unsigned long srm_ofs;
|
||||
unsigned long tpm_ofs;
|
||||
unsigned long csi0_ofs;
|
||||
unsigned long csi1_ofs;
|
||||
unsigned long disp0_ofs;
|
||||
unsigned long disp1_ofs;
|
||||
unsigned long dc_tmpl_ofs;
|
||||
@@ -452,6 +442,8 @@ static struct ipu_devtype ipu_type_imx51 = {
|
||||
.cpmem_ofs = 0x1f000000,
|
||||
.srm_ofs = 0x1f040000,
|
||||
.tpm_ofs = 0x1f060000,
|
||||
.csi0_ofs = 0x1f030000,
|
||||
.csi1_ofs = 0x1f038000,
|
||||
.disp0_ofs = 0x1e040000,
|
||||
.disp1_ofs = 0x1e048000,
|
||||
.dc_tmpl_ofs = 0x1f080000,
|
||||
@@ -465,6 +457,8 @@ static struct ipu_devtype ipu_type_imx53 = {
|
||||
.cpmem_ofs = 0x07000000,
|
||||
.srm_ofs = 0x07040000,
|
||||
.tpm_ofs = 0x07060000,
|
||||
.csi0_ofs = 0x07030000,
|
||||
.csi1_ofs = 0x07038000,
|
||||
.disp0_ofs = 0x06040000,
|
||||
.disp1_ofs = 0x06048000,
|
||||
.dc_tmpl_ofs = 0x07080000,
|
||||
@@ -478,6 +472,8 @@ static struct ipu_devtype ipu_type_imx6q = {
|
||||
.cpmem_ofs = 0x00300000,
|
||||
.srm_ofs = 0x00340000,
|
||||
.tpm_ofs = 0x00360000,
|
||||
.csi0_ofs = 0x00230000,
|
||||
.csi1_ofs = 0x00238000,
|
||||
.disp0_ofs = 0x00240000,
|
||||
.disp1_ofs = 0x00248000,
|
||||
.dc_tmpl_ofs = 0x00380000,
|
||||
@@ -508,6 +504,20 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
|
||||
goto err_cpmem;
|
||||
}
|
||||
|
||||
ret = ipu_csi_init(ipu, dev, 0, ipu_base + devtype->csi0_ofs,
|
||||
IPU_CONF_CSI0_EN, ipu_clk);
|
||||
if (ret) {
|
||||
unit = "csi0";
|
||||
goto err_csi_0;
|
||||
}
|
||||
|
||||
ret = ipu_csi_init(ipu, dev, 1, ipu_base + devtype->csi1_ofs,
|
||||
IPU_CONF_CSI1_EN, ipu_clk);
|
||||
if (ret) {
|
||||
unit = "csi1";
|
||||
goto err_csi_1;
|
||||
}
|
||||
|
||||
ret = ipu_di_init(ipu, dev, 0, ipu_base + devtype->disp0_ofs,
|
||||
IPU_CONF_DI0_EN, ipu_clk);
|
||||
if (ret) {
|
||||
@@ -562,6 +572,10 @@ err_dc:
|
||||
err_di_1:
|
||||
ipu_di_exit(ipu, 0);
|
||||
err_di_0:
|
||||
ipu_csi_exit(ipu, 1);
|
||||
err_csi_1:
|
||||
ipu_csi_exit(ipu, 0);
|
||||
err_csi_0:
|
||||
ipu_cpmem_exit(ipu);
|
||||
err_cpmem:
|
||||
dev_err(&pdev->dev, "init %s failed with %d\n", unit, ret);
|
||||
@@ -640,6 +654,8 @@ static void ipu_submodules_exit(struct ipu_soc *ipu)
|
||||
ipu_dc_exit(ipu);
|
||||
ipu_di_exit(ipu, 1);
|
||||
ipu_di_exit(ipu, 0);
|
||||
ipu_csi_exit(ipu, 1);
|
||||
ipu_csi_exit(ipu, 0);
|
||||
ipu_cpmem_exit(ipu);
|
||||
}
|
||||
|
||||
@@ -859,6 +875,10 @@ static int ipu_probe(struct platform_device *pdev)
|
||||
ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS);
|
||||
dev_dbg(&pdev->dev, "cpmem: 0x%08lx\n",
|
||||
ipu_base + devtype->cpmem_ofs);
|
||||
dev_dbg(&pdev->dev, "csi0: 0x%08lx\n",
|
||||
ipu_base + devtype->csi0_ofs);
|
||||
dev_dbg(&pdev->dev, "csi1: 0x%08lx\n",
|
||||
ipu_base + devtype->csi1_ofs);
|
||||
dev_dbg(&pdev->dev, "disp0: 0x%08lx\n",
|
||||
ipu_base + devtype->disp0_ofs);
|
||||
dev_dbg(&pdev->dev, "disp1: 0x%08lx\n",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -157,6 +157,7 @@ struct ipuv3_channel {
|
||||
};
|
||||
|
||||
struct ipu_cpmem;
|
||||
struct ipu_csi;
|
||||
struct ipu_dc_priv;
|
||||
struct ipu_dmfc_priv;
|
||||
struct ipu_di;
|
||||
@@ -189,6 +190,7 @@ struct ipu_soc {
|
||||
struct ipu_dp_priv *dp_priv;
|
||||
struct ipu_dmfc_priv *dmfc_priv;
|
||||
struct ipu_di *di_priv[2];
|
||||
struct ipu_csi *csi_priv[2];
|
||||
struct ipu_smfc_priv *smfc_priv;
|
||||
};
|
||||
|
||||
@@ -211,6 +213,10 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask);
|
||||
bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno);
|
||||
int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms);
|
||||
|
||||
int ipu_csi_init(struct ipu_soc *ipu, struct device *dev, int id,
|
||||
unsigned long base, u32 module, struct clk *clk_ipu);
|
||||
void ipu_csi_exit(struct ipu_soc *ipu, int id);
|
||||
|
||||
int ipu_di_init(struct ipu_soc *ipu, struct device *dev, int id,
|
||||
unsigned long base, u32 module, struct clk *ipu_clk);
|
||||
void ipu_di_exit(struct ipu_soc *ipu, int id);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/fb.h>
|
||||
#include <media/v4l2-mediabus.h>
|
||||
|
||||
struct ipu_soc;
|
||||
|
||||
@@ -61,6 +62,15 @@ struct ipu_di_signal_cfg {
|
||||
u8 vsync_pin;
|
||||
};
|
||||
|
||||
/*
|
||||
* Enumeration of CSI destinations
|
||||
*/
|
||||
enum ipu_csi_dest {
|
||||
IPU_CSI_DEST_IDMAC, /* to memory via SMFC */
|
||||
IPU_CSI_DEST_IC, /* to Image Converter */
|
||||
IPU_CSI_DEST_VDIC, /* to VDIC */
|
||||
};
|
||||
|
||||
enum ipu_color_space {
|
||||
IPUV3_COLORSPACE_RGB,
|
||||
IPUV3_COLORSPACE_YUV,
|
||||
@@ -211,8 +221,26 @@ int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
|
||||
/*
|
||||
* IPU CMOS Sensor Interface (csi) functions
|
||||
*/
|
||||
int ipu_csi_enable(struct ipu_soc *ipu, int csi);
|
||||
int ipu_csi_disable(struct ipu_soc *ipu, int csi);
|
||||
struct ipu_csi;
|
||||
int ipu_csi_init_interface(struct ipu_csi *csi,
|
||||
struct v4l2_mbus_config *mbus_cfg,
|
||||
struct v4l2_mbus_framefmt *mbus_fmt);
|
||||
bool ipu_csi_is_interlaced(struct ipu_csi *csi);
|
||||
void ipu_csi_get_window(struct ipu_csi *csi, struct v4l2_rect *w);
|
||||
void ipu_csi_set_window(struct ipu_csi *csi, struct v4l2_rect *w);
|
||||
void ipu_csi_set_test_generator(struct ipu_csi *csi, bool active,
|
||||
u32 r_value, u32 g_value, u32 b_value,
|
||||
u32 pix_clk);
|
||||
int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
|
||||
struct v4l2_mbus_framefmt *mbus_fmt);
|
||||
int ipu_csi_set_skip_smfc(struct ipu_csi *csi, u32 skip,
|
||||
u32 max_ratio, u32 id);
|
||||
int ipu_csi_set_dest(struct ipu_csi *csi, enum ipu_csi_dest csi_dest);
|
||||
int ipu_csi_enable(struct ipu_csi *csi);
|
||||
int ipu_csi_disable(struct ipu_csi *csi);
|
||||
struct ipu_csi *ipu_csi_get(struct ipu_soc *ipu, int id);
|
||||
void ipu_csi_put(struct ipu_csi *csi);
|
||||
void ipu_csi_dump(struct ipu_csi *csi);
|
||||
|
||||
/*
|
||||
* IPU Sensor Multiple FIFO Controller (SMFC) functions
|
||||
|
||||
Reference in New Issue
Block a user