]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: qcom: camss: Add sc8280xp support
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 22 Feb 2024 17:17:03 +0000 (17:17 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 8 Apr 2024 13:46:32 +0000 (15:46 +0200)
Add in functional logic throughout the code to support the sc8280xp.

Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
drivers/media/platform/qcom/camss/camss-csiphy.c
drivers/media/platform/qcom/camss/camss-vfe.c
drivers/media/platform/qcom/camss/camss-video.c

index 66ff48aeab64616311e44ed25078ff3c79de447f..df7e93a5a4f6e2cf74a652a752adc4d25c7b38b4 100644 (file)
@@ -513,6 +513,10 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy,
                r = &lane_regs_sm8250[0][0];
                array_size = ARRAY_SIZE(lane_regs_sm8250[0]);
                break;
+       case CAMSS_8280XP:
+               r = &lane_regs_sc8280xp[0][0];
+               array_size = ARRAY_SIZE(lane_regs_sc8280xp[0]);
+               break;
        default:
                WARN(1, "unknown cspi version\n");
                return;
@@ -548,13 +552,26 @@ static u8 csiphy_get_lane_mask(struct csiphy_lanes_cfg *lane_cfg)
        return lane_mask;
 }
 
+static bool csiphy_is_gen2(u32 version)
+{
+       bool ret = false;
+
+       switch (version) {
+       case CAMSS_845:
+       case CAMSS_8250:
+       case CAMSS_8280XP:
+               ret = true;
+               break;
+       }
+
+       return ret;
+}
+
 static void csiphy_lanes_enable(struct csiphy_device *csiphy,
                                struct csiphy_config *cfg,
                                s64 link_freq, u8 lane_mask)
 {
        struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
-       bool is_gen2 = (csiphy->camss->res->version == CAMSS_845 ||
-                       csiphy->camss->res->version == CAMSS_8250);
        u8 settle_cnt;
        u8 val;
        int i;
@@ -576,7 +593,7 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy,
        val = 0x00;
        writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(0));
 
-       if (is_gen2)
+       if (csiphy_is_gen2(csiphy->camss->res->version))
                csiphy_gen2_config_lanes(csiphy, settle_cnt);
        else
                csiphy_gen1_config_lanes(csiphy, cfg, settle_cnt);
index 264c99efeae8ab92bcad0ee8b22036ae6ba5401a..45b3a8e5dea498cac863eba68868c398b6c722a5 100644 (file)
@@ -578,6 +578,7 @@ int msm_csiphy_subdev_init(struct camss *camss,
                break;
        case CAMSS_845:
        case CAMSS_8250:
+       case CAMSS_8280XP:
                csiphy->formats = csiphy_formats_sdm845;
                csiphy->nformats = ARRAY_SIZE(csiphy_formats_sdm845);
                break;
index 2062be668f49d8a11a6016fd7de9994eb998ee65..d875237cf24431ae22a5b043308149a26828d871 100644 (file)
@@ -225,6 +225,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
        case CAMSS_660:
        case CAMSS_845:
        case CAMSS_8250:
+       case CAMSS_8280XP:
                switch (sink_code) {
                case MEDIA_BUS_FMT_YUYV8_1X16:
                {
@@ -1518,6 +1519,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
                        break;
                case CAMSS_845:
                case CAMSS_8250:
+               case CAMSS_8280XP:
                        l->formats = formats_rdi_845;
                        l->nformats = ARRAY_SIZE(formats_rdi_845);
                        break;
@@ -1595,6 +1597,23 @@ static const struct media_entity_operations vfe_media_ops = {
        .link_validate = v4l2_subdev_link_validate,
 };
 
+static int vfe_bpl_align(struct vfe_device *vfe)
+{
+       int ret = 8;
+
+       switch (vfe->camss->res->version) {
+       case CAMSS_845:
+       case CAMSS_8250:
+       case CAMSS_8280XP:
+               ret = 16;
+               break;
+       default:
+               break;
+       }
+
+       return ret;
+}
+
 /*
  * msm_vfe_register_entities - Register subdev node for VFE module
  * @vfe: VFE device
@@ -1661,11 +1680,7 @@ int msm_vfe_register_entities(struct vfe_device *vfe,
                }
 
                video_out->ops = &vfe->video_ops;
-               if (vfe->camss->res->version == CAMSS_845 ||
-                   vfe->camss->res->version == CAMSS_8250)
-                       video_out->bpl_alignment = 16;
-               else
-                       video_out->bpl_alignment = 8;
+               video_out->bpl_alignment = vfe_bpl_align(vfe);
                video_out->line_based = 0;
                if (i == VFE_LINE_PIX) {
                        video_out->bpl_alignment = 16;
index a89da5ef47109a3dc8d7f298392489350023db86..54cd82f741154c6eb61a1d6fa6d8ca16934990cf 100644 (file)
@@ -1028,6 +1028,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
                break;
        case CAMSS_845:
        case CAMSS_8250:
+       case CAMSS_8280XP:
                video->formats = formats_rdi_845;
                video->nformats = ARRAY_SIZE(formats_rdi_845);
                break;