Subject: [PATCH 0/6] Add support for SDM630/660 Camera Subsystem

From: AngeloGioacchino Del Regno <[email protected]>

This patch series implements support for the entire camera subsystem
found in SDM630/636/660 and SDA variants, including CSIPHY 3-Phase,
CSID v5.0, ISPIF 3.0 (though it didn't need any adaptation) and
VFE 4.8.

One small note about VFE4.8, even if I wrote it in the commit that
adds support for it: I know, the VFE support here is split in
multiple files having the name of the actual VFE version that it is
targeting... but it didn't feel right to commonize the VFE 4.7 file
and make another one only for VFE4.8, when it's just about something
like 3 small differences.
That VFE 4.8 seems to be just a minor revision of VFE 4.7.

While at it, also fix a small issue when using two VFEs: only one
of them was being resetted (always VFE0) so, after the first usage
of VFE1, in case we leave it in a bad state, it would not properly
start again. Now... it's fine :)))

P.S.: SDM630/660's camss seems to be *very* similar to MSM8998, so
likely 90% of this series should be reusable on that one, too!

Tested on:
- Sony Xperia XA2 (IMX300 on CSI0/PHY0/VFE0, IMX219 on CSI2,PHY2,VFE1)
* VFE0/1 RDI only, as the VIDEO one does not work with SRGGB Bayer
formats yet. As far as I can see, that color format hasn't been
implemented yet in the video interface.

AngeloGioacchino Del Regno (6):
media: camss: csiphy-3ph: Add support for SDM630/660
media: camss: ispif: Correctly reset based on the VFE ID
media: camss: vfe: Add support for VFE 4.8
media: camss: Add support for SDM630/636/660 camera subsystem
media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss
media: camss: csiphy: Set rate on csiX_phy clock on SDM630/660

.../devicetree/bindings/media/qcom,camss.txt | 7 +
.../media/platform/qcom/camss/camss-csid.c | 9 +-
.../qcom/camss/camss-csiphy-3ph-1-0.c | 7 +-
.../media/platform/qcom/camss/camss-csiphy.c | 25 ++-
.../media/platform/qcom/camss/camss-csiphy.h | 1 +
.../media/platform/qcom/camss/camss-ispif.c | 100 ++++++---
.../media/platform/qcom/camss/camss-ispif.h | 2 +-
.../media/platform/qcom/camss/camss-vfe-4-7.c | 129 ++++++++++-
drivers/media/platform/qcom/camss/camss-vfe.c | 19 +-
drivers/media/platform/qcom/camss/camss-vfe.h | 1 +
.../media/platform/qcom/camss/camss-video.c | 3 +-
drivers/media/platform/qcom/camss/camss.c | 206 +++++++++++++++++-
drivers/media/platform/qcom/camss/camss.h | 1 +
13 files changed, 448 insertions(+), 62 deletions(-)

--
2.28.0


Subject: [PATCH 5/6] media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss

From: AngeloGioacchino Del Regno <[email protected]>

Add bindings for qcom,sdm660-camss in order to support the camera
subsystem on SDM630/660 and SDA variants.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
Documentation/devicetree/bindings/media/qcom,camss.txt | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/qcom,camss.txt b/Documentation/devicetree/bindings/media/qcom,camss.txt
index 09eb6ed99114..498234629e21 100644
--- a/Documentation/devicetree/bindings/media/qcom,camss.txt
+++ b/Documentation/devicetree/bindings/media/qcom,camss.txt
@@ -8,6 +8,7 @@ Qualcomm Camera Subsystem
Definition: Should contain one of:
- "qcom,msm8916-camss"
- "qcom,msm8996-camss"
+ - "qcom,sdm660-camss"
- reg:
Usage: required
Value type: <prop-encoded-array>
@@ -64,30 +65,36 @@ Qualcomm Camera Subsystem
Value type: <stringlist>
Definition: Should contain the following entries:
- "top_ahb"
+ - "throttle_axi" (660 only)
- "ispif_ahb"
- "csiphy0_timer"
- "csiphy1_timer"
- "csiphy2_timer" (8996 only)
+ - "csiphy_ahb2crif" (660 only)
- "csi0_ahb"
- "csi0"
- "csi0_phy"
- "csi0_pix"
- "csi0_rdi"
+ - "cphy_csid0" (660 only)
- "csi1_ahb"
- "csi1"
- "csi1_phy"
- "csi1_pix"
- "csi1_rdi"
+ - "cphy_csid1" (660 only)
- "csi2_ahb" (8996 only)
- "csi2" (8996 only)
- "csi2_phy" (8996 only)
- "csi2_pix" (8996 only)
- "csi2_rdi" (8996 only)
+ - "cphy_csid2" (660 only)
- "csi3_ahb" (8996 only)
- "csi3" (8996 only)
- "csi3_phy" (8996 only)
- "csi3_pix" (8996 only)
- "csi3_rdi" (8996 only)
+ - "cphy_csid3" (660 only)
- "ahb"
- "vfe0"
- "csi_vfe0"
--
2.28.0

Subject: [PATCH 1/6] media: camss: csiphy-3ph: Add support for SDM630/660

From: AngeloGioacchino Del Regno <[email protected]>

The CSIPHY on SDM630/660 needs a slightly longer T_HS_CLK_MISS
configuration on lanes CFG4.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
index 2e65caf1ecae..97cb9de85031 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
@@ -8,6 +8,7 @@
* Copyright (C) 2016-2018 Linaro Ltd.
*/

+#include "camss.h"
#include "camss-csiphy.h"

#include <linux/delay.h>
@@ -21,6 +22,7 @@
#define CSIPHY_3PH_LNn_CFG3(n) (0x008 + 0x100 * (n))
#define CSIPHY_3PH_LNn_CFG4(n) (0x00c + 0x100 * (n))
#define CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS 0xa4
+#define CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660 0xa5
#define CSIPHY_3PH_LNn_CFG5(n) (0x010 + 0x100 * (n))
#define CSIPHY_3PH_LNn_CFG5_T_HS_DTERM 0x02
#define CSIPHY_3PH_LNn_CFG5_HS_REC_EQ_FQ_INT 0x50
@@ -198,7 +200,10 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy,
val = CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG;
writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG1(l));

