1 // SPDX-License-Identifier: GPL-2.0
5 * Qualcomm MSM Camera Subsystem - Core
7 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
8 * Copyright (C) 2015-2018 Linaro Ltd.
10 #include <linux/clk.h>
11 #include <linux/media-bus-format.h>
12 #include <linux/media.h>
13 #include <linux/module.h>
14 #include <linux/platform_device.h>
16 #include <linux/of_graph.h>
17 #include <linux/pm_runtime.h>
18 #include <linux/pm_domain.h>
19 #include <linux/slab.h>
20 #include <linux/videodev2.h>
22 #include <media/media-device.h>
23 #include <media/v4l2-async.h>
24 #include <media/v4l2-device.h>
25 #include <media/v4l2-mc.h>
26 #include <media/v4l2-fwnode.h>
30 #define CAMSS_CLOCK_MARGIN_NUMERATOR 105
31 #define CAMSS_CLOCK_MARGIN_DENOMINATOR 100
33 static const struct resources csiphy_res_8x16[] = {
36 .regulator = { NULL },
37 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
38 .clock_rate = { { 0 },
41 { 100000000, 200000000 } },
42 .reg = { "csiphy0", "csiphy0_clk_mux" },
43 .interrupt = { "csiphy0" }
48 .regulator = { NULL },
49 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
50 .clock_rate = { { 0 },
53 { 100000000, 200000000 } },
54 .reg = { "csiphy1", "csiphy1_clk_mux" },
55 .interrupt = { "csiphy1" }
59 static const struct resources csid_res_8x16[] = {
62 .regulator = { "vdda" },
63 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
64 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
65 .clock_rate = { { 0 },
69 { 100000000, 200000000 },
74 .interrupt = { "csid0" }
79 .regulator = { "vdda" },
80 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
81 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
82 .clock_rate = { { 0 },
86 { 100000000, 200000000 },
91 .interrupt = { "csid1" }
95 static const struct resources_ispif ispif_res_8x16 = {
97 .clock = { "top_ahb", "ahb", "ispif_ahb",
98 "csi0", "csi0_pix", "csi0_rdi",
99 "csi1", "csi1_pix", "csi1_rdi" },
100 .clock_for_reset = { "vfe0", "csi_vfe0" },
101 .reg = { "ispif", "csi_clk_mux" },
106 static const struct resources vfe_res_8x16[] = {
109 .regulator = { NULL },
110 .clock = { "top_ahb", "vfe0", "csi_vfe0",
111 "vfe_ahb", "vfe_axi", "ahb" },
112 .clock_rate = { { 0 },
113 { 50000000, 80000000, 100000000, 160000000,
114 177780000, 200000000, 266670000, 320000000,
115 400000000, 465000000 },
124 .interrupt = { "vfe0" }
128 static const struct resources csiphy_res_8x96[] = {
131 .regulator = { NULL },
132 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy0_timer" },
133 .clock_rate = { { 0 },
136 { 100000000, 200000000, 266666667 } },
137 .reg = { "csiphy0", "csiphy0_clk_mux" },
138 .interrupt = { "csiphy0" }
143 .regulator = { NULL },
144 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy1_timer" },
145 .clock_rate = { { 0 },
148 { 100000000, 200000000, 266666667 } },
149 .reg = { "csiphy1", "csiphy1_clk_mux" },
150 .interrupt = { "csiphy1" }
155 .regulator = { NULL },
156 .clock = { "top_ahb", "ispif_ahb", "ahb", "csiphy2_timer" },
157 .clock_rate = { { 0 },
160 { 100000000, 200000000, 266666667 } },
161 .reg = { "csiphy2", "csiphy2_clk_mux" },
162 .interrupt = { "csiphy2" }
166 static const struct resources csid_res_8x96[] = {
169 .regulator = { "vdda" },
170 .clock = { "top_ahb", "ispif_ahb", "csi0_ahb", "ahb",
171 "csi0", "csi0_phy", "csi0_pix", "csi0_rdi" },
172 .clock_rate = { { 0 },
176 { 100000000, 200000000, 266666667 },
181 .interrupt = { "csid0" }
186 .regulator = { "vdda" },
187 .clock = { "top_ahb", "ispif_ahb", "csi1_ahb", "ahb",
188 "csi1", "csi1_phy", "csi1_pix", "csi1_rdi" },
189 .clock_rate = { { 0 },
193 { 100000000, 200000000, 266666667 },
198 .interrupt = { "csid1" }
203 .regulator = { "vdda" },
204 .clock = { "top_ahb", "ispif_ahb", "csi2_ahb", "ahb",
205 "csi2", "csi2_phy", "csi2_pix", "csi2_rdi" },
206 .clock_rate = { { 0 },
210 { 100000000, 200000000, 266666667 },
215 .interrupt = { "csid2" }
220 .regulator = { "vdda" },
221 .clock = { "top_ahb", "ispif_ahb", "csi3_ahb", "ahb",
222 "csi3", "csi3_phy", "csi3_pix", "csi3_rdi" },
223 .clock_rate = { { 0 },
227 { 100000000, 200000000, 266666667 },
232 .interrupt = { "csid3" }
236 static const struct resources_ispif ispif_res_8x96 = {
238 .clock = { "top_ahb", "ahb", "ispif_ahb",
239 "csi0", "csi0_pix", "csi0_rdi",
240 "csi1", "csi1_pix", "csi1_rdi",
241 "csi2", "csi2_pix", "csi2_rdi",
242 "csi3", "csi3_pix", "csi3_rdi" },
243 .clock_for_reset = { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" },
244 .reg = { "ispif", "csi_clk_mux" },
248 static const struct resources vfe_res_8x96[] = {
251 .regulator = { NULL },
252 .clock = { "top_ahb", "ahb", "vfe0", "csi_vfe0", "vfe_ahb",
253 "vfe0_ahb", "vfe_axi", "vfe0_stream"},
254 .clock_rate = { { 0 },
256 { 75000000, 100000000, 300000000,
257 320000000, 480000000, 600000000 },
264 .interrupt = { "vfe0" }
269 .regulator = { NULL },
270 .clock = { "top_ahb", "ahb", "vfe1", "csi_vfe1", "vfe_ahb",
271 "vfe1_ahb", "vfe_axi", "vfe1_stream"},
272 .clock_rate = { { 0 },
274 { 75000000, 100000000, 300000000,
275 320000000, 480000000, 600000000 },
282 .interrupt = { "vfe1" }
287 * camss_add_clock_margin - Add margin to clock frequency rate
288 * @rate: Clock frequency rate
290 * When making calculations with physical clock frequency values
291 * some safety margin must be added. Add it.
293 inline void camss_add_clock_margin(u64 *rate)
295 *rate *= CAMSS_CLOCK_MARGIN_NUMERATOR;
296 *rate = div_u64(*rate, CAMSS_CLOCK_MARGIN_DENOMINATOR);
300 * camss_enable_clocks - Enable multiple clocks
301 * @nclocks: Number of clocks in clock array
302 * @clock: Clock array
305 * Return 0 on success or a negative error code otherwise
307 int camss_enable_clocks(int nclocks, struct camss_clock *clock,
313 for (i = 0; i < nclocks; i++) {
314 ret = clk_prepare_enable(clock[i].clk);
316 dev_err(dev, "clock enable failed: %d\n", ret);
324 for (i--; i >= 0; i--)
325 clk_disable_unprepare(clock[i].clk);
331 * camss_disable_clocks - Disable multiple clocks
332 * @nclocks: Number of clocks in clock array
333 * @clock: Clock array
335 void camss_disable_clocks(int nclocks, struct camss_clock *clock)
339 for (i = nclocks - 1; i >= 0; i--)
340 clk_disable_unprepare(clock[i].clk);
344 * camss_find_sensor - Find a linked media entity which represents a sensor
345 * @entity: Media entity to start searching from
347 * Return a pointer to sensor media entity or NULL if not found
349 static struct media_entity *camss_find_sensor(struct media_entity *entity)
351 struct media_pad *pad;
354 pad = &entity->pads[0];
355 if (!(pad->flags & MEDIA_PAD_FL_SINK))
358 pad = media_entity_remote_pad(pad);
359 if (!pad || !is_media_entity_v4l2_subdev(pad->entity))
362 entity = pad->entity;
364 if (entity->function == MEDIA_ENT_F_CAM_SENSOR)
370 * camss_get_pixel_clock - Get pixel clock rate from sensor
371 * @entity: Media entity in the current pipeline
372 * @pixel_clock: Received pixel clock value
374 * Return 0 on success or a negative error code otherwise
376 int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock)
378 struct media_entity *sensor;
379 struct v4l2_subdev *subdev;
380 struct v4l2_ctrl *ctrl;
382 sensor = camss_find_sensor(entity);
386 subdev = media_entity_to_v4l2_subdev(sensor);
388 ctrl = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_PIXEL_RATE);
393 *pixel_clock = v4l2_ctrl_g_ctrl_int64(ctrl);
398 int camss_pm_domain_on(struct camss *camss, int id)
400 if (camss->version == CAMSS_8x96) {
401 camss->genpd_link[id] = device_link_add(camss->dev,
402 camss->genpd[id], DL_FLAG_STATELESS |
403 DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
405 if (!camss->genpd_link[id])
412 void camss_pm_domain_off(struct camss *camss, int id)
414 if (camss->version == CAMSS_8x96)
415 device_link_del(camss->genpd_link[id]);
419 * camss_of_parse_endpoint_node - Parse port endpoint node
421 * @node: Device node to be parsed
422 * @csd: Parsed data from port endpoint node
424 * Return 0 on success or a negative error code on failure
426 static int camss_of_parse_endpoint_node(struct device *dev,
427 struct device_node *node,
428 struct camss_async_subdev *csd)
430 struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg;
431 struct v4l2_fwnode_bus_mipi_csi2 *mipi_csi2;
432 struct v4l2_fwnode_endpoint vep = { { 0 } };
435 v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep);
437 csd->interface.csiphy_id = vep.base.port;
439 mipi_csi2 = &vep.bus.mipi_csi2;
440 lncfg->clk.pos = mipi_csi2->clock_lane;
441 lncfg->clk.pol = mipi_csi2->lane_polarities[0];
442 lncfg->num_data = mipi_csi2->num_data_lanes;
444 lncfg->data = devm_kcalloc(dev,
445 lncfg->num_data, sizeof(*lncfg->data),
450 for (i = 0; i < lncfg->num_data; i++) {
451 lncfg->data[i].pos = mipi_csi2->data_lanes[i];
452 lncfg->data[i].pol = mipi_csi2->lane_polarities[i + 1];
459 * camss_of_parse_ports - Parse ports node
461 * @notifier: v4l2_device notifier data
463 * Return number of "port" nodes found in "ports" node
465 static int camss_of_parse_ports(struct device *dev,
466 struct v4l2_async_notifier *notifier)
468 struct device_node *node = NULL;
469 struct device_node *remote = NULL;
470 unsigned int size, i;
473 while ((node = of_graph_get_next_endpoint(dev->of_node, node)))
474 if (of_device_is_available(node))
475 notifier->num_subdevs++;
478 size = sizeof(*notifier->subdevs) * notifier->num_subdevs;
479 notifier->subdevs = devm_kzalloc(dev, size, GFP_KERNEL);
480 if (!notifier->subdevs) {
481 dev_err(dev, "Failed to allocate memory\n");
486 while ((node = of_graph_get_next_endpoint(dev->of_node, node))) {
487 struct camss_async_subdev *csd;
489 if (!of_device_is_available(node))
492 csd = devm_kzalloc(dev, sizeof(*csd), GFP_KERNEL);
495 dev_err(dev, "Failed to allocate memory\n");
499 notifier->subdevs[i++] = &csd->asd;
501 ret = camss_of_parse_endpoint_node(dev, node, csd);
507 remote = of_graph_get_remote_port_parent(node);
509 dev_err(dev, "Cannot get remote parent\n");
514 csd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
515 csd->asd.match.fwnode = of_fwnode_handle(remote);
519 return notifier->num_subdevs;
523 * camss_init_subdevices - Initialize subdev structures and resources
524 * @camss: CAMSS device
526 * Return 0 on success or a negative error code on failure
528 static int camss_init_subdevices(struct camss *camss)
530 const struct resources *csiphy_res;
531 const struct resources *csid_res;
532 const struct resources_ispif *ispif_res;
533 const struct resources *vfe_res;
537 if (camss->version == CAMSS_8x16) {
538 csiphy_res = csiphy_res_8x16;
539 csid_res = csid_res_8x16;
540 ispif_res = &ispif_res_8x16;
541 vfe_res = vfe_res_8x16;
542 } else if (camss->version == CAMSS_8x96) {
543 csiphy_res = csiphy_res_8x96;
544 csid_res = csid_res_8x96;
545 ispif_res = &ispif_res_8x96;
546 vfe_res = vfe_res_8x96;
551 for (i = 0; i < camss->csiphy_num; i++) {
552 ret = msm_csiphy_subdev_init(camss, &camss->csiphy[i],
556 "Failed to init csiphy%d sub-device: %d\n",
562 for (i = 0; i < camss->csid_num; i++) {
563 ret = msm_csid_subdev_init(camss, &camss->csid[i],
567 "Failed to init csid%d sub-device: %d\n",
573 ret = msm_ispif_subdev_init(&camss->ispif, ispif_res);
575 dev_err(camss->dev, "Failed to init ispif sub-device: %d\n",
580 for (i = 0; i < camss->vfe_num; i++) {
581 ret = msm_vfe_subdev_init(camss, &camss->vfe[i],
585 "Fail to init vfe%d sub-device: %d\n", i, ret);
594 * camss_register_entities - Register subdev nodes and create links
595 * @camss: CAMSS device
597 * Return 0 on success or a negative error code on failure
599 static int camss_register_entities(struct camss *camss)
604 for (i = 0; i < camss->csiphy_num; i++) {
605 ret = msm_csiphy_register_entity(&camss->csiphy[i],
609 "Failed to register csiphy%d entity: %d\n",
615 for (i = 0; i < camss->csid_num; i++) {
616 ret = msm_csid_register_entity(&camss->csid[i],
620 "Failed to register csid%d entity: %d\n",
626 ret = msm_ispif_register_entities(&camss->ispif, &camss->v4l2_dev);
628 dev_err(camss->dev, "Failed to register ispif entities: %d\n",
633 for (i = 0; i < camss->vfe_num; i++) {
634 ret = msm_vfe_register_entities(&camss->vfe[i],
638 "Failed to register vfe%d entities: %d\n",
644 for (i = 0; i < camss->csiphy_num; i++) {
645 for (j = 0; j < camss->csid_num; j++) {
646 ret = media_create_pad_link(
647 &camss->csiphy[i].subdev.entity,
649 &camss->csid[j].subdev.entity,
654 "Failed to link %s->%s entities: %d\n",
655 camss->csiphy[i].subdev.entity.name,
656 camss->csid[j].subdev.entity.name,
663 for (i = 0; i < camss->csid_num; i++) {
664 for (j = 0; j < camss->ispif.line_num; j++) {
665 ret = media_create_pad_link(
666 &camss->csid[i].subdev.entity,
668 &camss->ispif.line[j].subdev.entity,
673 "Failed to link %s->%s entities: %d\n",
674 camss->csid[i].subdev.entity.name,
675 camss->ispif.line[j].subdev.entity.name,
682 for (i = 0; i < camss->ispif.line_num; i++)
683 for (k = 0; k < camss->vfe_num; k++)
684 for (j = 0; j < ARRAY_SIZE(camss->vfe[k].line); j++) {
685 ret = media_create_pad_link(
686 &camss->ispif.line[i].subdev.entity,
688 &camss->vfe[k].line[j].subdev.entity,
693 "Failed to link %s->%s entities: %d\n",
694 camss->ispif.line[i].subdev.entity.name,
695 camss->vfe[k].line[j].subdev.entity.name,
706 for (i--; i >= 0; i--)
707 msm_vfe_unregister_entities(&camss->vfe[i]);
709 msm_ispif_unregister_entities(&camss->ispif);
714 for (i--; i >= 0; i--)
715 msm_csid_unregister_entity(&camss->csid[i]);
717 i = camss->csiphy_num;
719 for (i--; i >= 0; i--)
720 msm_csiphy_unregister_entity(&camss->csiphy[i]);
726 * camss_unregister_entities - Unregister subdev nodes
727 * @camss: CAMSS device
729 * Return 0 on success or a negative error code on failure
731 static void camss_unregister_entities(struct camss *camss)
735 for (i = 0; i < camss->csiphy_num; i++)
736 msm_csiphy_unregister_entity(&camss->csiphy[i]);
738 for (i = 0; i < camss->csid_num; i++)
739 msm_csid_unregister_entity(&camss->csid[i]);
741 msm_ispif_unregister_entities(&camss->ispif);
743 for (i = 0; i < camss->vfe_num; i++)
744 msm_vfe_unregister_entities(&camss->vfe[i]);
747 static int camss_subdev_notifier_bound(struct v4l2_async_notifier *async,
748 struct v4l2_subdev *subdev,
749 struct v4l2_async_subdev *asd)
751 struct camss *camss = container_of(async, struct camss, notifier);
752 struct camss_async_subdev *csd =
753 container_of(asd, struct camss_async_subdev, asd);
754 u8 id = csd->interface.csiphy_id;
755 struct csiphy_device *csiphy = &camss->csiphy[id];
757 csiphy->cfg.csi2 = &csd->interface.csi2;
758 subdev->host_priv = csiphy;
763 static int camss_subdev_notifier_complete(struct v4l2_async_notifier *async)
765 struct camss *camss = container_of(async, struct camss, notifier);
766 struct v4l2_device *v4l2_dev = &camss->v4l2_dev;
767 struct v4l2_subdev *sd;
770 list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
772 struct media_entity *sensor = &sd->entity;
773 struct csiphy_device *csiphy =
774 (struct csiphy_device *) sd->host_priv;
775 struct media_entity *input = &csiphy->subdev.entity;
778 for (i = 0; i < sensor->num_pads; i++) {
779 if (sensor->pads[i].flags & MEDIA_PAD_FL_SOURCE)
782 if (i == sensor->num_pads) {
784 "No source pad in external entity\n");
788 ret = media_create_pad_link(sensor, i,
789 input, MSM_CSIPHY_PAD_SINK,
790 MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
793 "Failed to link %s->%s entities: %d\n",
794 sensor->name, input->name, ret);
800 ret = v4l2_device_register_subdev_nodes(&camss->v4l2_dev);
804 return media_device_register(&camss->media_dev);
807 static const struct v4l2_async_notifier_operations camss_subdev_notifier_ops = {
808 .bound = camss_subdev_notifier_bound,
809 .complete = camss_subdev_notifier_complete,
812 static const struct media_device_ops camss_media_ops = {
813 .link_notify = v4l2_pipeline_link_notify,
817 * camss_probe - Probe CAMSS platform device
818 * @pdev: Pointer to CAMSS platform device
820 * Return 0 on success or a negative error code on failure
822 static int camss_probe(struct platform_device *pdev)
824 struct device *dev = &pdev->dev;
828 camss = kzalloc(sizeof(*camss), GFP_KERNEL);
832 atomic_set(&camss->ref_count, 0);
834 platform_set_drvdata(pdev, camss);
836 if (of_device_is_compatible(dev->of_node, "qcom,msm8916-camss")) {
837 camss->version = CAMSS_8x16;
838 camss->csiphy_num = 2;
841 } else if (of_device_is_compatible(dev->of_node,
842 "qcom,msm8996-camss")) {
843 camss->version = CAMSS_8x96;
844 camss->csiphy_num = 3;
851 camss->csiphy = devm_kcalloc(dev, camss->csiphy_num,
852 sizeof(*camss->csiphy), GFP_KERNEL);
856 camss->csid = devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid),
861 camss->vfe = devm_kcalloc(dev, camss->vfe_num, sizeof(*camss->vfe),
866 ret = camss_of_parse_ports(dev, &camss->notifier);
870 ret = camss_init_subdevices(camss);
874 ret = dma_set_mask_and_coherent(dev, 0xffffffff);
878 camss->media_dev.dev = camss->dev;
879 strlcpy(camss->media_dev.model, "Qualcomm Camera Subsystem",
880 sizeof(camss->media_dev.model));
881 camss->media_dev.ops = &camss_media_ops;
882 media_device_init(&camss->media_dev);
884 camss->v4l2_dev.mdev = &camss->media_dev;
885 ret = v4l2_device_register(camss->dev, &camss->v4l2_dev);
887 dev_err(dev, "Failed to register V4L2 device: %d\n", ret);
891 ret = camss_register_entities(camss);
893 goto err_register_entities;
895 if (camss->notifier.num_subdevs) {
896 camss->notifier.ops = &camss_subdev_notifier_ops;
898 ret = v4l2_async_notifier_register(&camss->v4l2_dev,
902 "Failed to register async subdev nodes: %d\n",
904 goto err_register_subdevs;
907 ret = v4l2_device_register_subdev_nodes(&camss->v4l2_dev);
909 dev_err(dev, "Failed to register subdev nodes: %d\n",
911 goto err_register_subdevs;
914 ret = media_device_register(&camss->media_dev);
916 dev_err(dev, "Failed to register media device: %d\n",
918 goto err_register_subdevs;
922 if (camss->version == CAMSS_8x96) {
923 camss->genpd[PM_DOMAIN_VFE0] = dev_pm_domain_attach_by_id(
924 camss->dev, PM_DOMAIN_VFE0);
925 if (IS_ERR(camss->genpd[PM_DOMAIN_VFE0]))
926 return PTR_ERR(camss->genpd[PM_DOMAIN_VFE0]);
928 camss->genpd[PM_DOMAIN_VFE1] = dev_pm_domain_attach_by_id(
929 camss->dev, PM_DOMAIN_VFE1);
930 if (IS_ERR(camss->genpd[PM_DOMAIN_VFE1])) {
931 dev_pm_domain_detach(camss->genpd[PM_DOMAIN_VFE0],
933 return PTR_ERR(camss->genpd[PM_DOMAIN_VFE1]);
937 pm_runtime_enable(dev);
941 err_register_subdevs:
942 camss_unregister_entities(camss);
943 err_register_entities:
944 v4l2_device_unregister(&camss->v4l2_dev);
949 void camss_delete(struct camss *camss)
951 v4l2_device_unregister(&camss->v4l2_dev);
952 media_device_unregister(&camss->media_dev);
953 media_device_cleanup(&camss->media_dev);
955 pm_runtime_disable(camss->dev);
957 if (camss->version == CAMSS_8x96) {
958 dev_pm_domain_detach(camss->genpd[PM_DOMAIN_VFE0], true);
959 dev_pm_domain_detach(camss->genpd[PM_DOMAIN_VFE1], true);
966 * camss_remove - Remove CAMSS platform device
967 * @pdev: Pointer to CAMSS platform device
971 static int camss_remove(struct platform_device *pdev)
975 struct camss *camss = platform_get_drvdata(pdev);
977 for (i = 0; i < camss->vfe_num; i++)
978 msm_vfe_stop_streaming(&camss->vfe[i]);
980 v4l2_async_notifier_unregister(&camss->notifier);
981 camss_unregister_entities(camss);
983 if (atomic_read(&camss->ref_count) == 0)
989 static const struct of_device_id camss_dt_match[] = {
990 { .compatible = "qcom,msm8916-camss" },
991 { .compatible = "qcom,msm8996-camss" },
995 MODULE_DEVICE_TABLE(of, camss_dt_match);
997 static int __maybe_unused camss_runtime_suspend(struct device *dev)
1002 static int __maybe_unused camss_runtime_resume(struct device *dev)
1007 static const struct dev_pm_ops camss_pm_ops = {
1008 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1009 pm_runtime_force_resume)
1010 SET_RUNTIME_PM_OPS(camss_runtime_suspend, camss_runtime_resume, NULL)
1013 static struct platform_driver qcom_camss_driver = {
1014 .probe = camss_probe,
1015 .remove = camss_remove,
1017 .name = "qcom-camss",
1018 .of_match_table = camss_dt_match,
1019 .pm = &camss_pm_ops,
1023 module_platform_driver(qcom_camss_driver);
1025 MODULE_ALIAS("platform:qcom-camss");
1026 MODULE_DESCRIPTION("Qualcomm Camera Subsystem driver");
1027 MODULE_AUTHOR("Todor Tomov <todor.tomov@linaro.org>");
1028 MODULE_LICENSE("GPL v2");