Message ID | 20220522162802.208275-1-luca@z3ntu.xyz |
---|---|
Headers | show |
Series | CAMSS support for MSM8974 | expand |
This patch does not apply on upstream-media/master or upstream-next/master. Is there another branch this series should be applied to? On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > Add a node for the camera-specific i2c bus found on msm8974. > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > arch/arm/boot/dts/qcom-msm8974.dtsi | 62 +++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > > diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi > index ffa6f874917a..a80b4ae71745 100644 > --- a/arch/arm/boot/dts/qcom-msm8974.dtsi > +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi > @@ -1434,6 +1434,34 @@ blsp2_i2c5_sleep: blsp2-i2c5-sleep { > > /* BLSP2_I2C6 info is missing - nobody uses it though? */ > > + cci0_default: cci0-default { > + pins = "gpio19", "gpio20"; > + function = "cci_i2c0"; > + drive-strength = <2>; > + bias-disable; > + }; > + > + cci0_sleep: cci0-sleep { > + pins = "gpio19", "gpio20"; > + function = "gpio"; > + drive-strength = <2>; > + bias-disable; > + }; > + > + cci1_default: cci1-default { > + pins = "gpio21", "gpio22"; > + function = "cci_i2c1"; > + drive-strength = <2>; > + bias-disable; > + }; > + > + cci1_sleep: cci1-sleep { > + pins = "gpio21", "gpio22"; > + function = "gpio"; > + drive-strength = <2>; > + bias-disable; > + }; > + > spi8_default: spi8_default { > mosi { > pins = "gpio45"; > @@ -1587,6 +1615,40 @@ dsi0_phy: dsi-phy@fd922a00 { > }; > }; > > + cci: cci@fda0c000 { > + compatible = "qcom,msm8974-cci"; > + #address-cells = <1>; > + #size-cells = <0>; > + reg = <0xfda0c000 0x1000>; > + interrupts = <GIC_SPI 50 IRQ_TYPE_EDGE_RISING>; > + clocks = <&mmcc CAMSS_TOP_AHB_CLK>, > + <&mmcc CAMSS_CCI_CCI_AHB_CLK>, > + <&mmcc CAMSS_CCI_CCI_CLK>; > + clock-names = "camss_top_ahb", > + "cci_ahb", > + "cci"; > + > + pinctrl-names = "default", "sleep"; > + pinctrl-0 = <&cci0_default &cci1_default>; > + pinctrl-1 = <&cci0_sleep &cci1_sleep>; > + > + status = "disabled"; > + > + cci_i2c0: i2c-bus@0 { > + reg = <0>; > + clock-frequency = <400000>; > + #address-cells = <1>; > + #size-cells = <0>; > + }; > + > + cci_i2c1: i2c-bus@1 { > + reg = <1>; > + clock-frequency = <400000>; > + #address-cells = <1>; > + #size-cells = <0>; > + }; > + }; > + > gpu: adreno@fdb00000 { > compatible = "qcom,adreno-330.1", "qcom,adreno"; > reg = <0xfdb00000 0x10000>; > -- > 2.36.0 >
On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > From: Matti Lehtimäki <matti.lehtimaki@gmail.com> > > VFE hardware modules on 8x74 and 8x16 are similar. > > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > drivers/media/platform/qcom/camss/camss-vfe.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c > index 5b148e9f8134..ace53ed24884 100644 > --- a/drivers/media/platform/qcom/camss/camss-vfe.c > +++ b/drivers/media/platform/qcom/camss/camss-vfe.c > @@ -170,7 +170,8 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code, > { > struct vfe_device *vfe = to_vfe(line); > > - if (vfe->camss->version == CAMSS_8x16) > + if (vfe->camss->version == CAMSS_8x16 || > + vfe->camss->version == CAMSS_8x74) Match indentation of previous line. CHECK: Alignment should match open parenthesis #27: FILE: drivers/media/platform/qcom/camss/camss-vfe.c:174: + if (vfe->camss->version == CAMSS_8x16 || + vfe->camss->version == CAMSS_8x74) > switch (sink_code) { > case MEDIA_BUS_FMT_YUYV8_2X8: > { > @@ -1286,6 +1287,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, > > switch (camss->version) { > case CAMSS_8x16: > + case CAMSS_8x74: > vfe->ops = &vfe_ops_4_1; > break; > case CAMSS_8x96: > @@ -1390,7 +1392,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, > init_completion(&l->output.sof); > init_completion(&l->output.reg_update); > > - if (camss->version == CAMSS_8x16) { > + if (camss->version == CAMSS_8x16 || > + camss->version == CAMSS_8x74) { Same > if (i == VFE_LINE_PIX) { > l->formats = formats_pix_8x16; > l->nformats = ARRAY_SIZE(formats_pix_8x16); > -- > 2.36.0 > With that fixed: Reviewed-by: Robert Foss <robert.foss@linaro.org>
On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > From: Matti Lehtimäki <matti.lehtimaki@gmail.com> > > CSID hardware module on 8x74 is similar to 8x16. > > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > drivers/media/platform/qcom/camss/camss-csid.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c > index f993f349b66b..6b5cd9a66ff6 100644 > --- a/drivers/media/platform/qcom/camss/camss-csid.c > +++ b/drivers/media/platform/qcom/camss/camss-csid.c > @@ -570,7 +570,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, > csid->camss = camss; > csid->id = id; > > - if (camss->version == CAMSS_8x16) { > + if (camss->version == CAMSS_8x16 || > + camss->version == CAMSS_8x74) { CHECK: Alignment should match open parenthesis #27: FILE: drivers/media/platform/qcom/camss/camss-csid.c:574: + if (camss->version == CAMSS_8x16 || + camss->version == CAMSS_8x74) { > csid->ops = &csid_ops_4_1; > } else if (camss->version == CAMSS_8x96 || > camss->version == CAMSS_660) { > -- > 2.36.0 > With that fixed: Reviewed-by: Robert Foss <robert.foss@linaro.org>
On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > From: Matti Lehtimäki <matti.lehtimaki@gmail.com> > > CSIPHY hardware modules in 8x74 and 8x16 are similar. > > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > drivers/media/platform/qcom/camss/camss-csiphy.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c > index 75fcfc627400..a0122705a874 100644 > --- a/drivers/media/platform/qcom/camss/camss-csiphy.c > +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c > @@ -557,7 +557,8 @@ int msm_csiphy_subdev_init(struct camss *camss, > csiphy->id = id; > csiphy->cfg.combo_mode = 0; > > - if (camss->version == CAMSS_8x16) { > + if (camss->version == CAMSS_8x16 || > + camss->version == CAMSS_8x74) { CHECK: Alignment should match open parenthesis #27: FILE: drivers/media/platform/qcom/camss/camss-csiphy.c:561: + if (camss->version == CAMSS_8x16 || + camss->version == CAMSS_8x74) { > csiphy->ops = &csiphy_ops_2ph_1_0; > csiphy->formats = csiphy_formats_8x16; > csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x16); > @@ -582,6 +583,7 @@ int msm_csiphy_subdev_init(struct camss *camss, > return PTR_ERR(csiphy->base); > > if (camss->version == CAMSS_8x16 || > + camss->version == CAMSS_8x74 || > camss->version == CAMSS_8x96) { > csiphy->base_clk_mux = > devm_platform_ioremap_resource_byname(pdev, res->reg[1]); > -- > 2.36.0 > With that fixed: Reviewed-by: Robert Foss <robert.foss@linaro.org>
On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > From: Matti Lehtimäki <matti.lehtimaki@gmail.com> > > Add structs with 8x74 resources. The number of CSIPHY, CSID > and VFE hardware modules is the same as 8x96 but the support > is otherwise different. > > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > drivers/media/platform/qcom/camss/camss.c | 161 ++++++++++++++++++++++ > 1 file changed, 161 insertions(+) > > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c > index 79ad82e233cb..5a69ce48c792 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -126,6 +126,154 @@ static const struct resources vfe_res_8x16[] = { > } > }; > > +static const struct resources csiphy_res_8974[] = { > + /* CSIPHY0 */ > + { > + .regulators = { NULL }, > + .clock = { "top_ahb", "ispif_ahb", "csiphy0_timer" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 100000000, 200000000 } }, > + .reg = { "csiphy0", "csiphy0_clk_mux" }, > + .interrupt = { "csiphy0" } > + }, > + > + /* CSIPHY1 */ > + { > + .regulators = { NULL }, > + .clock = { "top_ahb", "ispif_ahb", "csiphy1_timer" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 100000000, 200000000 } }, > + .reg = { "csiphy1", "csiphy1_clk_mux" }, > + .interrupt = { "csiphy1" } > + }, > + > + /* CSIPHY2 */ > + { > + .regulators = { NULL }, > + .clock = { "top_ahb", "ispif_ahb", "csiphy2_timer" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 100000000, 200000000 } }, > + .reg = { "csiphy2", "csiphy2_clk_mux" }, > + .interrupt = { "csiphy2" } > + } > +}; > + > +static const struct resources csid_res_8974[] = { > + /* CSID0 */ > + { > + .regulators = { "vdda" }, > + .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", > + "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 0 }, > + { 100000000, 200000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "csid0" }, > + .interrupt = { "csid0" } > + }, > + > + /* CSID1 */ > + { > + .regulators = { "vdda" }, > + .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", > + "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 0 }, > + { 100000000, 200000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "csid1" }, > + .interrupt = { "csid1" } > + }, > + > + /* CSID2 */ > + { > + .regulators = { "vdda" }, > + .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", > + "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 0 }, > + { 100000000, 200000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "csid2" }, > + .interrupt = { "csid2" } > + }, > + > + /* CSID3 */ > + { > + .regulators = { "vdda" }, > + .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", > + "csi3", "csi3_phy", "csi3_pix", "csi3_rdi" }, > + .clock_rate = { { 0 }, > + { 0 }, > + { 0 }, > + { 100000000, 200000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "csid3" }, > + .interrupt = { "csid3" } > + } > +}; > + > +static const struct resources_ispif ispif_res_8974 = { > + /* ISPIF */ > + .clock = { "top_ahb", "ispif_ahb", > + "csi0", "csi0_pix", "csi0_rdi", > + "csi1", "csi1_pix", "csi1_rdi", > + "csi2", "csi2_pix", "csi2_rdi", > + "csi3", "csi3_pix", "csi3_rdi" }, > + .clock_for_reset = { "vfe0", "csi_vfe0", > + "vfe1", "csi_vfe1" }, > + .reg = { "ispif", "csi_clk_mux" }, > + .interrupt = "ispif" > + > +}; > + > +static const struct resources vfe_res_8974[] = { > + /* VFE0 */ > + { > + .regulators = { NULL }, > + .clock = { "top_ahb", "vfe0", "csi_vfe0", > + "iface", "bus" }, > + .clock_rate = { { 0 }, > + { 50000000, 80000000, 100000000, 160000000, > + 177780000, 200000000, 266670000, 320000000, > + 400000000, 400000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "vfe0" }, > + .interrupt = { "vfe0" } > + }, > + /* VFE1 */ > + { > + .regulators = { NULL }, > + .clock = { "top_ahb", "vfe1", "csi_vfe1", > + "iface", "bus" }, > + .clock_rate = { { 0 }, > + { 50000000, 80000000, 100000000, 160000000, > + 177780000, 200000000, 266670000, 320000000, > + 400000000, 400000000 }, > + { 0 }, > + { 0 }, > + { 0 } }, > + .reg = { "vfe1" }, > + .interrupt = { "vfe1" } > + } > +}; > + > static const struct resources csiphy_res_8x96[] = { > /* CSIPHY0 */ > { > @@ -1132,6 +1280,11 @@ static int camss_init_subdevices(struct camss *camss) > csid_res = csid_res_8x16; > ispif_res = &ispif_res_8x16; > vfe_res = vfe_res_8x16; > + } else if (camss->version == CAMSS_8x74) { > + csiphy_res = csiphy_res_8974; > + csid_res = csid_res_8974; > + ispif_res = &ispif_res_8974; > + vfe_res = vfe_res_8974; > } else if (camss->version == CAMSS_8x96) { > csiphy_res = csiphy_res_8x96; > csid_res = csid_res_8x96; > @@ -1542,6 +1695,12 @@ static int camss_probe(struct platform_device *pdev) > camss->csiphy_num = 2; > camss->csid_num = 2; > camss->vfe_num = 1; > + } else if (of_device_is_compatible(dev->of_node, > + "qcom,msm8974-camss")) { > + camss->version = CAMSS_8x74; > + camss->csiphy_num = 3; > + camss->csid_num = 4; > + camss->vfe_num = 2; > } else if (of_device_is_compatible(dev->of_node, > "qcom,msm8996-camss")) { > camss->version = CAMSS_8x96; > @@ -1586,6 +1745,7 @@ static int camss_probe(struct platform_device *pdev) > } > > if (camss->version == CAMSS_8x16 || > + camss->version == CAMSS_8x74 || > camss->version == CAMSS_8x96) { > camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL); > if (!camss->ispif) { > @@ -1735,6 +1895,7 @@ static int camss_remove(struct platform_device *pdev) > > static const struct of_device_id camss_dt_match[] = { > { .compatible = "qcom,msm8916-camss" }, > + { .compatible = "qcom,msm8974-camss" }, > { .compatible = "qcom,msm8996-camss" }, > { .compatible = "qcom,sdm660-camss" }, > { .compatible = "qcom,sdm845-camss" }, > -- > 2.36.0 > Reviewed-by: Robert Foss <robert.foss@linaro.org>
On Sun, 22 May 2022 at 18:28, Luca Weiss <luca@z3ntu.xyz> wrote: > > From: Matti Lehtimäki <matti.lehtimaki@gmail.com> > > MSM8974 CCI is the same as MSM8916 except it has two masters. > > Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> > --- > To note, the cci_v1_5_data variable name is just a bit arbitrary and > isn't meant to reflect IP version "1.5". I'd be happy to change the > variable name to something else. > > drivers/i2c/busses/i2c-qcom-cci.c | 35 +++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c > index 5c7cc862f08f..a68f17eb9dd0 100644 > --- a/drivers/i2c/busses/i2c-qcom-cci.c > +++ b/drivers/i2c/busses/i2c-qcom-cci.c > @@ -725,6 +725,40 @@ static const struct cci_data cci_v1_data = { > }, > }; > > +static const struct cci_data cci_v1_5_data = { > + .num_masters = 2, > + .queue_size = { 64, 16 }, > + .quirks = { > + .max_write_len = 10, > + .max_read_len = 12, > + }, > + .cci_clk_rate = 19200000, > + .params[I2C_MODE_STANDARD] = { > + .thigh = 78, > + .tlow = 114, > + .tsu_sto = 28, > + .tsu_sta = 28, > + .thd_dat = 10, > + .thd_sta = 77, > + .tbuf = 118, > + .scl_stretch_en = 0, > + .trdhld = 6, > + .tsp = 1 > + }, > + .params[I2C_MODE_FAST] = { > + .thigh = 20, > + .tlow = 28, > + .tsu_sto = 21, > + .tsu_sta = 21, > + .thd_dat = 13, > + .thd_sta = 18, > + .tbuf = 32, > + .scl_stretch_en = 0, > + .trdhld = 6, > + .tsp = 3 > + }, > +}; > + > static const struct cci_data cci_v2_data = { > .num_masters = 2, > .queue_size = { 64, 16 }, > @@ -773,6 +807,7 @@ static const struct cci_data cci_v2_data = { > > static const struct of_device_id cci_dt_match[] = { > { .compatible = "qcom,msm8916-cci", .data = &cci_v1_data}, > + { .compatible = "qcom,msm8974-cci", .data = &cci_v1_5_data}, > { .compatible = "qcom,msm8996-cci", .data = &cci_v2_data}, > { .compatible = "qcom,sdm845-cci", .data = &cci_v2_data}, > { .compatible = "qcom,sm8250-cci", .data = &cci_v2_data}, > -- > 2.36.0 >