1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * camss.c 4 * 5 * Qualcomm MSM Camera Subsystem - Core 6 * 7 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 8 * Copyright (C) 2015-2018 Linaro Ltd. 9 */ 10 #include <linux/clk.h> 11 #include <linux/interconnect.h> 12 #include <linux/media-bus-format.h> 13 #include <linux/media.h> 14 #include <linux/module.h> 15 #include <linux/platform_device.h> 16 #include <linux/of.h> 17 #include <linux/of_device.h> 18 #include <linux/of_graph.h> 19 #include <linux/pm_runtime.h> 20 #include <linux/pm_domain.h> 21 #include <linux/slab.h> 22 #include <linux/videodev2.h> 23 24 #include <media/media-device.h> 25 #include <media/v4l2-async.h> 26 #include <media/v4l2-device.h> 27 #include <media/v4l2-mc.h> 28 #include <media/v4l2-fwnode.h> 29 30 #include "camss.h" 31 32 #define CAMSS_CLOCK_MARGIN_NUMERATOR 105 33 #define CAMSS_CLOCK_MARGIN_DENOMINATOR 100 34 35 static const struct parent_dev_ops vfe_parent_dev_ops; 36 37 static const struct camss_subdev_resources csiphy_res_8x16[] = { 38 /* CSIPHY0 */ 39 { 40 .regulators = {}, 41 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" }, 42 .clock_rate = { { 0 }, 43 { 0 }, 44 { 0 }, 45 { 100000000, 200000000 } }, 46 .reg = { "csiphy0", "csiphy0_clk_mux" }, 47 .interrupt = { "csiphy0" }, 48 .csiphy = { 49 .id = 0, 50 .hw_ops = &csiphy_ops_2ph_1_0, 51 .formats = &csiphy_formats_8x16 52 } 53 }, 54 55 /* CSIPHY1 */ 56 { 57 .regulators = {}, 58 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" }, 59 .clock_rate = { { 0 }, 60 { 0 }, 61 { 0 }, 62 { 100000000, 200000000 } }, 63 .reg = { "csiphy1", "csiphy1_clk_mux" }, 64 .interrupt = { "csiphy1" }, 65 .csiphy = { 66 .id = 1, 67 .hw_ops = &csiphy_ops_2ph_1_0, 68 .formats = &csiphy_formats_8x16 69 } 70 } 71 }; 72 73 static const struct camss_subdev_resources csid_res_8x16[] = { 74 /* CSID0 */ 75 { 76 .regulators = { "vdda" }, 77 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb", 78 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" }, 79 .clock_rate = { { 0 }, 80 { 0 }, 81 { 0 }, 82 { 0 }, 83 { 100000000, 200000000 }, 84 { 0 }, 85 { 0 }, 86 { 0 } }, 87 .reg = { "csid0" }, 88 .interrupt = { "csid0" }, 89 .csid = { 90 .hw_ops = &csid_ops_4_1, 91 .parent_dev_ops = &vfe_parent_dev_ops, 92 .formats = &csid_formats_4_1 93 } 94 }, 95 96 /* CSID1 */ 97 { 98 .regulators = { "vdda" }, 99 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb", 100 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" }, 101 .clock_rate = { { 0 }, 102 { 0 }, 103 { 0 }, 104 { 0 }, 105 { 100000000, 200000000 }, 106 { 0 }, 107 { 0 }, 108 { 0 } }, 109 .reg = { "csid1" }, 110 .interrupt = { "csid1" }, 111 .csid = { 112 .hw_ops = &csid_ops_4_1, 113 .parent_dev_ops = &vfe_parent_dev_ops, 114 .formats = &csid_formats_4_1 115 } 116 }, 117 }; 118 119 static const struct camss_subdev_resources ispif_res_8x16 = { 120 /* ISPIF */ 121 .clock = { "top_ahb", "ahb", "ispif_ahb", 122 "csi0", "csi0_pix", "csi0_rdi", 123 "csi1", "csi1_pix", "csi1_rdi" }, 124 .clock_for_reset = { "vfe0", "csi_vfe0" }, 125 .reg = { "ispif", "csi_clk_mux" }, 126 .interrupt = { "ispif" }, 127 }; 128 129 static const struct camss_subdev_resources vfe_res_8x16[] = { 130 /* VFE0 */ 131 { 132 .regulators = {}, 133 .clock = { "top_ahb", "vfe0", "csi_vfe0", 134 "vfe_ahb", "vfe_axi", "ahb" }, 135 .clock_rate = { { 0 }, 136 { 50000000, 80000000, 100000000, 160000000, 137 177780000, 200000000, 266670000, 320000000, 138 400000000, 465000000 }, 139 { 0 }, 140 { 0 }, 141 { 0 }, 142 { 0 }, 143 { 0 }, 144 { 0 }, 145 { 0 } }, 146 .reg = { "vfe0" }, 147 .interrupt = { "vfe0" }, 148 .vfe = { 149 .line_num = 3, 150 .hw_ops = &vfe_ops_4_1, 151 .formats_rdi = &vfe_formats_rdi_8x16, 152 .formats_pix = &vfe_formats_pix_8x16 153 } 154 } 155 }; 156 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 300 static const struct camss_subdev_resources csid_res_8x53[] = { 301 /* CSID0 */ 302 { 303 .regulators = { "vdda" }, 304 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb", 305 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" }, 306 .clock_rate = { { 0 }, 307 { 0 }, 308 { 0 }, 309 { 0 }, 310 { 100000000, 200000000, 310000000, 311 400000000, 465000000 }, 312 { 0 }, 313 { 0 }, 314 { 0 } }, 315 .reg = { "csid0" }, 316 .interrupt = { "csid0" }, 317 .csid = { 318 .hw_ops = &csid_ops_4_7, 319 .parent_dev_ops = &vfe_parent_dev_ops, 320 .formats = &csid_formats_4_7 321 } 322 }, 323 324 /* CSID1 */ 325 { 326 .regulators = { "vdda" }, 327 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb", 328 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" }, 329 .clock_rate = { { 0 }, 330 { 0 }, 331 { 0 }, 332 { 0 }, 333 { 100000000, 200000000, 310000000, 334 400000000, 465000000 }, 335 { 0 }, 336 { 0 }, 337 { 0 } }, 338 .reg = { "csid1" }, 339 .interrupt = { "csid1" }, 340 .csid = { 341 .hw_ops = &csid_ops_4_7, 342 .parent_dev_ops = &vfe_parent_dev_ops, 343 .formats = &csid_formats_4_7 344 } 345 }, 346 347 /* CSID2 */ 348 { 349 .regulators = { "vdda" }, 350 .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb", 351 "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" }, 352 .clock_rate = { { 0 }, 353 { 0 }, 354 { 0 }, 355 { 0 }, 356 { 100000000, 200000000, 310000000, 357 400000000, 465000000 }, 358 { 0 }, 359 { 0 }, 360 { 0 } }, 361 .reg = { "csid2" }, 362 .interrupt = { "csid2" }, 363 .csid = { 364 .hw_ops = &csid_ops_4_7, 365 .parent_dev_ops = &vfe_parent_dev_ops, 366 .formats = &csid_formats_4_7 367 } 368 }, 369 }; 370 371 static const struct camss_subdev_resources ispif_res_8x53 = { 372 /* ISPIF */ 373 .clock = { "top_ahb", "ahb", "ispif_ahb", 374 "csi0", "csi0_pix", "csi0_rdi", 375 "csi1", "csi1_pix", "csi1_rdi", 376 "csi2", "csi2_pix", "csi2_rdi" }, 377 .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, 378 .reg = { "ispif", "csi_clk_mux" }, 379 .interrupt = { "ispif" }, 380 }; 381 382 static const struct camss_subdev_resources vfe_res_8x53[] = { 383 /* VFE0 */ 384 { 385 .regulators = {}, 386 .clock = { "top_ahb", "ahb", "ispif_ahb", 387 "vfe0", "csi_vfe0", "vfe0_ahb", "vfe0_axi" }, 388 .clock_rate = { { 0 }, 389 { 0 }, 390 { 0 }, 391 { 50000000, 100000000, 133330000, 392 160000000, 200000000, 266670000, 393 310000000, 400000000, 465000000 }, 394 { 0 }, 395 { 0 }, 396 { 0 } }, 397 .reg = { "vfe0" }, 398 .interrupt = { "vfe0" }, 399 .vfe = { 400 .line_num = 3, 401 .has_pd = true, 402 .pd_name = "vfe0", 403 .hw_ops = &vfe_ops_4_1, 404 .formats_rdi = &vfe_formats_rdi_8x16, 405 .formats_pix = &vfe_formats_pix_8x16 406 } 407 }, 408 409 /* VFE1 */ 410 { 411 .regulators = {}, 412 .clock = { "top_ahb", "ahb", "ispif_ahb", 413 "vfe1", "csi_vfe1", "vfe1_ahb", "vfe1_axi" }, 414 .clock_rate = { { 0 }, 415 { 0 }, 416 { 0 }, 417 { 50000000, 100000000, 133330000, 418 160000000, 200000000, 266670000, 419 310000000, 400000000, 465000000 }, 420 { 0 }, 421 { 0 }, 422 { 0 } }, 423 .reg = { "vfe1" }, 424 .interrupt = { "vfe1" }, 425 .vfe = { 426 .line_num = 3, 427 .has_pd = true, 428 .pd_name = "vfe1", 429 .hw_ops = &vfe_ops_4_1, 430 .formats_rdi = &vfe_formats_rdi_8x16, 431 .formats_pix = &vfe_formats_pix_8x16 432 } 433 } 434 }; 435 436 static const struct resources_icc icc_res_8x53[] = { 437 { 438 .name = "cam_ahb", 439 .icc_bw_tbl.avg = 38400, 440 .icc_bw_tbl.peak = 76800, 441 }, 442 { 443 .name = "cam_vfe0_mem", 444 .icc_bw_tbl.avg = 939524, 445 .icc_bw_tbl.peak = 1342177, 446 }, 447 { 448 .name = "cam_vfe1_mem", 449 .icc_bw_tbl.avg = 939524, 450 .icc_bw_tbl.peak = 1342177, 451 }, 452 }; 453 454 static const struct camss_subdev_resources csiphy_res_8x96[] = { 455 /* CSIPHY0 */ 456 { 457 .regulators = {}, 458 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" }, 459 .clock_rate = { { 0 }, 460 { 0 }, 461 { 0 }, 462 { 100000000, 200000000, 266666667 } }, 463 .reg = { "csiphy0", "csiphy0_clk_mux" }, 464 .interrupt = { "csiphy0" }, 465 .csiphy = { 466 .id = 0, 467 .hw_ops = &csiphy_ops_3ph_1_0, 468 .formats = &csiphy_formats_8x96 469 } 470 }, 471 472 /* CSIPHY1 */ 473 { 474 .regulators = {}, 475 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" }, 476 .clock_rate = { { 0 }, 477 { 0 }, 478 { 0 }, 479 { 100000000, 200000000, 266666667 } }, 480 .reg = { "csiphy1", "csiphy1_clk_mux" }, 481 .interrupt = { "csiphy1" }, 482 .csiphy = { 483 .id = 1, 484 .hw_ops = &csiphy_ops_3ph_1_0, 485 .formats = &csiphy_formats_8x96 486 } 487 }, 488 489 /* CSIPHY2 */ 490 { 491 .regulators = {}, 492 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy2_timer" }, 493 .clock_rate = { { 0 }, 494 { 0 }, 495 { 0 }, 496 { 100000000, 200000000, 266666667 } }, 497 .reg = { "csiphy2", "csiphy2_clk_mux" }, 498 .interrupt = { "csiphy2" }, 499 .csiphy = { 500 .id = 2, 501 .hw_ops = &csiphy_ops_3ph_1_0, 502 .formats = &csiphy_formats_8x96 503 } 504 } 505 }; 506 507 static const struct camss_subdev_resources csid_res_8x96[] = { 508 /* CSID0 */ 509 { 510 .regulators = { "vdda" }, 511 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb", 512 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" }, 513 .clock_rate = { { 0 }, 514 { 0 }, 515 { 0 }, 516 { 0 }, 517 { 100000000, 200000000, 266666667 }, 518 { 0 }, 519 { 0 }, 520 { 0 } }, 521 .reg = { "csid0" }, 522 .interrupt = { "csid0" }, 523 .csid = { 524 .hw_ops = &csid_ops_4_7, 525 .parent_dev_ops = &vfe_parent_dev_ops, 526 .formats = &csid_formats_4_7 527 } 528 }, 529 530 /* CSID1 */ 531 { 532 .regulators = { "vdda" }, 533 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb", 534 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" }, 535 .clock_rate = { { 0 }, 536 { 0 }, 537 { 0 }, 538 { 0 }, 539 { 100000000, 200000000, 266666667 }, 540 { 0 }, 541 { 0 }, 542 { 0 } }, 543 .reg = { "csid1" }, 544 .interrupt = { "csid1" }, 545 .csid = { 546 .hw_ops = &csid_ops_4_7, 547 .parent_dev_ops = &vfe_parent_dev_ops, 548 .formats = &csid_formats_4_7 549 } 550 }, 551 552 /* CSID2 */ 553 { 554 .regulators = { "vdda" }, 555 .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb", 556 "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" }, 557 .clock_rate = { { 0 }, 558 { 0 }, 559 { 0 }, 560 { 0 }, 561 { 100000000, 200000000, 266666667 }, 562 { 0 }, 563 { 0 }, 564 { 0 } }, 565 .reg = { "csid2" }, 566 .interrupt = { "csid2" }, 567 .csid = { 568 .hw_ops = &csid_ops_4_7, 569 .parent_dev_ops = &vfe_parent_dev_ops, 570 .formats = &csid_formats_4_7 571 } 572 }, 573 574 /* CSID3 */ 575 { 576 .regulators = { "vdda" }, 577 .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", "ahb", 578 "csi3", "csi3_phy", "csi3_pix", "csi3_rdi" }, 579 .clock_rate = { { 0 }, 580 { 0 }, 581 { 0 }, 582 { 0 }, 583 { 100000000, 200000000, 266666667 }, 584 { 0 }, 585 { 0 }, 586 { 0 } }, 587 .reg = { "csid3" }, 588 .interrupt = { "csid3" }, 589 .csid = { 590 .hw_ops = &csid_ops_4_7, 591 .parent_dev_ops = &vfe_parent_dev_ops, 592 .formats = &csid_formats_4_7 593 } 594 } 595 }; 596 597 static const struct camss_subdev_resources ispif_res_8x96 = { 598 /* ISPIF */ 599 .clock = { "top_ahb", "ahb", "ispif_ahb", 600 "csi0", "csi0_pix", "csi0_rdi", 601 "csi1", "csi1_pix", "csi1_rdi", 602 "csi2", "csi2_pix", "csi2_rdi", 603 "csi3", "csi3_pix", "csi3_rdi" }, 604 .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, 605 .reg = { "ispif", "csi_clk_mux" }, 606 .interrupt = { "ispif" }, 607 }; 608 609 static const struct camss_subdev_resources vfe_res_8x96[] = { 610 /* VFE0 */ 611 { 612 .regulators = {}, 613 .clock = { "top_ahb", "ahb", "vfe0", "csi_vfe0", "vfe_ahb", 614 "vfe0_ahb", "vfe_axi", "vfe0_stream"}, 615 .clock_rate = { { 0 }, 616 { 0 }, 617 { 75000000, 100000000, 300000000, 618 320000000, 480000000, 600000000 }, 619 { 0 }, 620 { 0 }, 621 { 0 }, 622 { 0 }, 623 { 0 } }, 624 .reg = { "vfe0" }, 625 .interrupt = { "vfe0" }, 626 .vfe = { 627 .line_num = 3, 628 .has_pd = true, 629 .hw_ops = &vfe_ops_4_7, 630 .formats_rdi = &vfe_formats_rdi_8x96, 631 .formats_pix = &vfe_formats_pix_8x96 632 } 633 }, 634 635 /* VFE1 */ 636 { 637 .regulators = {}, 638 .clock = { "top_ahb", "ahb", "vfe1", "csi_vfe1", "vfe_ahb", 639 "vfe1_ahb", "vfe_axi", "vfe1_stream"}, 640 .clock_rate = { { 0 }, 641 { 0 }, 642 { 75000000, 100000000, 300000000, 643 320000000, 480000000, 600000000 }, 644 { 0 }, 645 { 0 }, 646 { 0 }, 647 { 0 }, 648 { 0 } }, 649 .reg = { "vfe1" }, 650 .interrupt = { "vfe1" }, 651 .vfe = { 652 .line_num = 3, 653 .has_pd = true, 654 .hw_ops = &vfe_ops_4_7, 655 .formats_rdi = &vfe_formats_rdi_8x96, 656 .formats_pix = &vfe_formats_pix_8x96 657 } 658 } 659 }; 660 661 static const struct camss_subdev_resources csiphy_res_2290[] = { 662 /* CSIPHY0 */ 663 { 664 .regulators = { "vdd-csiphy-1p2", "vdd-csiphy-1p8" }, 665 .clock = { "top_ahb", "ahb", "csiphy0", "csiphy0_timer" }, 666 .clock_rate = { { 0 }, 667 { 0 }, 668 { 240000000, 341330000, 384000000 }, 669 { 100000000, 200000000, 268800000 } }, 670 .reg = { "csiphy0" }, 671 .interrupt = { "csiphy0" }, 672 .csiphy = { 673 .id = 0, 674 .hw_ops = &csiphy_ops_3ph_1_0, 675 .formats = &csiphy_formats_sdm845 676 } 677 }, 678 679 /* CSIPHY1 */ 680 { 681 .regulators = { "vdd-csiphy-1p2", "vdd-csiphy-1p8" }, 682 .clock = { "top_ahb", "ahb", "csiphy1", "csiphy1_timer" }, 683 .clock_rate = { { 0 }, 684 { 0 }, 685 { 240000000, 341330000, 384000000 }, 686 { 100000000, 200000000, 268800000 } }, 687 .reg = { "csiphy1" }, 688 .interrupt = { "csiphy1" }, 689 .csiphy = { 690 .id = 1, 691 .hw_ops = &csiphy_ops_3ph_1_0, 692 .formats = &csiphy_formats_sdm845 693 } 694 } 695 }; 696 697 static const struct camss_subdev_resources csid_res_2290[] = { 698 /* CSID0 */ 699 { 700 .regulators = {}, 701 .clock = { "top_ahb", "ahb", "csi0", "vfe0_cphy_rx", "vfe0" }, 702 .clock_rate = { { 0 }, 703 { 0 }, 704 { 192000000, 240000000, 384000000, 426400000 }, 705 { 0 }, 706 { 0 } }, 707 .reg = { "csid0" }, 708 .interrupt = { "csid0" }, 709 .csid = { 710 .hw_ops = &csid_ops_340, 711 .parent_dev_ops = &vfe_parent_dev_ops, 712 .formats = &csid_formats_gen2 713 } 714 }, 715 716 /* CSID1 */ 717 { 718 .regulators = {}, 719 .clock = { "top_ahb", "ahb", "csi1", "vfe1_cphy_rx", "vfe1" }, 720 .clock_rate = { { 0 }, 721 { 0 }, 722 { 192000000, 240000000, 384000000, 426400000 }, 723 { 0 }, 724 { 0 } }, 725 .reg = { "csid1" }, 726 .interrupt = { "csid1" }, 727 .csid = { 728 .hw_ops = &csid_ops_340, 729 .parent_dev_ops = &vfe_parent_dev_ops, 730 .formats = &csid_formats_gen2 731 } 732 } 733 }; 734 735 static const struct camss_subdev_resources vfe_res_2290[] = { 736 /* VFE0 */ 737 { 738 .regulators = {}, 739 .clock = { "top_ahb", "ahb", "axi", "vfe0", "camnoc_rt_axi", "camnoc_nrt_axi" }, 740 .clock_rate = { { 0 }, 741 { 0 }, 742 { 0 }, 743 { 19200000, 153600000, 192000000, 256000000, 384000000, 460800000 }, 744 { 0 }, 745 { 0 }, }, 746 .reg = { "vfe0" }, 747 .interrupt = { "vfe0" }, 748 .vfe = { 749 .line_num = 4, 750 .hw_ops = &vfe_ops_340, 751 .formats_rdi = &vfe_formats_rdi_845, 752 .formats_pix = &vfe_formats_pix_845 753 } 754 }, 755 756 /* VFE1 */ 757 { 758 .regulators = {}, 759 .clock = { "top_ahb", "ahb", "axi", "vfe1", "camnoc_rt_axi", "camnoc_nrt_axi" }, 760 .clock_rate = { { 0 }, 761 { 0 }, 762 { 0 }, 763 { 19200000, 153600000, 192000000, 256000000, 384000000, 460800000 }, 764 { 0 }, 765 { 0 }, }, 766 .reg = { "vfe1" }, 767 .interrupt = { "vfe1" }, 768 .vfe = { 769 .line_num = 4, 770 .hw_ops = &vfe_ops_340, 771 .formats_rdi = &vfe_formats_rdi_845, 772 .formats_pix = &vfe_formats_pix_845 773 } 774 }, 775 }; 776 777 static const struct resources_icc icc_res_2290[] = { 778 { 779 .name = "ahb", 780 .icc_bw_tbl.avg = 150000, 781 .icc_bw_tbl.peak = 300000, 782 }, 783 { 784 .name = "hf_mnoc", 785 .icc_bw_tbl.avg = 2097152, 786 .icc_bw_tbl.peak = 3000000, 787 }, 788 { 789 .name = "sf_mnoc", 790 .icc_bw_tbl.avg = 2097152, 791 .icc_bw_tbl.peak = 3000000, 792 }, 793 }; 794 795 static const struct camss_subdev_resources csiphy_res_660[] = { 796 /* CSIPHY0 */ 797 { 798 .regulators = {}, 799 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer", 800 "csi0_phy", "csiphy_ahb2crif" }, 801 .clock_rate = { { 0 }, 802 { 0 }, 803 { 0 }, 804 { 100000000, 200000000, 269333333 }, 805 { 0 } }, 806 .reg = { "csiphy0", "csiphy0_clk_mux" }, 807 .interrupt = { "csiphy0" }, 808 .csiphy = { 809 .id = 0, 810 .hw_ops = &csiphy_ops_3ph_1_0, 811 .formats = &csiphy_formats_8x96 812 } 813 }, 814 815 /* CSIPHY1 */ 816 { 817 .regulators = {}, 818 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer", 819 "csi1_phy", "csiphy_ahb2crif" }, 820 .clock_rate = { { 0 }, 821 { 0 }, 822 { 0 }, 823 { 100000000, 200000000, 269333333 }, 824 { 0 } }, 825 .reg = { "csiphy1", "csiphy1_clk_mux" }, 826 .interrupt = { "csiphy1" }, 827 .csiphy = { 828 .id = 1, 829 .hw_ops = &csiphy_ops_3ph_1_0, 830 .formats = &csiphy_formats_8x96 831 } 832 }, 833 834 /* CSIPHY2 */ 835 { 836 .regulators = {}, 837 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy2_timer", 838 "csi2_phy", "csiphy_ahb2crif" }, 839 .clock_rate = { { 0 }, 840 { 0 }, 841 { 0 }, 842 { 100000000, 200000000, 269333333 }, 843 { 0 } }, 844 .reg = { "csiphy2", "csiphy2_clk_mux" }, 845 .interrupt = { "csiphy2" }, 846 .csiphy = { 847 .id = 2, 848 .hw_ops = &csiphy_ops_3ph_1_0, 849 .formats = &csiphy_formats_8x96 850 } 851 } 852 }; 853 854 static const struct camss_subdev_resources csid_res_660[] = { 855 /* CSID0 */ 856 { 857 .regulators = { "vdda", "vdd_sec" }, 858 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb", 859 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi", 860 "cphy_csid0" }, 861 .clock_rate = { { 0 }, 862 { 0 }, 863 { 0 }, 864 { 0 }, 865 { 100000000, 200000000, 310000000, 866 404000000, 465000000 }, 867 { 0 }, 868 { 0 }, 869 { 0 }, 870 { 0 } }, 871 .reg = { "csid0" }, 872 .interrupt = { "csid0" }, 873 .csid = { 874 .hw_ops = &csid_ops_4_7, 875 .parent_dev_ops = &vfe_parent_dev_ops, 876 .formats = &csid_formats_4_7 877 } 878 }, 879 880 /* CSID1 */ 881 { 882 .regulators = { "vdda", "vdd_sec" }, 883 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb", 884 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi", 885 "cphy_csid1" }, 886 .clock_rate = { { 0 }, 887 { 0 }, 888 { 0 }, 889 { 0 }, 890 { 100000000, 200000000, 310000000, 891 404000000, 465000000 }, 892 { 0 }, 893 { 0 }, 894 { 0 }, 895 { 0 } }, 896 .reg = { "csid1" }, 897 .interrupt = { "csid1" }, 898 .csid = { 899 .hw_ops = &csid_ops_4_7, 900 .parent_dev_ops = &vfe_parent_dev_ops, 901 .formats = &csid_formats_4_7 902 } 903 }, 904 905 /* CSID2 */ 906 { 907 .regulators = { "vdda", "vdd_sec" }, 908 .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb", 909 "csi2", "csi2_phy", "csi2_pix", "csi2_rdi", 910 "cphy_csid2" }, 911 .clock_rate = { { 0 }, 912 { 0 }, 913 { 0 }, 914 { 0 }, 915 { 100000000, 200000000, 310000000, 916 404000000, 465000000 }, 917 { 0 }, 918 { 0 }, 919 { 0 }, 920 { 0 } }, 921 .reg = { "csid2" }, 922 .interrupt = { "csid2" }, 923 .csid = { 924 .hw_ops = &csid_ops_4_7, 925 .parent_dev_ops = &vfe_parent_dev_ops, 926 .formats = &csid_formats_4_7 927 } 928 }, 929 930 /* CSID3 */ 931 { 932 .regulators = { "vdda", "vdd_sec" }, 933 .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", "ahb", 934 "csi3", "csi3_phy", "csi3_pix", "csi3_rdi", 935 "cphy_csid3" }, 936 .clock_rate = { { 0 }, 937 { 0 }, 938 { 0 }, 939 { 0 }, 940 { 100000000, 200000000, 310000000, 941 404000000, 465000000 }, 942 { 0 }, 943 { 0 }, 944 { 0 }, 945 { 0 } }, 946 .reg = { "csid3" }, 947 .interrupt = { "csid3" }, 948 .csid = { 949 .hw_ops = &csid_ops_4_7, 950 .parent_dev_ops = &vfe_parent_dev_ops, 951 .formats = &csid_formats_4_7 952 } 953 } 954 }; 955 956 static const struct camss_subdev_resources ispif_res_660 = { 957 /* ISPIF */ 958 .clock = { "top_ahb", "ahb", "ispif_ahb", 959 "csi0", "csi0_pix", "csi0_rdi", 960 "csi1", "csi1_pix", "csi1_rdi", 961 "csi2", "csi2_pix", "csi2_rdi", 962 "csi3", "csi3_pix", "csi3_rdi" }, 963 .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, 964 .reg = { "ispif", "csi_clk_mux" }, 965 .interrupt = { "ispif" }, 966 }; 967 968 static const struct camss_subdev_resources vfe_res_660[] = { 969 /* VFE0 */ 970 { 971 .regulators = {}, 972 .clock = { "throttle_axi", "top_ahb", "ahb", "vfe0", 973 "csi_vfe0", "vfe_ahb", "vfe0_ahb", "vfe_axi", 974 "vfe0_stream"}, 975 .clock_rate = { { 0 }, 976 { 0 }, 977 { 0 }, 978 { 120000000, 200000000, 256000000, 979 300000000, 404000000, 480000000, 980 540000000, 576000000 }, 981 { 0 }, 982 { 0 }, 983 { 0 }, 984 { 0 }, 985 { 0 } }, 986 .reg = { "vfe0" }, 987 .interrupt = { "vfe0" }, 988 .vfe = { 989 .line_num = 3, 990 .has_pd = true, 991 .hw_ops = &vfe_ops_4_8, 992 .formats_rdi = &vfe_formats_rdi_8x96, 993 .formats_pix = &vfe_formats_pix_8x96 994 } 995 }, 996 997 /* VFE1 */ 998 { 999 .regulators = {}, 1000 .clock = { "throttle_axi", "top_ahb", "ahb", "vfe1", 1001 "csi_vfe1", "vfe_ahb", "vfe1_ahb", "vfe_axi", 1002 "vfe1_stream"}, 1003 .clock_rate = { { 0 }, 1004 { 0 }, 1005 { 0 }, 1006 { 120000000, 200000000, 256000000, 1007 300000000, 404000000, 480000000, 1008 540000000, 576000000 }, 1009 { 0 }, 1010 { 0 }, 1011 { 0 }, 1012 { 0 }, 1013 { 0 } }, 1014 .reg = { "vfe1" }, 1015 .interrupt = { "vfe1" }, 1016 .vfe = { 1017 .line_num = 3, 1018 .has_pd = true, 1019 .hw_ops = &vfe_ops_4_8, 1020 .formats_rdi = &vfe_formats_rdi_8x96, 1021 .formats_pix = &vfe_formats_pix_8x96 1022 } 1023 } 1024 }; 1025 1026 static const struct camss_subdev_resources csiphy_res_670[] = { 1027 /* CSIPHY0 */ 1028 { 1029 .regulators = { "vdda-phy", "vdda-pll" }, 1030 .clock = { "soc_ahb", "cpas_ahb", 1031 "csiphy0", "csiphy0_timer" }, 1032 .clock_rate = { { 0 }, 1033 { 0 }, 1034 { 0 }, 1035 { 19200000, 240000000, 269333333 } }, 1036 .reg = { "csiphy0" }, 1037 .interrupt = { "csiphy0" }, 1038 .csiphy = { 1039 .id = 0, 1040 .hw_ops = &csiphy_ops_3ph_1_0, 1041 .formats = &csiphy_formats_sdm845 1042 } 1043 }, 1044 1045 /* CSIPHY1 */ 1046 { 1047 .regulators = { "vdda-phy", "vdda-pll" }, 1048 .clock = { "soc_ahb", "cpas_ahb", 1049 "csiphy1", "csiphy1_timer" }, 1050 .clock_rate = { { 0 }, 1051 { 0 }, 1052 { 0 }, 1053 { 19200000, 240000000, 269333333 } }, 1054 .reg = { "csiphy1" }, 1055 .interrupt = { "csiphy1" }, 1056 .csiphy = { 1057 .id = 1, 1058 .hw_ops = &csiphy_ops_3ph_1_0, 1059 .formats = &csiphy_formats_sdm845 1060 } 1061 }, 1062 1063 /* CSIPHY2 */ 1064 { 1065 .regulators = { "vdda-phy", "vdda-pll" }, 1066 .clock = { "soc_ahb", "cpas_ahb", 1067 "csiphy2", "csiphy2_timer" }, 1068 .clock_rate = { { 0 }, 1069 { 0 }, 1070 { 0 }, 1071 { 19200000, 240000000, 269333333 } }, 1072 .reg = { "csiphy2" }, 1073 .interrupt = { "csiphy2" }, 1074 .csiphy = { 1075 .id = 2, 1076 .hw_ops = &csiphy_ops_3ph_1_0, 1077 .formats = &csiphy_formats_sdm845 1078 } 1079 } 1080 }; 1081 1082 static const struct camss_subdev_resources csid_res_670[] = { 1083 /* CSID0 */ 1084 { 1085 .regulators = {}, 1086 .clock = { "cpas_ahb", "soc_ahb", "vfe0", 1087 "vfe0_cphy_rx", "csi0" }, 1088 .clock_rate = { { 0 }, 1089 { 0 }, 1090 { 100000000, 320000000, 404000000, 480000000, 600000000 }, 1091 { 384000000 }, 1092 { 19200000, 75000000, 384000000, 538666667 } }, 1093 .reg = { "csid0" }, 1094 .interrupt = { "csid0" }, 1095 .csid = { 1096 .hw_ops = &csid_ops_gen2, 1097 .parent_dev_ops = &vfe_parent_dev_ops, 1098 .formats = &csid_formats_gen2 1099 } 1100 }, 1101 1102 /* CSID1 */ 1103 { 1104 .regulators = {}, 1105 .clock = { "cpas_ahb", "soc_ahb", "vfe1", 1106 "vfe1_cphy_rx", "csi1" }, 1107 .clock_rate = { { 0 }, 1108 { 0 }, 1109 { 100000000, 320000000, 404000000, 480000000, 600000000 }, 1110 { 384000000 }, 1111 { 19200000, 75000000, 384000000, 538666667 } }, 1112 .reg = { "csid1" }, 1113 .interrupt = { "csid1" }, 1114 .csid = { 1115 .hw_ops = &csid_ops_gen2, 1116 .parent_dev_ops = &vfe_parent_dev_ops, 1117 .formats = &csid_formats_gen2 1118 } 1119 }, 1120 1121 /* CSID2 */ 1122 { 1123 .regulators = {}, 1124 .clock = { "cpas_ahb", "soc_ahb", "vfe_lite", 1125 "vfe_lite_cphy_rx", "csi2" }, 1126 .clock_rate = { { 0 }, 1127 { 0 }, 1128 { 100000000, 320000000, 404000000, 480000000, 600000000 }, 1129 { 384000000 }, 1130 { 19200000, 75000000, 384000000, 538666667 } }, 1131 .reg = { "csid2" }, 1132 .interrupt = { "csid2" }, 1133 .csid = { 1134 .is_lite = true, 1135 .hw_ops = &csid_ops_gen2, 1136 .parent_dev_ops = &vfe_parent_dev_ops, 1137 .formats = &csid_formats_gen2 1138 } 1139 } 1140 }; 1141 1142 static const struct camss_subdev_resources vfe_res_670[] = { 1143 /* VFE0 */ 1144 { 1145 .regulators = {}, 1146 .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb", 1147 "vfe0", "vfe0_axi" }, 1148 .clock_rate = { { 0 }, 1149 { 0 }, 1150 { 0 }, 1151 { 100000000, 320000000, 404000000, 480000000, 600000000 }, 1152 { 0 } }, 1153 .reg = { "vfe0" }, 1154 .interrupt = { "vfe0" }, 1155 .vfe = { 1156 .line_num = 4, 1157 .has_pd = true, 1158 .pd_name = "ife0", 1159 .hw_ops = &vfe_ops_170, 1160 .formats_rdi = &vfe_formats_rdi_845, 1161 .formats_pix = &vfe_formats_pix_845 1162 } 1163 }, 1164 1165 /* VFE1 */ 1166 { 1167 .regulators = {}, 1168 .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb", 1169 "vfe1", "vfe1_axi" }, 1170 .clock_rate = { { 0 }, 1171 { 0 }, 1172 { 0 }, 1173 { 100000000, 320000000, 404000000, 480000000, 600000000 }, 1174 { 0 } }, 1175 .reg = { "vfe1" }, 1176 .interrupt = { "vfe1" }, 1177 .vfe = { 1178 .line_num = 4, 1179 .has_pd = true, 1180 .pd_name = "ife1", 1181 .hw_ops = &vfe_ops_170, 1182 .formats_rdi = &vfe_formats_rdi_845, 1183 .formats_pix = &vfe_formats_pix_845 1184 } 1185 }, 1186 1187 /* VFE-lite */ 1188 { 1189 .regulators = {}, 1190 .clock = { "camnoc_axi", "cpas_ahb", "soc_ahb", 1191 "vfe_lite" }, 1192 .clock_rate = { { 0 }, 1193 { 0 }, 1194 { 0 }, 1195 { 100000000, 320000000, 404000000, 480000000, 600000000 } }, 1196 .reg = { "vfe_lite" }, 1197 .interrupt = { "vfe_lite" }, 1198 .vfe = { 1199 .is_lite = true, 1200 .line_num = 4, 1201 .hw_ops = &vfe_ops_170, 1202 .formats_rdi = &vfe_formats_rdi_845, 1203 .formats_pix = &vfe_formats_pix_845 1204 } 1205 } 1206 }; 1207 1208 static const struct camss_subdev_resources csiphy_res_845[] = { 1209 /* CSIPHY0 */ 1210 { 1211 .regulators = {}, 1212 .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src", 1213 "cpas_ahb", "cphy_rx_src", "csiphy0", 1214 "csiphy0_timer_src", "csiphy0_timer" }, 1215 .clock_rate = { { 0 }, 1216 { 0 }, 1217 { 0 }, 1218 { 0 }, 1219 { 0 }, 1220 { 0 }, 1221 { 0 }, 1222 { 19200000, 240000000, 269333333 } }, 1223 .reg = { "csiphy0" }, 1224 .interrupt = { "csiphy0" }, 1225 .csiphy = { 1226 .id = 0, 1227 .hw_ops = &csiphy_ops_3ph_1_0, 1228 .formats = &csiphy_formats_sdm845 1229 } 1230 }, 1231 1232 /* CSIPHY1 */ 1233 { 1234 .regulators = {}, 1235 .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src", 1236 "cpas_ahb", "cphy_rx_src", "csiphy1", 1237 "csiphy1_timer_src", "csiphy1_timer" }, 1238 .clock_rate = { { 0 }, 1239 { 0 }, 1240 { 0 }, 1241 { 0 }, 1242 { 0 }, 1243 { 0 }, 1244 { 0 }, 1245 { 19200000, 240000000, 269333333 } }, 1246 .reg = { "csiphy1" }, 1247 .interrupt = { "csiphy1" }, 1248 .csiphy = { 1249 .id = 1, 1250 .hw_ops = &csiphy_ops_3ph_1_0, 1251 .formats = &csiphy_formats_sdm845 1252 } 1253 }, 1254 1255 /* CSIPHY2 */ 1256 { 1257 .regulators = {}, 1258 .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src", 1259 "cpas_ahb", "cphy_rx_src", "csiphy2", 1260 "csiphy2_timer_src", "csiphy2_timer" }, 1261 .clock_rate = { { 0 }, 1262 { 0 }, 1263 { 0 }, 1264 { 0 }, 1265 { 0 }, 1266 { 0 }, 1267 { 0 }, 1268 { 19200000, 240000000, 269333333 } }, 1269 .reg = { "csiphy2" }, 1270 .interrupt = { "csiphy2" }, 1271 .csiphy = { 1272 .id = 2, 1273 .hw_ops = &csiphy_ops_3ph_1_0, 1274 .formats = &csiphy_formats_sdm845 1275 } 1276 }, 1277 1278 /* CSIPHY3 */ 1279 { 1280 .regulators = {}, 1281 .clock = { "camnoc_axi", "soc_ahb", "slow_ahb_src", 1282 "cpas_ahb", "cphy_rx_src", "csiphy3", 1283 "csiphy3_timer_src", "csiphy3_timer" }, 1284 .clock_rate = { { 0 }, 1285 { 0 }, 1286 { 0 }, 1287 { 0 }, 1288 { 0 }, 1289 { 0 }, 1290 { 0 }, 1291 { 19200000, 240000000, 269333333 } }, 1292 .reg = { "csiphy3" }, 1293 .interrupt = { "csiphy3" }, 1294 .csiphy = { 1295 .id = 3, 1296 .hw_ops = &csiphy_ops_3ph_1_0, 1297 .formats = &csiphy_formats_sdm845 1298 } 1299 } 1300 }; 1301 1302 static const struct camss_subdev_resources csid_res_845[] = { 1303 /* CSID0 */ 1304 { 1305 .regulators = { "vdda-phy", "vdda-pll" }, 1306 .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", 1307 "soc_ahb", "vfe0", "vfe0_src", 1308 "vfe0_cphy_rx", "csi0", 1309 "csi0_src" }, 1310 .clock_rate = { { 0 }, 1311 { 384000000 }, 1312 { 80000000 }, 1313 { 0 }, 1314 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1315 { 320000000 }, 1316 { 0 }, 1317 { 19200000, 75000000, 384000000, 538666667 }, 1318 { 384000000 } }, 1319 .reg = { "csid0" }, 1320 .interrupt = { "csid0" }, 1321 .csid = { 1322 .hw_ops = &csid_ops_gen2, 1323 .parent_dev_ops = &vfe_parent_dev_ops, 1324 .formats = &csid_formats_gen2 1325 } 1326 }, 1327 1328 /* CSID1 */ 1329 { 1330 .regulators = { "vdda-phy", "vdda-pll" }, 1331 .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", 1332 "soc_ahb", "vfe1", "vfe1_src", 1333 "vfe1_cphy_rx", "csi1", 1334 "csi1_src" }, 1335 .clock_rate = { { 0 }, 1336 { 384000000 }, 1337 { 80000000 }, 1338 { 0 }, 1339 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1340 { 320000000 }, 1341 { 0 }, 1342 { 19200000, 75000000, 384000000, 538666667 }, 1343 { 384000000 } }, 1344 .reg = { "csid1" }, 1345 .interrupt = { "csid1" }, 1346 .csid = { 1347 .hw_ops = &csid_ops_gen2, 1348 .parent_dev_ops = &vfe_parent_dev_ops, 1349 .formats = &csid_formats_gen2 1350 } 1351 }, 1352 1353 /* CSID2 */ 1354 { 1355 .regulators = { "vdda-phy", "vdda-pll" }, 1356 .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", 1357 "soc_ahb", "vfe_lite", "vfe_lite_src", 1358 "vfe_lite_cphy_rx", "csi2", 1359 "csi2_src" }, 1360 .clock_rate = { { 0 }, 1361 { 384000000 }, 1362 { 80000000 }, 1363 { 0 }, 1364 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1365 { 320000000 }, 1366 { 0 }, 1367 { 19200000, 75000000, 384000000, 538666667 }, 1368 { 384000000 } }, 1369 .reg = { "csid2" }, 1370 .interrupt = { "csid2" }, 1371 .csid = { 1372 .is_lite = true, 1373 .hw_ops = &csid_ops_gen2, 1374 .parent_dev_ops = &vfe_parent_dev_ops, 1375 .formats = &csid_formats_gen2 1376 } 1377 } 1378 }; 1379 1380 static const struct camss_subdev_resources vfe_res_845[] = { 1381 /* VFE0 */ 1382 { 1383 .regulators = {}, 1384 .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src", 1385 "soc_ahb", "vfe0", "vfe0_axi", 1386 "vfe0_src", "csi0", 1387 "csi0_src"}, 1388 .clock_rate = { { 0 }, 1389 { 0 }, 1390 { 80000000 }, 1391 { 0 }, 1392 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1393 { 0 }, 1394 { 320000000 }, 1395 { 19200000, 75000000, 384000000, 538666667 }, 1396 { 384000000 } }, 1397 .reg = { "vfe0" }, 1398 .interrupt = { "vfe0" }, 1399 .vfe = { 1400 .line_num = 4, 1401 .pd_name = "ife0", 1402 .has_pd = true, 1403 .hw_ops = &vfe_ops_170, 1404 .formats_rdi = &vfe_formats_rdi_845, 1405 .formats_pix = &vfe_formats_pix_845 1406 } 1407 }, 1408 1409 /* VFE1 */ 1410 { 1411 .regulators = {}, 1412 .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src", 1413 "soc_ahb", "vfe1", "vfe1_axi", 1414 "vfe1_src", "csi1", 1415 "csi1_src"}, 1416 .clock_rate = { { 0 }, 1417 { 0 }, 1418 { 80000000 }, 1419 { 0 }, 1420 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1421 { 0 }, 1422 { 320000000 }, 1423 { 19200000, 75000000, 384000000, 538666667 }, 1424 { 384000000 } }, 1425 .reg = { "vfe1" }, 1426 .interrupt = { "vfe1" }, 1427 .vfe = { 1428 .line_num = 4, 1429 .pd_name = "ife1", 1430 .has_pd = true, 1431 .hw_ops = &vfe_ops_170, 1432 .formats_rdi = &vfe_formats_rdi_845, 1433 .formats_pix = &vfe_formats_pix_845 1434 } 1435 }, 1436 1437 /* VFE-lite */ 1438 { 1439 .regulators = {}, 1440 .clock = { "camnoc_axi", "cpas_ahb", "slow_ahb_src", 1441 "soc_ahb", "vfe_lite", 1442 "vfe_lite_src", "csi2", 1443 "csi2_src"}, 1444 .clock_rate = { { 0 }, 1445 { 0 }, 1446 { 80000000 }, 1447 { 0 }, 1448 { 19200000, 100000000, 320000000, 404000000, 480000000, 600000000 }, 1449 { 320000000 }, 1450 { 19200000, 75000000, 384000000, 538666667 }, 1451 { 384000000 } }, 1452 .reg = { "vfe_lite" }, 1453 .interrupt = { "vfe_lite" }, 1454 .vfe = { 1455 .is_lite = true, 1456 .line_num = 4, 1457 .hw_ops = &vfe_ops_170, 1458 .formats_rdi = &vfe_formats_rdi_845, 1459 .formats_pix = &vfe_formats_pix_845 1460 } 1461 } 1462 }; 1463 1464 static const struct camss_subdev_resources csiphy_res_8250[] = { 1465 /* CSIPHY0 */ 1466 { 1467 .regulators = { "vdda-phy", "vdda-pll" }, 1468 .clock = { "csiphy0", "csiphy0_timer" }, 1469 .clock_rate = { { 400000000 }, 1470 { 300000000 } }, 1471 .reg = { "csiphy0" }, 1472 .interrupt = { "csiphy0" }, 1473 .csiphy = { 1474 .id = 0, 1475 .hw_ops = &csiphy_ops_3ph_1_0, 1476 .formats = &csiphy_formats_sdm845 1477 } 1478 }, 1479 /* CSIPHY1 */ 1480 { 1481 .regulators = { "vdda-phy", "vdda-pll" }, 1482 .clock = { "csiphy1", "csiphy1_timer" }, 1483 .clock_rate = { { 400000000 }, 1484 { 300000000 } }, 1485 .reg = { "csiphy1" }, 1486 .interrupt = { "csiphy1" }, 1487 .csiphy = { 1488 .id = 1, 1489 .hw_ops = &csiphy_ops_3ph_1_0, 1490 .formats = &csiphy_formats_sdm845 1491 } 1492 }, 1493 /* CSIPHY2 */ 1494 { 1495 .regulators = { "vdda-phy", "vdda-pll" }, 1496 .clock = { "csiphy2", "csiphy2_timer" }, 1497 .clock_rate = { { 400000000 }, 1498 { 300000000 } }, 1499 .reg = { "csiphy2" }, 1500 .interrupt = { "csiphy2" }, 1501 .csiphy = { 1502 .id = 2, 1503 .hw_ops = &csiphy_ops_3ph_1_0, 1504 .formats = &csiphy_formats_sdm845 1505 } 1506 }, 1507 /* CSIPHY3 */ 1508 { 1509 .regulators = { "vdda-phy", "vdda-pll" }, 1510 .clock = { "csiphy3", "csiphy3_timer" }, 1511 .clock_rate = { { 400000000 }, 1512 { 300000000 } }, 1513 .reg = { "csiphy3" }, 1514 .interrupt = { "csiphy3" }, 1515 .csiphy = { 1516 .id = 3, 1517 .hw_ops = &csiphy_ops_3ph_1_0, 1518 .formats = &csiphy_formats_sdm845 1519 } 1520 }, 1521 /* CSIPHY4 */ 1522 { 1523 .regulators = { "vdda-phy", "vdda-pll" }, 1524 .clock = { "csiphy4", "csiphy4_timer" }, 1525 .clock_rate = { { 400000000 }, 1526 { 300000000 } }, 1527 .reg = { "csiphy4" }, 1528 .interrupt = { "csiphy4" }, 1529 .csiphy = { 1530 .id = 4, 1531 .hw_ops = &csiphy_ops_3ph_1_0, 1532 .formats = &csiphy_formats_sdm845 1533 } 1534 }, 1535 /* CSIPHY5 */ 1536 { 1537 .regulators = { "vdda-phy", "vdda-pll" }, 1538 .clock = { "csiphy5", "csiphy5_timer" }, 1539 .clock_rate = { { 400000000 }, 1540 { 300000000 } }, 1541 .reg = { "csiphy5" }, 1542 .interrupt = { "csiphy5" }, 1543 .csiphy = { 1544 .id = 5, 1545 .hw_ops = &csiphy_ops_3ph_1_0, 1546 .formats = &csiphy_formats_sdm845 1547 } 1548 } 1549 }; 1550 1551 static const struct camss_subdev_resources csid_res_8250[] = { 1552 /* CSID0 */ 1553 { 1554 .regulators = {}, 1555 .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_areg", "vfe0_ahb" }, 1556 .clock_rate = { { 400000000 }, 1557 { 400000000 }, 1558 { 350000000, 475000000, 576000000, 720000000 }, 1559 { 100000000, 200000000, 300000000, 400000000 }, 1560 { 0 } }, 1561 .reg = { "csid0" }, 1562 .interrupt = { "csid0" }, 1563 .csid = { 1564 .hw_ops = &csid_ops_gen2, 1565 .parent_dev_ops = &vfe_parent_dev_ops, 1566 .formats = &csid_formats_gen2 1567 } 1568 }, 1569 /* CSID1 */ 1570 { 1571 .regulators = {}, 1572 .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_areg", "vfe1_ahb" }, 1573 .clock_rate = { { 400000000 }, 1574 { 400000000 }, 1575 { 350000000, 475000000, 576000000, 720000000 }, 1576 { 100000000, 200000000, 300000000, 400000000 }, 1577 { 0 } }, 1578 .reg = { "csid1" }, 1579 .interrupt = { "csid1" }, 1580 .csid = { 1581 .hw_ops = &csid_ops_gen2, 1582 .parent_dev_ops = &vfe_parent_dev_ops, 1583 .formats = &csid_formats_gen2 1584 } 1585 }, 1586 /* CSID2 */ 1587 { 1588 .regulators = {}, 1589 .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, 1590 .clock_rate = { { 400000000 }, 1591 { 400000000 }, 1592 { 400000000, 480000000 }, 1593 { 0 } }, 1594 .reg = { "csid2" }, 1595 .interrupt = { "csid2" }, 1596 .csid = { 1597 .is_lite = true, 1598 .hw_ops = &csid_ops_gen2, 1599 .parent_dev_ops = &vfe_parent_dev_ops, 1600 .formats = &csid_formats_gen2 1601 } 1602 }, 1603 /* CSID3 */ 1604 { 1605 .regulators = {}, 1606 .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, 1607 .clock_rate = { { 400000000 }, 1608 { 400000000 }, 1609 { 400000000, 480000000 }, 1610 { 0 } }, 1611 .reg = { "csid3" }, 1612 .interrupt = { "csid3" }, 1613 .csid = { 1614 .is_lite = true, 1615 .hw_ops = &csid_ops_gen2, 1616 .parent_dev_ops = &vfe_parent_dev_ops, 1617 .formats = &csid_formats_gen2 1618 } 1619 } 1620 }; 1621 1622 static const struct camss_subdev_resources vfe_res_8250[] = { 1623 /* VFE0 */ 1624 { 1625 .regulators = {}, 1626 .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", 1627 "camnoc_axi", "vfe0_ahb", "vfe0_areg", "vfe0", 1628 "vfe0_axi", "cam_hf_axi" }, 1629 .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, 1630 { 19200000, 80000000 }, 1631 { 19200000 }, 1632 { 0 }, 1633 { 0 }, 1634 { 100000000, 200000000, 300000000, 400000000 }, 1635 { 350000000, 475000000, 576000000, 720000000 }, 1636 { 0 }, 1637 { 0 } }, 1638 .reg = { "vfe0" }, 1639 .interrupt = { "vfe0" }, 1640 .vfe = { 1641 .line_num = 3, 1642 .has_pd = true, 1643 .pd_name = "ife0", 1644 .hw_ops = &vfe_ops_480, 1645 .formats_rdi = &vfe_formats_rdi_845, 1646 .formats_pix = &vfe_formats_pix_845 1647 } 1648 }, 1649 /* VFE1 */ 1650 { 1651 .regulators = {}, 1652 .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", 1653 "camnoc_axi", "vfe1_ahb", "vfe1_areg", "vfe1", 1654 "vfe1_axi", "cam_hf_axi" }, 1655 .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, 1656 { 19200000, 80000000 }, 1657 { 19200000 }, 1658 { 0 }, 1659 { 0 }, 1660 { 100000000, 200000000, 300000000, 400000000 }, 1661 { 350000000, 475000000, 576000000, 720000000 }, 1662 { 0 }, 1663 { 0 } }, 1664 .reg = { "vfe1" }, 1665 .interrupt = { "vfe1" }, 1666 .vfe = { 1667 .line_num = 3, 1668 .has_pd = true, 1669 .pd_name = "ife1", 1670 .hw_ops = &vfe_ops_480, 1671 .formats_rdi = &vfe_formats_rdi_845, 1672 .formats_pix = &vfe_formats_pix_845 1673 } 1674 }, 1675 /* VFE2 (lite) */ 1676 { 1677 .regulators = {}, 1678 .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", 1679 "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi", 1680 "vfe_lite", "cam_hf_axi" }, 1681 .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, 1682 { 19200000, 80000000 }, 1683 { 19200000 }, 1684 { 0 }, 1685 { 0 }, 1686 { 0 }, 1687 { 400000000, 480000000 }, 1688 { 0 } }, 1689 .reg = { "vfe_lite0" }, 1690 .interrupt = { "vfe_lite0" }, 1691 .vfe = { 1692 .is_lite = true, 1693 .line_num = 4, 1694 .hw_ops = &vfe_ops_480, 1695 .formats_rdi = &vfe_formats_rdi_845, 1696 .formats_pix = &vfe_formats_pix_845 1697 } 1698 }, 1699 /* VFE3 (lite) */ 1700 { 1701 .regulators = {}, 1702 .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", 1703 "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi", 1704 "vfe_lite", "cam_hf_axi" }, 1705 .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, 1706 { 19200000, 80000000 }, 1707 { 19200000 }, 1708 { 0 }, 1709 { 0 }, 1710 { 0 }, 1711 { 400000000, 480000000 }, 1712 { 0 } }, 1713 .reg = { "vfe_lite1" }, 1714 .interrupt = { "vfe_lite1" }, 1715 .vfe = { 1716 .is_lite = true, 1717 .line_num = 4, 1718 .hw_ops = &vfe_ops_480, 1719 .formats_rdi = &vfe_formats_rdi_845, 1720 .formats_pix = &vfe_formats_pix_845 1721 } 1722 }, 1723 }; 1724 1725 static const struct resources_icc icc_res_sm8250[] = { 1726 { 1727 .name = "cam_ahb", 1728 .icc_bw_tbl.avg = 38400, 1729 .icc_bw_tbl.peak = 76800, 1730 }, 1731 { 1732 .name = "cam_hf_0_mnoc", 1733 .icc_bw_tbl.avg = 2097152, 1734 .icc_bw_tbl.peak = 2097152, 1735 }, 1736 { 1737 .name = "cam_sf_0_mnoc", 1738 .icc_bw_tbl.avg = 0, 1739 .icc_bw_tbl.peak = 2097152, 1740 }, 1741 { 1742 .name = "cam_sf_icp_mnoc", 1743 .icc_bw_tbl.avg = 2097152, 1744 .icc_bw_tbl.peak = 2097152, 1745 }, 1746 }; 1747 1748 static const struct camss_subdev_resources csiphy_res_7280[] = { 1749 /* CSIPHY0 */ 1750 { 1751 .regulators = { "vdda-phy", "vdda-pll" }, 1752 1753 .clock = { "csiphy0", "csiphy0_timer" }, 1754 .clock_rate = { { 300000000, 400000000 }, 1755 { 300000000 } }, 1756 .reg = { "csiphy0" }, 1757 .interrupt = { "csiphy0" }, 1758 .csiphy = { 1759 .id = 0, 1760 .hw_ops = &csiphy_ops_3ph_1_0, 1761 .formats = &csiphy_formats_sdm845, 1762 } 1763 }, 1764 /* CSIPHY1 */ 1765 { 1766 .regulators = { "vdda-phy", "vdda-pll" }, 1767 1768 .clock = { "csiphy1", "csiphy1_timer" }, 1769 .clock_rate = { { 300000000, 400000000 }, 1770 { 300000000 } }, 1771 .reg = { "csiphy1" }, 1772 .interrupt = { "csiphy1" }, 1773 .csiphy = { 1774 .id = 1, 1775 .hw_ops = &csiphy_ops_3ph_1_0, 1776 .formats = &csiphy_formats_sdm845, 1777 } 1778 }, 1779 /* CSIPHY2 */ 1780 { 1781 .regulators = { "vdda-phy", "vdda-pll" }, 1782 1783 .clock = { "csiphy2", "csiphy2_timer" }, 1784 .clock_rate = { { 300000000, 400000000 }, 1785 { 300000000 } }, 1786 .reg = { "csiphy2" }, 1787 .interrupt = { "csiphy2" }, 1788 .csiphy = { 1789 .id = 2, 1790 .hw_ops = &csiphy_ops_3ph_1_0, 1791 .formats = &csiphy_formats_sdm845, 1792 } 1793 }, 1794 /* CSIPHY3 */ 1795 { 1796 .regulators = { "vdda-phy", "vdda-pll" }, 1797 1798 .clock = { "csiphy3", "csiphy3_timer" }, 1799 .clock_rate = { { 300000000, 400000000 }, 1800 { 300000000 } }, 1801 .reg = { "csiphy3" }, 1802 .interrupt = { "csiphy3" }, 1803 .csiphy = { 1804 .id = 3, 1805 .hw_ops = &csiphy_ops_3ph_1_0, 1806 .formats = &csiphy_formats_sdm845, 1807 } 1808 }, 1809 /* CSIPHY4 */ 1810 { 1811 .regulators = { "vdda-phy", "vdda-pll" }, 1812 1813 .clock = { "csiphy4", "csiphy4_timer" }, 1814 .clock_rate = { { 300000000, 400000000 }, 1815 { 300000000 } }, 1816 .reg = { "csiphy4" }, 1817 .interrupt = { "csiphy4" }, 1818 .csiphy = { 1819 .id = 4, 1820 .hw_ops = &csiphy_ops_3ph_1_0, 1821 .formats = &csiphy_formats_sdm845, 1822 } 1823 }, 1824 }; 1825 1826 static const struct camss_subdev_resources csid_res_7280[] = { 1827 /* CSID0 */ 1828 { 1829 .regulators = {}, 1830 1831 .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0" }, 1832 .clock_rate = { { 300000000, 400000000 }, 1833 { 0 }, 1834 { 380000000, 510000000, 637000000, 760000000 } 1835 }, 1836 1837 .reg = { "csid0" }, 1838 .interrupt = { "csid0" }, 1839 .csid = { 1840 .is_lite = false, 1841 .hw_ops = &csid_ops_gen2, 1842 .parent_dev_ops = &vfe_parent_dev_ops, 1843 .formats = &csid_formats_gen2 1844 } 1845 }, 1846 /* CSID1 */ 1847 { 1848 .regulators = {}, 1849 1850 .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1" }, 1851 .clock_rate = { { 300000000, 400000000 }, 1852 { 0 }, 1853 { 380000000, 510000000, 637000000, 760000000 } 1854 }, 1855 1856 .reg = { "csid1" }, 1857 .interrupt = { "csid1" }, 1858 .csid = { 1859 .is_lite = false, 1860 .hw_ops = &csid_ops_gen2, 1861 .parent_dev_ops = &vfe_parent_dev_ops, 1862 .formats = &csid_formats_gen2 1863 } 1864 }, 1865 /* CSID2 */ 1866 { 1867 .regulators = {}, 1868 1869 .clock = { "vfe2_csid", "vfe2_cphy_rx", "vfe2" }, 1870 .clock_rate = { { 300000000, 400000000 }, 1871 { 0 }, 1872 { 380000000, 510000000, 637000000, 760000000 } 1873 }, 1874 1875 .reg = { "csid2" }, 1876 .interrupt = { "csid2" }, 1877 .csid = { 1878 .is_lite = false, 1879 .hw_ops = &csid_ops_gen2, 1880 .parent_dev_ops = &vfe_parent_dev_ops, 1881 .formats = &csid_formats_gen2 1882 } 1883 }, 1884 /* CSID3 */ 1885 { 1886 .regulators = {}, 1887 1888 .clock = { "vfe_lite0_csid", "vfe_lite0_cphy_rx", "vfe_lite0" }, 1889 .clock_rate = { { 300000000, 400000000 }, 1890 { 0 }, 1891 { 320000000, 400000000, 480000000, 600000000 } 1892 }, 1893 1894 .reg = { "csid_lite0" }, 1895 .interrupt = { "csid_lite0" }, 1896 .csid = { 1897 .is_lite = true, 1898 .hw_ops = &csid_ops_gen2, 1899 .parent_dev_ops = &vfe_parent_dev_ops, 1900 .formats = &csid_formats_gen2 1901 } 1902 }, 1903 /* CSID4 */ 1904 { 1905 .regulators = {}, 1906 1907 .clock = { "vfe_lite1_csid", "vfe_lite1_cphy_rx", "vfe_lite1" }, 1908 .clock_rate = { { 300000000, 400000000 }, 1909 { 0 }, 1910 { 320000000, 400000000, 480000000, 600000000 } 1911 }, 1912 1913 .reg = { "csid_lite1" }, 1914 .interrupt = { "csid_lite1" }, 1915 .csid = { 1916 .is_lite = true, 1917 .hw_ops = &csid_ops_gen2, 1918 .parent_dev_ops = &vfe_parent_dev_ops, 1919 .formats = &csid_formats_gen2 1920 } 1921 }, 1922 }; 1923 1924 static const struct camss_subdev_resources vfe_res_7280[] = { 1925 /* VFE0 */ 1926 { 1927 .regulators = {}, 1928 1929 .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe0", 1930 "vfe0_axi", "gcc_axi_hf", "gcc_axi_sf" }, 1931 .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 }, 1932 { 80000000 }, 1933 { 0 }, 1934 { 380000000, 510000000, 637000000, 760000000 }, 1935 { 0 }, 1936 { 0 }, 1937 { 0 } }, 1938 1939 .reg = { "vfe0" }, 1940 .interrupt = { "vfe0" }, 1941 .vfe = { 1942 .line_num = 3, 1943 .is_lite = false, 1944 .has_pd = true, 1945 .pd_name = "ife0", 1946 .hw_ops = &vfe_ops_170, 1947 .formats_rdi = &vfe_formats_rdi_845, 1948 .formats_pix = &vfe_formats_pix_845 1949 } 1950 }, 1951 /* VFE1 */ 1952 { 1953 .regulators = {}, 1954 1955 .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe1", 1956 "vfe1_axi", "gcc_axi_hf", "gcc_axi_sf" }, 1957 .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 }, 1958 { 80000000 }, 1959 { 0 }, 1960 { 380000000, 510000000, 637000000, 760000000 }, 1961 { 0 }, 1962 { 0 }, 1963 { 0 } }, 1964 1965 .reg = { "vfe1" }, 1966 .interrupt = { "vfe1" }, 1967 .vfe = { 1968 .line_num = 3, 1969 .is_lite = false, 1970 .has_pd = true, 1971 .pd_name = "ife1", 1972 .hw_ops = &vfe_ops_170, 1973 .formats_rdi = &vfe_formats_rdi_845, 1974 .formats_pix = &vfe_formats_pix_845 1975 } 1976 }, 1977 /* VFE2 */ 1978 { 1979 .regulators = {}, 1980 1981 .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", "vfe2", 1982 "vfe2_axi", "gcc_axi_hf", "gcc_axi_sf" }, 1983 .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 }, 1984 { 80000000 }, 1985 { 0 }, 1986 { 380000000, 510000000, 637000000, 760000000 }, 1987 { 0 }, 1988 { 0 }, 1989 { 0 } }, 1990 1991 .reg = { "vfe2" }, 1992 .interrupt = { "vfe2" }, 1993 .vfe = { 1994 .line_num = 3, 1995 .is_lite = false, 1996 .hw_ops = &vfe_ops_170, 1997 .has_pd = true, 1998 .pd_name = "ife2", 1999 .formats_rdi = &vfe_formats_rdi_845, 2000 .formats_pix = &vfe_formats_pix_845 2001 } 2002 }, 2003 /* VFE3 (lite) */ 2004 { 2005 .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", 2006 "vfe_lite0", "gcc_axi_hf", "gcc_axi_sf" }, 2007 .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 }, 2008 { 80000000 }, 2009 { 0 }, 2010 { 320000000, 400000000, 480000000, 600000000 }, 2011 { 0 }, 2012 { 0 } }, 2013 2014 .regulators = {}, 2015 .reg = { "vfe_lite0" }, 2016 .interrupt = { "vfe_lite0" }, 2017 .vfe = { 2018 .line_num = 4, 2019 .is_lite = true, 2020 .hw_ops = &vfe_ops_170, 2021 .formats_rdi = &vfe_formats_rdi_845, 2022 .formats_pix = &vfe_formats_pix_845 2023 } 2024 }, 2025 /* VFE4 (lite) */ 2026 { 2027 .clock = { "camnoc_axi", "cpas_ahb", "icp_ahb", 2028 "vfe_lite1", "gcc_axi_hf", "gcc_axi_sf" }, 2029 .clock_rate = { { 150000000, 240000000, 320000000, 400000000, 480000000 }, 2030 { 80000000 }, 2031 { 0 }, 2032 { 320000000, 400000000, 480000000, 600000000 }, 2033 { 0 }, 2034 { 0 } }, 2035 2036 .regulators = {}, 2037 .reg = { "vfe_lite1" }, 2038 .interrupt = { "vfe_lite1" }, 2039 .vfe = { 2040 .line_num = 4, 2041 .is_lite = true, 2042 .hw_ops = &vfe_ops_170, 2043 .formats_rdi = &vfe_formats_rdi_845, 2044 .formats_pix = &vfe_formats_pix_845 2045 } 2046 }, 2047 }; 2048 2049 static const struct resources_icc icc_res_sc7280[] = { 2050 { 2051 .name = "ahb", 2052 .icc_bw_tbl.avg = 38400, 2053 .icc_bw_tbl.peak = 76800, 2054 }, 2055 { 2056 .name = "hf_0", 2057 .icc_bw_tbl.avg = 2097152, 2058 .icc_bw_tbl.peak = 2097152, 2059 }, 2060 }; 2061 2062 static const struct camss_subdev_resources csiphy_res_sc8280xp[] = { 2063 /* CSIPHY0 */ 2064 { 2065 .regulators = {}, 2066 .clock = { "csiphy0", "csiphy0_timer" }, 2067 .clock_rate = { { 400000000 }, 2068 { 300000000 } }, 2069 .reg = { "csiphy0" }, 2070 .interrupt = { "csiphy0" }, 2071 .csiphy = { 2072 .id = 0, 2073 .hw_ops = &csiphy_ops_3ph_1_0, 2074 .formats = &csiphy_formats_sdm845 2075 } 2076 }, 2077 /* CSIPHY1 */ 2078 { 2079 .regulators = {}, 2080 .clock = { "csiphy1", "csiphy1_timer" }, 2081 .clock_rate = { { 400000000 }, 2082 { 300000000 } }, 2083 .reg = { "csiphy1" }, 2084 .interrupt = { "csiphy1" }, 2085 .csiphy = { 2086 .id = 1, 2087 .hw_ops = &csiphy_ops_3ph_1_0, 2088 .formats = &csiphy_formats_sdm845 2089 } 2090 }, 2091 /* CSIPHY2 */ 2092 { 2093 .regulators = {}, 2094 .clock = { "csiphy2", "csiphy2_timer" }, 2095 .clock_rate = { { 400000000 }, 2096 { 300000000 } }, 2097 .reg = { "csiphy2" }, 2098 .interrupt = { "csiphy2" }, 2099 .csiphy = { 2100 .id = 2, 2101 .hw_ops = &csiphy_ops_3ph_1_0, 2102 .formats = &csiphy_formats_sdm845 2103 } 2104 }, 2105 /* CSIPHY3 */ 2106 { 2107 .regulators = {}, 2108 .clock = { "csiphy3", "csiphy3_timer" }, 2109 .clock_rate = { { 400000000 }, 2110 { 300000000 } }, 2111 .reg = { "csiphy3" }, 2112 .interrupt = { "csiphy3" }, 2113 .csiphy = { 2114 .id = 3, 2115 .hw_ops = &csiphy_ops_3ph_1_0, 2116 .formats = &csiphy_formats_sdm845 2117 } 2118 }, 2119 }; 2120 2121 static const struct camss_subdev_resources csid_res_sc8280xp[] = { 2122 /* CSID0 */ 2123 { 2124 .regulators = { "vdda-phy", "vdda-pll" }, 2125 .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_axi" }, 2126 .clock_rate = { { 400000000, 480000000, 600000000 }, 2127 { 0 }, 2128 { 0 }, 2129 { 0 } }, 2130 .reg = { "csid0" }, 2131 .interrupt = { "csid0" }, 2132 .csid = { 2133 .hw_ops = &csid_ops_gen2, 2134 .parent_dev_ops = &vfe_parent_dev_ops, 2135 .formats = &csid_formats_gen2 2136 } 2137 }, 2138 /* CSID1 */ 2139 { 2140 .regulators = { "vdda-phy", "vdda-pll" }, 2141 .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_axi" }, 2142 .clock_rate = { { 400000000, 480000000, 600000000 }, 2143 { 0 }, 2144 { 0 }, 2145 { 0 } }, 2146 .reg = { "csid1" }, 2147 .interrupt = { "csid1" }, 2148 .csid = { 2149 .hw_ops = &csid_ops_gen2, 2150 .parent_dev_ops = &vfe_parent_dev_ops, 2151 .formats = &csid_formats_gen2 2152 } 2153 }, 2154 /* CSID2 */ 2155 { 2156 .regulators = { "vdda-phy", "vdda-pll" }, 2157 .clock = { "vfe2_csid", "vfe2_cphy_rx", "vfe2", "vfe2_axi" }, 2158 .clock_rate = { { 400000000, 480000000, 600000000 }, 2159 { 0 }, 2160 { 0 }, 2161 { 0 } }, 2162 .reg = { "csid2" }, 2163 .interrupt = { "csid2" }, 2164 .csid = { 2165 .hw_ops = &csid_ops_gen2, 2166 .parent_dev_ops = &vfe_parent_dev_ops, 2167 .formats = &csid_formats_gen2 2168 } 2169 }, 2170 /* CSID3 */ 2171 { 2172 .regulators = { "vdda-phy", "vdda-pll" }, 2173 .clock = { "vfe3_csid", "vfe3_cphy_rx", "vfe3", "vfe3_axi" }, 2174 .clock_rate = { { 400000000, 480000000, 600000000 }, 2175 { 0 }, 2176 { 0 }, 2177 { 0 } }, 2178 .reg = { "csid3" }, 2179 .interrupt = { "csid3" }, 2180 .csid = { 2181 .hw_ops = &csid_ops_gen2, 2182 .parent_dev_ops = &vfe_parent_dev_ops, 2183 .formats = &csid_formats_gen2 2184 } 2185 }, 2186 /* CSID_LITE0 */ 2187 { 2188 .regulators = { "vdda-phy", "vdda-pll" }, 2189 .clock = { "vfe_lite0_csid", "vfe_lite0_cphy_rx", "vfe_lite0" }, 2190 .clock_rate = { { 400000000, 480000000, 600000000 }, 2191 { 0 }, 2192 { 0 }, }, 2193 .reg = { "csid0_lite" }, 2194 .interrupt = { "csid0_lite" }, 2195 .csid = { 2196 .is_lite = true, 2197 .hw_ops = &csid_ops_gen2, 2198 .parent_dev_ops = &vfe_parent_dev_ops, 2199 .formats = &csid_formats_gen2 2200 } 2201 }, 2202 /* CSID_LITE1 */ 2203 { 2204 .regulators = { "vdda-phy", "vdda-pll" }, 2205 .clock = { "vfe_lite1_csid", "vfe_lite1_cphy_rx", "vfe_lite1" }, 2206 .clock_rate = { { 400000000, 480000000, 600000000 }, 2207 { 0 }, 2208 { 0 }, }, 2209 .reg = { "csid1_lite" }, 2210 .interrupt = { "csid1_lite" }, 2211 .csid = { 2212 .is_lite = true, 2213 .hw_ops = &csid_ops_gen2, 2214 .parent_dev_ops = &vfe_parent_dev_ops, 2215 .formats = &csid_formats_gen2 2216 } 2217 }, 2218 /* CSID_LITE2 */ 2219 { 2220 .regulators = { "vdda-phy", "vdda-pll" }, 2221 .clock = { "vfe_lite2_csid", "vfe_lite2_cphy_rx", "vfe_lite2" }, 2222 .clock_rate = { { 400000000, 480000000, 600000000 }, 2223 { 0 }, 2224 { 0 }, }, 2225 .reg = { "csid2_lite" }, 2226 .interrupt = { "csid2_lite" }, 2227 .csid = { 2228 .is_lite = true, 2229 .hw_ops = &csid_ops_gen2, 2230 .parent_dev_ops = &vfe_parent_dev_ops, 2231 .formats = &csid_formats_gen2 2232 } 2233 }, 2234 /* CSID_LITE3 */ 2235 { 2236 .regulators = { "vdda-phy", "vdda-pll" }, 2237 .clock = { "vfe_lite3_csid", "vfe_lite3_cphy_rx", "vfe_lite3" }, 2238 .clock_rate = { { 400000000, 480000000, 600000000 }, 2239 { 0 }, 2240 { 0 }, }, 2241 .reg = { "csid3_lite" }, 2242 .interrupt = { "csid3_lite" }, 2243 .csid = { 2244 .is_lite = true, 2245 .hw_ops = &csid_ops_gen2, 2246 .parent_dev_ops = &vfe_parent_dev_ops, 2247 .formats = &csid_formats_gen2 2248 } 2249 } 2250 }; 2251 2252 static const struct camss_subdev_resources vfe_res_sc8280xp[] = { 2253 /* VFE0 */ 2254 { 2255 .regulators = {}, 2256 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe0", "vfe0_axi" }, 2257 .clock_rate = { { 0 }, 2258 { 0 }, 2259 { 19200000, 80000000}, 2260 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2261 { 400000000, 558000000, 637000000, 760000000 }, 2262 { 0 }, }, 2263 .reg = { "vfe0" }, 2264 .interrupt = { "vfe0" }, 2265 .vfe = { 2266 .line_num = 4, 2267 .pd_name = "ife0", 2268 .hw_ops = &vfe_ops_170, 2269 .formats_rdi = &vfe_formats_rdi_845, 2270 .formats_pix = &vfe_formats_pix_845 2271 } 2272 }, 2273 /* VFE1 */ 2274 { 2275 .regulators = {}, 2276 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe1", "vfe1_axi" }, 2277 .clock_rate = { { 0 }, 2278 { 0 }, 2279 { 19200000, 80000000}, 2280 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2281 { 400000000, 558000000, 637000000, 760000000 }, 2282 { 0 }, }, 2283 .reg = { "vfe1" }, 2284 .interrupt = { "vfe1" }, 2285 .vfe = { 2286 .line_num = 4, 2287 .pd_name = "ife1", 2288 .hw_ops = &vfe_ops_170, 2289 .formats_rdi = &vfe_formats_rdi_845, 2290 .formats_pix = &vfe_formats_pix_845 2291 } 2292 }, 2293 /* VFE2 */ 2294 { 2295 .regulators = {}, 2296 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe2", "vfe2_axi" }, 2297 .clock_rate = { { 0 }, 2298 { 0 }, 2299 { 19200000, 80000000}, 2300 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2301 { 400000000, 558000000, 637000000, 760000000 }, 2302 { 0 }, }, 2303 .reg = { "vfe2" }, 2304 .interrupt = { "vfe2" }, 2305 .vfe = { 2306 .line_num = 4, 2307 .pd_name = "ife2", 2308 .hw_ops = &vfe_ops_170, 2309 .formats_rdi = &vfe_formats_rdi_845, 2310 .formats_pix = &vfe_formats_pix_845 2311 } 2312 }, 2313 /* VFE3 */ 2314 { 2315 .regulators = {}, 2316 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe3", "vfe3_axi" }, 2317 .clock_rate = { { 0 }, 2318 { 0 }, 2319 { 19200000, 80000000}, 2320 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2321 { 400000000, 558000000, 637000000, 760000000 }, 2322 { 0 }, }, 2323 .reg = { "vfe3" }, 2324 .interrupt = { "vfe3" }, 2325 .vfe = { 2326 .line_num = 4, 2327 .pd_name = "ife3", 2328 .hw_ops = &vfe_ops_170, 2329 .formats_rdi = &vfe_formats_rdi_845, 2330 .formats_pix = &vfe_formats_pix_845 2331 } 2332 }, 2333 /* VFE_LITE_0 */ 2334 { 2335 .regulators = {}, 2336 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite0" }, 2337 .clock_rate = { { 0 }, 2338 { 0 }, 2339 { 19200000, 80000000}, 2340 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2341 { 320000000, 400000000, 480000000, 600000000 }, }, 2342 .reg = { "vfe_lite0" }, 2343 .interrupt = { "vfe_lite0" }, 2344 .vfe = { 2345 .is_lite = true, 2346 .line_num = 4, 2347 .hw_ops = &vfe_ops_170, 2348 .formats_rdi = &vfe_formats_rdi_845, 2349 .formats_pix = &vfe_formats_pix_845 2350 } 2351 }, 2352 /* VFE_LITE_1 */ 2353 { 2354 .regulators = {}, 2355 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite1" }, 2356 .clock_rate = { { 0 }, 2357 { 0 }, 2358 { 19200000, 80000000}, 2359 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2360 { 320000000, 400000000, 480000000, 600000000 }, }, 2361 .reg = { "vfe_lite1" }, 2362 .interrupt = { "vfe_lite1" }, 2363 .vfe = { 2364 .is_lite = true, 2365 .line_num = 4, 2366 .hw_ops = &vfe_ops_170, 2367 .formats_rdi = &vfe_formats_rdi_845, 2368 .formats_pix = &vfe_formats_pix_845 2369 } 2370 }, 2371 /* VFE_LITE_2 */ 2372 { 2373 .regulators = {}, 2374 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite2" }, 2375 .clock_rate = { { 0 }, 2376 { 0 }, 2377 { 19200000, 80000000}, 2378 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2379 { 320000000, 400000000, 480000000, 600000000, }, }, 2380 .reg = { "vfe_lite2" }, 2381 .interrupt = { "vfe_lite2" }, 2382 .vfe = { 2383 .is_lite = true, 2384 .line_num = 4, 2385 .hw_ops = &vfe_ops_170, 2386 .formats_rdi = &vfe_formats_rdi_845, 2387 .formats_pix = &vfe_formats_pix_845 2388 } 2389 }, 2390 /* VFE_LITE_3 */ 2391 { 2392 .regulators = {}, 2393 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", "camnoc_axi", "vfe_lite3" }, 2394 .clock_rate = { { 0 }, 2395 { 0 }, 2396 { 19200000, 80000000}, 2397 { 19200000, 150000000, 266666667, 320000000, 400000000, 480000000 }, 2398 { 320000000, 400000000, 480000000, 600000000 }, }, 2399 .reg = { "vfe_lite3" }, 2400 .interrupt = { "vfe_lite3" }, 2401 .vfe = { 2402 .is_lite = true, 2403 .line_num = 4, 2404 .hw_ops = &vfe_ops_170, 2405 .formats_rdi = &vfe_formats_rdi_845, 2406 .formats_pix = &vfe_formats_pix_845 2407 } 2408 }, 2409 }; 2410 2411 static const struct resources_icc icc_res_sc8280xp[] = { 2412 { 2413 .name = "cam_ahb", 2414 .icc_bw_tbl.avg = 150000, 2415 .icc_bw_tbl.peak = 300000, 2416 }, 2417 { 2418 .name = "cam_hf_mnoc", 2419 .icc_bw_tbl.avg = 2097152, 2420 .icc_bw_tbl.peak = 2097152, 2421 }, 2422 { 2423 .name = "cam_sf_mnoc", 2424 .icc_bw_tbl.avg = 2097152, 2425 .icc_bw_tbl.peak = 2097152, 2426 }, 2427 { 2428 .name = "cam_sf_icp_mnoc", 2429 .icc_bw_tbl.avg = 2097152, 2430 .icc_bw_tbl.peak = 2097152, 2431 }, 2432 }; 2433 2434 static const struct camss_subdev_resources csiphy_res_8550[] = { 2435 /* CSIPHY0 */ 2436 { 2437 .regulators = { "vdda-phy", "vdda-pll" }, 2438 .clock = { "csiphy0", "csiphy0_timer" }, 2439 .clock_rate = { { 400000000, 480000000 }, 2440 { 400000000 } }, 2441 .reg = { "csiphy0" }, 2442 .interrupt = { "csiphy0" }, 2443 .csiphy = { 2444 .id = 0, 2445 .hw_ops = &csiphy_ops_3ph_1_0, 2446 .formats = &csiphy_formats_sdm845 2447 } 2448 }, 2449 /* CSIPHY1 */ 2450 { 2451 .regulators = { "vdda-phy", "vdda-pll" }, 2452 .clock = { "csiphy1", "csiphy1_timer" }, 2453 .clock_rate = { { 400000000, 480000000 }, 2454 { 400000000 } }, 2455 .reg = { "csiphy1" }, 2456 .interrupt = { "csiphy1" }, 2457 .csiphy = { 2458 .id = 1, 2459 .hw_ops = &csiphy_ops_3ph_1_0, 2460 .formats = &csiphy_formats_sdm845 2461 } 2462 }, 2463 /* CSIPHY2 */ 2464 { 2465 .regulators = { "vdda-phy", "vdda-pll" }, 2466 .clock = { "csiphy2", "csiphy2_timer" }, 2467 .clock_rate = { { 400000000, 480000000 }, 2468 { 400000000 } }, 2469 .reg = { "csiphy2" }, 2470 .interrupt = { "csiphy2" }, 2471 .csiphy = { 2472 .id = 2, 2473 .hw_ops = &csiphy_ops_3ph_1_0, 2474 .formats = &csiphy_formats_sdm845 2475 } 2476 }, 2477 /* CSIPHY3 */ 2478 { 2479 .regulators = { "vdda-phy", "vdda-pll" }, 2480 .clock = { "csiphy3", "csiphy3_timer" }, 2481 .clock_rate = { { 400000000, 480000000 }, 2482 { 400000000 } }, 2483 .reg = { "csiphy3" }, 2484 .interrupt = { "csiphy3" }, 2485 .csiphy = { 2486 .id = 3, 2487 .hw_ops = &csiphy_ops_3ph_1_0, 2488 .formats = &csiphy_formats_sdm845 2489 } 2490 }, 2491 /* CSIPHY4 */ 2492 { 2493 .regulators = { "vdda-phy", "vdda-pll" }, 2494 .clock = { "csiphy4", "csiphy4_timer" }, 2495 .clock_rate = { { 400000000, 480000000 }, 2496 { 400000000 } }, 2497 .reg = { "csiphy4" }, 2498 .interrupt = { "csiphy4" }, 2499 .csiphy = { 2500 .id = 4, 2501 .hw_ops = &csiphy_ops_3ph_1_0, 2502 .formats = &csiphy_formats_sdm845 2503 } 2504 }, 2505 /* CSIPHY5 */ 2506 { 2507 .regulators = { "vdda-phy", "vdda-pll" }, 2508 .clock = { "csiphy5", "csiphy5_timer" }, 2509 .clock_rate = { { 400000000, 480000000 }, 2510 { 400000000 } }, 2511 .reg = { "csiphy5" }, 2512 .interrupt = { "csiphy5" }, 2513 .csiphy = { 2514 .id = 5, 2515 .hw_ops = &csiphy_ops_3ph_1_0, 2516 .formats = &csiphy_formats_sdm845 2517 } 2518 }, 2519 /* CSIPHY6 */ 2520 { 2521 .regulators = { "vdda-phy", "vdda-pll" }, 2522 .clock = { "csiphy6", "csiphy6_timer" }, 2523 .clock_rate = { { 400000000, 480000000 }, 2524 { 400000000 } }, 2525 .reg = { "csiphy6" }, 2526 .interrupt = { "csiphy6" }, 2527 .csiphy = { 2528 .id = 6, 2529 .hw_ops = &csiphy_ops_3ph_1_0, 2530 .formats = &csiphy_formats_sdm845 2531 } 2532 }, 2533 /* CSIPHY7 */ 2534 { 2535 .regulators = { "vdda-phy", "vdda-pll" }, 2536 .clock = { "csiphy7", "csiphy7_timer" }, 2537 .clock_rate = { { 400000000, 480000000 }, 2538 { 400000000 } }, 2539 .reg = { "csiphy7" }, 2540 .interrupt = { "csiphy7" }, 2541 .csiphy = { 2542 .id = 7, 2543 .hw_ops = &csiphy_ops_3ph_1_0, 2544 .formats = &csiphy_formats_sdm845 2545 } 2546 } 2547 }; 2548 2549 static const struct resources_wrapper csid_wrapper_res_sm8550 = { 2550 .reg = "csid_wrapper", 2551 }; 2552 2553 static const struct camss_subdev_resources csid_res_8550[] = { 2554 /* CSID0 */ 2555 { 2556 .regulators = {}, 2557 .clock = { "csid", "csiphy_rx" }, 2558 .clock_rate = { { 400000000, 480000000 }, 2559 { 400000000, 480000000 } }, 2560 .reg = { "csid0" }, 2561 .interrupt = { "csid0" }, 2562 .csid = { 2563 .is_lite = false, 2564 .parent_dev_ops = &vfe_parent_dev_ops, 2565 .hw_ops = &csid_ops_gen3, 2566 .formats = &csid_formats_gen2 2567 } 2568 }, 2569 /* CSID1 */ 2570 { 2571 .regulators = {}, 2572 .clock = { "csid", "csiphy_rx" }, 2573 .clock_rate = { { 400000000, 480000000 }, 2574 { 400000000, 480000000 } }, 2575 .reg = { "csid1" }, 2576 .interrupt = { "csid1" }, 2577 .csid = { 2578 .is_lite = false, 2579 .parent_dev_ops = &vfe_parent_dev_ops, 2580 .hw_ops = &csid_ops_gen3, 2581 .formats = &csid_formats_gen2 2582 } 2583 }, 2584 /* CSID2 */ 2585 { 2586 .regulators = {}, 2587 .clock = { "csid", "csiphy_rx" }, 2588 .clock_rate = { { 400000000, 480000000 }, 2589 { 400000000, 480000000 } }, 2590 .reg = { "csid2" }, 2591 .interrupt = { "csid2" }, 2592 .csid = { 2593 .is_lite = false, 2594 .parent_dev_ops = &vfe_parent_dev_ops, 2595 .hw_ops = &csid_ops_gen3, 2596 .formats = &csid_formats_gen2 2597 } 2598 }, 2599 /* CSID3 */ 2600 { 2601 .regulators = {}, 2602 .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" }, 2603 .clock_rate = { { 400000000, 480000000 }, 2604 { 400000000, 480000000 } }, 2605 .reg = { "csid_lite0" }, 2606 .interrupt = { "csid_lite0" }, 2607 .csid = { 2608 .is_lite = true, 2609 .parent_dev_ops = &vfe_parent_dev_ops, 2610 .hw_ops = &csid_ops_gen3, 2611 .formats = &csid_formats_gen2 2612 } 2613 }, 2614 /* CSID4 */ 2615 { 2616 .regulators = {}, 2617 .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx" }, 2618 .clock_rate = { { 400000000, 480000000 }, 2619 { 400000000, 480000000 } }, 2620 .reg = { "csid_lite1" }, 2621 .interrupt = { "csid_lite1" }, 2622 .csid = { 2623 .is_lite = true, 2624 .parent_dev_ops = &vfe_parent_dev_ops, 2625 .hw_ops = &csid_ops_gen3, 2626 .formats = &csid_formats_gen2 2627 } 2628 } 2629 }; 2630 2631 static const struct camss_subdev_resources vfe_res_8550[] = { 2632 /* VFE0 */ 2633 { 2634 .regulators = {}, 2635 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe0_fast_ahb", 2636 "vfe0", "cpas_vfe0", "camnoc_axi" }, 2637 .clock_rate = { { 0 }, 2638 { 80000000 }, 2639 { 300000000, 400000000 }, 2640 { 300000000, 400000000 }, 2641 { 466000000, 594000000, 675000000, 785000000 }, 2642 { 300000000, 400000000 }, 2643 { 300000000, 400000000 } }, 2644 .reg = { "vfe0" }, 2645 .interrupt = { "vfe0" }, 2646 .vfe = { 2647 .line_num = 3, 2648 .is_lite = false, 2649 .has_pd = true, 2650 .pd_name = "ife0", 2651 .hw_ops = &vfe_ops_gen3, 2652 .formats_rdi = &vfe_formats_rdi_845, 2653 .formats_pix = &vfe_formats_pix_845 2654 } 2655 }, 2656 /* VFE1 */ 2657 { 2658 .regulators = {}, 2659 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe1_fast_ahb", 2660 "vfe1", "cpas_vfe1", "camnoc_axi" }, 2661 .clock_rate = { { 0 }, 2662 { 80000000 }, 2663 { 300000000, 400000000 }, 2664 { 300000000, 400000000 }, 2665 { 466000000, 594000000, 675000000, 785000000 }, 2666 { 300000000, 400000000 }, 2667 { 300000000, 400000000 } }, 2668 .reg = { "vfe1" }, 2669 .interrupt = { "vfe1" }, 2670 .vfe = { 2671 .line_num = 3, 2672 .is_lite = false, 2673 .has_pd = true, 2674 .pd_name = "ife1", 2675 .hw_ops = &vfe_ops_gen3, 2676 .formats_rdi = &vfe_formats_rdi_845, 2677 .formats_pix = &vfe_formats_pix_845 2678 } 2679 }, 2680 /* VFE2 */ 2681 { 2682 .regulators = {}, 2683 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe2_fast_ahb", 2684 "vfe2", "cpas_vfe2", "camnoc_axi" }, 2685 .clock_rate = { { 0 }, 2686 { 80000000 }, 2687 { 300000000, 400000000 }, 2688 { 300000000, 400000000 }, 2689 { 466000000, 594000000, 675000000, 785000000 }, 2690 { 300000000, 400000000 }, 2691 { 300000000, 400000000 } }, 2692 .reg = { "vfe2" }, 2693 .interrupt = { "vfe2" }, 2694 .vfe = { 2695 .line_num = 3, 2696 .is_lite = false, 2697 .has_pd = true, 2698 .pd_name = "ife2", 2699 .hw_ops = &vfe_ops_gen3, 2700 .formats_rdi = &vfe_formats_rdi_845, 2701 .formats_pix = &vfe_formats_pix_845 2702 } 2703 }, 2704 /* VFE3 lite */ 2705 { 2706 .regulators = {}, 2707 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe_lite_ahb", 2708 "vfe_lite", "cpas_ife_lite", "camnoc_axi" }, 2709 .clock_rate = { { 0 }, 2710 { 80000000 }, 2711 { 300000000, 400000000 }, 2712 { 300000000, 400000000 }, 2713 { 400000000, 480000000 }, 2714 { 300000000, 400000000 }, 2715 { 300000000, 400000000 } }, 2716 .reg = { "vfe_lite0" }, 2717 .interrupt = { "vfe_lite0" }, 2718 .vfe = { 2719 .line_num = 4, 2720 .is_lite = true, 2721 .hw_ops = &vfe_ops_gen3, 2722 .formats_rdi = &vfe_formats_rdi_845, 2723 .formats_pix = &vfe_formats_pix_845 2724 } 2725 }, 2726 /* VFE4 lite */ 2727 { 2728 .regulators = {}, 2729 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb_clk", "vfe_lite_ahb", 2730 "vfe_lite", "cpas_ife_lite", "camnoc_axi" }, 2731 .clock_rate = { { 0 }, 2732 { 80000000 }, 2733 { 300000000, 400000000 }, 2734 { 300000000, 400000000 }, 2735 { 400000000, 480000000 }, 2736 { 300000000, 400000000 }, 2737 { 300000000, 400000000 } }, 2738 .reg = { "vfe_lite1" }, 2739 .interrupt = { "vfe_lite1" }, 2740 .vfe = { 2741 .line_num = 4, 2742 .is_lite = true, 2743 .hw_ops = &vfe_ops_gen3, 2744 .formats_rdi = &vfe_formats_rdi_845, 2745 .formats_pix = &vfe_formats_pix_845 2746 } 2747 }, 2748 }; 2749 2750 static const struct resources_icc icc_res_sm8550[] = { 2751 { 2752 .name = "ahb", 2753 .icc_bw_tbl.avg = 2097152, 2754 .icc_bw_tbl.peak = 2097152, 2755 }, 2756 { 2757 .name = "hf_0_mnoc", 2758 .icc_bw_tbl.avg = 2097152, 2759 .icc_bw_tbl.peak = 2097152, 2760 }, 2761 }; 2762 2763 static const struct camss_subdev_resources csiphy_res_sm8650[] = { 2764 /* CSIPHY0 */ 2765 { 2766 .regulators = { "vdd-csiphy01-0p9", "vdd-csiphy01-1p2", }, 2767 .clock = { "csiphy0", "csiphy0_timer" }, 2768 .clock_rate = { { 400000000 }, 2769 { 400000000 } }, 2770 .reg = { "csiphy0" }, 2771 .interrupt = { "csiphy0" }, 2772 .csiphy = { 2773 .id = 0, 2774 .hw_ops = &csiphy_ops_3ph_1_0, 2775 .formats = &csiphy_formats_sdm845, 2776 }, 2777 }, 2778 /* CSIPHY1 */ 2779 { 2780 .regulators = { "vdd-csiphy01-0p9", "vdd-csiphy01-1p2", }, 2781 .clock = { "csiphy1", "csiphy1_timer" }, 2782 .clock_rate = { { 400000000 }, 2783 { 400000000 } }, 2784 .reg = { "csiphy1" }, 2785 .interrupt = { "csiphy1" }, 2786 .csiphy = { 2787 .id = 1, 2788 .hw_ops = &csiphy_ops_3ph_1_0, 2789 .formats = &csiphy_formats_sdm845, 2790 }, 2791 }, 2792 /* CSIPHY2 */ 2793 { 2794 .regulators = { "vdd-csiphy24-0p9", "vdd-csiphy24-1p2", }, 2795 .clock = { "csiphy2", "csiphy2_timer" }, 2796 .clock_rate = { { 400000000 }, 2797 { 400000000 } }, 2798 .reg = { "csiphy2" }, 2799 .interrupt = { "csiphy2" }, 2800 .csiphy = { 2801 .id = 2, 2802 .hw_ops = &csiphy_ops_3ph_1_0, 2803 .formats = &csiphy_formats_sdm845, 2804 }, 2805 }, 2806 /* CSIPHY3 */ 2807 { 2808 .regulators = { "vdd-csiphy35-0p9", "vdd-csiphy35-1p2", }, 2809 .clock = { "csiphy3", "csiphy3_timer" }, 2810 .clock_rate = { { 400000000 }, 2811 { 400000000 } }, 2812 .reg = { "csiphy3" }, 2813 .interrupt = { "csiphy3" }, 2814 .csiphy = { 2815 .id = 3, 2816 .hw_ops = &csiphy_ops_3ph_1_0, 2817 .formats = &csiphy_formats_sdm845, 2818 }, 2819 }, 2820 /* CSIPHY4 */ 2821 { 2822 .regulators = { "vdd-csiphy24-0p9", "vdd-csiphy24-1p2", }, 2823 .clock = { "csiphy4", "csiphy4_timer" }, 2824 .clock_rate = { { 400000000 }, 2825 { 400000000 } }, 2826 .reg = { "csiphy4" }, 2827 .interrupt = { "csiphy4" }, 2828 .csiphy = { 2829 .id = 4, 2830 .hw_ops = &csiphy_ops_3ph_1_0, 2831 .formats = &csiphy_formats_sdm845, 2832 }, 2833 }, 2834 /* CSIPHY5 */ 2835 { 2836 .regulators = { "vdd-csiphy35-0p9", "vdd-csiphy35-1p2", }, 2837 .clock = { "csiphy5", "csiphy5_timer" }, 2838 .clock_rate = { { 400000000 }, 2839 { 400000000 } }, 2840 .reg = { "csiphy5" }, 2841 .interrupt = { "csiphy5" }, 2842 .csiphy = { 2843 .id = 5, 2844 .hw_ops = &csiphy_ops_3ph_1_0, 2845 .formats = &csiphy_formats_sdm845, 2846 }, 2847 }, 2848 }; 2849 2850 static const struct camss_subdev_resources csid_res_sm8650[] = { 2851 /* CSID0 */ 2852 { 2853 .regulators = { }, 2854 .clock = { "csid", "csiphy_rx" }, 2855 .clock_rate = { { 400000000 }, 2856 { 400000000, 480000000 } }, 2857 .reg = { "csid0" }, 2858 .interrupt = { "csid0" }, 2859 .csid = { 2860 .parent_dev_ops = &vfe_parent_dev_ops, 2861 .hw_ops = &csid_ops_gen3, 2862 .formats = &csid_formats_gen2, 2863 }, 2864 }, 2865 /* CSID1 */ 2866 { 2867 .regulators = { }, 2868 .clock = { "csid", "csiphy_rx" }, 2869 .clock_rate = { { 400000000 }, 2870 { 400000000, 480000000 } }, 2871 .reg = { "csid1" }, 2872 .interrupt = { "csid1" }, 2873 .csid = { 2874 .parent_dev_ops = &vfe_parent_dev_ops, 2875 .hw_ops = &csid_ops_gen3, 2876 .formats = &csid_formats_gen2, 2877 }, 2878 }, 2879 /* CSID2 */ 2880 { 2881 .regulators = { }, 2882 .clock = { "csid", "csiphy_rx" }, 2883 .clock_rate = { { 400000000 }, 2884 { 400000000, 480000000 } }, 2885 .reg = { "csid2" }, 2886 .interrupt = { "csid2" }, 2887 .csid = { 2888 .parent_dev_ops = &vfe_parent_dev_ops, 2889 .hw_ops = &csid_ops_gen3, 2890 .formats = &csid_formats_gen2, 2891 }, 2892 }, 2893 /* CSID3 lite */ 2894 { 2895 .regulators = { }, 2896 .clock = { "vfe_lite_ahb", "vfe_lite_csid", "vfe_lite_cphy_rx" }, 2897 .clock_rate = { { 0 }, 2898 { 400000000, 480000000 }, 2899 { 0 } }, 2900 .reg = { "csid_lite0" }, 2901 .interrupt = { "csid_lite0" }, 2902 .csid = { 2903 .is_lite = true, 2904 .parent_dev_ops = &vfe_parent_dev_ops, 2905 .hw_ops = &csid_ops_gen3, 2906 .formats = &csid_formats_gen2, 2907 }, 2908 }, 2909 /* CSID4 lite */ 2910 { 2911 .regulators = { }, 2912 .clock = { "vfe_lite_ahb", "vfe_lite_csid", "vfe_lite_cphy_rx" }, 2913 .clock_rate = { { 0 }, 2914 { 400000000, 480000000 }, 2915 { 0 } }, 2916 .reg = { "csid_lite1" }, 2917 .interrupt = { "csid_lite1" }, 2918 .csid = { 2919 .is_lite = true, 2920 .parent_dev_ops = &vfe_parent_dev_ops, 2921 .hw_ops = &csid_ops_gen3, 2922 .formats = &csid_formats_gen2, 2923 }, 2924 }, 2925 }; 2926 2927 static const struct camss_subdev_resources vfe_res_sm8650[] = { 2928 /* VFE0 */ 2929 { 2930 .regulators = { }, 2931 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb", 2932 "camnoc_axi", "vfe0_fast_ahb", "vfe0", "cpas_vfe0", 2933 "qdss_debug_xo", 2934 }, 2935 .clock_rate = { { 0 }, 2936 { 80000000 }, 2937 { 300000000, 400000000 }, 2938 { 300000000, 400000000 }, 2939 { 0 }, 2940 { 466000000, 594000000, 675000000, 785000000 }, 2941 { 0 }, 2942 { 0 }, 2943 }, 2944 .reg = { "vfe0" }, 2945 .interrupt = { "vfe0" }, 2946 .vfe = { 2947 .line_num = 3, 2948 .has_pd = true, 2949 .pd_name = "ife0", 2950 .hw_ops = &vfe_ops_gen3, 2951 .formats_rdi = &vfe_formats_rdi_845, 2952 .formats_pix = &vfe_formats_pix_845 2953 }, 2954 }, 2955 /* VFE1 */ 2956 { 2957 .regulators = { }, 2958 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb", 2959 "camnoc_axi", "vfe1_fast_ahb", "vfe1", "cpas_vfe1", 2960 "qdss_debug_xo", 2961 }, 2962 .clock_rate = { { 0 }, 2963 { 80000000 }, 2964 { 300000000, 400000000 }, 2965 { 300000000, 400000000 }, 2966 { 0 }, 2967 { 466000000, 594000000, 675000000, 785000000 }, 2968 { 0 }, 2969 { 0 }, 2970 }, 2971 .reg = { "vfe1" }, 2972 .interrupt = { "vfe1" }, 2973 .vfe = { 2974 .line_num = 3, 2975 .has_pd = true, 2976 .pd_name = "ife1", 2977 .hw_ops = &vfe_ops_gen3, 2978 .formats_rdi = &vfe_formats_rdi_845, 2979 .formats_pix = &vfe_formats_pix_845 2980 }, 2981 }, 2982 /* VFE2 */ 2983 { 2984 .regulators = { }, 2985 .clock = { "gcc_axi_hf", "cpas_ahb", "cpas_fast_ahb", 2986 "camnoc_axi", "vfe2_fast_ahb", "vfe2", "cpas_vfe2", 2987 "qdss_debug_xo", 2988 }, 2989 .clock_rate = { { 0 }, 2990 { 80000000 }, 2991 { 300000000, 400000000 }, 2992 { 300000000, 400000000 }, 2993 { 0 }, 2994 { 466000000, 594000000, 675000000, 785000000 }, 2995 { 0 }, 2996 { 0 }, 2997 }, 2998 .reg = { "vfe2" }, 2999 .interrupt = { "vfe2" }, 3000 .vfe = { 3001 .line_num = 3, 3002 .has_pd = true, 3003 .pd_name = "ife2", 3004 .hw_ops = &vfe_ops_gen3, 3005 .formats_rdi = &vfe_formats_rdi_845, 3006 .formats_pix = &vfe_formats_pix_845 3007 }, 3008 }, 3009 /* VFE3 lite */ 3010 { 3011 .regulators = { }, 3012 .clock = { "gcc_axi_hf", "cpas_ahb", "camnoc_axi", 3013 "vfe_lite_ahb", "vfe_lite", "cpas_vfe_lite", 3014 "qdss_debug_xo", 3015 }, 3016 .clock_rate = { { 0 }, 3017 { 80000000 }, 3018 { 300000000, 400000000 }, 3019 { 0 }, 3020 { 400000000, 480000000 }, 3021 { 0 }, 3022 { 0 }, 3023 }, 3024 .reg = { "vfe_lite0" }, 3025 .interrupt = { "vfe_lite0" }, 3026 .vfe = { 3027 .line_num = 4, 3028 .is_lite = true, 3029 .hw_ops = &vfe_ops_gen3, 3030 .formats_rdi = &vfe_formats_rdi_845, 3031 .formats_pix = &vfe_formats_pix_845 3032 }, 3033 }, 3034 /* VFE4 lite */ 3035 { 3036 .regulators = { }, 3037 .clock = { "gcc_axi_hf", "cpas_ahb", "camnoc_axi", 3038 "vfe_lite_ahb", "vfe_lite", "cpas_vfe_lite", 3039 "qdss_debug_xo", 3040 }, 3041 .clock_rate = { { 0 }, 3042 { 80000000 }, 3043 { 300000000, 400000000 }, 3044 { 0 }, 3045 { 400000000, 480000000 }, 3046 { 0 }, 3047 { 0 }, 3048 }, 3049 .reg = { "vfe_lite1" }, 3050 .interrupt = { "vfe_lite1" }, 3051 .vfe = { 3052 .line_num = 4, 3053 .is_lite = true, 3054 .hw_ops = &vfe_ops_gen3, 3055 .formats_rdi = &vfe_formats_rdi_845, 3056 .formats_pix = &vfe_formats_pix_845 3057 }, 3058 }, 3059 }; 3060 3061 static const struct resources_icc icc_res_sm8650[] = { 3062 { 3063 .name = "ahb", 3064 .icc_bw_tbl.avg = 38400, 3065 .icc_bw_tbl.peak = 76800, 3066 }, 3067 { 3068 .name = "hf_mnoc", 3069 .icc_bw_tbl.avg = 2097152, 3070 .icc_bw_tbl.peak = 2097152, 3071 }, 3072 }; 3073 3074 static const struct camss_subdev_resources csiphy_res_8300[] = { 3075 /* CSIPHY0 */ 3076 { 3077 .regulators = { "vdda-phy", "vdda-pll" }, 3078 3079 .clock = { "csiphy_rx", "csiphy0", "csiphy0_timer" }, 3080 .clock_rate = { 3081 { 400000000 }, 3082 { 0 }, 3083 { 400000000 }, 3084 }, 3085 .reg = { "csiphy0" }, 3086 .interrupt = { "csiphy0" }, 3087 .csiphy = { 3088 .id = 0, 3089 .hw_ops = &csiphy_ops_3ph_1_0, 3090 .formats = &csiphy_formats_sdm845, 3091 } 3092 }, 3093 /* CSIPHY1 */ 3094 { 3095 .regulators = { "vdda-phy", "vdda-pll" }, 3096 3097 .clock = { "csiphy_rx", "csiphy1", "csiphy1_timer" }, 3098 .clock_rate = { 3099 { 400000000 }, 3100 { 0 }, 3101 { 400000000 }, 3102 }, 3103 .reg = { "csiphy1" }, 3104 .interrupt = { "csiphy1" }, 3105 .csiphy = { 3106 .id = 1, 3107 .hw_ops = &csiphy_ops_3ph_1_0, 3108 .formats = &csiphy_formats_sdm845, 3109 } 3110 }, 3111 /* CSIPHY2 */ 3112 { 3113 .regulators = { "vdda-phy", "vdda-pll" }, 3114 3115 .clock = { "csiphy_rx", "csiphy2", "csiphy2_timer" }, 3116 .clock_rate = { 3117 { 400000000 }, 3118 { 0 }, 3119 { 400000000 }, 3120 }, 3121 .reg = { "csiphy2" }, 3122 .interrupt = { "csiphy2" }, 3123 .csiphy = { 3124 .id = 2, 3125 .hw_ops = &csiphy_ops_3ph_1_0, 3126 .formats = &csiphy_formats_sdm845, 3127 } 3128 }, 3129 }; 3130 3131 static const struct camss_subdev_resources csiphy_res_8775p[] = { 3132 /* CSIPHY0 */ 3133 { 3134 .regulators = { "vdda-phy", "vdda-pll" }, 3135 .clock = { "csiphy_rx", "csiphy0", "csiphy0_timer"}, 3136 .clock_rate = { 3137 { 400000000 }, 3138 { 0 }, 3139 { 400000000 }, 3140 }, 3141 .reg = { "csiphy0" }, 3142 .interrupt = { "csiphy0" }, 3143 .csiphy = { 3144 .id = 0, 3145 .hw_ops = &csiphy_ops_3ph_1_0, 3146 .formats = &csiphy_formats_sdm845 3147 } 3148 }, 3149 /* CSIPHY1 */ 3150 { 3151 .regulators = { "vdda-phy", "vdda-pll" }, 3152 .clock = { "csiphy_rx", "csiphy1", "csiphy1_timer"}, 3153 .clock_rate = { 3154 { 400000000 }, 3155 { 0 }, 3156 { 400000000 }, 3157 }, 3158 .reg = { "csiphy1" }, 3159 .interrupt = { "csiphy1" }, 3160 .csiphy = { 3161 .id = 1, 3162 .hw_ops = &csiphy_ops_3ph_1_0, 3163 .formats = &csiphy_formats_sdm845 3164 } 3165 }, 3166 /* CSIPHY2 */ 3167 { 3168 .regulators = { "vdda-phy", "vdda-pll" }, 3169 .clock = { "csiphy_rx", "csiphy2", "csiphy2_timer"}, 3170 .clock_rate = { 3171 { 400000000 }, 3172 { 0 }, 3173 { 400000000 }, 3174 }, 3175 .reg = { "csiphy2" }, 3176 .interrupt = { "csiphy2" }, 3177 .csiphy = { 3178 .id = 2, 3179 .hw_ops = &csiphy_ops_3ph_1_0, 3180 .formats = &csiphy_formats_sdm845 3181 } 3182 }, 3183 /* CSIPHY3 */ 3184 { 3185 .regulators = { "vdda-phy", "vdda-pll" }, 3186 .clock = { "csiphy_rx", "csiphy3", "csiphy3_timer"}, 3187 .clock_rate = { 3188 { 400000000 }, 3189 { 0 }, 3190 { 400000000 }, 3191 }, 3192 .reg = { "csiphy3" }, 3193 .interrupt = { "csiphy3" }, 3194 .csiphy = { 3195 .id = 3, 3196 .hw_ops = &csiphy_ops_3ph_1_0, 3197 .formats = &csiphy_formats_sdm845 3198 } 3199 }, 3200 }; 3201 3202 static const struct camss_subdev_resources csid_res_8775p[] = { 3203 /* CSID0 */ 3204 { 3205 .regulators = {}, 3206 .clock = { "csid", "csiphy_rx"}, 3207 .clock_rate = { 3208 { 400000000, 400000000}, 3209 { 400000000, 400000000} 3210 }, 3211 .reg = { "csid0" }, 3212 .interrupt = { "csid0" }, 3213 .csid = { 3214 .is_lite = false, 3215 .hw_ops = &csid_ops_gen3, 3216 .parent_dev_ops = &vfe_parent_dev_ops, 3217 .formats = &csid_formats_gen2 3218 } 3219 }, 3220 /* CSID1 */ 3221 { 3222 .regulators = {}, 3223 .clock = { "csid", "csiphy_rx"}, 3224 .clock_rate = { 3225 { 400000000, 400000000}, 3226 { 400000000, 400000000} 3227 }, 3228 .reg = { "csid1" }, 3229 .interrupt = { "csid1" }, 3230 .csid = { 3231 .is_lite = false, 3232 .hw_ops = &csid_ops_gen3, 3233 .parent_dev_ops = &vfe_parent_dev_ops, 3234 .formats = &csid_formats_gen2 3235 } 3236 }, 3237 3238 /* CSID2 (lite) */ 3239 { 3240 .regulators = {}, 3241 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3242 "vfe_lite_csid", "vfe_lite_cphy_rx", 3243 "vfe_lite"}, 3244 .clock_rate = { 3245 { 0, 0, 400000000, 400000000, 0}, 3246 { 0, 0, 400000000, 480000000, 0} 3247 }, 3248 .reg = { "csid_lite0" }, 3249 .interrupt = { "csid_lite0" }, 3250 .csid = { 3251 .is_lite = true, 3252 .hw_ops = &csid_ops_gen3, 3253 .parent_dev_ops = &vfe_parent_dev_ops, 3254 .formats = &csid_formats_gen2 3255 } 3256 }, 3257 /* CSID3 (lite) */ 3258 { 3259 .regulators = {}, 3260 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3261 "vfe_lite_csid", "vfe_lite_cphy_rx", 3262 "vfe_lite"}, 3263 .clock_rate = { 3264 { 0, 0, 400000000, 400000000, 0}, 3265 { 0, 0, 400000000, 480000000, 0} 3266 }, 3267 .reg = { "csid_lite1" }, 3268 .interrupt = { "csid_lite1" }, 3269 .csid = { 3270 .is_lite = true, 3271 .hw_ops = &csid_ops_gen3, 3272 .parent_dev_ops = &vfe_parent_dev_ops, 3273 .formats = &csid_formats_gen2 3274 } 3275 }, 3276 /* CSID4 (lite) */ 3277 { 3278 .regulators = {}, 3279 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3280 "vfe_lite_csid", "vfe_lite_cphy_rx", 3281 "vfe_lite"}, 3282 .clock_rate = { 3283 { 0, 0, 400000000, 400000000, 0}, 3284 { 0, 0, 400000000, 480000000, 0} 3285 }, 3286 .reg = { "csid_lite2" }, 3287 .interrupt = { "csid_lite2" }, 3288 .csid = { 3289 .is_lite = true, 3290 .hw_ops = &csid_ops_gen3, 3291 .parent_dev_ops = &vfe_parent_dev_ops, 3292 .formats = &csid_formats_gen2 3293 } 3294 }, 3295 /* CSID5 (lite) */ 3296 { 3297 .regulators = {}, 3298 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3299 "vfe_lite_csid", "vfe_lite_cphy_rx", 3300 "vfe_lite"}, 3301 .clock_rate = { 3302 { 0, 0, 400000000, 400000000, 0}, 3303 { 0, 0, 400000000, 480000000, 0} 3304 }, 3305 .reg = { "csid_lite3" }, 3306 .interrupt = { "csid_lite3" }, 3307 .csid = { 3308 .is_lite = true, 3309 .hw_ops = &csid_ops_gen3, 3310 .parent_dev_ops = &vfe_parent_dev_ops, 3311 .formats = &csid_formats_gen2 3312 } 3313 }, 3314 /* CSID6 (lite) */ 3315 { 3316 .regulators = {}, 3317 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3318 "vfe_lite_csid", "vfe_lite_cphy_rx", 3319 "vfe_lite"}, 3320 .clock_rate = { 3321 { 0, 0, 400000000, 400000000, 0}, 3322 { 0, 0, 400000000, 480000000, 0} 3323 }, 3324 .reg = { "csid_lite4" }, 3325 .interrupt = { "csid_lite4" }, 3326 .csid = { 3327 .is_lite = true, 3328 .hw_ops = &csid_ops_gen3, 3329 .parent_dev_ops = &vfe_parent_dev_ops, 3330 .formats = &csid_formats_gen2 3331 } 3332 }, 3333 }; 3334 3335 static const struct camss_subdev_resources vfe_res_8775p[] = { 3336 /* VFE0 */ 3337 { 3338 .regulators = {}, 3339 .clock = { "cpas_vfe0", "vfe0", "vfe0_fast_ahb", 3340 "cpas_ahb", "gcc_axi_hf", 3341 "cpas_fast_ahb_clk", 3342 "camnoc_axi"}, 3343 .clock_rate = { 3344 { 0 }, 3345 { 480000000 }, 3346 { 300000000, 400000000 }, 3347 { 300000000, 400000000 }, 3348 { 0 }, 3349 { 300000000, 400000000 }, 3350 { 400000000 }, 3351 }, 3352 .reg = { "vfe0" }, 3353 .interrupt = { "vfe0" }, 3354 .vfe = { 3355 .line_num = 3, 3356 .is_lite = false, 3357 .has_pd = false, 3358 .pd_name = NULL, 3359 .hw_ops = &vfe_ops_gen3, 3360 .formats_rdi = &vfe_formats_rdi_845, 3361 .formats_pix = &vfe_formats_pix_845 3362 } 3363 }, 3364 /* VFE1 */ 3365 { 3366 .regulators = {}, 3367 .clock = { "cpas_vfe1", "vfe1", "vfe1_fast_ahb", 3368 "cpas_ahb", "gcc_axi_hf", 3369 "cpas_fast_ahb_clk", 3370 "camnoc_axi"}, 3371 .clock_rate = { 3372 { 0 }, 3373 { 480000000 }, 3374 { 300000000, 400000000 }, 3375 { 300000000, 400000000 }, 3376 { 0 }, 3377 { 300000000, 400000000 }, 3378 { 400000000 }, 3379 }, 3380 .reg = { "vfe1" }, 3381 .interrupt = { "vfe1" }, 3382 .vfe = { 3383 .line_num = 3, 3384 .is_lite = false, 3385 .has_pd = false, 3386 .pd_name = NULL, 3387 .hw_ops = &vfe_ops_gen3, 3388 .formats_rdi = &vfe_formats_rdi_845, 3389 .formats_pix = &vfe_formats_pix_845 3390 } 3391 }, 3392 /* VFE2 (lite) */ 3393 { 3394 .regulators = {}, 3395 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3396 "vfe_lite_csid", "vfe_lite_cphy_rx", 3397 "vfe_lite"}, 3398 .clock_rate = { 3399 { 0, 0, 0, 0 }, 3400 { 300000000, 400000000, 400000000, 400000000 }, 3401 { 400000000, 400000000, 400000000, 400000000 }, 3402 { 400000000, 400000000, 400000000, 400000000 }, 3403 { 480000000, 600000000, 600000000, 600000000 }, 3404 }, 3405 .reg = { "vfe_lite0" }, 3406 .interrupt = { "vfe_lite0" }, 3407 .vfe = { 3408 .line_num = 4, 3409 .is_lite = true, 3410 .hw_ops = &vfe_ops_gen3, 3411 .formats_rdi = &vfe_formats_rdi_845, 3412 .formats_pix = &vfe_formats_pix_845 3413 } 3414 }, 3415 /* VFE3 (lite) */ 3416 { 3417 .regulators = {}, 3418 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3419 "vfe_lite_csid", "vfe_lite_cphy_rx", 3420 "vfe_lite"}, 3421 .clock_rate = { 3422 { 0, 0, 0, 0 }, 3423 { 300000000, 400000000, 400000000, 400000000 }, 3424 { 400000000, 400000000, 400000000, 400000000 }, 3425 { 400000000, 400000000, 400000000, 400000000 }, 3426 { 480000000, 600000000, 600000000, 600000000 }, 3427 }, 3428 .reg = { "vfe_lite1" }, 3429 .interrupt = { "vfe_lite1" }, 3430 .vfe = { 3431 .line_num = 4, 3432 .is_lite = true, 3433 .hw_ops = &vfe_ops_gen3, 3434 .formats_rdi = &vfe_formats_rdi_845, 3435 .formats_pix = &vfe_formats_pix_845 3436 } 3437 }, 3438 /* VFE4 (lite) */ 3439 { 3440 .regulators = {}, 3441 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3442 "vfe_lite_csid", "vfe_lite_cphy_rx", 3443 "vfe_lite"}, 3444 .clock_rate = { 3445 { 0, 0, 0, 0 }, 3446 { 300000000, 400000000, 400000000, 400000000 }, 3447 { 400000000, 400000000, 400000000, 400000000 }, 3448 { 400000000, 400000000, 400000000, 400000000 }, 3449 { 480000000, 600000000, 600000000, 600000000 }, 3450 }, 3451 .reg = { "vfe_lite2" }, 3452 .interrupt = { "vfe_lite2" }, 3453 .vfe = { 3454 .line_num = 4, 3455 .is_lite = true, 3456 .hw_ops = &vfe_ops_gen3, 3457 .formats_rdi = &vfe_formats_rdi_845, 3458 .formats_pix = &vfe_formats_pix_845 3459 } 3460 }, 3461 /* VFE5 (lite) */ 3462 { 3463 .regulators = {}, 3464 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3465 "vfe_lite_csid", "vfe_lite_cphy_rx", 3466 "vfe_lite"}, 3467 .clock_rate = { 3468 { 0, 0, 0, 0 }, 3469 { 300000000, 400000000, 400000000, 400000000 }, 3470 { 400000000, 400000000, 400000000, 400000000 }, 3471 { 400000000, 400000000, 400000000, 400000000 }, 3472 { 480000000, 600000000, 600000000, 600000000 }, 3473 }, 3474 .reg = { "vfe_lite3" }, 3475 .interrupt = { "vfe_lite3" }, 3476 .vfe = { 3477 .line_num = 4, 3478 .is_lite = true, 3479 .hw_ops = &vfe_ops_gen3, 3480 .formats_rdi = &vfe_formats_rdi_845, 3481 .formats_pix = &vfe_formats_pix_845 3482 } 3483 }, 3484 /* VFE6 (lite) */ 3485 { 3486 .regulators = {}, 3487 .clock = { "cpas_vfe_lite", "vfe_lite_ahb", 3488 "vfe_lite_csid", "vfe_lite_cphy_rx", 3489 "vfe_lite"}, 3490 .clock_rate = { 3491 { 0, 0, 0, 0 }, 3492 { 300000000, 400000000, 400000000, 400000000 }, 3493 { 400000000, 400000000, 400000000, 400000000 }, 3494 { 400000000, 400000000, 400000000, 400000000 }, 3495 { 480000000, 600000000, 600000000, 600000000 }, 3496 }, 3497 .reg = { "vfe_lite4" }, 3498 .interrupt = { "vfe_lite4" }, 3499 .vfe = { 3500 .line_num = 4, 3501 .is_lite = true, 3502 .hw_ops = &vfe_ops_gen3, 3503 .formats_rdi = &vfe_formats_rdi_845, 3504 .formats_pix = &vfe_formats_pix_845 3505 } 3506 }, 3507 }; 3508 3509 static const struct resources_icc icc_res_qcs8300[] = { 3510 { 3511 .name = "ahb", 3512 .icc_bw_tbl.avg = 38400, 3513 .icc_bw_tbl.peak = 76800, 3514 }, 3515 { 3516 .name = "hf_0", 3517 .icc_bw_tbl.avg = 2097152, 3518 .icc_bw_tbl.peak = 2097152, 3519 }, 3520 }; 3521 3522 static const struct resources_icc icc_res_sa8775p[] = { 3523 { 3524 .name = "ahb", 3525 .icc_bw_tbl.avg = 38400, 3526 .icc_bw_tbl.peak = 76800, 3527 }, 3528 { 3529 .name = "hf_0", 3530 .icc_bw_tbl.avg = 2097152, 3531 .icc_bw_tbl.peak = 2097152, 3532 }, 3533 }; 3534 3535 static const struct camss_subdev_resources csiphy_res_x1e80100[] = { 3536 /* CSIPHY0 */ 3537 { 3538 .regulators = { "vdd-csiphy-0p8", 3539 "vdd-csiphy-1p2" }, 3540 .clock = { "csiphy0", "csiphy0_timer" }, 3541 .clock_rate = { { 300000000, 400000000, 480000000 }, 3542 { 266666667, 400000000 } }, 3543 .reg = { "csiphy0" }, 3544 .interrupt = { "csiphy0" }, 3545 .csiphy = { 3546 .id = 0, 3547 .hw_ops = &csiphy_ops_3ph_1_0, 3548 .formats = &csiphy_formats_sdm845 3549 }, 3550 }, 3551 /* CSIPHY1 */ 3552 { 3553 .regulators = { "vdd-csiphy-0p8", 3554 "vdd-csiphy-1p2" }, 3555 .clock = { "csiphy1", "csiphy1_timer" }, 3556 .clock_rate = { { 300000000, 400000000, 480000000 }, 3557 { 266666667, 400000000 } }, 3558 .reg = { "csiphy1" }, 3559 .interrupt = { "csiphy1" }, 3560 .csiphy = { 3561 .id = 1, 3562 .hw_ops = &csiphy_ops_3ph_1_0, 3563 .formats = &csiphy_formats_sdm845 3564 }, 3565 }, 3566 /* CSIPHY2 */ 3567 { 3568 .regulators = { "vdd-csiphy-0p8", 3569 "vdd-csiphy-1p2" }, 3570 .clock = { "csiphy2", "csiphy2_timer" }, 3571 .clock_rate = { { 300000000, 400000000, 480000000 }, 3572 { 266666667, 400000000 } }, 3573 .reg = { "csiphy2" }, 3574 .interrupt = { "csiphy2" }, 3575 .csiphy = { 3576 .id = 2, 3577 .hw_ops = &csiphy_ops_3ph_1_0, 3578 .formats = &csiphy_formats_sdm845 3579 }, 3580 }, 3581 /* CSIPHY4 */ 3582 { 3583 .regulators = { "vdd-csiphy-0p8", 3584 "vdd-csiphy-1p2" }, 3585 .clock = { "csiphy4", "csiphy4_timer" }, 3586 .clock_rate = { { 300000000, 400000000, 480000000 }, 3587 { 266666667, 400000000 } }, 3588 .reg = { "csiphy4" }, 3589 .interrupt = { "csiphy4" }, 3590 .csiphy = { 3591 .id = 4, 3592 .hw_ops = &csiphy_ops_3ph_1_0, 3593 .formats = &csiphy_formats_sdm845 3594 }, 3595 }, 3596 }; 3597 3598 static const struct camss_subdev_resources csid_res_x1e80100[] = { 3599 /* CSID0 */ 3600 { 3601 .regulators = {}, 3602 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", 3603 "cpas_fast_ahb", "csid", "csid_csiphy_rx" }, 3604 .clock_rate = { { 0 }, 3605 { 0 }, 3606 { 64000000, 80000000 }, 3607 { 80000000, 100000000, 200000000, 3608 300000000, 400000000 }, 3609 { 300000000, 400000000, 480000000 }, 3610 { 300000000, 400000000, 480000000 }, }, 3611 .reg = { "csid0" }, 3612 .interrupt = { "csid0" }, 3613 .csid = { 3614 .hw_ops = &csid_ops_680, 3615 .parent_dev_ops = &vfe_parent_dev_ops, 3616 .formats = &csid_formats_gen2 3617 }, 3618 }, 3619 /* CSID1 */ 3620 { 3621 .regulators = {}, 3622 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", 3623 "cpas_fast_ahb", "csid", "csid_csiphy_rx" }, 3624 .clock_rate = { { 0 }, 3625 { 0 }, 3626 { 64000000, 80000000 }, 3627 { 80000000, 100000000, 200000000, 3628 300000000, 400000000 }, 3629 { 300000000, 400000000, 480000000 }, 3630 { 300000000, 400000000, 480000000 }, }, 3631 .reg = { "csid1" }, 3632 .interrupt = { "csid1" }, 3633 .csid = { 3634 .hw_ops = &csid_ops_680, 3635 .parent_dev_ops = &vfe_parent_dev_ops, 3636 .formats = &csid_formats_gen2 3637 }, 3638 }, 3639 /* CSID2 */ 3640 { 3641 .regulators = {}, 3642 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", 3643 "cpas_fast_ahb", "csid", "csid_csiphy_rx" }, 3644 .clock_rate = { { 0 }, 3645 { 0 }, 3646 { 64000000, 80000000 }, 3647 { 80000000, 100000000, 200000000, 3648 300000000, 400000000 }, 3649 { 300000000, 400000000, 480000000 }, 3650 { 300000000, 400000000, 480000000 }, }, 3651 .reg = { "csid2" }, 3652 .interrupt = { "csid2" }, 3653 .csid = { 3654 .hw_ops = &csid_ops_680, 3655 .parent_dev_ops = &vfe_parent_dev_ops, 3656 .formats = &csid_formats_gen2 3657 }, 3658 }, 3659 /* CSID_LITE0 */ 3660 { 3661 .regulators = {}, 3662 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", 3663 "cpas_fast_ahb", "csid", "csid_csiphy_rx" }, 3664 .clock_rate = { { 0 }, 3665 { 0 }, 3666 { 64000000, 80000000 }, 3667 { 80000000, 100000000, 200000000, 3668 300000000, 400000000 }, 3669 { 300000000, 400000000, 480000000 }, 3670 { 300000000, 400000000, 480000000 }, }, 3671 .reg = { "csid_lite0" }, 3672 .interrupt = { "csid_lite0" }, 3673 .csid = { 3674 .is_lite = true, 3675 .hw_ops = &csid_ops_680, 3676 .parent_dev_ops = &vfe_parent_dev_ops, 3677 .formats = &csid_formats_gen2 3678 } 3679 }, 3680 /* CSID_LITE1 */ 3681 { 3682 .regulators = {}, 3683 .clock = { "gcc_axi_hf", "gcc_axi_sf", "cpas_ahb", 3684 "cpas_fast_ahb", "csid", "csid_csiphy_rx" }, 3685 .clock_rate = { { 0 }, 3686 { 0 }, 3687 { 64000000, 80000000 }, 3688 { 80000000, 100000000, 200000000, 3689 300000000, 400000000 }, 3690 { 300000000, 400000000, 480000000 }, 3691 { 300000000, 400000000, 480000000 }, }, 3692 3693 .reg = { "csid_lite1" }, 3694 .interrupt = { "csid_lite1" }, 3695 .csid = { 3696 .is_lite = true, 3697 .hw_ops = &csid_ops_680, 3698 .parent_dev_ops = &vfe_parent_dev_ops, 3699 .formats = &csid_formats_gen2 3700 } 3701 }, 3702 }; 3703 3704 static const struct camss_subdev_resources vfe_res_x1e80100[] = { 3705 /* IFE0 */ 3706 { 3707 .regulators = {}, 3708 .clock = {"camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb", 3709 "cpas_fast_ahb", "cpas_vfe0", "vfe0_fast_ahb", 3710 "vfe0" }, 3711 .clock_rate = { { 0 }, 3712 { 0 }, 3713 { 0 }, 3714 { 0 }, 3715 { 0 }, 3716 { 0 }, 3717 { 345600000, 432000000, 594000000, 675000000, 3718 727000000 }, }, 3719 .reg = { "vfe0" }, 3720 .interrupt = { "vfe0" }, 3721 .vfe = { 3722 .line_num = 4, 3723 .pd_name = "ife0", 3724 .hw_ops = &vfe_ops_680, 3725 .formats_rdi = &vfe_formats_rdi_845, 3726 .formats_pix = &vfe_formats_pix_845 3727 }, 3728 }, 3729 /* IFE1 */ 3730 { 3731 .regulators = {}, 3732 .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb", 3733 "cpas_fast_ahb", "cpas_vfe1", "vfe1_fast_ahb", 3734 "vfe1" }, 3735 .clock_rate = { { 0 }, 3736 { 0 }, 3737 { 0 }, 3738 { 0 }, 3739 { 0 }, 3740 { 0 }, 3741 { 345600000, 432000000, 594000000, 675000000, 3742 727000000 }, }, 3743 .reg = { "vfe1" }, 3744 .interrupt = { "vfe1" }, 3745 .vfe = { 3746 .line_num = 4, 3747 .pd_name = "ife1", 3748 .hw_ops = &vfe_ops_680, 3749 .formats_rdi = &vfe_formats_rdi_845, 3750 .formats_pix = &vfe_formats_pix_845 3751 }, 3752 }, 3753 /* IFE_LITE_0 */ 3754 { 3755 .regulators = {}, 3756 .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb", 3757 "vfe_lite_ahb", "cpas_vfe_lite", "vfe_lite", 3758 "vfe_lite_csid" }, 3759 .clock_rate = { { 0 }, 3760 { 0 }, 3761 { 0 }, 3762 { 0 }, 3763 { 0 }, 3764 { 266666667, 400000000, 480000000 }, 3765 { 266666667, 400000000, 480000000 }, }, 3766 .reg = { "vfe_lite0" }, 3767 .interrupt = { "vfe_lite0" }, 3768 .vfe = { 3769 .is_lite = true, 3770 .line_num = 4, 3771 .hw_ops = &vfe_ops_680, 3772 .formats_rdi = &vfe_formats_rdi_845, 3773 .formats_pix = &vfe_formats_pix_845 3774 }, 3775 }, 3776 /* IFE_LITE_1 */ 3777 { 3778 .regulators = {}, 3779 .clock = { "camnoc_rt_axi", "camnoc_nrt_axi", "cpas_ahb", 3780 "vfe_lite_ahb", "cpas_vfe_lite", "vfe_lite", 3781 "vfe_lite_csid" }, 3782 .clock_rate = { { 0 }, 3783 { 0 }, 3784 { 0 }, 3785 { 0 }, 3786 { 0 }, 3787 { 266666667, 400000000, 480000000 }, 3788 { 266666667, 400000000, 480000000 }, }, 3789 .reg = { "vfe_lite1" }, 3790 .interrupt = { "vfe_lite1" }, 3791 .vfe = { 3792 .is_lite = true, 3793 .line_num = 4, 3794 .hw_ops = &vfe_ops_680, 3795 .formats_rdi = &vfe_formats_rdi_845, 3796 .formats_pix = &vfe_formats_pix_845 3797 }, 3798 }, 3799 }; 3800 3801 static const struct resources_icc icc_res_x1e80100[] = { 3802 { 3803 .name = "ahb", 3804 .icc_bw_tbl.avg = 150000, 3805 .icc_bw_tbl.peak = 300000, 3806 }, 3807 { 3808 .name = "hf_mnoc", 3809 .icc_bw_tbl.avg = 2097152, 3810 .icc_bw_tbl.peak = 2097152, 3811 }, 3812 { 3813 .name = "sf_mnoc", 3814 .icc_bw_tbl.avg = 2097152, 3815 .icc_bw_tbl.peak = 2097152, 3816 }, 3817 { 3818 .name = "sf_icp_mnoc", 3819 .icc_bw_tbl.avg = 2097152, 3820 .icc_bw_tbl.peak = 2097152, 3821 }, 3822 }; 3823 3824 static const struct resources_wrapper csid_wrapper_res_x1e80100 = { 3825 .reg = "csid_wrapper", 3826 }; 3827 3828 /* 3829 * camss_add_clock_margin - Add margin to clock frequency rate 3830 * @rate: Clock frequency rate 3831 * 3832 * When making calculations with physical clock frequency values 3833 * some safety margin must be added. Add it. 3834 */ 3835 inline void camss_add_clock_margin(u64 *rate) 3836 { 3837 *rate *= CAMSS_CLOCK_MARGIN_NUMERATOR; 3838 *rate = div_u64(*rate, CAMSS_CLOCK_MARGIN_DENOMINATOR); 3839 } 3840 3841 /* 3842 * camss_enable_clocks - Enable multiple clocks 3843 * @nclocks: Number of clocks in clock array 3844 * @clock: Clock array 3845 * @dev: Device 3846 * 3847 * Return 0 on success or a negative error code otherwise 3848 */ 3849 int camss_enable_clocks(int nclocks, struct camss_clock *clock, 3850 struct device *dev) 3851 { 3852 int ret; 3853 int i; 3854 3855 for (i = 0; i < nclocks; i++) { 3856 ret = clk_prepare_enable(clock[i].clk); 3857 if (ret) { 3858 dev_err(dev, "clock enable failed: %d\n", ret); 3859 goto error; 3860 } 3861 } 3862 3863 return 0; 3864 3865 error: 3866 for (i--; i >= 0; i--) 3867 clk_disable_unprepare(clock[i].clk); 3868 3869 return ret; 3870 } 3871 3872 /* 3873 * camss_disable_clocks - Disable multiple clocks 3874 * @nclocks: Number of clocks in clock array 3875 * @clock: Clock array 3876 */ 3877 void camss_disable_clocks(int nclocks, struct camss_clock *clock) 3878 { 3879 int i; 3880 3881 for (i = nclocks - 1; i >= 0; i--) 3882 clk_disable_unprepare(clock[i].clk); 3883 } 3884 3885 /* 3886 * camss_find_sensor_pad - Find the media pad via which the sensor is linked 3887 * @entity: Media entity to start searching from 3888 * 3889 * Return a pointer to sensor media pad or NULL if not found 3890 */ 3891 struct media_pad *camss_find_sensor_pad(struct media_entity *entity) 3892 { 3893 struct media_pad *pad; 3894 3895 while (1) { 3896 pad = &entity->pads[0]; 3897 if (!(pad->flags & MEDIA_PAD_FL_SINK)) 3898 return NULL; 3899 3900 pad = media_pad_remote_pad_first(pad); 3901 if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) 3902 return NULL; 3903 3904 entity = pad->entity; 3905 3906 if (entity->function == MEDIA_ENT_F_CAM_SENSOR) 3907 return pad; 3908 } 3909 } 3910 3911 /** 3912 * camss_get_link_freq - Get link frequency from sensor 3913 * @entity: Media entity in the current pipeline 3914 * @bpp: Number of bits per pixel for the current format 3915 * @lanes: Number of lanes in the link to the sensor 3916 * 3917 * Return link frequency on success or a negative error code otherwise 3918 */ 3919 s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp, 3920 unsigned int lanes) 3921 { 3922 struct media_pad *sensor_pad; 3923 3924 sensor_pad = camss_find_sensor_pad(entity); 3925 if (!sensor_pad) 3926 return -ENODEV; 3927 3928 return v4l2_get_link_freq(sensor_pad, bpp, 2 * lanes); 3929 } 3930 3931 /* 3932 * camss_get_pixel_clock - Get pixel clock rate from sensor 3933 * @entity: Media entity in the current pipeline 3934 * @pixel_clock: Received pixel clock value 3935 * 3936 * Return 0 on success or a negative error code otherwise 3937 */ 3938 int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock) 3939 { 3940 struct media_pad *sensor_pad; 3941 struct v4l2_subdev *subdev; 3942 struct v4l2_ctrl *ctrl; 3943 3944 sensor_pad = camss_find_sensor_pad(entity); 3945 if (!sensor_pad) 3946 return -ENODEV; 3947 3948 subdev = media_entity_to_v4l2_subdev(sensor_pad->entity); 3949 3950 ctrl = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_PIXEL_RATE); 3951 3952 if (!ctrl) 3953 return -EINVAL; 3954 3955 *pixel_clock = v4l2_ctrl_g_ctrl_int64(ctrl); 3956 3957 return 0; 3958 } 3959 3960 int camss_pm_domain_on(struct camss *camss, int id) 3961 { 3962 int ret = 0; 3963 3964 if (id < camss->res->vfe_num) { 3965 struct vfe_device *vfe = &camss->vfe[id]; 3966 3967 ret = vfe->res->hw_ops->pm_domain_on(vfe); 3968 } 3969 3970 return ret; 3971 } 3972 3973 void camss_pm_domain_off(struct camss *camss, int id) 3974 { 3975 if (id < camss->res->vfe_num) { 3976 struct vfe_device *vfe = &camss->vfe[id]; 3977 3978 vfe->res->hw_ops->pm_domain_off(vfe); 3979 } 3980 } 3981 3982 static int vfe_parent_dev_ops_get(struct camss *camss, int id) 3983 { 3984 int ret = -EINVAL; 3985 3986 if (id < camss->res->vfe_num) { 3987 struct vfe_device *vfe = &camss->vfe[id]; 3988 3989 ret = vfe_get(vfe); 3990 } 3991 3992 return ret; 3993 } 3994 3995 static int vfe_parent_dev_ops_put(struct camss *camss, int id) 3996 { 3997 if (id < camss->res->vfe_num) { 3998 struct vfe_device *vfe = &camss->vfe[id]; 3999 4000 vfe_put(vfe); 4001 } 4002 4003 return 0; 4004 } 4005 4006 static void __iomem 4007 *vfe_parent_dev_ops_get_base_address(struct camss *camss, int id) 4008 { 4009 if (id < camss->res->vfe_num) { 4010 struct vfe_device *vfe = &camss->vfe[id]; 4011 4012 return vfe->base; 4013 } 4014 4015 return NULL; 4016 } 4017 4018 static const struct parent_dev_ops vfe_parent_dev_ops = { 4019 .get = vfe_parent_dev_ops_get, 4020 .put = vfe_parent_dev_ops_put, 4021 .get_base_address = vfe_parent_dev_ops_get_base_address 4022 }; 4023 4024 /* 4025 * camss_of_parse_endpoint_node - Parse port endpoint node 4026 * @dev: Device 4027 * @node: Device node to be parsed 4028 * @csd: Parsed data from port endpoint node 4029 * 4030 * Return 0 on success or a negative error code on failure 4031 */ 4032 static int camss_of_parse_endpoint_node(struct device *dev, 4033 struct device_node *node, 4034 struct camss_async_subdev *csd) 4035 { 4036 struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg; 4037 struct v4l2_mbus_config_mipi_csi2 *mipi_csi2; 4038 struct v4l2_fwnode_endpoint vep = { { 0 } }; 4039 unsigned int i; 4040 int ret; 4041 4042 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep); 4043 if (ret) 4044 return ret; 4045 4046 /* 4047 * Most SoCs support both D-PHY and C-PHY standards, but currently only 4048 * D-PHY is supported in the driver. 4049 */ 4050 if (vep.bus_type != V4L2_MBUS_CSI2_DPHY) { 4051 dev_err(dev, "Unsupported bus type %d\n", vep.bus_type); 4052 return -EINVAL; 4053 } 4054 4055 csd->interface.csiphy_id = vep.base.port; 4056 4057 mipi_csi2 = &vep.bus.mipi_csi2; 4058 lncfg->clk.pos = mipi_csi2->clock_lane; 4059 lncfg->clk.pol = mipi_csi2->lane_polarities[0]; 4060 lncfg->num_data = mipi_csi2->num_data_lanes; 4061 4062 lncfg->data = devm_kcalloc(dev, 4063 lncfg->num_data, sizeof(*lncfg->data), 4064 GFP_KERNEL); 4065 if (!lncfg->data) 4066 return -ENOMEM; 4067 4068 for (i = 0; i < lncfg->num_data; i++) { 4069 lncfg->data[i].pos = mipi_csi2->data_lanes[i]; 4070 lncfg->data[i].pol = mipi_csi2->lane_polarities[i + 1]; 4071 } 4072 4073 return 0; 4074 } 4075 4076 /* 4077 * camss_of_parse_ports - Parse ports node 4078 * @dev: Device 4079 * @notifier: v4l2_device notifier data 4080 * 4081 * Return number of "port" nodes found in "ports" node 4082 */ 4083 static int camss_of_parse_ports(struct camss *camss) 4084 { 4085 struct device *dev = camss->dev; 4086 struct device_node *node = NULL; 4087 struct device_node *remote = NULL; 4088 int ret, num_subdevs = 0; 4089 4090 for_each_endpoint_of_node(dev->of_node, node) { 4091 struct camss_async_subdev *csd; 4092 4093 remote = of_graph_get_remote_port_parent(node); 4094 if (!remote) { 4095 dev_err(dev, "Cannot get remote parent\n"); 4096 ret = -EINVAL; 4097 goto err_cleanup; 4098 } 4099 4100 csd = v4l2_async_nf_add_fwnode(&camss->notifier, 4101 of_fwnode_handle(remote), 4102 struct camss_async_subdev); 4103 of_node_put(remote); 4104 if (IS_ERR(csd)) { 4105 ret = PTR_ERR(csd); 4106 goto err_cleanup; 4107 } 4108 4109 ret = camss_of_parse_endpoint_node(dev, node, csd); 4110 if (ret < 0) 4111 goto err_cleanup; 4112 4113 num_subdevs++; 4114 } 4115 4116 return num_subdevs; 4117 4118 err_cleanup: 4119 of_node_put(node); 4120 return ret; 4121 } 4122 4123 /* 4124 * camss_init_subdevices - Initialize subdev structures and resources 4125 * @camss: CAMSS device 4126 * 4127 * Return 0 on success or a negative error code on failure 4128 */ 4129 static int camss_init_subdevices(struct camss *camss) 4130 { 4131 struct platform_device *pdev = to_platform_device(camss->dev); 4132 const struct camss_resources *res = camss->res; 4133 unsigned int i; 4134 int ret; 4135 4136 for (i = 0; i < camss->res->csiphy_num; i++) { 4137 ret = msm_csiphy_subdev_init(camss, &camss->csiphy[i], 4138 &res->csiphy_res[i], 4139 res->csiphy_res[i].csiphy.id); 4140 if (ret < 0) { 4141 dev_err(camss->dev, 4142 "Failed to init csiphy%d sub-device: %d\n", 4143 i, ret); 4144 return ret; 4145 } 4146 } 4147 4148 /* note: SM8250 requires VFE to be initialized before CSID */ 4149 for (i = 0; i < camss->res->vfe_num; i++) { 4150 ret = msm_vfe_subdev_init(camss, &camss->vfe[i], 4151 &res->vfe_res[i], i); 4152 if (ret < 0) { 4153 dev_err(camss->dev, 4154 "Fail to init vfe%d sub-device: %d\n", i, ret); 4155 return ret; 4156 } 4157 } 4158 4159 /* Get optional CSID wrapper regs shared between CSID devices */ 4160 if (res->csid_wrapper_res) { 4161 char *reg = res->csid_wrapper_res->reg; 4162 void __iomem *base; 4163 4164 base = devm_platform_ioremap_resource_byname(pdev, reg); 4165 if (IS_ERR(base)) 4166 return PTR_ERR(base); 4167 camss->csid_wrapper_base = base; 4168 } 4169 4170 for (i = 0; i < camss->res->csid_num; i++) { 4171 ret = msm_csid_subdev_init(camss, &camss->csid[i], 4172 &res->csid_res[i], i); 4173 if (ret < 0) { 4174 dev_err(camss->dev, 4175 "Failed to init csid%d sub-device: %d\n", 4176 i, ret); 4177 return ret; 4178 } 4179 } 4180 4181 ret = msm_ispif_subdev_init(camss, res->ispif_res); 4182 if (ret < 0) { 4183 dev_err(camss->dev, "Failed to init ispif sub-device: %d\n", 4184 ret); 4185 return ret; 4186 } 4187 4188 return 0; 4189 } 4190 4191 /* 4192 * camss_link_err - print error in case link creation fails 4193 * @src_name: name for source of the link 4194 * @sink_name: name for sink of the link 4195 */ 4196 inline void camss_link_err(struct camss *camss, 4197 const char *src_name, 4198 const char *sink_name, 4199 int ret) 4200 { 4201 dev_err(camss->dev, 4202 "Failed to link %s->%s entities: %d\n", 4203 src_name, 4204 sink_name, 4205 ret); 4206 } 4207 4208 /* 4209 * camss_link_entities - Register subdev nodes and create links 4210 * @camss: CAMSS device 4211 * 4212 * Return 0 on success or a negative error code on failure 4213 */ 4214 static int camss_link_entities(struct camss *camss) 4215 { 4216 int i, j, k; 4217 int ret; 4218 4219 for (i = 0; i < camss->res->csiphy_num; i++) { 4220 for (j = 0; j < camss->res->csid_num; j++) { 4221 ret = media_create_pad_link(&camss->csiphy[i].subdev.entity, 4222 MSM_CSIPHY_PAD_SRC, 4223 &camss->csid[j].subdev.entity, 4224 MSM_CSID_PAD_SINK, 4225 0); 4226 if (ret < 0) { 4227 camss_link_err(camss, 4228 camss->csiphy[i].subdev.entity.name, 4229 camss->csid[j].subdev.entity.name, 4230 ret); 4231 return ret; 4232 } 4233 } 4234 } 4235 4236 if (camss->ispif) { 4237 for (i = 0; i < camss->res->csid_num; i++) { 4238 for (j = 0; j < camss->ispif->line_num; j++) { 4239 ret = media_create_pad_link(&camss->csid[i].subdev.entity, 4240 MSM_CSID_PAD_SRC, 4241 &camss->ispif->line[j].subdev.entity, 4242 MSM_ISPIF_PAD_SINK, 4243 0); 4244 if (ret < 0) { 4245 camss_link_err(camss, 4246 camss->csid[i].subdev.entity.name, 4247 camss->ispif->line[j].subdev.entity.name, 4248 ret); 4249 return ret; 4250 } 4251 } 4252 } 4253 4254 for (i = 0; i < camss->ispif->line_num; i++) 4255 for (k = 0; k < camss->res->vfe_num; k++) 4256 for (j = 0; j < camss->vfe[k].res->line_num; j++) { 4257 struct v4l2_subdev *ispif = &camss->ispif->line[i].subdev; 4258 struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; 4259 4260 ret = media_create_pad_link(&ispif->entity, 4261 MSM_ISPIF_PAD_SRC, 4262 &vfe->entity, 4263 MSM_VFE_PAD_SINK, 4264 0); 4265 if (ret < 0) { 4266 camss_link_err(camss, ispif->entity.name, 4267 vfe->entity.name, 4268 ret); 4269 return ret; 4270 } 4271 } 4272 } else { 4273 for (i = 0; i < camss->res->csid_num; i++) 4274 for (k = 0; k < camss->res->vfe_num; k++) 4275 for (j = 0; j < camss->vfe[k].res->line_num; j++) { 4276 struct v4l2_subdev *csid = &camss->csid[i].subdev; 4277 struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; 4278 4279 ret = media_create_pad_link(&csid->entity, 4280 MSM_CSID_PAD_FIRST_SRC + j, 4281 &vfe->entity, 4282 MSM_VFE_PAD_SINK, 4283 0); 4284 if (ret < 0) { 4285 camss_link_err(camss, csid->entity.name, 4286 vfe->entity.name, 4287 ret); 4288 return ret; 4289 } 4290 } 4291 } 4292 4293 return 0; 4294 } 4295 4296 void camss_reg_update(struct camss *camss, int hw_id, int port_id, bool is_clear) 4297 { 4298 struct csid_device *csid; 4299 4300 if (hw_id < camss->res->csid_num) { 4301 csid = &camss->csid[hw_id]; 4302 4303 csid->res->hw_ops->reg_update(csid, port_id, is_clear); 4304 } 4305 } 4306 4307 void camss_buf_done(struct camss *camss, int hw_id, int port_id) 4308 { 4309 struct vfe_device *vfe; 4310 4311 if (hw_id < camss->res->vfe_num) { 4312 vfe = &camss->vfe[hw_id]; 4313 4314 vfe->res->hw_ops->vfe_buf_done(vfe, port_id); 4315 } 4316 } 4317 4318 /* 4319 * camss_register_entities - Register subdev nodes and create links 4320 * @camss: CAMSS device 4321 * 4322 * Return 0 on success or a negative error code on failure 4323 */ 4324 static int camss_register_entities(struct camss *camss) 4325 { 4326 int i; 4327 int ret; 4328 4329 for (i = 0; i < camss->res->csiphy_num; i++) { 4330 ret = msm_csiphy_register_entity(&camss->csiphy[i], 4331 &camss->v4l2_dev); 4332 if (ret < 0) { 4333 dev_err(camss->dev, 4334 "Failed to register csiphy%d entity: %d\n", 4335 i, ret); 4336 goto err_reg_csiphy; 4337 } 4338 } 4339 4340 for (i = 0; i < camss->res->csid_num; i++) { 4341 ret = msm_csid_register_entity(&camss->csid[i], 4342 &camss->v4l2_dev); 4343 if (ret < 0) { 4344 dev_err(camss->dev, 4345 "Failed to register csid%d entity: %d\n", 4346 i, ret); 4347 goto err_reg_csid; 4348 } 4349 } 4350 4351 ret = msm_ispif_register_entities(camss->ispif, 4352 &camss->v4l2_dev); 4353 if (ret < 0) { 4354 dev_err(camss->dev, "Failed to register ispif entities: %d\n", ret); 4355 goto err_reg_ispif; 4356 } 4357 4358 for (i = 0; i < camss->res->vfe_num; i++) { 4359 ret = msm_vfe_register_entities(&camss->vfe[i], 4360 &camss->v4l2_dev); 4361 if (ret < 0) { 4362 dev_err(camss->dev, 4363 "Failed to register vfe%d entities: %d\n", 4364 i, ret); 4365 goto err_reg_vfe; 4366 } 4367 } 4368 4369 return 0; 4370 4371 err_reg_vfe: 4372 for (i--; i >= 0; i--) 4373 msm_vfe_unregister_entities(&camss->vfe[i]); 4374 4375 err_reg_ispif: 4376 msm_ispif_unregister_entities(camss->ispif); 4377 4378 i = camss->res->csid_num; 4379 err_reg_csid: 4380 for (i--; i >= 0; i--) 4381 msm_csid_unregister_entity(&camss->csid[i]); 4382 4383 i = camss->res->csiphy_num; 4384 err_reg_csiphy: 4385 for (i--; i >= 0; i--) 4386 msm_csiphy_unregister_entity(&camss->csiphy[i]); 4387 4388 return ret; 4389 } 4390 4391 /* 4392 * camss_unregister_entities - Unregister subdev nodes 4393 * @camss: CAMSS device 4394 * 4395 * Return 0 on success or a negative error code on failure 4396 */ 4397 static void camss_unregister_entities(struct camss *camss) 4398 { 4399 unsigned int i; 4400 4401 for (i = 0; i < camss->res->csiphy_num; i++) 4402 msm_csiphy_unregister_entity(&camss->csiphy[i]); 4403 4404 for (i = 0; i < camss->res->csid_num; i++) 4405 msm_csid_unregister_entity(&camss->csid[i]); 4406 4407 msm_ispif_unregister_entities(camss->ispif); 4408 4409 for (i = 0; i < camss->res->vfe_num; i++) 4410 msm_vfe_unregister_entities(&camss->vfe[i]); 4411 } 4412 4413 static int camss_subdev_notifier_bound(struct v4l2_async_notifier *async, 4414 struct v4l2_subdev *subdev, 4415 struct v4l2_async_connection *asd) 4416 { 4417 struct camss *camss = container_of(async, struct camss, notifier); 4418 struct camss_async_subdev *csd = 4419 container_of(asd, struct camss_async_subdev, asd); 4420 u8 id = csd->interface.csiphy_id; 4421 struct csiphy_device *csiphy = &camss->csiphy[id]; 4422 4423 csiphy->cfg.csi2 = &csd->interface.csi2; 4424 subdev->host_priv = csiphy; 4425 4426 return 0; 4427 } 4428 4429 static int camss_subdev_notifier_complete(struct v4l2_async_notifier *async) 4430 { 4431 struct camss *camss = container_of(async, struct camss, notifier); 4432 struct v4l2_device *v4l2_dev = &camss->v4l2_dev; 4433 struct v4l2_subdev *sd; 4434 4435 list_for_each_entry(sd, &v4l2_dev->subdevs, list) { 4436 struct csiphy_device *csiphy = sd->host_priv; 4437 struct media_entity *input, *sensor; 4438 unsigned int i; 4439 int ret; 4440 4441 if (!csiphy) 4442 continue; 4443 4444 input = &csiphy->subdev.entity; 4445 sensor = &sd->entity; 4446 4447 for (i = 0; i < sensor->num_pads; i++) { 4448 if (sensor->pads[i].flags & MEDIA_PAD_FL_SOURCE) 4449 break; 4450 } 4451 if (i == sensor->num_pads) { 4452 dev_err(camss->dev, 4453 "No source pad in external entity\n"); 4454 return -EINVAL; 4455 } 4456 4457 ret = media_create_pad_link(sensor, i, input, 4458 MSM_CSIPHY_PAD_SINK, 4459 MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); 4460 if (ret < 0) { 4461 camss_link_err(camss, sensor->name, input->name, ret); 4462 return ret; 4463 } 4464 } 4465 4466 return v4l2_device_register_subdev_nodes(&camss->v4l2_dev); 4467 } 4468 4469 static const struct v4l2_async_notifier_operations camss_subdev_notifier_ops = { 4470 .bound = camss_subdev_notifier_bound, 4471 .complete = camss_subdev_notifier_complete, 4472 }; 4473 4474 static const struct media_device_ops camss_media_ops = { 4475 .link_notify = v4l2_pipeline_link_notify, 4476 }; 4477 4478 static int camss_configure_pd(struct camss *camss) 4479 { 4480 const struct camss_resources *res = camss->res; 4481 struct device *dev = camss->dev; 4482 int vfepd_num; 4483 int i; 4484 int ret; 4485 4486 camss->genpd_num = of_count_phandle_with_args(dev->of_node, 4487 "power-domains", 4488 "#power-domain-cells"); 4489 if (camss->genpd_num < 0) { 4490 dev_err(dev, "Power domains are not defined for camss\n"); 4491 return camss->genpd_num; 4492 } 4493 4494 /* 4495 * If a platform device has just one power domain, then it is attached 4496 * at platform_probe() level, thus there shall be no need and even no 4497 * option to attach it again, this is the case for CAMSS on MSM8916. 4498 */ 4499 if (camss->genpd_num == 1) 4500 return 0; 4501 4502 /* count the # of VFEs which have flagged power-domain */ 4503 for (vfepd_num = i = 0; i < camss->res->vfe_num; i++) { 4504 if (res->vfe_res[i].vfe.has_pd) 4505 vfepd_num++; 4506 } 4507 4508 /* 4509 * If the number of power-domains is greater than the number of VFEs 4510 * then the additional power-domain is for the entire CAMSS block. 4511 */ 4512 if (!(camss->genpd_num > vfepd_num)) 4513 return 0; 4514 4515 /* 4516 * If a power-domain name is defined try to use it. 4517 * It is possible we are running a new kernel with an old dtb so 4518 * fallback to indexes even if a pd_name is defined but not found. 4519 */ 4520 if (camss->res->pd_name) { 4521 camss->genpd = dev_pm_domain_attach_by_name(camss->dev, 4522 camss->res->pd_name); 4523 if (IS_ERR(camss->genpd)) 4524 return PTR_ERR(camss->genpd); 4525 } 4526 4527 if (!camss->genpd) { 4528 /* 4529 * Legacy magic index. TITAN_TOP GDSC must be the last 4530 * item in the power-domain list. 4531 */ 4532 camss->genpd = dev_pm_domain_attach_by_id(camss->dev, 4533 camss->genpd_num - 1); 4534 if (IS_ERR(camss->genpd)) 4535 return PTR_ERR(camss->genpd); 4536 } 4537 4538 if (!camss->genpd) 4539 return -ENODEV; 4540 4541 camss->genpd_link = device_link_add(camss->dev, camss->genpd, 4542 DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | 4543 DL_FLAG_RPM_ACTIVE); 4544 if (!camss->genpd_link) { 4545 ret = -EINVAL; 4546 goto fail_pm; 4547 } 4548 4549 return 0; 4550 4551 fail_pm: 4552 dev_pm_domain_detach(camss->genpd, true); 4553 4554 return ret; 4555 } 4556 4557 static int camss_icc_get(struct camss *camss) 4558 { 4559 const struct resources_icc *icc_res; 4560 int i; 4561 4562 icc_res = camss->res->icc_res; 4563 4564 for (i = 0; i < camss->res->icc_path_num; i++) { 4565 camss->icc_path[i] = devm_of_icc_get(camss->dev, 4566 icc_res[i].name); 4567 if (IS_ERR(camss->icc_path[i])) 4568 return PTR_ERR(camss->icc_path[i]); 4569 } 4570 4571 return 0; 4572 } 4573 4574 static void camss_genpd_subdevice_cleanup(struct camss *camss) 4575 { 4576 int i; 4577 4578 for (i = 0; i < camss->res->vfe_num; i++) 4579 msm_vfe_genpd_cleanup(&camss->vfe[i]); 4580 } 4581 4582 static void camss_genpd_cleanup(struct camss *camss) 4583 { 4584 if (camss->genpd_num == 1) 4585 return; 4586 4587 camss_genpd_subdevice_cleanup(camss); 4588 4589 if (camss->genpd_link) 4590 device_link_del(camss->genpd_link); 4591 4592 dev_pm_domain_detach(camss->genpd, true); 4593 } 4594 4595 /* 4596 * camss_probe - Probe CAMSS platform device 4597 * @pdev: Pointer to CAMSS platform device 4598 * 4599 * Return 0 on success or a negative error code on failure 4600 */ 4601 static int camss_probe(struct platform_device *pdev) 4602 { 4603 struct device *dev = &pdev->dev; 4604 struct camss *camss; 4605 int ret; 4606 4607 camss = devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL); 4608 if (!camss) 4609 return -ENOMEM; 4610 4611 camss->res = of_device_get_match_data(dev); 4612 4613 atomic_set(&camss->ref_count, 0); 4614 camss->dev = dev; 4615 platform_set_drvdata(pdev, camss); 4616 4617 camss->csiphy = devm_kcalloc(dev, camss->res->csiphy_num, 4618 sizeof(*camss->csiphy), GFP_KERNEL); 4619 if (!camss->csiphy) 4620 return -ENOMEM; 4621 4622 camss->csid = devm_kcalloc(dev, camss->res->csid_num, sizeof(*camss->csid), 4623 GFP_KERNEL); 4624 if (!camss->csid) 4625 return -ENOMEM; 4626 4627 if (camss->res->version == CAMSS_8x16 || 4628 camss->res->version == CAMSS_8x39 || 4629 camss->res->version == CAMSS_8x53 || 4630 camss->res->version == CAMSS_8x96) { 4631 camss->ispif = devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL); 4632 if (!camss->ispif) 4633 return -ENOMEM; 4634 } 4635 4636 camss->vfe = devm_kcalloc(dev, camss->res->vfe_num, 4637 sizeof(*camss->vfe), GFP_KERNEL); 4638 if (!camss->vfe) 4639 return -ENOMEM; 4640 4641 ret = camss_icc_get(camss); 4642 if (ret < 0) 4643 return ret; 4644 4645 ret = camss_configure_pd(camss); 4646 if (ret < 0) { 4647 dev_err(dev, "Failed to configure power domains: %d\n", ret); 4648 return ret; 4649 } 4650 4651 ret = camss_init_subdevices(camss); 4652 if (ret < 0) 4653 goto err_genpd_cleanup; 4654 4655 ret = dma_set_mask_and_coherent(dev, 0xffffffff); 4656 if (ret) 4657 goto err_genpd_cleanup; 4658 4659 camss->media_dev.dev = camss->dev; 4660 strscpy(camss->media_dev.model, "Qualcomm Camera Subsystem", 4661 sizeof(camss->media_dev.model)); 4662 camss->media_dev.ops = &camss_media_ops; 4663 media_device_init(&camss->media_dev); 4664 4665 camss->v4l2_dev.mdev = &camss->media_dev; 4666 ret = v4l2_device_register(camss->dev, &camss->v4l2_dev); 4667 if (ret < 0) { 4668 dev_err(dev, "Failed to register V4L2 device: %d\n", ret); 4669 goto err_media_device_cleanup; 4670 } 4671 4672 v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev); 4673 4674 pm_runtime_enable(dev); 4675 4676 ret = camss_of_parse_ports(camss); 4677 if (ret < 0) 4678 goto err_v4l2_device_unregister; 4679 4680 ret = camss_register_entities(camss); 4681 if (ret < 0) 4682 goto err_v4l2_device_unregister; 4683 4684 ret = camss_link_entities(camss); 4685 if (ret < 0) 4686 goto err_register_subdevs; 4687 4688 ret = media_device_register(&camss->media_dev); 4689 if (ret < 0) { 4690 dev_err(dev, "Failed to register media device: %d\n", ret); 4691 goto err_register_subdevs; 4692 } 4693 4694 camss->notifier.ops = &camss_subdev_notifier_ops; 4695 ret = v4l2_async_nf_register(&camss->notifier); 4696 if (ret) { 4697 dev_err(dev, 4698 "Failed to register async subdev nodes: %d\n", ret); 4699 goto err_media_device_unregister; 4700 } 4701 4702 return 0; 4703 4704 err_media_device_unregister: 4705 media_device_unregister(&camss->media_dev); 4706 err_register_subdevs: 4707 camss_unregister_entities(camss); 4708 err_v4l2_device_unregister: 4709 v4l2_device_unregister(&camss->v4l2_dev); 4710 v4l2_async_nf_cleanup(&camss->notifier); 4711 pm_runtime_disable(dev); 4712 err_media_device_cleanup: 4713 media_device_cleanup(&camss->media_dev); 4714 err_genpd_cleanup: 4715 camss_genpd_cleanup(camss); 4716 4717 return ret; 4718 } 4719 4720 void camss_delete(struct camss *camss) 4721 { 4722 v4l2_device_unregister(&camss->v4l2_dev); 4723 media_device_unregister(&camss->media_dev); 4724 media_device_cleanup(&camss->media_dev); 4725 4726 pm_runtime_disable(camss->dev); 4727 } 4728 4729 /* 4730 * camss_remove - Remove CAMSS platform device 4731 * @pdev: Pointer to CAMSS platform device 4732 * 4733 * Always returns 0. 4734 */ 4735 static void camss_remove(struct platform_device *pdev) 4736 { 4737 struct camss *camss = platform_get_drvdata(pdev); 4738 4739 v4l2_async_nf_unregister(&camss->notifier); 4740 v4l2_async_nf_cleanup(&camss->notifier); 4741 camss_unregister_entities(camss); 4742 4743 if (atomic_read(&camss->ref_count) == 0) 4744 camss_delete(camss); 4745 4746 camss_genpd_cleanup(camss); 4747 } 4748 4749 static const struct camss_resources msm8916_resources = { 4750 .version = CAMSS_8x16, 4751 .csiphy_res = csiphy_res_8x16, 4752 .csid_res = csid_res_8x16, 4753 .ispif_res = &ispif_res_8x16, 4754 .vfe_res = vfe_res_8x16, 4755 .csiphy_num = ARRAY_SIZE(csiphy_res_8x16), 4756 .csid_num = ARRAY_SIZE(csid_res_8x16), 4757 .vfe_num = ARRAY_SIZE(vfe_res_8x16), 4758 }; 4759 4760 static const struct camss_resources msm8939_resources = { 4761 .version = CAMSS_8x39, 4762 .csiphy_res = csiphy_res_8x39, 4763 .csid_res = csid_res_8x39, 4764 .ispif_res = &ispif_res_8x39, 4765 .vfe_res = vfe_res_8x39, 4766 .csiphy_num = ARRAY_SIZE(csiphy_res_8x39), 4767 .csid_num = ARRAY_SIZE(csid_res_8x39), 4768 .vfe_num = ARRAY_SIZE(vfe_res_8x39), 4769 }; 4770 4771 static const struct camss_resources msm8953_resources = { 4772 .version = CAMSS_8x53, 4773 .icc_res = icc_res_8x53, 4774 .icc_path_num = ARRAY_SIZE(icc_res_8x53), 4775 .csiphy_res = csiphy_res_8x96, 4776 .csid_res = csid_res_8x53, 4777 .ispif_res = &ispif_res_8x53, 4778 .vfe_res = vfe_res_8x53, 4779 .csiphy_num = ARRAY_SIZE(csiphy_res_8x96), 4780 .csid_num = ARRAY_SIZE(csid_res_8x53), 4781 .vfe_num = ARRAY_SIZE(vfe_res_8x53), 4782 }; 4783 4784 static const struct camss_resources msm8996_resources = { 4785 .version = CAMSS_8x96, 4786 .csiphy_res = csiphy_res_8x96, 4787 .csid_res = csid_res_8x96, 4788 .ispif_res = &ispif_res_8x96, 4789 .vfe_res = vfe_res_8x96, 4790 .csiphy_num = ARRAY_SIZE(csiphy_res_8x96), 4791 .csid_num = ARRAY_SIZE(csid_res_8x96), 4792 .vfe_num = ARRAY_SIZE(vfe_res_8x96), 4793 }; 4794 4795 static const struct camss_resources qcm2290_resources = { 4796 .version = CAMSS_2290, 4797 .csiphy_res = csiphy_res_2290, 4798 .csid_res = csid_res_2290, 4799 .vfe_res = vfe_res_2290, 4800 .icc_res = icc_res_2290, 4801 .icc_path_num = ARRAY_SIZE(icc_res_2290), 4802 .csiphy_num = ARRAY_SIZE(csiphy_res_2290), 4803 .csid_num = ARRAY_SIZE(csid_res_2290), 4804 .vfe_num = ARRAY_SIZE(vfe_res_2290), 4805 }; 4806 4807 static const struct camss_resources qcs8300_resources = { 4808 .version = CAMSS_8300, 4809 .pd_name = "top", 4810 .csiphy_res = csiphy_res_8300, 4811 .csid_res = csid_res_8775p, 4812 .csid_wrapper_res = &csid_wrapper_res_sm8550, 4813 .vfe_res = vfe_res_8775p, 4814 .icc_res = icc_res_qcs8300, 4815 .csiphy_num = ARRAY_SIZE(csiphy_res_8300), 4816 .csid_num = ARRAY_SIZE(csid_res_8775p), 4817 .vfe_num = ARRAY_SIZE(vfe_res_8775p), 4818 .icc_path_num = ARRAY_SIZE(icc_res_qcs8300), 4819 }; 4820 4821 static const struct camss_resources sa8775p_resources = { 4822 .version = CAMSS_8775P, 4823 .pd_name = "top", 4824 .csiphy_res = csiphy_res_8775p, 4825 .csid_res = csid_res_8775p, 4826 .csid_wrapper_res = &csid_wrapper_res_sm8550, 4827 .vfe_res = vfe_res_8775p, 4828 .icc_res = icc_res_sa8775p, 4829 .csiphy_num = ARRAY_SIZE(csiphy_res_8775p), 4830 .csid_num = ARRAY_SIZE(csid_res_8775p), 4831 .vfe_num = ARRAY_SIZE(vfe_res_8775p), 4832 .icc_path_num = ARRAY_SIZE(icc_res_sa8775p), 4833 }; 4834 4835 static const struct camss_resources sdm660_resources = { 4836 .version = CAMSS_660, 4837 .csiphy_res = csiphy_res_660, 4838 .csid_res = csid_res_660, 4839 .ispif_res = &ispif_res_660, 4840 .vfe_res = vfe_res_660, 4841 .csiphy_num = ARRAY_SIZE(csiphy_res_660), 4842 .csid_num = ARRAY_SIZE(csid_res_660), 4843 .vfe_num = ARRAY_SIZE(vfe_res_660), 4844 }; 4845 4846 static const struct camss_resources sdm670_resources = { 4847 .version = CAMSS_845, 4848 .csiphy_res = csiphy_res_670, 4849 .csid_res = csid_res_670, 4850 .vfe_res = vfe_res_670, 4851 .csiphy_num = ARRAY_SIZE(csiphy_res_670), 4852 .csid_num = ARRAY_SIZE(csid_res_670), 4853 .vfe_num = ARRAY_SIZE(vfe_res_670), 4854 }; 4855 4856 static const struct camss_resources sdm845_resources = { 4857 .version = CAMSS_845, 4858 .pd_name = "top", 4859 .csiphy_res = csiphy_res_845, 4860 .csid_res = csid_res_845, 4861 .vfe_res = vfe_res_845, 4862 .csiphy_num = ARRAY_SIZE(csiphy_res_845), 4863 .csid_num = ARRAY_SIZE(csid_res_845), 4864 .vfe_num = ARRAY_SIZE(vfe_res_845), 4865 }; 4866 4867 static const struct camss_resources sm8250_resources = { 4868 .version = CAMSS_8250, 4869 .pd_name = "top", 4870 .csiphy_res = csiphy_res_8250, 4871 .csid_res = csid_res_8250, 4872 .vfe_res = vfe_res_8250, 4873 .icc_res = icc_res_sm8250, 4874 .icc_path_num = ARRAY_SIZE(icc_res_sm8250), 4875 .csiphy_num = ARRAY_SIZE(csiphy_res_8250), 4876 .csid_num = ARRAY_SIZE(csid_res_8250), 4877 .vfe_num = ARRAY_SIZE(vfe_res_8250), 4878 }; 4879 4880 static const struct camss_resources sc8280xp_resources = { 4881 .version = CAMSS_8280XP, 4882 .pd_name = "top", 4883 .csiphy_res = csiphy_res_sc8280xp, 4884 .csid_res = csid_res_sc8280xp, 4885 .ispif_res = NULL, 4886 .vfe_res = vfe_res_sc8280xp, 4887 .icc_res = icc_res_sc8280xp, 4888 .icc_path_num = ARRAY_SIZE(icc_res_sc8280xp), 4889 .csiphy_num = ARRAY_SIZE(csiphy_res_sc8280xp), 4890 .csid_num = ARRAY_SIZE(csid_res_sc8280xp), 4891 .vfe_num = ARRAY_SIZE(vfe_res_sc8280xp), 4892 }; 4893 4894 static const struct camss_resources sc7280_resources = { 4895 .version = CAMSS_7280, 4896 .pd_name = "top", 4897 .csiphy_res = csiphy_res_7280, 4898 .csid_res = csid_res_7280, 4899 .vfe_res = vfe_res_7280, 4900 .icc_res = icc_res_sc7280, 4901 .icc_path_num = ARRAY_SIZE(icc_res_sc7280), 4902 .csiphy_num = ARRAY_SIZE(csiphy_res_7280), 4903 .csid_num = ARRAY_SIZE(csid_res_7280), 4904 .vfe_num = ARRAY_SIZE(vfe_res_7280), 4905 }; 4906 4907 static const struct camss_resources sm8550_resources = { 4908 .version = CAMSS_8550, 4909 .pd_name = "top", 4910 .csiphy_res = csiphy_res_8550, 4911 .csid_res = csid_res_8550, 4912 .vfe_res = vfe_res_8550, 4913 .csid_wrapper_res = &csid_wrapper_res_sm8550, 4914 .icc_res = icc_res_sm8550, 4915 .icc_path_num = ARRAY_SIZE(icc_res_sm8550), 4916 .csiphy_num = ARRAY_SIZE(csiphy_res_8550), 4917 .csid_num = ARRAY_SIZE(csid_res_8550), 4918 .vfe_num = ARRAY_SIZE(vfe_res_8550), 4919 }; 4920 4921 static const struct camss_resources sm8650_resources = { 4922 .version = CAMSS_8650, 4923 .pd_name = "top", 4924 .csiphy_res = csiphy_res_sm8650, 4925 .csid_res = csid_res_sm8650, 4926 .csid_wrapper_res = &csid_wrapper_res_sm8550, 4927 .vfe_res = vfe_res_sm8650, 4928 .icc_res = icc_res_sm8650, 4929 .icc_path_num = ARRAY_SIZE(icc_res_sm8650), 4930 .csiphy_num = ARRAY_SIZE(csiphy_res_sm8650), 4931 .csid_num = ARRAY_SIZE(csid_res_sm8650), 4932 .vfe_num = ARRAY_SIZE(vfe_res_sm8650), 4933 }; 4934 4935 static const struct camss_resources x1e80100_resources = { 4936 .version = CAMSS_X1E80100, 4937 .pd_name = "top", 4938 .csiphy_res = csiphy_res_x1e80100, 4939 .csid_res = csid_res_x1e80100, 4940 .vfe_res = vfe_res_x1e80100, 4941 .csid_wrapper_res = &csid_wrapper_res_x1e80100, 4942 .icc_res = icc_res_x1e80100, 4943 .icc_path_num = ARRAY_SIZE(icc_res_x1e80100), 4944 .csiphy_num = ARRAY_SIZE(csiphy_res_x1e80100), 4945 .csid_num = ARRAY_SIZE(csid_res_x1e80100), 4946 .vfe_num = ARRAY_SIZE(vfe_res_x1e80100), 4947 }; 4948 4949 static const struct of_device_id camss_dt_match[] = { 4950 { .compatible = "qcom,msm8916-camss", .data = &msm8916_resources }, 4951 { .compatible = "qcom,msm8939-camss", .data = &msm8939_resources }, 4952 { .compatible = "qcom,msm8953-camss", .data = &msm8953_resources }, 4953 { .compatible = "qcom,msm8996-camss", .data = &msm8996_resources }, 4954 { .compatible = "qcom,qcm2290-camss", .data = &qcm2290_resources }, 4955 { .compatible = "qcom,qcs8300-camss", .data = &qcs8300_resources }, 4956 { .compatible = "qcom,sa8775p-camss", .data = &sa8775p_resources }, 4957 { .compatible = "qcom,sc7280-camss", .data = &sc7280_resources }, 4958 { .compatible = "qcom,sc8280xp-camss", .data = &sc8280xp_resources }, 4959 { .compatible = "qcom,sdm660-camss", .data = &sdm660_resources }, 4960 { .compatible = "qcom,sdm670-camss", .data = &sdm670_resources }, 4961 { .compatible = "qcom,sdm845-camss", .data = &sdm845_resources }, 4962 { .compatible = "qcom,sm8250-camss", .data = &sm8250_resources }, 4963 { .compatible = "qcom,sm8550-camss", .data = &sm8550_resources }, 4964 { .compatible = "qcom,sm8650-camss", .data = &sm8650_resources }, 4965 { .compatible = "qcom,x1e80100-camss", .data = &x1e80100_resources }, 4966 { } 4967 }; 4968 4969 MODULE_DEVICE_TABLE(of, camss_dt_match); 4970 4971 static int __maybe_unused camss_runtime_suspend(struct device *dev) 4972 { 4973 struct camss *camss = dev_get_drvdata(dev); 4974 int i; 4975 int ret; 4976 4977 for (i = 0; i < camss->res->icc_path_num; i++) { 4978 ret = icc_set_bw(camss->icc_path[i], 0, 0); 4979 if (ret) 4980 return ret; 4981 } 4982 4983 return 0; 4984 } 4985 4986 static int __maybe_unused camss_runtime_resume(struct device *dev) 4987 { 4988 struct camss *camss = dev_get_drvdata(dev); 4989 const struct resources_icc *icc_res = camss->res->icc_res; 4990 int i; 4991 int ret; 4992 4993 for (i = 0; i < camss->res->icc_path_num; i++) { 4994 ret = icc_set_bw(camss->icc_path[i], 4995 icc_res[i].icc_bw_tbl.avg, 4996 icc_res[i].icc_bw_tbl.peak); 4997 if (ret) 4998 return ret; 4999 } 5000 5001 return 0; 5002 } 5003 5004 static const struct dev_pm_ops camss_pm_ops = { 5005 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 5006 pm_runtime_force_resume) 5007 SET_RUNTIME_PM_OPS(camss_runtime_suspend, camss_runtime_resume, NULL) 5008 }; 5009 5010 static struct platform_driver qcom_camss_driver = { 5011 .probe = camss_probe, 5012 .remove = camss_remove, 5013 .driver = { 5014 .name = "qcom-camss", 5015 .of_match_table = camss_dt_match, 5016 .pm = &camss_pm_ops, 5017 }, 5018 }; 5019 5020 module_platform_driver(qcom_camss_driver); 5021 5022 MODULE_DESCRIPTION("Qualcomm Camera Subsystem driver"); 5023 MODULE_AUTHOR("Todor Tomov <todor.tomov@linaro.org>"); 5024 MODULE_LICENSE("GPL v2"); 5025