1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * S5P/EXYNOS4 SoC series camera host interface media device driver
5 * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
6 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
10 #include <linux/clk.h>
11 #include <linux/clk-provider.h>
12 #include <linux/device.h>
13 #include <linux/errno.h>
14 #include <linux/i2c.h>
15 #include <linux/kernel.h>
16 #include <linux/list.h>
17 #include <linux/module.h>
19 #include <linux/of_platform.h>
20 #include <linux/of_device.h>
21 #include <linux/of_graph.h>
22 #include <linux/platform_device.h>
23 #include <linux/pm_runtime.h>
24 #include <linux/types.h>
25 #include <linux/slab.h>
26 #include <media/v4l2-async.h>
27 #include <media/v4l2-ctrls.h>
28 #include <media/v4l2-fwnode.h>
29 #include <media/media-device.h>
30 #include <media/drv-intf/exynos-fimc.h>
32 #include "media-dev.h"
33 #include "fimc-core.h"
35 #include "fimc-lite.h"
36 #include "mipi-csis.h"
38 /* Set up image sensor subdev -> FIMC capture node notifications. */
39 static void __setup_sensor_notification(struct fimc_md
*fmd
,
40 struct v4l2_subdev
*sensor
,
41 struct v4l2_subdev
*fimc_sd
)
43 struct fimc_source_info
*src_inf
;
44 struct fimc_sensor_info
*md_si
;
47 src_inf
= v4l2_get_subdev_hostdata(sensor
);
48 if (!src_inf
|| WARN_ON(fmd
== NULL
))
51 md_si
= source_to_sensor_info(src_inf
);
52 spin_lock_irqsave(&fmd
->slock
, flags
);
53 md_si
->host
= v4l2_get_subdevdata(fimc_sd
);
54 spin_unlock_irqrestore(&fmd
->slock
, flags
);
58 * fimc_pipeline_prepare - update pipeline information with subdevice pointers
60 * @me: media entity terminating the pipeline
62 * Caller holds the graph mutex.
64 static void fimc_pipeline_prepare(struct fimc_pipeline
*p
,
65 struct media_entity
*me
)
67 struct fimc_md
*fmd
= entity_to_fimc_mdev(me
);
68 struct v4l2_subdev
*sd
;
69 struct v4l2_subdev
*sensor
= NULL
;
72 for (i
= 0; i
< IDX_MAX
; i
++)
76 struct media_pad
*pad
= NULL
;
78 /* Find remote source pad */
79 for (i
= 0; i
< me
->num_pads
; i
++) {
80 struct media_pad
*spad
= &me
->pads
[i
];
81 if (!(spad
->flags
& MEDIA_PAD_FL_SINK
))
83 pad
= media_entity_remote_pad(spad
);
88 if (!pad
|| !is_media_entity_v4l2_subdev(pad
->entity
))
90 sd
= media_entity_to_v4l2_subdev(pad
->entity
);
96 case GRP_ID_FIMC_IS_SENSOR
:
97 p
->subdevs
[IDX_SENSOR
] = sd
;
100 p
->subdevs
[IDX_CSIS
] = sd
;
103 p
->subdevs
[IDX_FLITE
] = sd
;
106 p
->subdevs
[IDX_FIMC
] = sd
;
109 p
->subdevs
[IDX_IS_ISP
] = sd
;
115 if (me
->num_pads
== 1)
119 if (sensor
&& p
->subdevs
[IDX_FIMC
])
120 __setup_sensor_notification(fmd
, sensor
, p
->subdevs
[IDX_FIMC
]);
124 * __subdev_set_power - change power state of a single subdev
125 * @sd: subdevice to change power state for
126 * @on: 1 to enable power or 0 to disable
128 * Return result of s_power subdev operation or -ENXIO if sd argument
129 * is NULL. Return 0 if the subdevice does not implement s_power.
131 static int __subdev_set_power(struct v4l2_subdev
*sd
, int on
)
139 use_count
= &sd
->entity
.use_count
;
140 if (on
&& (*use_count
)++ > 0)
142 else if (!on
&& (*use_count
== 0 || --(*use_count
) > 0))
144 ret
= v4l2_subdev_call(sd
, core
, s_power
, on
);
146 return ret
!= -ENOIOCTLCMD
? ret
: 0;
150 * fimc_pipeline_s_power - change power state of all pipeline subdevs
151 * @p: fimc device terminating the pipeline
152 * @on: true to power on, false to power off
154 * Needs to be called with the graph mutex held.
156 static int fimc_pipeline_s_power(struct fimc_pipeline
*p
, bool on
)
158 static const u8 seq
[2][IDX_MAX
- 1] = {
159 { IDX_IS_ISP
, IDX_SENSOR
, IDX_CSIS
, IDX_FLITE
},
160 { IDX_CSIS
, IDX_FLITE
, IDX_SENSOR
, IDX_IS_ISP
},
164 if (p
->subdevs
[IDX_SENSOR
] == NULL
)
167 for (i
= 0; i
< IDX_MAX
- 1; i
++) {
168 unsigned int idx
= seq
[on
][i
];
170 ret
= __subdev_set_power(p
->subdevs
[idx
], on
);
173 if (ret
< 0 && ret
!= -ENXIO
)
178 for (; i
>= 0; i
--) {
179 unsigned int idx
= seq
[on
][i
];
180 __subdev_set_power(p
->subdevs
[idx
], !on
);
186 * __fimc_pipeline_enable - enable power of all pipeline subdevs
187 * and the sensor clock
188 * @ep: video pipeline structure
189 * @fmd: fimc media device
191 * Called with the graph mutex held.
193 static int __fimc_pipeline_enable(struct exynos_media_pipeline
*ep
,
196 struct fimc_pipeline
*p
= to_fimc_pipeline(ep
);
199 /* Enable PXLASYNC clock if this pipeline includes FIMC-IS */
200 if (!IS_ERR(fmd
->wbclk
[CLK_IDX_WB_B
]) && p
->subdevs
[IDX_IS_ISP
]) {
201 ret
= clk_prepare_enable(fmd
->wbclk
[CLK_IDX_WB_B
]);
206 ret
= fimc_pipeline_s_power(p
, 1);
210 if (!IS_ERR(fmd
->wbclk
[CLK_IDX_WB_B
]) && p
->subdevs
[IDX_IS_ISP
])
211 clk_disable_unprepare(fmd
->wbclk
[CLK_IDX_WB_B
]);
217 * __fimc_pipeline_open - update the pipeline information, enable power
218 * of all pipeline subdevs and the sensor clock
219 * @ep: fimc device terminating the pipeline
220 * @me: media entity to start graph walk with
221 * @prepare: true to walk the current pipeline and acquire all subdevs
223 * Called with the graph mutex held.
225 static int __fimc_pipeline_open(struct exynos_media_pipeline
*ep
,
226 struct media_entity
*me
, bool prepare
)
228 struct fimc_md
*fmd
= entity_to_fimc_mdev(me
);
229 struct fimc_pipeline
*p
= to_fimc_pipeline(ep
);
230 struct v4l2_subdev
*sd
;
232 if (WARN_ON(p
== NULL
|| me
== NULL
))
236 fimc_pipeline_prepare(p
, me
);
238 sd
= p
->subdevs
[IDX_SENSOR
];
240 pr_warn("%s(): No sensor subdev\n", __func__
);
242 * Pipeline open cannot fail so as to make it possible
243 * for the user space to configure the pipeline.
248 return __fimc_pipeline_enable(ep
, fmd
);
252 * __fimc_pipeline_close - disable the sensor clock and pipeline power
253 * @ep: fimc device terminating the pipeline
255 * Disable power of all subdevs and turn the external sensor clock off.
257 static int __fimc_pipeline_close(struct exynos_media_pipeline
*ep
)
259 struct fimc_pipeline
*p
= to_fimc_pipeline(ep
);
260 struct v4l2_subdev
*sd
= p
? p
->subdevs
[IDX_SENSOR
] : NULL
;
265 pr_warn("%s(): No sensor subdev\n", __func__
);
269 ret
= fimc_pipeline_s_power(p
, 0);
271 fmd
= entity_to_fimc_mdev(&sd
->entity
);
273 /* Disable PXLASYNC clock if this pipeline includes FIMC-IS */
274 if (!IS_ERR(fmd
->wbclk
[CLK_IDX_WB_B
]) && p
->subdevs
[IDX_IS_ISP
])
275 clk_disable_unprepare(fmd
->wbclk
[CLK_IDX_WB_B
]);
277 return ret
== -ENXIO
? 0 : ret
;
281 * __fimc_pipeline_s_stream - call s_stream() on pipeline subdevs
282 * @ep: video pipeline structure
283 * @on: passed as the s_stream() callback argument
285 static int __fimc_pipeline_s_stream(struct exynos_media_pipeline
*ep
, bool on
)
287 static const u8 seq
[2][IDX_MAX
] = {
288 { IDX_FIMC
, IDX_SENSOR
, IDX_IS_ISP
, IDX_CSIS
, IDX_FLITE
},
289 { IDX_CSIS
, IDX_FLITE
, IDX_FIMC
, IDX_SENSOR
, IDX_IS_ISP
},
291 struct fimc_pipeline
*p
= to_fimc_pipeline(ep
);
292 struct fimc_md
*fmd
= entity_to_fimc_mdev(&p
->subdevs
[IDX_CSIS
]->entity
);
293 enum fimc_subdev_index sd_id
;
296 if (p
->subdevs
[IDX_SENSOR
] == NULL
) {
297 if (!fmd
->user_subdev_api
) {
299 * Sensor must be already discovered if we
300 * aren't in the user_subdev_api mode
305 /* Get pipeline sink entity */
306 if (p
->subdevs
[IDX_FIMC
])
308 else if (p
->subdevs
[IDX_IS_ISP
])
310 else if (p
->subdevs
[IDX_FLITE
])
316 * Sensor could have been linked between open and STREAMON -
317 * check if this is the case.
319 fimc_pipeline_prepare(p
, &p
->subdevs
[sd_id
]->entity
);
321 if (p
->subdevs
[IDX_SENSOR
] == NULL
)
324 ret
= __fimc_pipeline_enable(ep
, fmd
);
330 for (i
= 0; i
< IDX_MAX
; i
++) {
331 unsigned int idx
= seq
[on
][i
];
333 ret
= v4l2_subdev_call(p
->subdevs
[idx
], video
, s_stream
, on
);
335 if (ret
< 0 && ret
!= -ENOIOCTLCMD
&& ret
!= -ENODEV
)
341 fimc_pipeline_s_power(p
, !on
);
342 for (; i
>= 0; i
--) {
343 unsigned int idx
= seq
[on
][i
];
344 v4l2_subdev_call(p
->subdevs
[idx
], video
, s_stream
, !on
);
349 /* Media pipeline operations for the FIMC/FIMC-LITE video device driver */
350 static const struct exynos_media_pipeline_ops fimc_pipeline_ops
= {
351 .open
= __fimc_pipeline_open
,
352 .close
= __fimc_pipeline_close
,
353 .set_stream
= __fimc_pipeline_s_stream
,
356 static struct exynos_media_pipeline
*fimc_md_pipeline_create(
359 struct fimc_pipeline
*p
;
361 p
= kzalloc(sizeof(*p
), GFP_KERNEL
);
365 list_add_tail(&p
->list
, &fmd
->pipelines
);
367 p
->ep
.ops
= &fimc_pipeline_ops
;
371 static void fimc_md_pipelines_free(struct fimc_md
*fmd
)
373 while (!list_empty(&fmd
->pipelines
)) {
374 struct fimc_pipeline
*p
;
376 p
= list_entry(fmd
->pipelines
.next
, typeof(*p
), list
);
382 /* Parse port node and register as a sub-device any sensor specified there. */
383 static int fimc_md_parse_port_node(struct fimc_md
*fmd
,
384 struct device_node
*port
,
387 struct fimc_source_info
*pd
= &fmd
->sensor
[index
].pdata
;
388 struct device_node
*rem
, *ep
, *np
;
389 struct v4l2_fwnode_endpoint endpoint
= { .bus_type
= 0 };
392 /* Assume here a port node can have only one endpoint node. */
393 ep
= of_get_next_child(port
, NULL
);
397 ret
= v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep
), &endpoint
);
403 if (WARN_ON(endpoint
.base
.port
== 0) || index
>= FIMC_MAX_SENSORS
) {
408 pd
->mux_id
= (endpoint
.base
.port
- 1) & 0x1;
410 rem
= of_graph_get_remote_port_parent(ep
);
413 v4l2_info(&fmd
->v4l2_dev
, "Remote device at %pOF not found\n",
418 if (fimc_input_is_parallel(endpoint
.base
.port
)) {
419 if (endpoint
.bus_type
== V4L2_MBUS_PARALLEL
)
420 pd
->sensor_bus_type
= FIMC_BUS_TYPE_ITU_601
;
422 pd
->sensor_bus_type
= FIMC_BUS_TYPE_ITU_656
;
423 pd
->flags
= endpoint
.bus
.parallel
.flags
;
424 } else if (fimc_input_is_mipi_csi(endpoint
.base
.port
)) {
426 * MIPI CSI-2: only input mux selection and
427 * the sensor's clock frequency is needed.
429 pd
->sensor_bus_type
= FIMC_BUS_TYPE_MIPI_CSI2
;
431 v4l2_err(&fmd
->v4l2_dev
, "Wrong port id (%u) at node %pOF\n",
432 endpoint
.base
.port
, rem
);
435 * For FIMC-IS handled sensors, that are placed under i2c-isp device
436 * node, FIMC is connected to the FIMC-IS through its ISP Writeback
437 * input. Sensors are attached to the FIMC-LITE hostdata interface
438 * directly or through MIPI-CSIS, depending on the external media bus
439 * used. This needs to be handled in a more reliable way, not by just
440 * checking parent's node name.
442 np
= of_get_parent(rem
);
444 if (of_node_name_eq(np
, "i2c-isp"))
445 pd
->fimc_bus_type
= FIMC_BUS_TYPE_ISP_WRITEBACK
;
447 pd
->fimc_bus_type
= pd
->sensor_bus_type
;
450 if (WARN_ON(index
>= ARRAY_SIZE(fmd
->sensor
))) {
455 fmd
->sensor
[index
].asd
.match_type
= V4L2_ASYNC_MATCH_FWNODE
;
456 fmd
->sensor
[index
].asd
.match
.fwnode
= of_fwnode_handle(rem
);
458 ret
= v4l2_async_notifier_add_subdev(&fmd
->subdev_notifier
,
459 &fmd
->sensor
[index
].asd
);
470 /* Register all SoC external sub-devices */
471 static int fimc_md_register_sensor_entities(struct fimc_md
*fmd
)
473 struct device_node
*parent
= fmd
->pdev
->dev
.of_node
;
474 struct device_node
*ports
= NULL
;
475 struct device_node
*node
;
480 * Runtime resume one of the FIMC entities to make sure
481 * the sclk_cam clocks are not globally disabled.
486 ret
= pm_runtime_get_sync(fmd
->pmf
);
490 fmd
->num_sensors
= 0;
492 /* Attach sensors linked to MIPI CSI-2 receivers */
493 for_each_available_child_of_node(parent
, node
) {
494 struct device_node
*port
;
496 if (!of_node_name_eq(node
, "csis"))
498 /* The csis node can have only port subnode. */
499 port
= of_get_next_child(node
, NULL
);
503 ret
= fimc_md_parse_port_node(fmd
, port
, index
);
512 /* Attach sensors listed in the parallel-ports node */
513 ports
= of_get_child_by_name(parent
, "parallel-ports");
517 for_each_child_of_node(ports
, node
) {
518 ret
= fimc_md_parse_port_node(fmd
, node
, index
);
528 pm_runtime_put(fmd
->pmf
);
533 v4l2_async_notifier_cleanup(&fmd
->subdev_notifier
);
534 pm_runtime_put(fmd
->pmf
);
538 static int __of_get_csis_id(struct device_node
*np
)
542 np
= of_get_child_by_name(np
, "port");
545 of_property_read_u32(np
, "reg", ®
);
547 return reg
- FIMC_INPUT_MIPI_CSI2_0
;
551 * MIPI-CSIS, FIMC and FIMC-LITE platform devices registration.
553 static int register_fimc_lite_entity(struct fimc_md
*fmd
,
554 struct fimc_lite
*fimc_lite
)
556 struct v4l2_subdev
*sd
;
557 struct exynos_media_pipeline
*ep
;
560 if (WARN_ON(fimc_lite
->index
>= FIMC_LITE_MAX_DEVS
||
561 fmd
->fimc_lite
[fimc_lite
->index
]))
564 sd
= &fimc_lite
->subdev
;
565 sd
->grp_id
= GRP_ID_FLITE
;
567 ep
= fimc_md_pipeline_create(fmd
);
571 v4l2_set_subdev_hostdata(sd
, ep
);
573 ret
= v4l2_device_register_subdev(&fmd
->v4l2_dev
, sd
);
575 fmd
->fimc_lite
[fimc_lite
->index
] = fimc_lite
;
577 v4l2_err(&fmd
->v4l2_dev
, "Failed to register FIMC.LITE%d\n",
582 static int register_fimc_entity(struct fimc_md
*fmd
, struct fimc_dev
*fimc
)
584 struct v4l2_subdev
*sd
;
585 struct exynos_media_pipeline
*ep
;
588 if (WARN_ON(fimc
->id
>= FIMC_MAX_DEVS
|| fmd
->fimc
[fimc
->id
]))
591 sd
= &fimc
->vid_cap
.subdev
;
592 sd
->grp_id
= GRP_ID_FIMC
;
594 ep
= fimc_md_pipeline_create(fmd
);
598 v4l2_set_subdev_hostdata(sd
, ep
);
600 ret
= v4l2_device_register_subdev(&fmd
->v4l2_dev
, sd
);
602 if (!fmd
->pmf
&& fimc
->pdev
)
603 fmd
->pmf
= &fimc
->pdev
->dev
;
604 fmd
->fimc
[fimc
->id
] = fimc
;
605 fimc
->vid_cap
.user_subdev_api
= fmd
->user_subdev_api
;
607 v4l2_err(&fmd
->v4l2_dev
, "Failed to register FIMC.%d (%d)\n",
613 static int register_csis_entity(struct fimc_md
*fmd
,
614 struct platform_device
*pdev
,
615 struct v4l2_subdev
*sd
)
617 struct device_node
*node
= pdev
->dev
.of_node
;
620 id
= node
? __of_get_csis_id(node
) : max(0, pdev
->id
);
622 if (WARN_ON(id
< 0 || id
>= CSIS_MAX_ENTITIES
))
625 if (WARN_ON(fmd
->csis
[id
].sd
))
628 sd
->grp_id
= GRP_ID_CSIS
;
629 ret
= v4l2_device_register_subdev(&fmd
->v4l2_dev
, sd
);
631 fmd
->csis
[id
].sd
= sd
;
633 v4l2_err(&fmd
->v4l2_dev
,
634 "Failed to register MIPI-CSIS.%d (%d)\n", id
, ret
);
638 static int register_fimc_is_entity(struct fimc_md
*fmd
, struct fimc_is
*is
)
640 struct v4l2_subdev
*sd
= &is
->isp
.subdev
;
641 struct exynos_media_pipeline
*ep
;
644 /* Allocate pipeline object for the ISP capture video node. */
645 ep
= fimc_md_pipeline_create(fmd
);
649 v4l2_set_subdev_hostdata(sd
, ep
);
651 ret
= v4l2_device_register_subdev(&fmd
->v4l2_dev
, sd
);
653 v4l2_err(&fmd
->v4l2_dev
,
654 "Failed to register FIMC-ISP (%d)\n", ret
);
662 static int fimc_md_register_platform_entity(struct fimc_md
*fmd
,
663 struct platform_device
*pdev
,
666 struct device
*dev
= &pdev
->dev
;
667 int ret
= -EPROBE_DEFER
;
670 /* Lock to ensure dev->driver won't change. */
673 if (!dev
->driver
|| !try_module_get(dev
->driver
->owner
))
676 drvdata
= dev_get_drvdata(dev
);
677 /* Some subdev didn't probe successfully id drvdata is NULL */
679 switch (plat_entity
) {
681 ret
= register_fimc_entity(fmd
, drvdata
);
684 ret
= register_fimc_lite_entity(fmd
, drvdata
);
687 ret
= register_csis_entity(fmd
, pdev
, drvdata
);
690 ret
= register_fimc_is_entity(fmd
, drvdata
);
697 module_put(dev
->driver
->owner
);
700 if (ret
== -EPROBE_DEFER
)
701 dev_info(&fmd
->pdev
->dev
, "deferring %s device registration\n",
704 dev_err(&fmd
->pdev
->dev
, "%s device registration failed (%d)\n",
709 /* Register FIMC, FIMC-LITE and CSIS media entities */
710 static int fimc_md_register_platform_entities(struct fimc_md
*fmd
,
711 struct device_node
*parent
)
713 struct device_node
*node
;
716 for_each_available_child_of_node(parent
, node
) {
717 struct platform_device
*pdev
;
718 int plat_entity
= -1;
720 pdev
= of_find_device_by_node(node
);
724 /* If driver of any entity isn't ready try all again later. */
725 if (of_node_name_eq(node
, CSIS_OF_NODE_NAME
))
726 plat_entity
= IDX_CSIS
;
727 else if (of_node_name_eq(node
, FIMC_IS_OF_NODE_NAME
))
728 plat_entity
= IDX_IS_ISP
;
729 else if (of_node_name_eq(node
, FIMC_LITE_OF_NODE_NAME
))
730 plat_entity
= IDX_FLITE
;
731 else if (of_node_name_eq(node
, FIMC_OF_NODE_NAME
) &&
732 !of_property_read_bool(node
, "samsung,lcd-wb"))
733 plat_entity
= IDX_FIMC
;
735 if (plat_entity
>= 0)
736 ret
= fimc_md_register_platform_entity(fmd
, pdev
,
738 put_device(&pdev
->dev
);
748 static void fimc_md_unregister_entities(struct fimc_md
*fmd
)
752 for (i
= 0; i
< FIMC_MAX_DEVS
; i
++) {
753 struct fimc_dev
*dev
= fmd
->fimc
[i
];
756 v4l2_device_unregister_subdev(&dev
->vid_cap
.subdev
);
757 dev
->vid_cap
.ve
.pipe
= NULL
;
760 for (i
= 0; i
< FIMC_LITE_MAX_DEVS
; i
++) {
761 struct fimc_lite
*dev
= fmd
->fimc_lite
[i
];
764 v4l2_device_unregister_subdev(&dev
->subdev
);
766 fmd
->fimc_lite
[i
] = NULL
;
768 for (i
= 0; i
< CSIS_MAX_ENTITIES
; i
++) {
769 if (fmd
->csis
[i
].sd
== NULL
)
771 v4l2_device_unregister_subdev(fmd
->csis
[i
].sd
);
772 fmd
->csis
[i
].sd
= NULL
;
776 v4l2_device_unregister_subdev(&fmd
->fimc_is
->isp
.subdev
);
778 v4l2_info(&fmd
->v4l2_dev
, "Unregistered all entities\n");
782 * __fimc_md_create_fimc_links - create links to all FIMC entities
783 * @fmd: fimc media device
784 * @source: the source entity to create links to all fimc entities from
785 * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null
786 * @pad: the source entity pad index
787 * @link_mask: bitmask of the fimc devices for which link should be enabled
789 static int __fimc_md_create_fimc_sink_links(struct fimc_md
*fmd
,
790 struct media_entity
*source
,
791 struct v4l2_subdev
*sensor
,
792 int pad
, int link_mask
)
794 struct fimc_source_info
*si
= NULL
;
795 struct media_entity
*sink
;
796 unsigned int flags
= 0;
800 si
= v4l2_get_subdev_hostdata(sensor
);
801 /* Skip direct FIMC links in the logical FIMC-IS sensor path */
802 if (si
&& si
->fimc_bus_type
== FIMC_BUS_TYPE_ISP_WRITEBACK
)
806 for (i
= 0; !ret
&& i
< FIMC_MAX_DEVS
; i
++) {
810 * Some FIMC variants are not fitted with camera capture
811 * interface. Skip creating a link from sensor for those.
813 if (!fmd
->fimc
[i
]->variant
->has_cam_if
)
816 flags
= ((1 << i
) & link_mask
) ? MEDIA_LNK_FL_ENABLED
: 0;
818 sink
= &fmd
->fimc
[i
]->vid_cap
.subdev
.entity
;
819 ret
= media_create_pad_link(source
, pad
, sink
,
820 FIMC_SD_PAD_SINK_CAM
, flags
);
824 /* Notify FIMC capture subdev entity */
825 ret
= media_entity_call(sink
, link_setup
, &sink
->pads
[0],
826 &source
->pads
[pad
], flags
);
830 v4l2_info(&fmd
->v4l2_dev
, "created link [%s] %c> [%s]\n",
831 source
->name
, flags
? '=' : '-', sink
->name
);
834 for (i
= 0; i
< FIMC_LITE_MAX_DEVS
; i
++) {
835 if (!fmd
->fimc_lite
[i
])
838 sink
= &fmd
->fimc_lite
[i
]->subdev
.entity
;
839 ret
= media_create_pad_link(source
, pad
, sink
,
840 FLITE_SD_PAD_SINK
, 0);
844 /* Notify FIMC-LITE subdev entity */
845 ret
= media_entity_call(sink
, link_setup
, &sink
->pads
[0],
846 &source
->pads
[pad
], 0);
850 v4l2_info(&fmd
->v4l2_dev
, "created link [%s] -> [%s]\n",
851 source
->name
, sink
->name
);
856 /* Create links from FIMC-LITE source pads to other entities */
857 static int __fimc_md_create_flite_source_links(struct fimc_md
*fmd
)
859 struct media_entity
*source
, *sink
;
862 for (i
= 0; i
< FIMC_LITE_MAX_DEVS
; i
++) {
863 struct fimc_lite
*fimc
= fmd
->fimc_lite
[i
];
868 source
= &fimc
->subdev
.entity
;
869 sink
= &fimc
->ve
.vdev
.entity
;
870 /* FIMC-LITE's subdev and video node */
871 ret
= media_create_pad_link(source
, FLITE_SD_PAD_SOURCE_DMA
,
875 /* Link from FIMC-LITE to IS-ISP subdev */
876 sink
= &fmd
->fimc_is
->isp
.subdev
.entity
;
877 ret
= media_create_pad_link(source
, FLITE_SD_PAD_SOURCE_ISP
,
886 /* Create FIMC-IS links */
887 static int __fimc_md_create_fimc_is_links(struct fimc_md
*fmd
)
889 struct fimc_isp
*isp
= &fmd
->fimc_is
->isp
;
890 struct media_entity
*source
, *sink
;
893 source
= &isp
->subdev
.entity
;
895 for (i
= 0; i
< FIMC_MAX_DEVS
; i
++) {
896 if (fmd
->fimc
[i
] == NULL
)
899 /* Link from FIMC-IS-ISP subdev to FIMC */
900 sink
= &fmd
->fimc
[i
]->vid_cap
.subdev
.entity
;
901 ret
= media_create_pad_link(source
, FIMC_ISP_SD_PAD_SRC_FIFO
,
902 sink
, FIMC_SD_PAD_SINK_FIFO
, 0);
907 /* Link from FIMC-IS-ISP subdev to fimc-is-isp.capture video node */
908 sink
= &isp
->video_capture
.ve
.vdev
.entity
;
910 /* Skip this link if the fimc-is-isp video node driver isn't built-in */
911 if (sink
->num_pads
== 0)
914 return media_create_pad_link(source
, FIMC_ISP_SD_PAD_SRC_DMA
,
919 * fimc_md_create_links - create default links between registered entities
920 * @fmd: fimc media device
922 * Parallel interface sensor entities are connected directly to FIMC capture
923 * entities. The sensors using MIPI CSIS bus are connected through immutable
924 * link with CSI receiver entity specified by mux_id. Any registered CSIS
925 * entity has a link to each registered FIMC capture entity. Enabled links
926 * are created by default between each subsequent registered sensor and
927 * subsequent FIMC capture entity. The number of default active links is
928 * determined by the number of available sensors or FIMC entities,
931 static int fimc_md_create_links(struct fimc_md
*fmd
)
933 struct v4l2_subdev
*csi_sensors
[CSIS_MAX_ENTITIES
] = { NULL
};
934 struct v4l2_subdev
*sensor
, *csis
;
935 struct fimc_source_info
*pdata
;
936 struct media_entity
*source
, *sink
;
937 int i
, pad
, fimc_id
= 0, ret
= 0;
938 u32 flags
, link_mask
= 0;
940 for (i
= 0; i
< fmd
->num_sensors
; i
++) {
941 if (fmd
->sensor
[i
].subdev
== NULL
)
944 sensor
= fmd
->sensor
[i
].subdev
;
945 pdata
= v4l2_get_subdev_hostdata(sensor
);
951 switch (pdata
->sensor_bus_type
) {
952 case FIMC_BUS_TYPE_MIPI_CSI2
:
953 if (WARN(pdata
->mux_id
>= CSIS_MAX_ENTITIES
,
954 "Wrong CSI channel id: %d\n", pdata
->mux_id
))
957 csis
= fmd
->csis
[pdata
->mux_id
].sd
;
958 if (WARN(csis
== NULL
,
959 "MIPI-CSI interface specified but s5p-csis module is not loaded!\n"))
962 pad
= sensor
->entity
.num_pads
- 1;
963 ret
= media_create_pad_link(&sensor
->entity
, pad
,
964 &csis
->entity
, CSIS_PAD_SINK
,
965 MEDIA_LNK_FL_IMMUTABLE
|
966 MEDIA_LNK_FL_ENABLED
);
970 v4l2_info(&fmd
->v4l2_dev
, "created link [%s] => [%s]\n",
971 sensor
->entity
.name
, csis
->entity
.name
);
974 csi_sensors
[pdata
->mux_id
] = sensor
;
977 case FIMC_BUS_TYPE_ITU_601
...FIMC_BUS_TYPE_ITU_656
:
978 source
= &sensor
->entity
;
983 v4l2_err(&fmd
->v4l2_dev
, "Wrong bus_type: %x\n",
984 pdata
->sensor_bus_type
);
990 link_mask
= 1 << fimc_id
++;
991 ret
= __fimc_md_create_fimc_sink_links(fmd
, source
, sensor
,
995 for (i
= 0; i
< CSIS_MAX_ENTITIES
; i
++) {
996 if (fmd
->csis
[i
].sd
== NULL
)
999 source
= &fmd
->csis
[i
].sd
->entity
;
1000 pad
= CSIS_PAD_SOURCE
;
1001 sensor
= csi_sensors
[i
];
1003 link_mask
= 1 << fimc_id
++;
1004 ret
= __fimc_md_create_fimc_sink_links(fmd
, source
, sensor
,
1008 /* Create immutable links between each FIMC's subdev and video node */
1009 flags
= MEDIA_LNK_FL_IMMUTABLE
| MEDIA_LNK_FL_ENABLED
;
1010 for (i
= 0; i
< FIMC_MAX_DEVS
; i
++) {
1014 source
= &fmd
->fimc
[i
]->vid_cap
.subdev
.entity
;
1015 sink
= &fmd
->fimc
[i
]->vid_cap
.ve
.vdev
.entity
;
1017 ret
= media_create_pad_link(source
, FIMC_SD_PAD_SOURCE
,
1023 ret
= __fimc_md_create_flite_source_links(fmd
);
1028 ret
= __fimc_md_create_fimc_is_links(fmd
);
1034 * The peripheral sensor and CAM_BLK (PIXELASYNCMx) clocks management.
1036 static void fimc_md_put_clocks(struct fimc_md
*fmd
)
1038 int i
= FIMC_MAX_CAMCLKS
;
1041 if (IS_ERR(fmd
->camclk
[i
].clock
))
1043 clk_put(fmd
->camclk
[i
].clock
);
1044 fmd
->camclk
[i
].clock
= ERR_PTR(-EINVAL
);
1047 /* Writeback (PIXELASYNCMx) clocks */
1048 for (i
= 0; i
< FIMC_MAX_WBCLKS
; i
++) {
1049 if (IS_ERR(fmd
->wbclk
[i
]))
1051 clk_put(fmd
->wbclk
[i
]);
1052 fmd
->wbclk
[i
] = ERR_PTR(-EINVAL
);
1056 static int fimc_md_get_clocks(struct fimc_md
*fmd
)
1058 struct device
*dev
= &fmd
->pdev
->dev
;
1063 for (i
= 0; i
< FIMC_MAX_CAMCLKS
; i
++)
1064 fmd
->camclk
[i
].clock
= ERR_PTR(-EINVAL
);
1066 for (i
= 0; i
< FIMC_MAX_CAMCLKS
; i
++) {
1067 snprintf(clk_name
, sizeof(clk_name
), "sclk_cam%u", i
);
1068 clock
= clk_get(dev
, clk_name
);
1070 if (IS_ERR(clock
)) {
1071 dev_err(dev
, "Failed to get clock: %s\n", clk_name
);
1072 ret
= PTR_ERR(clock
);
1075 fmd
->camclk
[i
].clock
= clock
;
1078 fimc_md_put_clocks(fmd
);
1083 * For now get only PIXELASYNCM1 clock (Writeback B/ISP),
1084 * leave PIXELASYNCM0 out for the LCD Writeback driver.
1086 fmd
->wbclk
[CLK_IDX_WB_A
] = ERR_PTR(-EINVAL
);
1088 for (i
= CLK_IDX_WB_B
; i
< FIMC_MAX_WBCLKS
; i
++) {
1089 snprintf(clk_name
, sizeof(clk_name
), "pxl_async%u", i
);
1090 clock
= clk_get(dev
, clk_name
);
1091 if (IS_ERR(clock
)) {
1092 v4l2_err(&fmd
->v4l2_dev
, "Failed to get clock: %s\n",
1094 ret
= PTR_ERR(clock
);
1097 fmd
->wbclk
[i
] = clock
;
1100 fimc_md_put_clocks(fmd
);
1105 static int __fimc_md_modify_pipeline(struct media_entity
*entity
, bool enable
)
1107 struct exynos_video_entity
*ve
;
1108 struct fimc_pipeline
*p
;
1109 struct video_device
*vdev
;
1112 vdev
= media_entity_to_video_device(entity
);
1113 if (vdev
->entity
.use_count
== 0)
1116 ve
= vdev_to_exynos_video_entity(vdev
);
1117 p
= to_fimc_pipeline(ve
->pipe
);
1119 * Nothing to do if we are disabling the pipeline, some link
1120 * has been disconnected and p->subdevs array is cleared now.
1122 if (!enable
&& p
->subdevs
[IDX_SENSOR
] == NULL
)
1126 ret
= __fimc_pipeline_open(ve
->pipe
, entity
, true);
1128 ret
= __fimc_pipeline_close(ve
->pipe
);
1130 if (ret
== 0 && !enable
)
1131 memset(p
->subdevs
, 0, sizeof(p
->subdevs
));
1136 /* Locking: called with entity->graph_obj.mdev->graph_mutex mutex held. */
1137 static int __fimc_md_modify_pipelines(struct media_entity
*entity
, bool enable
,
1138 struct media_graph
*graph
)
1140 struct media_entity
*entity_err
= entity
;
1144 * Walk current graph and call the pipeline open/close routine for each
1145 * opened video node that belongs to the graph of entities connected
1146 * through active links. This is needed as we cannot power on/off the
1147 * subdevs in random order.
1149 media_graph_walk_start(graph
, entity
);
1151 while ((entity
= media_graph_walk_next(graph
))) {
1152 if (!is_media_entity_v4l2_video_device(entity
))
1155 ret
= __fimc_md_modify_pipeline(entity
, enable
);
1164 media_graph_walk_start(graph
, entity_err
);
1166 while ((entity_err
= media_graph_walk_next(graph
))) {
1167 if (!is_media_entity_v4l2_video_device(entity_err
))
1170 __fimc_md_modify_pipeline(entity_err
, !enable
);
1172 if (entity_err
== entity
)
1179 static int fimc_md_link_notify(struct media_link
*link
, unsigned int flags
,
1180 unsigned int notification
)
1182 struct media_graph
*graph
=
1183 &container_of(link
->graph_obj
.mdev
, struct fimc_md
,
1184 media_dev
)->link_setup_graph
;
1185 struct media_entity
*sink
= link
->sink
->entity
;
1188 /* Before link disconnection */
1189 if (notification
== MEDIA_DEV_NOTIFY_PRE_LINK_CH
) {
1190 ret
= media_graph_walk_init(graph
,
1191 link
->graph_obj
.mdev
);
1194 if (!(flags
& MEDIA_LNK_FL_ENABLED
))
1195 ret
= __fimc_md_modify_pipelines(sink
, false, graph
);
1198 /* TODO: Link state change validation */
1200 /* After link activation */
1201 } else if (notification
== MEDIA_DEV_NOTIFY_POST_LINK_CH
) {
1202 if (link
->flags
& MEDIA_LNK_FL_ENABLED
)
1203 ret
= __fimc_md_modify_pipelines(sink
, true, graph
);
1204 media_graph_walk_cleanup(graph
);
1207 return ret
? -EPIPE
: 0;
1210 static const struct media_device_ops fimc_md_ops
= {
1211 .link_notify
= fimc_md_link_notify
,
1214 static ssize_t
fimc_md_sysfs_show(struct device
*dev
,
1215 struct device_attribute
*attr
, char *buf
)
1217 struct fimc_md
*fmd
= dev_get_drvdata(dev
);
1219 if (fmd
->user_subdev_api
)
1220 return strscpy(buf
, "Sub-device API (sub-dev)\n", PAGE_SIZE
);
1222 return strscpy(buf
, "V4L2 video node only API (vid-dev)\n", PAGE_SIZE
);
1225 static ssize_t
fimc_md_sysfs_store(struct device
*dev
,
1226 struct device_attribute
*attr
,
1227 const char *buf
, size_t count
)
1229 struct fimc_md
*fmd
= dev_get_drvdata(dev
);
1233 if (!strcmp(buf
, "vid-dev\n"))
1235 else if (!strcmp(buf
, "sub-dev\n"))
1240 fmd
->user_subdev_api
= subdev_api
;
1241 for (i
= 0; i
< FIMC_MAX_DEVS
; i
++)
1243 fmd
->fimc
[i
]->vid_cap
.user_subdev_api
= subdev_api
;
1247 * This device attribute is to select video pipeline configuration method.
1248 * There are following valid values:
1249 * vid-dev - for V4L2 video node API only, subdevice will be configured
1250 * by the host driver.
1251 * sub-dev - for media controller API, subdevs must be configured in user
1252 * space before starting streaming.
1254 static DEVICE_ATTR(subdev_conf_mode
, S_IWUSR
| S_IRUGO
,
1255 fimc_md_sysfs_show
, fimc_md_sysfs_store
);
1257 static int fimc_md_get_pinctrl(struct fimc_md
*fmd
)
1259 struct device
*dev
= &fmd
->pdev
->dev
;
1260 struct fimc_pinctrl
*pctl
= &fmd
->pinctl
;
1262 pctl
->pinctrl
= devm_pinctrl_get(dev
);
1263 if (IS_ERR(pctl
->pinctrl
))
1264 return PTR_ERR(pctl
->pinctrl
);
1266 pctl
->state_default
= pinctrl_lookup_state(pctl
->pinctrl
,
1267 PINCTRL_STATE_DEFAULT
);
1268 if (IS_ERR(pctl
->state_default
))
1269 return PTR_ERR(pctl
->state_default
);
1271 pctl
->state_idle
= pinctrl_lookup_state(pctl
->pinctrl
,
1272 PINCTRL_STATE_IDLE
);
1276 static int cam_clk_prepare(struct clk_hw
*hw
)
1278 struct cam_clk
*camclk
= to_cam_clk(hw
);
1281 if (camclk
->fmd
->pmf
== NULL
)
1284 ret
= pm_runtime_get_sync(camclk
->fmd
->pmf
);
1285 return ret
< 0 ? ret
: 0;
1288 static void cam_clk_unprepare(struct clk_hw
*hw
)
1290 struct cam_clk
*camclk
= to_cam_clk(hw
);
1292 if (camclk
->fmd
->pmf
== NULL
)
1295 pm_runtime_put_sync(camclk
->fmd
->pmf
);
1298 static const struct clk_ops cam_clk_ops
= {
1299 .prepare
= cam_clk_prepare
,
1300 .unprepare
= cam_clk_unprepare
,
1303 static void fimc_md_unregister_clk_provider(struct fimc_md
*fmd
)
1305 struct cam_clk_provider
*cp
= &fmd
->clk_provider
;
1309 of_clk_del_provider(cp
->of_node
);
1311 for (i
= 0; i
< cp
->num_clocks
; i
++)
1312 clk_unregister(cp
->clks
[i
]);
1315 static int fimc_md_register_clk_provider(struct fimc_md
*fmd
)
1317 struct cam_clk_provider
*cp
= &fmd
->clk_provider
;
1318 struct device
*dev
= &fmd
->pdev
->dev
;
1321 for (i
= 0; i
< FIMC_MAX_CAMCLKS
; i
++) {
1322 struct cam_clk
*camclk
= &cp
->camclk
[i
];
1323 struct clk_init_data init
;
1326 ret
= of_property_read_string_index(dev
->of_node
,
1327 "clock-output-names", i
, &init
.name
);
1331 p_name
= __clk_get_name(fmd
->camclk
[i
].clock
);
1333 /* It's safe since clk_register() will duplicate the string. */
1334 init
.parent_names
= &p_name
;
1335 init
.num_parents
= 1;
1336 init
.ops
= &cam_clk_ops
;
1337 init
.flags
= CLK_SET_RATE_PARENT
;
1338 camclk
->hw
.init
= &init
;
1341 cp
->clks
[i
] = clk_register(NULL
, &camclk
->hw
);
1342 if (IS_ERR(cp
->clks
[i
])) {
1343 dev_err(dev
, "failed to register clock: %s (%ld)\n",
1344 init
.name
, PTR_ERR(cp
->clks
[i
]));
1345 ret
= PTR_ERR(cp
->clks
[i
]);
1351 if (cp
->num_clocks
== 0) {
1352 dev_warn(dev
, "clk provider not registered\n");
1356 cp
->clk_data
.clks
= cp
->clks
;
1357 cp
->clk_data
.clk_num
= cp
->num_clocks
;
1358 cp
->of_node
= dev
->of_node
;
1359 ret
= of_clk_add_provider(dev
->of_node
, of_clk_src_onecell_get
,
1364 fimc_md_unregister_clk_provider(fmd
);
1368 static int subdev_notifier_bound(struct v4l2_async_notifier
*notifier
,
1369 struct v4l2_subdev
*subdev
,
1370 struct v4l2_async_subdev
*asd
)
1372 struct fimc_md
*fmd
= notifier_to_fimc_md(notifier
);
1373 struct fimc_sensor_info
*si
= NULL
;
1376 /* Find platform data for this sensor subdev */
1377 for (i
= 0; i
< ARRAY_SIZE(fmd
->sensor
); i
++)
1378 if (fmd
->sensor
[i
].asd
.match
.fwnode
==
1379 of_fwnode_handle(subdev
->dev
->of_node
))
1380 si
= &fmd
->sensor
[i
];
1385 v4l2_set_subdev_hostdata(subdev
, &si
->pdata
);
1387 if (si
->pdata
.fimc_bus_type
== FIMC_BUS_TYPE_ISP_WRITEBACK
)
1388 subdev
->grp_id
= GRP_ID_FIMC_IS_SENSOR
;
1390 subdev
->grp_id
= GRP_ID_SENSOR
;
1392 si
->subdev
= subdev
;
1394 v4l2_info(&fmd
->v4l2_dev
, "Registered sensor subdevice: %s (%d)\n",
1395 subdev
->name
, fmd
->num_sensors
);
1402 static int subdev_notifier_complete(struct v4l2_async_notifier
*notifier
)
1404 struct fimc_md
*fmd
= notifier_to_fimc_md(notifier
);
1407 mutex_lock(&fmd
->media_dev
.graph_mutex
);
1409 ret
= fimc_md_create_links(fmd
);
1413 ret
= v4l2_device_register_subdev_nodes(&fmd
->v4l2_dev
);
1415 mutex_unlock(&fmd
->media_dev
.graph_mutex
);
1419 return media_device_register(&fmd
->media_dev
);
1422 static const struct v4l2_async_notifier_operations subdev_notifier_ops
= {
1423 .bound
= subdev_notifier_bound
,
1424 .complete
= subdev_notifier_complete
,
1427 static int fimc_md_probe(struct platform_device
*pdev
)
1429 struct device
*dev
= &pdev
->dev
;
1430 struct v4l2_device
*v4l2_dev
;
1431 struct fimc_md
*fmd
;
1434 fmd
= devm_kzalloc(dev
, sizeof(*fmd
), GFP_KERNEL
);
1438 spin_lock_init(&fmd
->slock
);
1439 INIT_LIST_HEAD(&fmd
->pipelines
);
1442 strscpy(fmd
->media_dev
.model
, "SAMSUNG S5P FIMC",
1443 sizeof(fmd
->media_dev
.model
));
1444 fmd
->media_dev
.ops
= &fimc_md_ops
;
1445 fmd
->media_dev
.dev
= dev
;
1447 v4l2_dev
= &fmd
->v4l2_dev
;
1448 v4l2_dev
->mdev
= &fmd
->media_dev
;
1449 v4l2_dev
->notify
= fimc_sensor_notify
;
1450 strscpy(v4l2_dev
->name
, "s5p-fimc-md", sizeof(v4l2_dev
->name
));
1452 fmd
->use_isp
= fimc_md_is_isp_available(dev
->of_node
);
1453 fmd
->user_subdev_api
= true;
1455 media_device_init(&fmd
->media_dev
);
1457 ret
= v4l2_device_register(dev
, &fmd
->v4l2_dev
);
1459 v4l2_err(v4l2_dev
, "Failed to register v4l2_device: %d\n", ret
);
1463 ret
= fimc_md_get_clocks(fmd
);
1467 ret
= fimc_md_get_pinctrl(fmd
);
1469 if (ret
!= EPROBE_DEFER
)
1470 dev_err(dev
, "Failed to get pinctrl: %d\n", ret
);
1474 platform_set_drvdata(pdev
, fmd
);
1476 v4l2_async_notifier_init(&fmd
->subdev_notifier
);
1478 ret
= fimc_md_register_platform_entities(fmd
, dev
->of_node
);
1482 ret
= fimc_md_register_sensor_entities(fmd
);
1486 ret
= device_create_file(&pdev
->dev
, &dev_attr_subdev_conf_mode
);
1490 * FIMC platform devices need to be registered before the sclk_cam
1491 * clocks provider, as one of these devices needs to be activated
1492 * to enable the clock.
1494 ret
= fimc_md_register_clk_provider(fmd
);
1496 v4l2_err(v4l2_dev
, "clock provider registration failed\n");
1500 if (fmd
->num_sensors
> 0) {
1501 fmd
->subdev_notifier
.ops
= &subdev_notifier_ops
;
1502 fmd
->num_sensors
= 0;
1504 ret
= v4l2_async_notifier_register(&fmd
->v4l2_dev
,
1505 &fmd
->subdev_notifier
);
1513 fimc_md_unregister_clk_provider(fmd
);
1515 device_remove_file(&pdev
->dev
, &dev_attr_subdev_conf_mode
);
1517 v4l2_async_notifier_cleanup(&fmd
->subdev_notifier
);
1519 fimc_md_unregister_entities(fmd
);
1521 fimc_md_put_clocks(fmd
);
1523 v4l2_device_unregister(&fmd
->v4l2_dev
);
1525 media_device_cleanup(&fmd
->media_dev
);
1529 static int fimc_md_remove(struct platform_device
*pdev
)
1531 struct fimc_md
*fmd
= platform_get_drvdata(pdev
);
1536 fimc_md_unregister_clk_provider(fmd
);
1537 v4l2_async_notifier_unregister(&fmd
->subdev_notifier
);
1538 v4l2_async_notifier_cleanup(&fmd
->subdev_notifier
);
1540 v4l2_device_unregister(&fmd
->v4l2_dev
);
1541 device_remove_file(&pdev
->dev
, &dev_attr_subdev_conf_mode
);
1542 fimc_md_unregister_entities(fmd
);
1543 fimc_md_pipelines_free(fmd
);
1544 media_device_unregister(&fmd
->media_dev
);
1545 media_device_cleanup(&fmd
->media_dev
);
1546 fimc_md_put_clocks(fmd
);
1551 static const struct platform_device_id fimc_driver_ids
[] __always_unused
= {
1552 { .name
= "s5p-fimc-md" },
1555 MODULE_DEVICE_TABLE(platform
, fimc_driver_ids
);
1557 static const struct of_device_id fimc_md_of_match
[] = {
1558 { .compatible
= "samsung,fimc" },
1561 MODULE_DEVICE_TABLE(of
, fimc_md_of_match
);
1563 static struct platform_driver fimc_md_driver
= {
1564 .probe
= fimc_md_probe
,
1565 .remove
= fimc_md_remove
,
1567 .of_match_table
= of_match_ptr(fimc_md_of_match
),
1568 .name
= "s5p-fimc-md",
1572 static int __init
fimc_md_init(void)
1576 request_module("s5p-csis");
1577 ret
= fimc_register_driver();
1581 return platform_driver_register(&fimc_md_driver
);
1584 static void __exit
fimc_md_exit(void)
1586 platform_driver_unregister(&fimc_md_driver
);
1587 fimc_unregister_driver();
1590 module_init(fimc_md_init
);
1591 module_exit(fimc_md_exit
);
1593 MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
1594 MODULE_DESCRIPTION("S5P FIMC camera host interface/video postprocessor driver");
1595 MODULE_LICENSE("GPL");
1596 MODULE_VERSION("2.0.1");