mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 17:14:14 +08:00
media: qcom: camss: Decouple VFE from CSID
Decouple the direct calls to VFE's vfe_get/put in the CSID subdev in order to prepare for the introduction of IFE subdev. Also decouple CSID base address from VFE since on the Titan platform CSID register base address resides within VFE's base address. Signed-off-by: Milen Mitkov <quic_mmitkov@quicinc.com> Signed-off-by: Gjorgji Rosikopulos <quic_grosikop@quicinc.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp/sm8250/sdm845/apq8016 Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
73ac545caf
commit
b1e6eef535
@ -602,7 +602,6 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
|
||||
struct csid_device *csid = v4l2_get_subdevdata(sd);
|
||||
struct camss *camss = csid->camss;
|
||||
struct device *dev = camss->dev;
|
||||
struct vfe_device *vfe = &camss->vfe[csid->id];
|
||||
int ret = 0;
|
||||
|
||||
if (on) {
|
||||
@ -611,7 +610,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
|
||||
* switching on the CSID. Do so unconditionally, as there is no
|
||||
* drawback in following the same powering order on older SoCs.
|
||||
*/
|
||||
ret = vfe_get(vfe);
|
||||
ret = csid->res->parent_dev_ops->get(camss, csid->id);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -663,7 +662,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
|
||||
regulator_bulk_disable(csid->num_supplies,
|
||||
csid->supplies);
|
||||
pm_runtime_put_sync(dev);
|
||||
vfe_put(vfe);
|
||||
csid->res->parent_dev_ops->put(camss, csid->id);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1021,6 +1020,11 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
|
||||
csid->id = id;
|
||||
csid->res = &res->csid;
|
||||
|
||||
if (dev_WARN_ONCE(dev, !csid->res->parent_dev_ops,
|
||||
"Error: CSID depends on VFE/IFE device ops!\n")) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
csid->res->hw_ops->subdev_init(csid);
|
||||
|
||||
/* Memory */
|
||||
@ -1031,9 +1035,11 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
|
||||
* VFE to be initialized before CSID
|
||||
*/
|
||||
if (id >= 2) /* VFE/CSID lite */
|
||||
csid->base = camss->vfe[id].base + VFE_480_LITE_CSID_OFFSET;
|
||||
csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
|
||||
+ VFE_480_LITE_CSID_OFFSET;
|
||||
else
|
||||
csid->base = camss->vfe[id].base + VFE_480_CSID_OFFSET;
|
||||
csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
|
||||
+ VFE_480_CSID_OFFSET;
|
||||
} else {
|
||||
csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
|
||||
if (IS_ERR(csid->base))
|
||||
|
@ -157,6 +157,7 @@ struct csid_hw_ops {
|
||||
struct csid_subdev_resources {
|
||||
bool is_lite;
|
||||
const struct csid_hw_ops *hw_ops;
|
||||
const struct parent_dev_ops *parent_dev_ops;
|
||||
const struct csid_formats *formats;
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#define CAMSS_CLOCK_MARGIN_NUMERATOR 105
|
||||
#define CAMSS_CLOCK_MARGIN_DENOMINATOR 100
|
||||
|
||||
static const struct parent_dev_ops vfe_parent_dev_ops;
|
||||
|
||||
static const struct camss_subdev_resources csiphy_res_8x16[] = {
|
||||
/* CSIPHY0 */
|
||||
{
|
||||
@ -84,6 +86,7 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_1,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_1
|
||||
}
|
||||
},
|
||||
@ -105,6 +108,7 @@ static const struct camss_subdev_resources csid_res_8x16[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_1,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_1
|
||||
}
|
||||
},
|
||||
@ -216,6 +220,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -237,6 +242,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -258,6 +264,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
|
||||
.interrupt = { "csid2" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -279,6 +286,7 @@ static const struct camss_subdev_resources csid_res_8x96[] = {
|
||||
.interrupt = { "csid3" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
}
|
||||
@ -425,6 +433,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -449,6 +458,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -473,6 +483,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
|
||||
.interrupt = { "csid2" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
},
|
||||
@ -497,6 +508,7 @@ static const struct camss_subdev_resources csid_res_660[] = {
|
||||
.interrupt = { "csid3" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_4_7,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_4_7
|
||||
}
|
||||
}
|
||||
@ -683,6 +695,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -707,6 +720,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -732,6 +746,7 @@ static const struct camss_subdev_resources csid_res_845[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
}
|
||||
@ -914,6 +929,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -930,6 +946,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -946,6 +963,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -962,6 +980,7 @@ static const struct camss_subdev_resources csid_res_8250[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
}
|
||||
@ -1161,6 +1180,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.interrupt = { "csid0" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1176,6 +1196,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.interrupt = { "csid1" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1191,6 +1212,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.interrupt = { "csid2" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1206,6 +1228,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.interrupt = { "csid3" },
|
||||
.csid = {
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1221,6 +1244,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1236,6 +1260,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1251,6 +1276,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
},
|
||||
@ -1266,6 +1292,7 @@ static const struct camss_subdev_resources csid_res_sc8280xp[] = {
|
||||
.csid = {
|
||||
.is_lite = true,
|
||||
.hw_ops = &csid_ops_gen2,
|
||||
.parent_dev_ops = &vfe_parent_dev_ops,
|
||||
.formats = &csid_formats_gen2
|
||||
}
|
||||
}
|
||||
@ -1610,6 +1637,48 @@ void camss_pm_domain_off(struct camss *camss, int id)
|
||||
}
|
||||
}
|
||||
|
||||
static int vfe_parent_dev_ops_get(struct camss *camss, int id)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id < camss->res->vfe_num) {
|
||||
struct vfe_device *vfe = &camss->vfe[id];
|
||||
|
||||
ret = vfe_get(vfe);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vfe_parent_dev_ops_put(struct camss *camss, int id)
|
||||
{
|
||||
if (id < camss->res->vfe_num) {
|
||||
struct vfe_device *vfe = &camss->vfe[id];
|
||||
|
||||
vfe_put(vfe);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __iomem
|
||||
*vfe_parent_dev_ops_get_base_address(struct camss *camss, int id)
|
||||
{
|
||||
if (id < camss->res->vfe_num) {
|
||||
struct vfe_device *vfe = &camss->vfe[id];
|
||||
|
||||
return vfe->base;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const struct parent_dev_ops vfe_parent_dev_ops = {
|
||||
.get = vfe_parent_dev_ops_get,
|
||||
.put = vfe_parent_dev_ops_put,
|
||||
.get_base_address = vfe_parent_dev_ops_get_base_address
|
||||
};
|
||||
|
||||
/*
|
||||
* camss_of_parse_endpoint_node - Parse port endpoint node
|
||||
* @dev: Device
|
||||
|
@ -135,6 +135,12 @@ struct camss_clock {
|
||||
u32 nfreqs;
|
||||
};
|
||||
|
||||
struct parent_dev_ops {
|
||||
int (*get)(struct camss *camss, int id);
|
||||
int (*put)(struct camss *camss, int id);
|
||||
void __iomem *(*get_base_address)(struct camss *camss, int id);
|
||||
};
|
||||
|
||||
void camss_add_clock_margin(u64 *rate);
|
||||
int camss_enable_clocks(int nclocks, struct camss_clock *clock,
|
||||
struct device *dev);
|
||||
@ -145,6 +151,8 @@ s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp,
|
||||
int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
|
||||
int camss_pm_domain_on(struct camss *camss, int id);
|
||||
void camss_pm_domain_off(struct camss *camss, int id);
|
||||
int camss_vfe_get(struct camss *camss, int id);
|
||||
void camss_vfe_put(struct camss *camss, int id);
|
||||
void camss_delete(struct camss *camss);
|
||||
|
||||
#endif /* QC_MSM_CAMSS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user