Skip to content

Commit 1799ba7

Browse files
vknechtTravMurav
authored andcommitted
UPSTREAM: media: qcom: camss: Add support for MSM8939
The camera subsystem for the MSM8939 is the same as MSM8916 except with 3 CSID instead of 2, and some higher clock rates. As a quirk, this SoC needs writing values to 2 VFE VBIF registers (see downstream msm8939-camera.dtsi vbif-{regs,settings} properties). This fixes black stripes across sensor and garbage in CSID TPG outputs. Add support for the MSM8939 camera subsystem. Reviewed-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Vincent Knecht <[email protected]> Signed-off-by: André Apitzsch <[email protected]> Signed-off-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 28d46b9 commit 1799ba7

File tree

6 files changed

+171
-2
lines changed

6 files changed

+171
-2
lines changed

drivers/media/platform/qcom/camss/camss-csiphy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ int msm_csiphy_subdev_init(struct camss *camss,
600600
return PTR_ERR(csiphy->base);
601601

602602
if (camss->res->version == CAMSS_8x16 ||
603+
camss->res->version == CAMSS_8x39 ||
603604
camss->res->version == CAMSS_8x53 ||
604605
camss->res->version == CAMSS_8x96) {
605606
csiphy->base_clk_mux =

drivers/media/platform/qcom/camss/camss-ispif.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,8 @@ int msm_ispif_subdev_init(struct camss *camss,
11121112
/* Number of ISPIF lines - same as number of CSID hardware modules */
11131113
if (camss->res->version == CAMSS_8x16)
11141114
ispif->line_num = 2;
1115+
else if (camss->res->version == CAMSS_8x39)
1116+
ispif->line_num = 3;
11151117
else if (camss->res->version == CAMSS_8x96 ||
11161118
camss->res->version == CAMSS_8x53 ||
11171119
camss->res->version == CAMSS_660)
@@ -1128,7 +1130,8 @@ int msm_ispif_subdev_init(struct camss *camss,
11281130
ispif->line[i].ispif = ispif;
11291131
ispif->line[i].id = i;
11301132

1131-
if (camss->res->version == CAMSS_8x16) {
1133+
if (camss->res->version == CAMSS_8x16 ||
1134+
camss->res->version == CAMSS_8x39) {
11321135
ispif->line[i].formats = ispif_formats_8x16;
11331136
ispif->line[i].nformats =
11341137
ARRAY_SIZE(ispif_formats_8x16);
@@ -1162,7 +1165,8 @@ int msm_ispif_subdev_init(struct camss *camss,
11621165
ispif->irq = ret;
11631166
snprintf(ispif->irq_name, sizeof(ispif->irq_name), "%s_%s",
11641167
dev_name(dev), MSM_ISPIF_NAME);
1165-
if (camss->res->version == CAMSS_8x16)
1168+
if (camss->res->version == CAMSS_8x16 ||
1169+
camss->res->version == CAMSS_8x39)
11661170
ret = devm_request_irq(dev, ispif->irq, ispif_isr_8x16,
11671171
IRQF_TRIGGER_RISING, ispif->irq_name, ispif);
11681172
else if (camss->res->version == CAMSS_8x96 ||

drivers/media/platform/qcom/camss/camss-vfe-vbif.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
#include "camss-vfe.h"
1515
#include "camss-vfe-vbif.h"
1616

17+
#define VBIF_FIXED_SORT_EN 0x30
18+
#define VBIF_FIXED_SORT_SEL0 0x34
19+
1720
void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val)
1821
{
1922
writel_relaxed(val, vfe->vbif_base + reg);
2023
}
2124

2225
int vfe_vbif_apply_settings(struct vfe_device *vfe)
2326
{
27+
vfe_vbif_write_reg(vfe, VBIF_FIXED_SORT_EN, 0xfff);
28+
vfe_vbif_write_reg(vfe, VBIF_FIXED_SORT_SEL0, 0x555000);
29+
2430
return 0;
2531
}

drivers/media/platform/qcom/camss/camss-vfe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
290290

291291
switch (vfe->camss->res->version) {
292292
case CAMSS_8x16:
293+
case CAMSS_8x39:
293294
case CAMSS_8x53:
294295
switch (sink_code) {
295296
case MEDIA_BUS_FMT_YUYV8_1X16:

drivers/media/platform/qcom/camss/camss.c

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,149 @@ static const struct camss_subdev_resources vfe_res_8x16[] = {
154154
}
155155
};
156156

157+
static const struct camss_subdev_resources csiphy_res_8x39[] = {
158+
/* CSIPHY0 */
159+
{
160+
.regulators = { "vdda" },
161+
.clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
162+
.clock_rate = { { 0 },
163+
{ 40000000, 80000000 },
164+
{ 0 },
165+
{ 100000000, 200000000 } },
166+
.reg = { "csiphy0", "csiphy0_clk_mux" },
167+
.interrupt = { "csiphy0" },
168+
.csiphy = {
169+
.id = 0,
170+
.hw_ops = &csiphy_ops_2ph_1_0,
171+
.formats = &csiphy_formats_8x16
172+
}
173+
},
174+
175+
/* CSIPHY1 */
176+
{
177+
.regulators = { "vdda" },
178+
.clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
179+
.clock_rate = { { 0 },
180+
{ 40000000, 80000000 },
181+
{ 0 },
182+
{ 100000000, 200000000 } },
183+
.reg = { "csiphy1", "csiphy1_clk_mux" },
184+
.interrupt = { "csiphy1" },
185+
.csiphy = {
186+
.id = 1,
187+
.hw_ops = &csiphy_ops_2ph_1_0,
188+
.formats = &csiphy_formats_8x16
189+
}
190+
}
191+
};
192+
193+
static const struct camss_subdev_resources csid_res_8x39[] = {
194+
/* CSID0 */
195+
{
196+
.regulators = {},
197+
.clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
198+
"csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
199+
.clock_rate = { { 0 },
200+
{ 40000000, 80000000 },
201+
{ 0 },
202+
{ 0 },
203+
{ 100000000, 200000000 },
204+
{ 0 },
205+
{ 0 },
206+
{ 0 } },
207+
.reg = { "csid0" },
208+
.interrupt = { "csid0" },
209+
.csid = {
210+
.hw_ops = &csid_ops_4_1,
211+
.parent_dev_ops = &vfe_parent_dev_ops,
212+
.formats = &csid_formats_4_1
213+
}
214+
},
215+
216+
/* CSID1 */
217+
{
218+
.regulators = {},
219+
.clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
220+
"csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
221+
.clock_rate = { { 0 },
222+
{ 40000000, 80000000 },
223+
{ 0 },
224+
{ 0 },
225+
{ 100000000, 200000000 },
226+
{ 0 },
227+
{ 0 },
228+
{ 0 } },
229+
.reg = { "csid1" },
230+
.interrupt = { "csid1" },
231+
.csid = {
232+
.hw_ops = &csid_ops_4_1,
233+
.parent_dev_ops = &vfe_parent_dev_ops,
234+
.formats = &csid_formats_4_1
235+
}
236+
},
237+
238+
/* CSID2 */
239+
{
240+
.regulators = {},
241+
.clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
242+
"csi2", "csi2_phy", "csi2_pix", "csi2_rdi" },
243+
.clock_rate = { { 0 },
244+
{ 40000000, 80000000 },
245+
{ 0 },
246+
{ 0 },
247+
{ 100000000, 200000000 },
248+
{ 0 },
249+
{ 0 },
250+
{ 0 } },
251+
.reg = { "csid2" },
252+
.interrupt = { "csid2" },
253+
.csid = {
254+
.hw_ops = &csid_ops_4_1,
255+
.parent_dev_ops = &vfe_parent_dev_ops,
256+
.formats = &csid_formats_4_1
257+
}
258+
},
259+
};
260+
261+
static const struct camss_subdev_resources ispif_res_8x39 = {
262+
/* ISPIF */
263+
.clock = { "top_ahb", "ispif_ahb", "ahb",
264+
"csi0", "csi0_pix", "csi0_rdi",
265+
"csi1", "csi1_pix", "csi1_rdi",
266+
"csi2", "csi2_pix", "csi2_rdi" },
267+
.clock_for_reset = { "vfe0", "csi_vfe0" },
268+
.reg = { "ispif", "csi_clk_mux" },
269+
.interrupt = { "ispif" },
270+
};
271+
272+
static const struct camss_subdev_resources vfe_res_8x39[] = {
273+
/* VFE0 */
274+
{
275+
.regulators = {},
276+
.clock = { "top_ahb", "ispif_ahb", "vfe0", "csi_vfe0",
277+
"vfe_ahb", "vfe_axi", "ahb" },
278+
.clock_rate = { { 0 },
279+
{ 40000000, 80000000 },
280+
{ 50000000, 80000000, 100000000, 160000000,
281+
177780000, 200000000, 266670000, 320000000,
282+
400000000, 465000000, 480000000, 600000000 },
283+
{ 0 },
284+
{ 0 },
285+
{ 0 },
286+
{ 0 } },
287+
.reg = { "vfe0" },
288+
.interrupt = { "vfe0" },
289+
.vfe = {
290+
.line_num = 3,
291+
.has_vbif = true,
292+
.vbif_name = "vfe0_vbif",
293+
.hw_ops = &vfe_ops_4_1,
294+
.formats_rdi = &vfe_formats_rdi_8x16,
295+
.formats_pix = &vfe_formats_pix_8x16
296+
}
297+
}
298+
};
299+
157300
static const struct camss_subdev_resources csid_res_8x53[] = {
158301
/* CSID0 */
159302
{
@@ -4171,6 +4314,7 @@ static int camss_probe(struct platform_device *pdev)
41714314
return -ENOMEM;
41724315

41734316
if (camss->res->version == CAMSS_8x16 ||
4317+
camss->res->version == CAMSS_8x39 ||
41744318
camss->res->version == CAMSS_8x53 ||
41754319
camss->res->version == CAMSS_8x96) {
41764320
camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL);
@@ -4302,6 +4446,17 @@ static const struct camss_resources msm8916_resources = {
43024446
.vfe_num = ARRAY_SIZE(vfe_res_8x16),
43034447
};
43044448

4449+
static const struct camss_resources msm8939_resources = {
4450+
.version = CAMSS_8x39,
4451+
.csiphy_res = csiphy_res_8x39,
4452+
.csid_res = csid_res_8x39,
4453+
.ispif_res = &ispif_res_8x39,
4454+
.vfe_res = vfe_res_8x39,
4455+
.csiphy_num = ARRAY_SIZE(csiphy_res_8x39),
4456+
.csid_num = ARRAY_SIZE(csid_res_8x39),
4457+
.vfe_num = ARRAY_SIZE(vfe_res_8x39),
4458+
};
4459+
43054460
static const struct camss_resources msm8953_resources = {
43064461
.version = CAMSS_8x53,
43074462
.icc_res = icc_res_8x53,
@@ -4468,6 +4623,7 @@ static const struct camss_resources x1e80100_resources = {
44684623

44694624
static const struct of_device_id camss_dt_match[] = {
44704625
{ .compatible = "qcom,msm8916-camss", .data = &msm8916_resources },
4626+
{ .compatible = "qcom,msm8939-camss", .data = &msm8939_resources },
44714627
{ .compatible = "qcom,msm8953-camss", .data = &msm8953_resources },
44724628
{ .compatible = "qcom,msm8996-camss", .data = &msm8996_resources },
44734629
{ .compatible = "qcom,qcm2290-camss", .data = &qcm2290_resources },

drivers/media/platform/qcom/camss/camss.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ enum camss_version {
8181
CAMSS_2290,
8282
CAMSS_7280,
8383
CAMSS_8x16,
84+
CAMSS_8x39,
8485
CAMSS_8x53,
8586
CAMSS_8x96,
8687
CAMSS_8250,

0 commit comments

Comments
 (0)