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