Commit c23c7998 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Hans Verkuil

media: qcom: camss: Pass CAMSS subdev callbacks via resource ops pointer

It is possible to pass all of the CAMSS subdevice internal operations
pointers from the controlling resources structure with an additional
pointer added to the resources structure.

This allows for the removal of most of the probe-time control structures.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 91719b27
...@@ -575,18 +575,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, ...@@ -575,18 +575,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
csid->camss = camss; csid->camss = camss;
csid->id = id; csid->id = id;
csid->ops = res->ops;
if (camss->res->version == CAMSS_8x16) {
csid->ops = &csid_ops_4_1;
} else if (camss->res->version == CAMSS_8x96 ||
camss->res->version == CAMSS_660) {
csid->ops = &csid_ops_4_7;
} else if (camss->res->version == CAMSS_845 ||
camss->res->version == CAMSS_8250) {
csid->ops = &csid_ops_gen2;
} else {
return -EINVAL;
}
csid->ops->subdev_init(csid); csid->ops->subdev_init(csid);
/* Memory */ /* Memory */
......
...@@ -556,19 +556,17 @@ int msm_csiphy_subdev_init(struct camss *camss, ...@@ -556,19 +556,17 @@ int msm_csiphy_subdev_init(struct camss *camss,
csiphy->camss = camss; csiphy->camss = camss;
csiphy->id = id; csiphy->id = id;
csiphy->cfg.combo_mode = 0; csiphy->cfg.combo_mode = 0;
csiphy->ops = res->ops;
if (camss->res->version == CAMSS_8x16) { if (camss->res->version == CAMSS_8x16) {
csiphy->ops = &csiphy_ops_2ph_1_0;
csiphy->formats = csiphy_formats_8x16; csiphy->formats = csiphy_formats_8x16;
csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x16); csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x16);
} else if (camss->res->version == CAMSS_8x96 || } else if (camss->res->version == CAMSS_8x96 ||
camss->res->version == CAMSS_660) { camss->res->version == CAMSS_660) {
csiphy->ops = &csiphy_ops_3ph_1_0;
csiphy->formats = csiphy_formats_8x96; csiphy->formats = csiphy_formats_8x96;
csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x96); csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x96);
} else if (camss->res->version == CAMSS_845 || } else if (camss->res->version == CAMSS_845 ||
camss->res->version == CAMSS_8250) { camss->res->version == CAMSS_8250) {
csiphy->ops = &csiphy_ops_3ph_1_0;
csiphy->formats = csiphy_formats_sdm845; csiphy->formats = csiphy_formats_sdm845;
csiphy->nformats = ARRAY_SIZE(csiphy_formats_sdm845); csiphy->nformats = ARRAY_SIZE(csiphy_formats_sdm845);
} else { } else {
......
...@@ -1286,25 +1286,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, ...@@ -1286,25 +1286,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
int i, j; int i, j;
int ret; int ret;
switch (camss->res->version) { vfe->ops = res->ops;
case CAMSS_8x16:
vfe->ops = &vfe_ops_4_1;
break;
case CAMSS_8x96:
vfe->ops = &vfe_ops_4_7;
break;
case CAMSS_660:
vfe->ops = &vfe_ops_4_8;
break;
case CAMSS_845:
vfe->ops = &vfe_ops_170;
break;
case CAMSS_8250:
vfe->ops = &vfe_ops_480;
break;
default:
return -EINVAL;
}
if (!res->line_num) if (!res->line_num)
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
...@@ -49,6 +49,7 @@ struct camss_subdev_resources { ...@@ -49,6 +49,7 @@ struct camss_subdev_resources {
char *reg[CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX];
char *interrupt[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX];
u8 line_num; u8 line_num;
const void *ops;
}; };
struct icc_bw_tbl { struct icc_bw_tbl {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment