18 #include <linux/module.h>
23 #include <linux/errno.h>
26 #include <linux/kernel.h>
29 #include <linux/time.h>
30 #include <linux/slab.h>
31 #include <linux/device.h>
33 #include <linux/videodev2.h>
35 #include <linux/sched.h>
84 #define dev_geo dev_info
86 #define dev_geo dev_dbg
152 unsigned long reg_offs,
u32 data)
167 ceu_write(pcdev,
CAPSR, 1 << 16);
170 for (i = 0; i < 1000; i++) {
171 if (!(ceu_read(pcdev,
CSTSR) & 1)) {
179 for (i = 0; i < 1000; i++) {
180 if (!(ceu_read(pcdev,
CAPSR) & (1 << 16))) {
205 static int sh_mobile_ceu_videobuf_setup(
struct vb2_queue *vq,
208 unsigned int sizes[],
void *alloc_ctxs[])
216 fmt->
fmt.
pix.pixelformat);
217 unsigned int bytes_per_line;
260 dev_dbg(icd->
parent,
"count=%d, size=%u\n", *count, sizes[0]);
265 #define CEU_CETCR_MAGIC 0x0317f313
266 #define CEU_CETCR_IGRW (1 << 4)
267 #define CEU_CEIER_CPEIE (1 << 0)
268 #define CEU_CEIER_VBP (1 << 20)
269 #define CEU_CAPCR_CTNCP (1 << 16)
270 #define CEU_CEIER_MASK (CEU_CEIER_CPEIE | CEU_CEIER_VBP)
281 unsigned long top1, top2;
282 unsigned long bottom1, bottom2;
293 status = ceu_read(pcdev,
CETCR);
306 sh_mobile_ceu_soft_reset(pcdev);
330 phys_addr_top = vb2_dma_contig_plane_dma_addr(pcdev->
active, 0);
343 ceu_write(pcdev, top1, phys_addr_top);
346 ceu_write(pcdev, bottom1, phys_addr_bottom);
351 ceu_write(pcdev, top2, phys_addr_top);
354 ceu_write(pcdev, bottom2, phys_addr_bottom);
358 ceu_write(pcdev,
CAPSR, 0x1);
363 static int sh_mobile_ceu_videobuf_prepare(
struct vb2_buffer *vb)
368 WARN(!list_empty(&buf->
queue),
"Buffer %p on queue!\n", vb);
373 static void sh_mobile_ceu_videobuf_queue(
struct vb2_buffer *vb)
383 if (vb2_plane_size(vb, 0) < size) {
385 vb->
v4l2_buf.index, vb2_plane_size(vb, 0), size);
389 vb2_set_plane_payload(vb, 0, size);
403 spin_lock_irq(&pcdev->
lock);
413 sh_mobile_ceu_capture(pcdev);
415 spin_unlock_irq(&pcdev->
lock);
423 static void sh_mobile_ceu_videobuf_release(
struct vb2_buffer *vb)
430 spin_lock_irq(&pcdev->
lock);
432 if (pcdev->
active == vb) {
434 ceu_write(pcdev,
CAPSR, 1 << 16);
443 list_del_init(&buf->
queue);
449 spin_unlock_irq(&pcdev->
lock);
452 static int sh_mobile_ceu_videobuf_init(
struct vb2_buffer *vb)
463 INIT_LIST_HEAD(&to_ceu_vb(vb)->
queue);
467 static int sh_mobile_ceu_stop_streaming(
struct vb2_queue *
q)
474 spin_lock_irq(&pcdev->
lock);
479 list_del_init(buf_head);
481 spin_unlock_irq(&pcdev->lock);
483 return sh_mobile_ceu_soft_reset(pcdev);
488 .buf_prepare = sh_mobile_ceu_videobuf_prepare,
489 .buf_queue = sh_mobile_ceu_videobuf_queue,
490 .buf_cleanup = sh_mobile_ceu_videobuf_release,
491 .buf_init = sh_mobile_ceu_videobuf_init,
494 .stop_streaming = sh_mobile_ceu_stop_streaming,
503 spin_lock(&pcdev->
lock);
510 list_del_init(&to_ceu_vb(vb)->
queue);
512 if (!list_empty(&pcdev->
capture))
518 ret = sh_mobile_ceu_capture(pcdev);
527 spin_unlock(&pcdev->
lock);
540 if (&pcdev->csi2_pdev->
dev == v4l2_get_subdevdata(sd))
558 "SuperH Mobile CEU driver attached to camera %d\n",
561 pm_runtime_get_sync(ici->
v4l2_dev.dev);
565 ret = sh_mobile_ceu_soft_reset(pcdev);
567 csi2_sd = find_csi2(pcdev);
569 csi2_sd->
grp_id = soc_camera_grp_id(icd);
570 v4l2_set_subdev_hostdata(csi2_sd, icd);
575 pm_runtime_put_sync(ici->
v4l2_dev.dev);
583 if (ret == -
ENODEV && csi2_sd)
603 ceu_write(pcdev,
CEIER, 0);
604 sh_mobile_ceu_soft_reset(pcdev);
607 spin_lock_irq(&pcdev->
lock);
609 list_del_init(&to_ceu_vb(pcdev->
active)->queue);
613 spin_unlock_irq(&pcdev->
lock);
615 pm_runtime_put_sync(ici->
v4l2_dev.dev);
618 "SuperH Mobile CEU driver detached from camera %d\n",
628 static unsigned int size_dst(
unsigned int src,
unsigned int scale)
630 unsigned int mant_pre = scale >> 12;
633 return ((mant_pre + 2 * (src - 1)) / (2 * mant_pre) - 1) *
634 mant_pre * 4096 / scale + 1;
637 static u16 calc_scale(
unsigned int src,
unsigned int *
dst)
644 scale = (src * 4096 / *
dst) & ~7;
646 while (scale > 4096 && size_dst(src, scale) < *
dst)
649 *dst = size_dst(src, scale);
660 unsigned int height,
width, cdwdr_width, in_width, in_height;
661 unsigned int left_offset, top_offset;
675 in_width = cam->
width;
681 unsigned int w_factor;
691 in_width = cam->
width * w_factor;
692 left_offset *= w_factor;
700 height = (height / 2) & ~3;
707 if (pcdev->
pdata->csi2) {
708 in_width = ((in_width - 2) * 2);
713 camor = left_offset | (top_offset << 16);
716 "CAMOR 0x%x, CAPWR 0x%x, CFSZR 0x%x, CDWDR 0x%x\n", camor,
717 (in_height << 16) | in_width, (height << 16) | width,
720 ceu_write(pcdev,
CAMOR, camor);
721 ceu_write(pcdev,
CAPWR, (in_height << 16) | in_width);
723 ceu_write(pcdev,
CFSZR, (height << 16) | width);
724 ceu_write(pcdev,
CDWDR, cdwdr_width);
730 ceu_write(pcdev,
CAPSR, 1 << 16);
747 "Timeout waiting for frame end! Interface problem?\n");
752 while (ceu_read(pcdev,
CAPSR) & (1 << 16))
756 if (capsr & ~(1 << 16))
757 ceu_write(pcdev,
CAPSR, capsr);
766 if (csi2_sd && csi2_sd->
grp_id == soc_camera_grp_id(icd))
770 return soc_camera_to_subdev(icd);
773 #define CEU_BUS_FLAGS (V4L2_MBUS_MASTER | \
774 V4L2_MBUS_PCLK_SAMPLE_RISING | \
775 V4L2_MBUS_HSYNC_ACTIVE_HIGH | \
776 V4L2_MBUS_HSYNC_ACTIVE_LOW | \
777 V4L2_MBUS_VSYNC_ACTIVE_HIGH | \
778 V4L2_MBUS_VSYNC_ACTIVE_LOW | \
779 V4L2_MBUS_DATA_ACTIVE_HIGH)
786 struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd);
790 u32 capsr = capture_save_reset(pcdev);
791 unsigned int yuv_lineskip;
812 common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
814 common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
820 common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
822 common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
830 if (icd->
current_fmt->host_fmt->bits_per_sample > 8)
835 ceu_write(pcdev,
CRCNTR, 0);
836 ceu_write(pcdev,
CRCMPR, 0);
871 value |= common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? 1 << 1 : 0;
872 value |= common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? 1 << 0 : 0;
874 if (pcdev->
pdata->csi2)
881 ceu_write(pcdev,
CAMCR, value);
883 ceu_write(pcdev,
CAPCR, 0x00300000);
885 switch (pcdev->
field) {
896 ceu_write(pcdev,
CAIFR, value);
898 sh_mobile_ceu_set_rect(icd);
917 value = 0x00000007 | yuv_lineskip;
919 ceu_write(pcdev,
CDOCR, value);
920 ceu_write(pcdev,
CFWCR, 0);
922 capture_restore(pcdev, capsr);
933 struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd);
945 if (!common_flags || buswidth > 16)
955 .bits_per_sample = 8,
962 .bits_per_sample = 8,
969 .bits_per_sample = 8,
976 .bits_per_sample = 8,
1016 ceu_write(pcdev,
CLFCR, !ctrl->
val);
1025 static const struct v4l2_ctrl_ops sh_mobile_ceu_ctrl_ops = {
1026 .s_ctrl = sh_mobile_ceu_s_ctrl,
1030 struct soc_camera_format_xlate *xlate)
1032 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1049 dev_warn(dev,
"unsupported format code #%u: %d\n", idx, code);
1053 if (!pcdev->
pdata->csi2) {
1061 struct v4l2_mbus_framefmt mf;
1074 ret = client_g_rect(sd, &rect);
1091 mf.height > pcdev->
max_height) && shift < 4) {
1093 mf.width = 2560 >> shift;
1094 mf.height = 1920 >> shift;
1096 soc_camera_grp_id(icd), video,
1104 dev_err(dev,
"Failed to configure the client below %ux%x\n",
1105 mf.width, mf.height);
1109 dev_geo(dev,
"camera fmt %ux%u\n", mf.width, mf.height);
1119 cam->
width = mf.width;
1152 for (k = 0; xlate && k <
n; k++) {
1153 xlate->host_fmt = &sh_mobile_ceu_formats[
k];
1156 dev_dbg(dev,
"Providing format %s using code %d\n",
1157 sh_mobile_ceu_formats[k].
name, code);
1161 if (!sh_mobile_ceu_packing_supported(fmt))
1168 xlate->host_fmt =
fmt;
1171 dev_dbg(dev,
"Providing format %s in pass-through mode\n",
1198 static unsigned int scale_down(
unsigned int size,
unsigned int scale)
1200 return (size * 4096 + scale / 2) / scale;
1203 static unsigned int calc_generic_scale(
unsigned int input,
unsigned int output)
1205 return (input * 4096 + output / 2) / output;
1228 *rect =
cap.defrect;
1238 if (rect->
width < subrect->width)
1239 subrect->width = rect->
width;
1241 if (rect->
height < subrect->height)
1242 subrect->height = rect->
height;
1244 if (rect->
left > subrect->left)
1245 subrect->left = rect->
left;
1247 subrect->left + subrect->width)
1248 subrect->left = rect->
left + rect->
width -
1251 if (rect->
top > subrect->top)
1252 subrect->top = rect->
top;
1254 subrect->top + subrect->height)
1255 subrect->top = rect->
top + rect->
height -
1268 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1269 struct v4l2_rect *rect = &crop->
c, *cam_rect = &cam_crop->
c;
1277 ret = client_g_rect(sd, cam_rect);
1285 if (!
memcmp(rect, cam_rect,
sizeof(*rect))) {
1287 dev_dbg(dev,
"Camera S_CROP successful for %dx%d@%d:%d\n",
1289 cam->
rect = *cam_rect;
1294 dev_geo(dev,
"Fix camera S_CROP for %dx%d@%d:%d to %dx%d@%d:%d\n",
1295 cam_rect->width, cam_rect->height,
1296 cam_rect->left, cam_rect->top,
1305 soc_camera_limit_side(&rect->
left, &rect->
width,
cap.bounds.left, 2,
1307 soc_camera_limit_side(&rect->
top, &rect->
height,
cap.bounds.top, 4,
1314 width =
max(cam_rect->width, 2);
1315 height =
max(cam_rect->height, 2);
1321 while (!ret && (is_smaller(cam_rect, rect) ||
1322 is_inside(cam_rect, rect)) &&
1323 (
cap.bounds.width > width ||
cap.bounds.height > height)) {
1328 cam_rect->width =
width;
1329 cam_rect->height =
height;
1340 if (cam_rect->left > rect->
left)
1341 cam_rect->left =
cap.bounds.left;
1343 if (cam_rect->left + cam_rect->width < rect->
left + rect->
width)
1344 cam_rect->width = rect->
left + rect->
width -
1347 if (cam_rect->top > rect->
top)
1348 cam_rect->top =
cap.bounds.top;
1350 if (cam_rect->top + cam_rect->height < rect->
top + rect->
height)
1351 cam_rect->height = rect->
top + rect->
height -
1355 ret = client_g_rect(sd, cam_rect);
1356 dev_geo(dev,
"Camera S_CROP %d for %dx%d@%d:%d\n", ret,
1357 cam_rect->width, cam_rect->height,
1358 cam_rect->left, cam_rect->top);
1362 if (is_smaller(cam_rect, rect) || is_inside(cam_rect, rect)) {
1367 *cam_rect =
cap.bounds;
1369 ret = client_g_rect(sd, cam_rect);
1370 dev_geo(dev,
"Camera S_CROP %d for max %dx%d@%d:%d\n", ret,
1371 cam_rect->width, cam_rect->height,
1372 cam_rect->left, cam_rect->top);
1376 cam->
rect = *cam_rect;
1377 update_subrect(cam);
1385 struct v4l2_mbus_framefmt *mf,
bool ceu_can_scale)
1390 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1392 unsigned int width = mf->width, height = mf->height, tmp_w, tmp_h;
1399 soc_camera_grp_id(icd), video,
1404 dev_geo(dev,
"camera scaled to %ux%u\n", mf->width, mf->height);
1406 if (width == mf->width && height == mf->height) {
1430 while ((width > tmp_w || height > tmp_h) &&
1431 tmp_w < max_width && tmp_h < max_height) {
1432 tmp_w =
min(2 * tmp_w, max_width);
1433 tmp_h =
min(2 * tmp_h, max_height);
1437 soc_camera_grp_id(icd), video,
1439 dev_geo(dev,
"Camera scaled to %ux%u\n",
1440 mf->width, mf->height);
1443 dev_err(dev,
"Client failed to set format: %d\n", ret);
1450 ret = client_g_rect(sd, &cam->
rect);
1457 update_subrect(cam);
1468 struct v4l2_mbus_framefmt *mf,
1469 unsigned int *width,
unsigned int *height,
1474 struct v4l2_mbus_framefmt mf_tmp = *mf;
1475 unsigned int scale_h, scale_v;
1482 ret = client_s_fmt(icd, &mf_tmp, ceu_can_scale);
1486 dev_geo(dev,
"5: camera scaled to %ux%u\n",
1487 mf_tmp.width, mf_tmp.height);
1494 scale_h = calc_generic_scale(cam->
rect.width, mf_tmp.width);
1495 scale_v = calc_generic_scale(cam->
rect.height, mf_tmp.height);
1497 mf->width = mf_tmp.width;
1498 mf->height = mf_tmp.height;
1499 mf->colorspace = mf_tmp.colorspace;
1505 *width = scale_down(cam->
subrect.width, scale_h);
1506 *height = scale_down(cam->
subrect.height, scale_v);
1508 dev_geo(dev,
"8: new client sub-window %ux%u\n", *width, *height);
1523 const struct v4l2_rect *rect = &a_writable.
c;
1530 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1531 struct v4l2_mbus_framefmt mf;
1532 unsigned int scale_cam_h, scale_cam_v, scale_ceu_h, scale_ceu_v,
1533 out_width, out_height;
1534 int interm_width, interm_height;
1542 capsr = capture_save_reset(pcdev);
1543 dev_dbg(dev,
"CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->
cflcr);
1549 ret = client_s_crop(icd, &a_writable, &cam_crop);
1553 dev_geo(dev,
"1-2: camera cropped to %ux%u@%u:%u\n",
1555 cam_rect->
left, cam_rect->
top);
1568 scale_cam_h = calc_generic_scale(cam_rect->
width, mf.width);
1569 scale_cam_v = calc_generic_scale(cam_rect->
height, mf.height);
1572 interm_width = scale_down(rect->
width, scale_cam_h);
1573 interm_height = scale_down(rect->
height, scale_cam_v);
1575 if (interm_width < icd->user_width) {
1580 mf.width = scale_down(cam_rect->
width, new_scale_h);
1583 if (interm_height < icd->user_height) {
1588 mf.height = scale_down(cam_rect->
height, new_scale_v);
1591 if (interm_width < icd->user_width || interm_height < icd->user_height) {
1593 soc_camera_grp_id(icd), video,
1598 dev_geo(dev,
"New camera output %ux%u\n", mf.width, mf.height);
1599 scale_cam_h = calc_generic_scale(cam_rect->
width, mf.width);
1600 scale_cam_v = calc_generic_scale(cam_rect->
height, mf.height);
1601 interm_width = scale_down(rect->
width, scale_cam_h);
1602 interm_height = scale_down(rect->
height, scale_cam_v);
1606 cam->
width = mf.width;
1613 out_width = interm_width;
1614 out_height = interm_height;
1621 scale_ceu_h = calc_scale(interm_width, &out_width);
1622 scale_ceu_v = calc_scale(interm_height, &out_height);
1624 dev_geo(dev,
"5: CEU scales %u:%u\n", scale_ceu_h, scale_ceu_v);
1627 cflcr = scale_ceu_h | (scale_ceu_v << 16);
1628 if (cflcr != pcdev->
cflcr) {
1629 pcdev->
cflcr = cflcr;
1630 ceu_write(pcdev,
CFLCR, cflcr);
1637 cam->
ceu_top = scale_down(rect->
top - cam_rect->
top, scale_cam_v) & ~1;
1640 sh_mobile_ceu_set_rect(icd);
1644 dev_geo(dev,
"6: CEU cropped to %ux%u@%u:%u\n",
1651 capture_restore(pcdev, capsr);
1679 unsigned int scale_v, scale_h;
1681 if (cam_subrect->
width == cam->
rect.width &&
1684 mf->width = pix->
width;
1685 mf->height = pix->
height;
1691 dev_geo(dev,
"2: subwin %ux%u@%u:%u\n",
1693 cam_subrect->
left, cam_subrect->
top);
1704 scale_h = calc_generic_scale(cam_subrect->
width, pix->
width);
1705 scale_v = calc_generic_scale(cam_subrect->
height, pix->
height);
1707 dev_geo(dev,
"3: scales %u:%u\n", scale_h, scale_v);
1713 mf->width = scale_down(cam->
rect.width, scale_h);
1714 mf->height = scale_down(cam->
rect.height, scale_v);
1726 struct v4l2_mbus_framefmt mf;
1728 const struct soc_camera_format_xlate *xlate;
1730 unsigned int ceu_sub_width = 0, ceu_sub_height = 0;
1731 u16 scale_v, scale_h;
1736 switch (pix->
field) {
1752 dev_warn(dev,
"Format %x not found\n", pixfmt);
1757 calculate_client_output(icd, pix, &mf);
1758 mf.field = pix->
field;
1760 mf.code = xlate->code;
1773 dev_geo(dev,
"S_FMT(pix=0x%x, fld 0x%x, code 0x%x, %ux%u)\n", pixfmt, mf.field, mf.code,
1776 dev_geo(dev,
"4: request camera output %ux%u\n", mf.width, mf.height);
1779 ret = client_scale(icd, &mf, &ceu_sub_width, &ceu_sub_height,
1782 dev_geo(dev,
"5-9: client scale return %d\n", ret);
1786 dev_geo(dev,
"fmt %ux%u, requested %ux%u\n",
1791 if (mf.code != xlate->code)
1795 cam->
width = mf.width;
1801 if (pix->
width > ceu_sub_width)
1802 ceu_sub_width = pix->
width;
1804 if (pix->
height > ceu_sub_height)
1805 ceu_sub_height = pix->
height;
1811 scale_h = calc_scale(ceu_sub_width, &pix->
width);
1812 scale_v = calc_scale(ceu_sub_height, &pix->
height);
1814 pix->
width = ceu_sub_width;
1815 pix->
height = ceu_sub_height;
1820 pcdev->
cflcr = scale_h | (scale_v << 16);
1827 dev_geo(dev,
"10: W: %u : 0x%x = %u, H: %u : 0x%x = %u\n",
1828 ceu_sub_width, scale_h, pix->
width,
1829 ceu_sub_height, scale_v, pix->
height);
1831 cam->
code = xlate->code;
1844 #define CEU_CHDW_MAX 8188U
1851 const struct soc_camera_format_xlate *xlate;
1853 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1854 struct v4l2_mbus_framefmt mf;
1866 pixfmt, xlate->host_fmt->fourcc);
1867 pixfmt = xlate->host_fmt->fourcc;
1882 mf.width = pix->
width;
1884 mf.field = pix->
field;
1885 mf.code = xlate->code;
1889 video, try_mbus_fmt, &mf);
1893 pix->
width = mf.width;
1895 pix->
field = mf.field;
1914 soc_camera_grp_id(icd), video,
1919 "FIXME: client try_fmt() = %d\n", ret);
1924 if (mf.width > width)
1926 if (mf.height > height)
1952 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1966 "Client failed to stop the stream: %d\n", ret);
1969 sh_mobile_ceu_set_crop(icd, a);
1978 .height = out_height,
1979 .pixelformat = icd->
current_fmt->host_fmt->fourcc,
1980 .field = pcdev->
field,
1984 ret = sh_mobile_ceu_set_fmt(icd, &f);
1985 if (!ret && (out_width != f.
fmt.
pix.width ||
1986 out_height != f.
fmt.
pix.height))
1991 ret = sh_mobile_ceu_set_bus_param(icd);
1997 spin_lock_irq(&pcdev->
lock);
1998 sh_mobile_ceu_capture(pcdev);
1999 spin_unlock_irq(&pcdev->
lock);
2020 static int sh_mobile_ceu_init_videobuf(
struct vb2_queue *q,
2026 q->
ops = &sh_mobile_ceu_videobuf_ops;
2035 .add = sh_mobile_ceu_add_device,
2036 .remove = sh_mobile_ceu_remove_device,
2037 .get_formats = sh_mobile_ceu_get_formats,
2038 .put_formats = sh_mobile_ceu_put_formats,
2039 .get_crop = sh_mobile_ceu_get_crop,
2040 .set_crop = sh_mobile_ceu_set_crop,
2041 .set_livecrop = sh_mobile_ceu_set_livecrop,
2042 .set_fmt = sh_mobile_ceu_set_fmt,
2043 .try_fmt = sh_mobile_ceu_try_fmt,
2044 .poll = sh_mobile_ceu_poll,
2045 .querycap = sh_mobile_ceu_querycap,
2046 .set_bus_param = sh_mobile_ceu_set_bus_param,
2047 .init_videobuf2 = sh_mobile_ceu_init_videobuf,
2057 unsigned long action,
void *data)
2062 if (wait->
dev != dev)
2083 .notifier.notifier_call = bus_notify,
2089 if (!res || (
int)irq <= 0) {
2090 dev_err(&pdev->
dev,
"Not enough CEU platform resources.\n");
2097 dev_err(&pdev->
dev,
"Could not allocate pcdev\n");
2102 INIT_LIST_HEAD(&pcdev->
capture);
2106 pcdev->
pdata = pdev->
dev.platform_data;
2107 if (!pcdev->
pdata) {
2109 dev_err(&pdev->
dev,
"CEU platform data not set.\n");
2119 dev_err(&pdev->
dev,
"Unable to ioremap CEU registers.\n");
2135 dev_err(&pdev->
dev,
"Unable to declare CEU memory.\n");
2145 dev_name(&pdev->
dev), pcdev);
2147 dev_err(&pdev->
dev,
"Unable to register CEU interrupt.\n");
2148 goto exit_release_mem;
2151 pm_suspend_ignore_children(&pdev->
dev,
true);
2153 pm_runtime_resume(&pdev->
dev);
2155 pcdev->
ici.priv = pcdev;
2156 pcdev->
ici.v4l2_dev.dev = &pdev->
dev;
2157 pcdev->
ici.nr = pdev->
id;
2158 pcdev->
ici.drv_name = dev_name(&pdev->
dev);
2159 pcdev->
ici.ops = &sh_mobile_ceu_host_ops;
2173 csi2 = pcdev->
pdata->csi2;
2181 goto exit_host_unregister;
2190 csi2_pdata = csi2_pdev->
dev.platform_data;
2200 wait.
dev = &csi2_pdev->
dev;
2204 goto exit_pdev_unregister;
2211 if (!csi2_pdev->
dev.driver) {
2216 goto exit_pdev_unregister;
2225 err = try_module_get(csi2_pdev->
dev.driver->owner);
2232 goto exit_pdev_unregister;
2238 exit_pdev_unregister:
2243 exit_host_unregister:
2248 pm_runtime_disable(&pdev->
dev);
2269 pm_runtime_disable(&pdev->
dev);
2275 if (csi2_pdev && csi2_pdev->
dev.driver) {
2276 struct module *csi2_drv = csi2_pdev->
dev.driver->owner;
2280 module_put(csi2_drv);
2287 static int sh_mobile_ceu_runtime_nop(
struct device *dev)
2299 static const struct dev_pm_ops sh_mobile_ceu_dev_pm_ops = {
2300 .runtime_suspend = sh_mobile_ceu_runtime_nop,
2301 .runtime_resume = sh_mobile_ceu_runtime_nop,
2306 .name =
"sh_mobile_ceu",
2307 .pm = &sh_mobile_ceu_dev_pm_ops,
2309 .probe = sh_mobile_ceu_probe,
2313 static int __init sh_mobile_ceu_init(
void)
2316 request_module(
"sh_mobile_csi2");
2320 static void __exit sh_mobile_ceu_exit(
void)