- val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS;
+ if (csiphy->camss->version == CAMSS_660)
+ val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660;
+ else
+ val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS;
writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG4(l));

val = CSIPHY_3PH_LNn_MISC1_IS_CLKLANE;
--
2.28.0

2020-10-20 10:37:30

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH 1/6] media: camss: csiphy-3ph: Add support for SDM630/660

Hi Angelo,

On Sun, 18 Oct 2020 at 14:52, <[email protected]> wrote:
>
> From: AngeloGioacchino Del Regno <[email protected]>
>
> The CSIPHY on SDM630/660 needs a slightly longer T_HS_CLK_MISS
> configuration on lanes CFG4.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index 2e65caf1ecae..97cb9de85031 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> @@ -8,6 +8,7 @@
> * Copyright (C) 2016-2018 Linaro Ltd.
> */
>
> +#include "camss.h"
> #include "camss-csiphy.h"
>
> #include <linux/delay.h>
> @@ -21,6 +22,7 @@
> #define CSIPHY_3PH_LNn_CFG3(n) (0x008 + 0x100 * (n))
> #define CSIPHY_3PH_LNn_CFG4(n) (0x00c + 0x100 * (n))
> #define CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS 0xa4
> +#define CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660 0xa5
> #define CSIPHY_3PH_LNn_CFG5(n) (0x010 + 0x100 * (n))
> #define CSIPHY_3PH_LNn_CFG5_T_HS_DTERM 0x02
> #define CSIPHY_3PH_LNn_CFG5_HS_REC_EQ_FQ_INT 0x50
> @@ -198,7 +200,10 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy,
> val = CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG;
> writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG1(l));
>
> - val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS;
> + if (csiphy->camss->version == CAMSS_660)

The CAMSS_660 enum is not defined until patch #4, so building fails
here. I expect to see this issue in a few other places, but I'll
refrain from pointing them all out.

> + val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660;
> + else
> + val = CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS;
> writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG4(l));
>
> val = CSIPHY_3PH_LNn_MISC1_IS_CLKLANE;
> --
> 2.28.0
>

2020-10-20 11:32:08

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH 5/6] media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss

Looks good to me.

Signed-off-by: Robert Foss <[email protected]>

