1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2023 Intel Corporation. All rights reserved.
4 * Intel Visual Sensing Controller CSI Linux driver
8 * To set ownership of CSI-2 link and to configure CSI-2 link, there
9 * are specific commands, which are sent via MEI protocol. The send
10 * command function uses "completion" as a synchronization mechanism.
11 * The response for command is received via a mei callback which wakes
12 * up the caller. There can be only one outstanding command at a time.
15 #include <linux/completion.h>
16 #include <linux/delay.h>
17 #include <linux/kernel.h>
18 #include <linux/math64.h>
19 #include <linux/mei_cl_bus.h>
20 #include <linux/module.h>
21 #include <linux/mutex.h>
22 #include <linux/pm_runtime.h>
23 #include <linux/slab.h>
24 #include <linux/units.h>
25 #include <linux/uuid.h>
26 #include <linux/workqueue.h>
28 #include <media/v4l2-async.h>
29 #include <media/v4l2-ctrls.h>
30 #include <media/v4l2-fwnode.h>
31 #include <media/v4l2-subdev.h>
33 #define MEI_CSI_ENTITY_NAME "Intel IVSC CSI"
35 #define MEI_CSI_LINK_FREQ_400MHZ 400000000ULL
37 /* the 5s used here is based on experiment */
38 #define CSI_CMD_TIMEOUT (5 * HZ)
39 /* to setup CSI-2 link an extra delay needed and determined experimentally */
40 #define CSI_FW_READY_DELAY_MS 100
41 /* link frequency unit is 100kHz */
42 #define CSI_LINK_FREQ(x) ((u32)(div_u64(x, 100 * HZ_PER_KHZ)))
45 * identify the command id supported by firmware
46 * IPC, as well as the privacy notification id
47 * used when processing privacy event.
50 /* used to set csi ownership */
53 /* used to configure CSI-2 link */
56 /* privacy notification id used when privacy state changes */
57 CSI_PRIVACY_NOTIF = 6,
60 /* CSI-2 link ownership definition */
66 /* privacy status definition */
67 enum ivsc_privacy_status {
79 /* configuration of the CSI-2 link between host and IVSC */
81 /* number of data lanes used on the CSI-2 link */
84 /* frequency of the CSI-2 link */
91 /* CSI command structure */
96 struct csi_link_cfg conf;
100 /* CSI notification structure */
106 struct csi_link_cfg conf;
111 struct mei_cl_device *cldev;
113 /* command response */
114 struct csi_notif cmd_response;
115 /* used to wait for command response from firmware */
116 struct completion cmd_completion;
117 /* protect command download */
120 struct v4l2_subdev subdev;
121 struct v4l2_subdev *remote;
122 struct v4l2_async_notifier notifier;
123 struct v4l2_ctrl_handler ctrl_handler;
124 struct v4l2_ctrl *freq_ctrl;
125 struct v4l2_ctrl *privacy_ctrl;
126 unsigned int remote_pad;
127 /* start streaming or not */
130 struct media_pad pads[CSI_NUM_PADS];
131 struct v4l2_mbus_framefmt format_mbus[CSI_NUM_PADS];
133 /* number of data lanes used on the CSI-2 link */
135 /* frequency of the CSI-2 link */
139 enum ivsc_privacy_status status;
142 static const struct v4l2_mbus_framefmt mei_csi_format_mbus_default = {
145 .code = MEDIA_BUS_FMT_Y8_1X8,
146 .field = V4L2_FIELD_NONE,
149 static s64 link_freq_menu_items[] = {
150 MEI_CSI_LINK_FREQ_400MHZ
153 static inline struct mei_csi *notifier_to_csi(struct v4l2_async_notifier *n)
155 return container_of(n, struct mei_csi, notifier);
158 static inline struct mei_csi *sd_to_csi(struct v4l2_subdev *sd)
160 return container_of(sd, struct mei_csi, subdev);
163 static inline struct mei_csi *ctrl_to_csi(struct v4l2_ctrl *ctrl)
165 return container_of(ctrl->handler, struct mei_csi, ctrl_handler);
168 /* send a command to firmware and mutex must be held by caller */
169 static int mei_csi_send(struct mei_csi *csi, u8 *buf, size_t len)
171 struct csi_cmd *cmd = (struct csi_cmd *)buf;
174 reinit_completion(&csi->cmd_completion);
176 ret = mei_cldev_send(csi->cldev, buf, len);
180 ret = wait_for_completion_killable_timeout(&csi->cmd_completion,
189 /* command response status */
190 ret = csi->cmd_response.status;
196 if (csi->cmd_response.cmd_id != cmd->cmd_id)
203 /* set CSI-2 link ownership */
204 static int csi_set_link_owner(struct mei_csi *csi, enum csi_link_owner owner)
206 struct csi_cmd cmd = { 0 };
210 cmd.cmd_id = CSI_SET_OWNER;
211 cmd.param.param = owner;
212 cmd_size = sizeof(cmd.cmd_id) + sizeof(cmd.param.param);
214 mutex_lock(&csi->lock);
216 ret = mei_csi_send(csi, (u8 *)&cmd, cmd_size);
218 mutex_unlock(&csi->lock);
223 /* configure CSI-2 link between host and IVSC */
224 static int csi_set_link_cfg(struct mei_csi *csi)
226 struct csi_cmd cmd = { 0 };
230 cmd.cmd_id = CSI_SET_CONF;
231 cmd.param.conf.nr_of_lanes = csi->nr_of_lanes;
232 cmd.param.conf.link_freq = CSI_LINK_FREQ(csi->link_freq);
233 cmd_size = sizeof(cmd.cmd_id) + sizeof(cmd.param.conf);
235 mutex_lock(&csi->lock);
237 ret = mei_csi_send(csi, (u8 *)&cmd, cmd_size);
239 * wait configuration ready if download success. placing
240 * delay under mutex is to make sure current command flow
241 * completed before starting a possible new one.
244 msleep(CSI_FW_READY_DELAY_MS);
246 mutex_unlock(&csi->lock);
251 /* callback for receive */
252 static void mei_csi_rx(struct mei_cl_device *cldev)
254 struct mei_csi *csi = mei_cldev_get_drvdata(cldev);
255 struct csi_notif notif = { 0 };
258 ret = mei_cldev_recv(cldev, (u8 *)¬if, sizeof(notif));
260 dev_err(&cldev->dev, "recv error: %d\n", ret);
264 switch (notif.cmd_id) {
265 case CSI_PRIVACY_NOTIF:
266 if (notif.cont.cont < CSI_PRIVACY_MAX) {
267 csi->status = notif.cont.cont;
268 v4l2_ctrl_s_ctrl(csi->privacy_ctrl, csi->status);
273 memcpy(&csi->cmd_response, ¬if, ret);
275 complete(&csi->cmd_completion);
282 static int mei_csi_set_stream(struct v4l2_subdev *sd, int enable)
284 struct mei_csi *csi = sd_to_csi(sd);
288 if (enable && csi->streaming == 0) {
289 freq = v4l2_get_link_freq(csi->remote->ctrl_handler, 0, 0);
291 dev_err(&csi->cldev->dev,
292 "error %lld, invalid link_freq\n", freq);
296 csi->link_freq = freq;
298 /* switch CSI-2 link to host */
299 ret = csi_set_link_owner(csi, CSI_LINK_HOST);
303 /* configure CSI-2 link */
304 ret = csi_set_link_cfg(csi);
308 ret = v4l2_subdev_call(csi->remote, video, s_stream, 1);
311 } else if (!enable && csi->streaming == 1) {
312 v4l2_subdev_call(csi->remote, video, s_stream, 0);
314 /* switch CSI-2 link to IVSC */
315 ret = csi_set_link_owner(csi, CSI_LINK_IVSC);
317 dev_warn(&csi->cldev->dev,
318 "failed to switch CSI2 link: %d\n", ret);
321 csi->streaming = enable;
326 csi_set_link_owner(csi, CSI_LINK_IVSC);
332 static struct v4l2_mbus_framefmt *
333 mei_csi_get_pad_format(struct v4l2_subdev *sd,
334 struct v4l2_subdev_state *sd_state,
335 unsigned int pad, u32 which)
337 struct mei_csi *csi = sd_to_csi(sd);
340 case V4L2_SUBDEV_FORMAT_TRY:
341 return v4l2_subdev_get_try_format(sd, sd_state, pad);
342 case V4L2_SUBDEV_FORMAT_ACTIVE:
343 return &csi->format_mbus[pad];
349 static int mei_csi_init_cfg(struct v4l2_subdev *sd,
350 struct v4l2_subdev_state *sd_state)
352 struct v4l2_mbus_framefmt *mbusformat;
353 struct mei_csi *csi = sd_to_csi(sd);
356 mutex_lock(&csi->lock);
358 for (i = 0; i < sd->entity.num_pads; i++) {
359 mbusformat = v4l2_subdev_get_try_format(sd, sd_state, i);
360 *mbusformat = mei_csi_format_mbus_default;
363 mutex_unlock(&csi->lock);
368 static int mei_csi_get_fmt(struct v4l2_subdev *sd,
369 struct v4l2_subdev_state *sd_state,
370 struct v4l2_subdev_format *format)
372 struct v4l2_mbus_framefmt *mbusformat;
373 struct mei_csi *csi = sd_to_csi(sd);
375 mutex_lock(&csi->lock);
377 mbusformat = mei_csi_get_pad_format(sd, sd_state, format->pad,
380 format->format = *mbusformat;
382 mutex_unlock(&csi->lock);
387 static int mei_csi_set_fmt(struct v4l2_subdev *sd,
388 struct v4l2_subdev_state *sd_state,
389 struct v4l2_subdev_format *format)
391 struct v4l2_mbus_framefmt *source_mbusformat;
392 struct v4l2_mbus_framefmt *mbusformat;
393 struct mei_csi *csi = sd_to_csi(sd);
394 struct media_pad *pad;
396 mbusformat = mei_csi_get_pad_format(sd, sd_state, format->pad,
401 source_mbusformat = mei_csi_get_pad_format(sd, sd_state, CSI_PAD_SOURCE,
403 if (!source_mbusformat)
406 v4l_bound_align_image(&format->format.width, 1, 65536, 0,
407 &format->format.height, 1, 65536, 0, 0);
409 switch (format->format.code) {
410 case MEDIA_BUS_FMT_RGB444_1X12:
411 case MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE:
412 case MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE:
413 case MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE:
414 case MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE:
415 case MEDIA_BUS_FMT_RGB565_1X16:
416 case MEDIA_BUS_FMT_BGR565_2X8_BE:
417 case MEDIA_BUS_FMT_BGR565_2X8_LE:
418 case MEDIA_BUS_FMT_RGB565_2X8_BE:
419 case MEDIA_BUS_FMT_RGB565_2X8_LE:
420 case MEDIA_BUS_FMT_RGB666_1X18:
421 case MEDIA_BUS_FMT_RBG888_1X24:
422 case MEDIA_BUS_FMT_RGB666_1X24_CPADHI:
423 case MEDIA_BUS_FMT_BGR888_1X24:
424 case MEDIA_BUS_FMT_GBR888_1X24:
425 case MEDIA_BUS_FMT_RGB888_1X24:
426 case MEDIA_BUS_FMT_RGB888_2X12_BE:
427 case MEDIA_BUS_FMT_RGB888_2X12_LE:
428 case MEDIA_BUS_FMT_ARGB8888_1X32:
429 case MEDIA_BUS_FMT_RGB888_1X32_PADHI:
430 case MEDIA_BUS_FMT_RGB101010_1X30:
431 case MEDIA_BUS_FMT_RGB121212_1X36:
432 case MEDIA_BUS_FMT_RGB161616_1X48:
433 case MEDIA_BUS_FMT_Y8_1X8:
434 case MEDIA_BUS_FMT_UV8_1X8:
435 case MEDIA_BUS_FMT_UYVY8_1_5X8:
436 case MEDIA_BUS_FMT_VYUY8_1_5X8:
437 case MEDIA_BUS_FMT_YUYV8_1_5X8:
438 case MEDIA_BUS_FMT_YVYU8_1_5X8:
439 case MEDIA_BUS_FMT_UYVY8_2X8:
440 case MEDIA_BUS_FMT_VYUY8_2X8:
441 case MEDIA_BUS_FMT_YUYV8_2X8:
442 case MEDIA_BUS_FMT_YVYU8_2X8:
443 case MEDIA_BUS_FMT_Y10_1X10:
444 case MEDIA_BUS_FMT_UYVY10_2X10:
445 case MEDIA_BUS_FMT_VYUY10_2X10:
446 case MEDIA_BUS_FMT_YUYV10_2X10:
447 case MEDIA_BUS_FMT_YVYU10_2X10:
448 case MEDIA_BUS_FMT_Y12_1X12:
449 case MEDIA_BUS_FMT_UYVY12_2X12:
450 case MEDIA_BUS_FMT_VYUY12_2X12:
451 case MEDIA_BUS_FMT_YUYV12_2X12:
452 case MEDIA_BUS_FMT_YVYU12_2X12:
453 case MEDIA_BUS_FMT_UYVY8_1X16:
454 case MEDIA_BUS_FMT_VYUY8_1X16:
455 case MEDIA_BUS_FMT_YUYV8_1X16:
456 case MEDIA_BUS_FMT_YVYU8_1X16:
457 case MEDIA_BUS_FMT_YDYUYDYV8_1X16:
458 case MEDIA_BUS_FMT_UYVY10_1X20:
459 case MEDIA_BUS_FMT_VYUY10_1X20:
460 case MEDIA_BUS_FMT_YUYV10_1X20:
461 case MEDIA_BUS_FMT_YVYU10_1X20:
462 case MEDIA_BUS_FMT_VUY8_1X24:
463 case MEDIA_BUS_FMT_YUV8_1X24:
464 case MEDIA_BUS_FMT_UYYVYY8_0_5X24:
465 case MEDIA_BUS_FMT_UYVY12_1X24:
466 case MEDIA_BUS_FMT_VYUY12_1X24:
467 case MEDIA_BUS_FMT_YUYV12_1X24:
468 case MEDIA_BUS_FMT_YVYU12_1X24:
469 case MEDIA_BUS_FMT_YUV10_1X30:
470 case MEDIA_BUS_FMT_UYYVYY10_0_5X30:
471 case MEDIA_BUS_FMT_AYUV8_1X32:
472 case MEDIA_BUS_FMT_UYYVYY12_0_5X36:
473 case MEDIA_BUS_FMT_YUV12_1X36:
474 case MEDIA_BUS_FMT_YUV16_1X48:
475 case MEDIA_BUS_FMT_UYYVYY16_0_5X48:
476 case MEDIA_BUS_FMT_JPEG_1X8:
477 case MEDIA_BUS_FMT_AHSV8888_1X32:
478 case MEDIA_BUS_FMT_SBGGR8_1X8:
479 case MEDIA_BUS_FMT_SGBRG8_1X8:
480 case MEDIA_BUS_FMT_SGRBG8_1X8:
481 case MEDIA_BUS_FMT_SRGGB8_1X8:
482 case MEDIA_BUS_FMT_SBGGR10_1X10:
483 case MEDIA_BUS_FMT_SGBRG10_1X10:
484 case MEDIA_BUS_FMT_SGRBG10_1X10:
485 case MEDIA_BUS_FMT_SRGGB10_1X10:
486 case MEDIA_BUS_FMT_SBGGR12_1X12:
487 case MEDIA_BUS_FMT_SGBRG12_1X12:
488 case MEDIA_BUS_FMT_SGRBG12_1X12:
489 case MEDIA_BUS_FMT_SRGGB12_1X12:
490 case MEDIA_BUS_FMT_SBGGR14_1X14:
491 case MEDIA_BUS_FMT_SGBRG14_1X14:
492 case MEDIA_BUS_FMT_SGRBG14_1X14:
493 case MEDIA_BUS_FMT_SRGGB14_1X14:
494 case MEDIA_BUS_FMT_SBGGR16_1X16:
495 case MEDIA_BUS_FMT_SGBRG16_1X16:
496 case MEDIA_BUS_FMT_SGRBG16_1X16:
497 case MEDIA_BUS_FMT_SRGGB16_1X16:
500 format->format.code = MEDIA_BUS_FMT_Y8_1X8;
504 if (format->format.field == V4L2_FIELD_ANY)
505 format->format.field = V4L2_FIELD_NONE;
507 mutex_lock(&csi->lock);
509 pad = &csi->pads[format->pad];
510 if (pad->flags & MEDIA_PAD_FL_SOURCE)
511 format->format = csi->format_mbus[CSI_PAD_SINK];
513 *mbusformat = format->format;
515 if (pad->flags & MEDIA_PAD_FL_SINK)
516 *source_mbusformat = format->format;
518 mutex_unlock(&csi->lock);
523 static int mei_csi_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
525 struct mei_csi *csi = ctrl_to_csi(ctrl);
528 if (ctrl->id == V4L2_CID_LINK_FREQ) {
532 freq = v4l2_get_link_freq(csi->remote->ctrl_handler, 0, 0);
534 dev_err(&csi->cldev->dev,
535 "error %lld, invalid link_freq\n", freq);
539 link_freq_menu_items[0] = freq;
548 static const struct v4l2_ctrl_ops mei_csi_ctrl_ops = {
549 .g_volatile_ctrl = mei_csi_g_volatile_ctrl,
552 static const struct v4l2_subdev_video_ops mei_csi_video_ops = {
553 .s_stream = mei_csi_set_stream,
556 static const struct v4l2_subdev_pad_ops mei_csi_pad_ops = {
557 .init_cfg = mei_csi_init_cfg,
558 .get_fmt = mei_csi_get_fmt,
559 .set_fmt = mei_csi_set_fmt,
562 static const struct v4l2_subdev_ops mei_csi_subdev_ops = {
563 .video = &mei_csi_video_ops,
564 .pad = &mei_csi_pad_ops,
567 static const struct media_entity_operations mei_csi_entity_ops = {
568 .link_validate = v4l2_subdev_link_validate,
571 static int mei_csi_notify_bound(struct v4l2_async_notifier *notifier,
572 struct v4l2_subdev *subdev,
573 struct v4l2_async_connection *asd)
575 struct mei_csi *csi = notifier_to_csi(notifier);
578 pad = media_entity_get_fwnode_pad(&subdev->entity, asd->match.fwnode,
579 MEDIA_PAD_FL_SOURCE);
583 csi->remote = subdev;
584 csi->remote_pad = pad;
586 return media_create_pad_link(&subdev->entity, pad,
587 &csi->subdev.entity, 1,
588 MEDIA_LNK_FL_ENABLED |
589 MEDIA_LNK_FL_IMMUTABLE);
592 static void mei_csi_notify_unbind(struct v4l2_async_notifier *notifier,
593 struct v4l2_subdev *subdev,
594 struct v4l2_async_connection *asd)
596 struct mei_csi *csi = notifier_to_csi(notifier);
601 static const struct v4l2_async_notifier_operations mei_csi_notify_ops = {
602 .bound = mei_csi_notify_bound,
603 .unbind = mei_csi_notify_unbind,
606 static int mei_csi_init_controls(struct mei_csi *csi)
611 ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 2);
615 csi->ctrl_handler.lock = &csi->lock;
617 max = ARRAY_SIZE(link_freq_menu_items) - 1;
618 csi->freq_ctrl = v4l2_ctrl_new_int_menu(&csi->ctrl_handler,
623 link_freq_menu_items);
625 csi->freq_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY |
626 V4L2_CTRL_FLAG_VOLATILE;
628 csi->privacy_ctrl = v4l2_ctrl_new_std(&csi->ctrl_handler, NULL,
629 V4L2_CID_PRIVACY, 0, 1, 1, 0);
630 if (csi->privacy_ctrl)
631 csi->privacy_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
633 if (csi->ctrl_handler.error)
634 return csi->ctrl_handler.error;
636 csi->subdev.ctrl_handler = &csi->ctrl_handler;
641 static int mei_csi_parse_firmware(struct mei_csi *csi)
643 struct v4l2_fwnode_endpoint v4l2_ep = {
644 .bus_type = V4L2_MBUS_CSI2_DPHY,
646 struct device *dev = &csi->cldev->dev;
647 struct v4l2_async_connection *asd;
648 struct fwnode_handle *fwnode;
649 struct fwnode_handle *ep;
652 ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, 0);
654 dev_err(dev, "not connected to subdevice\n");
658 ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
660 dev_err(dev, "could not parse v4l2 endpoint\n");
661 fwnode_handle_put(ep);
665 fwnode = fwnode_graph_get_remote_endpoint(ep);
666 fwnode_handle_put(ep);
668 v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev);
669 csi->notifier.ops = &mei_csi_notify_ops;
671 asd = v4l2_async_nf_add_fwnode(&csi->notifier, fwnode,
672 struct v4l2_async_connection);
674 fwnode_handle_put(fwnode);
678 ret = v4l2_fwnode_endpoint_alloc_parse(fwnode, &v4l2_ep);
679 fwnode_handle_put(fwnode);
682 csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
684 ret = v4l2_async_nf_register(&csi->notifier);
686 v4l2_async_nf_cleanup(&csi->notifier);
688 v4l2_fwnode_endpoint_free(&v4l2_ep);
693 static int mei_csi_probe(struct mei_cl_device *cldev,
694 const struct mei_cl_device_id *id)
696 struct device *dev = &cldev->dev;
700 if (!dev_fwnode(dev))
701 return -EPROBE_DEFER;
703 csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL);
708 mutex_init(&csi->lock);
709 init_completion(&csi->cmd_completion);
711 mei_cldev_set_drvdata(cldev, csi);
713 ret = mei_cldev_enable(cldev);
715 dev_err(dev, "mei_cldev_enable failed: %d\n", ret);
719 ret = mei_cldev_register_rx_cb(cldev, mei_csi_rx);
721 dev_err(dev, "event cb registration failed: %d\n", ret);
725 ret = mei_csi_parse_firmware(csi);
729 csi->subdev.dev = &cldev->dev;
730 v4l2_subdev_init(&csi->subdev, &mei_csi_subdev_ops);
731 v4l2_set_subdevdata(&csi->subdev, csi);
732 csi->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE |
733 V4L2_SUBDEV_FL_HAS_EVENTS;
734 csi->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
735 csi->subdev.entity.ops = &mei_csi_entity_ops;
737 snprintf(csi->subdev.name, sizeof(csi->subdev.name),
738 MEI_CSI_ENTITY_NAME);
740 ret = mei_csi_init_controls(csi);
742 goto err_ctrl_handler;
744 csi->format_mbus[CSI_PAD_SOURCE] = mei_csi_format_mbus_default;
745 csi->format_mbus[CSI_PAD_SINK] = mei_csi_format_mbus_default;
747 csi->pads[CSI_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
748 csi->pads[CSI_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
749 ret = media_entity_pads_init(&csi->subdev.entity, CSI_NUM_PADS,
752 goto err_ctrl_handler;
754 ret = v4l2_subdev_init_finalize(&csi->subdev);
758 ret = v4l2_async_register_subdev(&csi->subdev);
762 pm_runtime_enable(&cldev->dev);
767 v4l2_subdev_cleanup(&csi->subdev);
770 media_entity_cleanup(&csi->subdev.entity);
773 v4l2_ctrl_handler_free(&csi->ctrl_handler);
774 v4l2_async_nf_unregister(&csi->notifier);
775 v4l2_async_nf_cleanup(&csi->notifier);
778 mei_cldev_disable(cldev);
781 mutex_destroy(&csi->lock);
786 static void mei_csi_remove(struct mei_cl_device *cldev)
788 struct mei_csi *csi = mei_cldev_get_drvdata(cldev);
790 v4l2_async_nf_unregister(&csi->notifier);
791 v4l2_async_nf_cleanup(&csi->notifier);
792 v4l2_ctrl_handler_free(&csi->ctrl_handler);
793 v4l2_async_unregister_subdev(&csi->subdev);
794 v4l2_subdev_cleanup(&csi->subdev);
795 media_entity_cleanup(&csi->subdev.entity);
797 pm_runtime_disable(&cldev->dev);
799 mutex_destroy(&csi->lock);
802 #define MEI_CSI_UUID UUID_LE(0x92335FCF, 0x3203, 0x4472, \
803 0xAF, 0x93, 0x7b, 0x44, 0x53, 0xAC, 0x29, 0xDA)
805 static const struct mei_cl_device_id mei_csi_tbl[] = {
806 { .uuid = MEI_CSI_UUID, .version = MEI_CL_VERSION_ANY },
809 MODULE_DEVICE_TABLE(mei, mei_csi_tbl);
811 static struct mei_cl_driver mei_csi_driver = {
812 .id_table = mei_csi_tbl,
813 .name = KBUILD_MODNAME,
815 .probe = mei_csi_probe,
816 .remove = mei_csi_remove,
819 module_mei_cl_driver(mei_csi_driver);
821 MODULE_AUTHOR("Wentong Wu <wentong.wu@intel.com>");
822 MODULE_AUTHOR("Zhifeng Wang <zhifeng.wang@intel.com>");
823 MODULE_DESCRIPTION("Device driver for IVSC CSI");
824 MODULE_LICENSE("GPL");