mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
media: rockchip: vicap fixes error of lvds for rv1126b
and compatitle with mipi and lvds links Change-Id: I8bf79bdce46dc1979d7e17dabbcd87eae726e82d Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
This commit is contained in:
@@ -5127,7 +5127,8 @@ static int rkcif_csi_channel_set_rv1126b(struct rkcif_stream *stream,
|
||||
|
||||
if (stream->dma_en) {
|
||||
if (mbus_type == V4L2_MBUS_CSI2_DPHY ||
|
||||
mbus_type == V4L2_MBUS_CSI2_CPHY) {
|
||||
mbus_type == V4L2_MBUS_CSI2_CPHY ||
|
||||
dev->chip_id >= CHIP_RV1126B_CIF) {
|
||||
dma_en = CSI_DMA_ENABLE_RK3576;
|
||||
} else {
|
||||
dma_en = LVDS_DMAEN_RV1106;
|
||||
@@ -12063,7 +12064,9 @@ static u32 rkcif_get_sof(struct rkcif_device *cif_dev)
|
||||
struct csi2_dev *csi;
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY ||
|
||||
sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) {
|
||||
sensor->mbus.type == V4L2_MBUS_CSI2_CPHY ||
|
||||
(sensor->mbus.type == V4L2_MBUS_CCP2 &&
|
||||
cif_dev->chip_id >= CHIP_RV1106_CIF)) {
|
||||
csi = container_of(sensor->sd, struct csi2_dev, sd);
|
||||
val = rkcif_csi2_get_sof(csi);
|
||||
} else if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
@@ -12081,7 +12084,9 @@ void rkcif_set_sof(struct rkcif_device *cif_dev, u32 seq)
|
||||
struct csi2_dev *csi;
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY ||
|
||||
sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) {
|
||||
sensor->mbus.type == V4L2_MBUS_CSI2_CPHY ||
|
||||
(sensor->mbus.type == V4L2_MBUS_CCP2 &&
|
||||
cif_dev->chip_id >= CHIP_RV1106_CIF)) {
|
||||
csi = container_of(sensor->sd, struct csi2_dev, sd);
|
||||
rkcif_csi2_set_sof(csi, seq);
|
||||
} else if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
@@ -13139,7 +13144,9 @@ static void rkcif_send_sof(struct rkcif_device *cif_dev)
|
||||
return;
|
||||
|
||||
if (mbus->type == V4L2_MBUS_CSI2_DPHY ||
|
||||
mbus->type == V4L2_MBUS_CSI2_CPHY) {
|
||||
mbus->type == V4L2_MBUS_CSI2_CPHY ||
|
||||
(mbus->type == V4L2_MBUS_CCP2 &&
|
||||
cif_dev->chip_id >= CHIP_RV1106_CIF)) {
|
||||
csi = container_of(cif_dev->active_sensor->sd, struct csi2_dev, sd);
|
||||
rkcif_csi2_event_inc_sof(csi);
|
||||
} else if (mbus->type == V4L2_MBUS_CCP2) {
|
||||
|
||||
@@ -1897,7 +1897,8 @@ static int rkcif_create_link(struct rkcif_device *dev,
|
||||
|
||||
linked_sensor.lanes = sensor->lanes;
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2 &&
|
||||
dev->chip_id < CHIP_RV1106_CIF) {
|
||||
linked_sensor.sd = &dev->lvds_subdev.sd;
|
||||
dev->lvds_subdev.sensor_self.sd = &dev->lvds_subdev.sd;
|
||||
dev->lvds_subdev.sensor_self.lanes = sensor->lanes;
|
||||
@@ -2027,7 +2028,8 @@ static int rkcif_create_link(struct rkcif_device *dev,
|
||||
}
|
||||
}
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2 &&
|
||||
dev->chip_id < CHIP_RV1106_CIF) {
|
||||
source_entity = &sensor->sd->entity;
|
||||
sink_entity = &linked_sensor.sd->entity;
|
||||
ret = media_create_pad_link(source_entity,
|
||||
@@ -2143,7 +2145,8 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
|
||||
sensor->lanes = sensor->mbus.bus.mipi_csi1.data_lane;
|
||||
}
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2 &&
|
||||
dev->chip_id < CHIP_RV1106_CIF) {
|
||||
ret = rkcif_register_lvds_subdev(dev);
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
|
||||
@@ -125,7 +125,7 @@ static void csi2_update_sensor_info(struct csi2_dev *csi2)
|
||||
csi2->dsi_input_en = 0;
|
||||
}
|
||||
|
||||
csi2->bus = mbus.bus.mipi_csi2;
|
||||
csi2->mbus = mbus;
|
||||
|
||||
}
|
||||
|
||||
@@ -172,23 +172,19 @@ static void csi2_disable(struct csi2_hw *csi2_hw)
|
||||
write_csihost_reg(csi2_hw->base, CSIHOST_MSK2, 0xffffffff);
|
||||
}
|
||||
|
||||
static int csi2_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
|
||||
struct v4l2_mbus_config *mbus);
|
||||
|
||||
static void csi2_enable(struct csi2_hw *csi2_hw,
|
||||
enum host_type_t host_type)
|
||||
{
|
||||
void __iomem *base = csi2_hw->base;
|
||||
struct csi2_dev *csi2 = csi2_hw->csi2;
|
||||
int lanes = csi2->bus.num_data_lanes;
|
||||
struct v4l2_mbus_config mbus;
|
||||
int lanes = csi2->mbus.bus.mipi_csi2.num_data_lanes;
|
||||
struct v4l2_mbus_config mbus = csi2->mbus;
|
||||
u32 val = 0;
|
||||
u32 mask1 = 0;
|
||||
struct v4l2_subdev *terminal_sensor_sd = NULL;
|
||||
struct rkmodule_hdr_cfg hdr_cfg = {0};
|
||||
int ret = 0;
|
||||
|
||||
csi2_g_mbus_config(&csi2->sd, 0, &mbus);
|
||||
if (mbus.type == V4L2_MBUS_CSI2_DPHY)
|
||||
val = SW_CPHY_EN(0);
|
||||
else if (mbus.type == V4L2_MBUS_CSI2_CPHY)
|
||||
@@ -248,6 +244,10 @@ static int csi2_start(struct csi2_dev *csi2)
|
||||
|
||||
csi2_update_sensor_info(csi2);
|
||||
|
||||
if (csi2->mbus.type != V4L2_MBUS_CSI2_DPHY &&
|
||||
csi2->mbus.type != V4L2_MBUS_CSI2_CPHY)
|
||||
return 0;
|
||||
|
||||
if (csi2->dsi_input_en == RKMODULE_DSI_INPUT)
|
||||
host_type = RK_DSI_RXHOST;
|
||||
else
|
||||
@@ -295,6 +295,10 @@ static void csi2_stop(struct csi2_dev *csi2)
|
||||
int i = 0;
|
||||
int csi_idx = 0;
|
||||
|
||||
if (csi2->mbus.type != V4L2_MBUS_CSI2_DPHY &&
|
||||
csi2->mbus.type != V4L2_MBUS_CSI2_CPHY)
|
||||
return;
|
||||
|
||||
/* stop upstream */
|
||||
v4l2_subdev_call(csi2->src_sd, video, s_stream, 0);
|
||||
|
||||
@@ -415,7 +419,7 @@ static int csi2_media_init(struct v4l2_subdev *sd)
|
||||
csi2->crop.left = 0;
|
||||
csi2->crop.width = RKCIF_DEFAULT_WIDTH;
|
||||
csi2->crop.height = RKCIF_DEFAULT_HEIGHT;
|
||||
csi2->bus.num_data_lanes = 4;
|
||||
csi2->mbus.bus.mipi_csi2.num_data_lanes = 4;
|
||||
|
||||
return media_entity_pads_init(&sd->entity, num_pads, csi2->pad);
|
||||
}
|
||||
@@ -536,8 +540,8 @@ static int csi2_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
|
||||
ret = v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, mbus);
|
||||
if (ret) {
|
||||
mbus->type = V4L2_MBUS_CSI2_DPHY;
|
||||
mbus->bus.mipi_csi2.flags = csi2->bus.flags;
|
||||
mbus->bus.mipi_csi2.flags |= BIT(csi2->bus.num_data_lanes - 1);
|
||||
mbus->bus.mipi_csi2.flags = csi2->mbus.bus.mipi_csi2.flags;
|
||||
mbus->bus.mipi_csi2.flags |= BIT(csi2->mbus.bus.mipi_csi2.num_data_lanes - 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -152,7 +152,7 @@ struct csi2_dev {
|
||||
|
||||
void __iomem *base;
|
||||
struct v4l2_async_notifier notifier;
|
||||
struct v4l2_mbus_config_mipi_csi2 bus;
|
||||
struct v4l2_mbus_config mbus;
|
||||
|
||||
/* lock to protect all members below */
|
||||
struct mutex lock;
|
||||
|
||||
Reference in New Issue
Block a user