Skip to content

Commit

Permalink
media: camss: add support for SM8250 camss
Browse files Browse the repository at this point in the history
The Titan 480 camss found on SM8250 has 6 CSIPHY and 4 VFE/CSID.

CSID is compatible with the Titan 170 CSID, but the Titan 480 CSID are
inside the VFE region (between the "top" and "bus" registers), so a
workaround is added to avoid ioremap failure.

[bod] Fixed setting camnoc_axi_clk_src instead of camcc_camnoc_axi_clk
[jgrahsl, bod] Add slow_ahb_src clock values
[jgrahsl, bod] Add cpa_ahb clock values

Signed-off-by: Jonathan Marek <[email protected]>
Tested-by: Julian Grahsl <[email protected]>
Co-developed-by: Julian Grahsl <[email protected]>
Signed-off-by: Julian Grahsl <[email protected]>
Reviewed-by: Robert Foss <[email protected]>
Co-developed-by: Bryan O'Donoghue <[email protected]>
Signed-off-by: Bryan O'Donoghue <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
flto authored and mchehab committed Jan 23, 2022
1 parent e53d660 commit b4436a1
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 25 deletions.
2 changes: 1 addition & 1 deletion drivers/media/platform/qcom/camss/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ qcom-camss-objs += \
camss-csid.o \
camss-csid-4-1.o \
camss-csid-4-7.o \
camss-csid-170.o \
camss-csid-gen2.o \
camss-csiphy-2ph-1-0.o \
camss-csiphy-3ph-1-0.o \
camss-csiphy.o \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ static void csid_subdev_init(struct csid_device *csid)
csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2;
}

const struct csid_hw_ops csid_ops_170 = {
const struct csid_hw_ops csid_ops_gen2 = {
.configure_stream = csid_configure_stream,
.configure_testgen_pattern = csid_configure_testgen_pattern,
.hw_version = csid_hw_version,
Expand Down
26 changes: 21 additions & 5 deletions drivers/media/platform/qcom/camss/camss-csid.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "camss-csid-gen1.h"
#include "camss.h"

/* offset of CSID registers in VFE region for VFE 480 */
#define VFE_480_CSID_OFFSET 0x1200
#define VFE_480_LITE_CSID_OFFSET 0x200

#define MSM_CSID_NAME "msm_csid"

const char * const csid_testgen_modes[] = {
Expand Down Expand Up @@ -559,18 +563,30 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
} else if (camss->version == CAMSS_8x96 ||
camss->version == CAMSS_660) {
csid->ops = &csid_ops_4_7;
} else if (camss->version == CAMSS_845) {
csid->ops = &csid_ops_170;
} else if (camss->version == CAMSS_845 ||
camss->version == CAMSS_8250) {
csid->ops = &csid_ops_gen2;
} else {
return -EINVAL;
}
csid->ops->subdev_init(csid);

/* Memory */

csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
if (IS_ERR(csid->base))
return PTR_ERR(csid->base);
if (camss->version == CAMSS_8250) {
/* for titan 480, CSID registers are inside the VFE region,
* between the VFE "top" and "bus" registers. this requires
* VFE to be initialized before CSID
*/
if (id >= 2) /* VFE/CSID lite */
csid->base = camss->vfe[id].base + VFE_480_LITE_CSID_OFFSET;
else
csid->base = camss->vfe[id].base + VFE_480_CSID_OFFSET;
} else {
csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
if (IS_ERR(csid->base))
return PTR_ERR(csid->base);
}

/* Interrupt */

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/qcom/camss/camss-csid.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ extern const char * const csid_testgen_modes[];

extern const struct csid_hw_ops csid_ops_4_1;
extern const struct csid_hw_ops csid_ops_4_7;
extern const struct csid_hw_ops csid_ops_170;
extern const struct csid_hw_ops csid_ops_gen2;


#endif /* QC_MSM_CAMSS_CSID_H */
8 changes: 6 additions & 2 deletions drivers/media/platform/qcom/camss/camss-csiphy.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ int msm_csiphy_subdev_init(struct camss *camss,
csiphy->ops = &csiphy_ops_3ph_1_0;
csiphy->formats = csiphy_formats_8x96;
csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x96);
} else if (camss->version == CAMSS_845) {
} else if (camss->version == CAMSS_845 ||
camss->version == CAMSS_8250) {
csiphy->ops = &csiphy_ops_3ph_1_0;
csiphy->formats = csiphy_formats_sdm845;
csiphy->nformats = ARRAY_SIZE(csiphy_formats_sdm845);
Expand Down Expand Up @@ -680,7 +681,10 @@ int msm_csiphy_subdev_init(struct camss *camss,

if (!strcmp(clock->name, "csiphy0_timer") ||
!strcmp(clock->name, "csiphy1_timer") ||
!strcmp(clock->name, "csiphy2_timer"))
!strcmp(clock->name, "csiphy2_timer") ||
!strcmp(clock->name, "csiphy3_timer") ||
!strcmp(clock->name, "csiphy4_timer") ||
!strcmp(clock->name, "csiphy5_timer"))
csiphy->rate_set[i] = true;

if (camss->version == CAMSS_660 &&
Expand Down
9 changes: 7 additions & 2 deletions drivers/media/platform/qcom/camss/camss-vfe.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
}
else if (vfe->camss->version == CAMSS_8x96 ||
vfe->camss->version == CAMSS_660 ||
vfe->camss->version == CAMSS_845)
vfe->camss->version == CAMSS_845 ||
vfe->camss->version == CAMSS_8250)
switch (sink_code) {
case MEDIA_BUS_FMT_YUYV8_2X8:
{
Expand Down Expand Up @@ -1297,6 +1298,9 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
case CAMSS_845:
vfe->ops = &vfe_ops_170;
break;
case CAMSS_8250:
vfe->ops = &vfe_ops_480;
break;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -1407,7 +1411,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
l->formats = formats_rdi_8x96;
l->nformats = ARRAY_SIZE(formats_rdi_8x96);
}
} else if (camss->version == CAMSS_845) {
} else if (camss->version == CAMSS_845 ||
camss->version == CAMSS_8250) {
l->formats = formats_rdi_845;
l->nformats = ARRAY_SIZE(formats_rdi_845);
} else {
Expand Down
3 changes: 2 additions & 1 deletion drivers/media/platform/qcom/camss/camss-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
video->formats = formats_rdi_8x96;
video->nformats = ARRAY_SIZE(formats_rdi_8x96);
}
} else if (video->camss->version == CAMSS_845) {
} else if (video->camss->version == CAMSS_845 ||
video->camss->version == CAMSS_8250) {
video->formats = formats_rdi_845;
video->nformats = ARRAY_SIZE(formats_rdi_845);
} else {
Expand Down
Loading

0 comments on commit b4436a1

Please sign in to comment.