On Sun, 18 Oct 2020 at 14:53, <[email protected]> wrote:
>
> From: AngeloGioacchino Del Regno <[email protected]>
>
> Add bindings for qcom,sdm660-camss in order to support the camera
> subsystem on SDM630/660 and SDA variants.
>
> Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
> ---
> Documentation/devicetree/bindings/media/qcom,camss.txt | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/qcom,camss.txt b/Documentation/devicetree/bindings/media/qcom,camss.txt
> index 09eb6ed99114..498234629e21 100644
> --- a/Documentation/devicetree/bindings/media/qcom,camss.txt
> +++ b/Documentation/devicetree/bindings/media/qcom,camss.txt
> @@ -8,6 +8,7 @@ Qualcomm Camera Subsystem
> Definition: Should contain one of:
> - "qcom,msm8916-camss"
> - "qcom,msm8996-camss"
> + - "qcom,sdm660-camss"
> - reg:
> Usage: required
> Value type: <prop-encoded-array>
> @@ -64,30 +65,36 @@ Qualcomm Camera Subsystem
> Value type: <stringlist>
> Definition: Should contain the following entries:
> - "top_ahb"
> + - "throttle_axi" (660 only)
> - "ispif_ahb"
> - "csiphy0_timer"
> - "csiphy1_timer"
> - "csiphy2_timer" (8996 only)
> + - "csiphy_ahb2crif" (660 only)
> - "csi0_ahb"
> - "csi0"
> - "csi0_phy"
> - "csi0_pix"
> - "csi0_rdi"
> + - "cphy_csid0" (660 only)
> - "csi1_ahb"
> - "csi1"
> - "csi1_phy"
> - "csi1_pix"
> - "csi1_rdi"
> + - "cphy_csid1" (660 only)
> - "csi2_ahb" (8996 only)
> - "csi2" (8996 only)
> - "csi2_phy" (8996 only)
> - "csi2_pix" (8996 only)
> - "csi2_rdi" (8996 only)
> + - "cphy_csid2" (660 only)
> - "csi3_ahb" (8996 only)
> - "csi3" (8996 only)
> - "csi3_phy" (8996 only)
> - "csi3_pix" (8996 only)
> - "csi3_rdi" (8996 only)
> + - "cphy_csid3" (660 only)
> - "ahb"
> - "vfe0"
> - "csi_vfe0"
> --
> 2.28.0
>

2020-10-20 12:03:53

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH 0/6] Add support for SDM630/660 Camera Subsystem

Hey Angelo,

Thanks for submitting this, and fixing other issues as you went.

I sent out some SoBs which should have been Reviewed-bys, so if you
add them to your commit please replace the SoBs with RBs.


Rob.

On Sun, 18 Oct 2020 at 14:52, <[email protected]> wrote:
>
> From: AngeloGioacchino Del Regno <[email protected]>
>
> This patch series implements support for the entire camera subsystem
> found in SDM630/636/660 and SDA variants, including CSIPHY 3-Phase,
> CSID v5.0, ISPIF 3.0 (though it didn't need any adaptation) and
> VFE 4.8.
>
> One small note about VFE4.8, even if I wrote it in the commit that
> adds support for it: I know, the VFE support here is split in
> multiple files having the name of the actual VFE version that it is
> targeting... but it didn't feel right to commonize the VFE 4.7 file
> and make another one only for VFE4.8, when it's just about something
> like 3 small differences.
> That VFE 4.8 seems to be just a minor revision of VFE 4.7.
>
> While at it, also fix a small issue when using two VFEs: only one
> of them was being resetted (always VFE0) so, after the first usage
> of VFE1, in case we leave it in a bad state, it would not properly
> start again. Now... it's fine :)))
>
> P.S.: SDM630/660's camss seems to be *very* similar to MSM8998, so
> likely 90% of this series should be reusable on that one, too!
>
> Tested on:
> - Sony Xperia XA2 (IMX300 on CSI0/PHY0/VFE0, IMX219 on CSI2,PHY2,VFE1)
> * VFE0/1 RDI only, as the VIDEO one does not work with SRGGB Bayer
> formats yet. As far as I can see, that color format hasn't been
> implemented yet in the video interface.
>
> AngeloGioacchino Del Regno (6):
> media: camss: csiphy-3ph: Add support for SDM630/660
> media: camss: ispif: Correctly reset based on the VFE ID
> media: camss: vfe: Add support for VFE 4.8
> media: camss: Add support for SDM630/636/660 camera subsystem
> media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss
> media: camss: csiphy: Set rate on csiX_phy clock on SDM630/660
>
> .../devicetree/bindings/media/qcom,camss.txt | 7 +
> .../media/platform/qcom/camss/camss-csid.c | 9 +-
> .../qcom/camss/camss-csiphy-3ph-1-0.c | 7 +-
> .../media/platform/qcom/camss/camss-csiphy.c | 25 ++-
> .../media/platform/qcom/camss/camss-csiphy.h | 1 +
> .../media/platform/qcom/camss/camss-ispif.c | 100 ++++++---
> .../media/platform/qcom/camss/camss-ispif.h | 2 +-
> .../media/platform/qcom/camss/camss-vfe-4-7.c | 129 ++++++++++-
> drivers/media/platform/qcom/camss/camss-vfe.c | 19 +-
> drivers/media/platform/qcom/camss/camss-vfe.h | 1 +
> .../media/platform/qcom/camss/camss-video.c | 3 +-
> drivers/media/platform/qcom/camss/camss.c | 206 +++++++++++++++++-
> drivers/media/platform/qcom/camss/camss.h | 1 +
> 13 files changed, 448 insertions(+), 62 deletions(-)
>
> --
> 2.28.0
>