24 return readl(mdev->
res.vp_regs + reg_id);
32 static inline void vp_write_mask(
struct mxr_device *mdev,
u32 reg_id,
35 u32 old = vp_read(mdev, reg_id);
37 val = (val &
mask) | (old & ~mask);
43 return readl(mdev->
res.mxr_regs + reg_id);
51 static inline void mxr_write_mask(
struct mxr_device *mdev,
u32 reg_id,
54 u32 old = mxr_read(mdev, reg_id);
56 val = (val &
mask) | (old & ~mask);
64 MXR_STATUS_SYNC_ENABLE);
68 static void __mxr_reg_vp_reset(
struct mxr_device *mdev)
73 for (tries = 100; tries; --tries) {
79 WARN(tries == 0,
"failed to reset Video Processor\n");
82 static void mxr_reg_vp_default_filter(
struct mxr_device *mdev);
126 __mxr_reg_vp_reset(mdev);
127 mxr_reg_vp_default_filter(mdev);
133 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
168 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
210 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
216 u32 val = addr ? ~0 : 0;
229 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
235 u32 val = luma_addr[0] ? ~0 : 0;
250 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
253 static void mxr_irq_layer_handle(
struct mxr_layer *layer)
269 if (list_empty(head)) {
304 val &= ~MXR_INT_STATUS_VSYNC;
319 mxr_irq_layer_handle(mdev->
layer[i]);
342 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
355 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
371 mxr_warn(mdev,
"no vsync detected - timeout\n");
376 struct v4l2_mbus_framefmt *
fmt)
397 if (fmt->height == 480)
399 else if (fmt->height == 576)
401 else if (fmt->height == 720)
403 else if (fmt->height == 1080)
406 WARN(1,
"unrecognized mbus height %u!\n", fmt->height);
412 vp_write_mask(mdev,
VP_MODE, val,
416 spin_unlock_irqrestore(&mdev->
reg_slock, flags);
429 static const u8 filter_y_horiz_tap8[] = {
430 0, -1, -1, -1, -1, -1, -1, -1,
431 -1, -1, -1, -1, -1, 0, 0, 0,
432 0, 2, 4, 5, 6, 6, 6, 6,
433 6, 5, 5, 4, 3, 2, 1, 1,
434 0, -6, -12, -16, -18, -20, -21, -20,
435 -20, -18, -16, -13, -10, -8, -5, -2,
436 127, 126, 125, 121, 114, 107, 99, 89,
437 79, 68, 57, 46, 35, 25, 16, 8,
440 static const u8 filter_y_vert_tap4[] = {
441 0, -3, -6, -8, -8, -8, -8, -7,
442 -6, -5, -4, -3, -2, -1, -1, 0,
443 127, 126, 124, 118, 111, 102, 92, 81,
444 70, 59, 48, 37, 27, 19, 11, 5,
445 0, 5, 11, 19, 27, 37, 48, 59,
446 70, 81, 92, 102, 111, 118, 124, 126,
447 0, 0, -1, -1, -2, -3, -4, -5,
448 -6, -7, -8, -8, -8, -8, -6, -3,
451 static const u8 filter_cr_horiz_tap4[] = {
452 0, -3, -6, -8, -8, -8, -8, -7,
453 -6, -5, -4, -3, -2, -1, -1, 0,
454 127, 126, 124, 118, 111, 102, 92, 81,
455 70, 59, 48, 37, 27, 19, 11, 5,
458 static inline void mxr_reg_vp_filter_set(
struct mxr_device *mdev,
459 int reg_id,
const u8 *
data,
unsigned int size)
463 for (;
size; size -= 4, reg_id += 4, data += 4) {
464 u32 val = (data[0] << 24) | (data[1] << 16) |
465 (data[2] << 8) | data[3];
466 vp_write(mdev, reg_id, val);
470 static void mxr_reg_vp_default_filter(
struct mxr_device *mdev)
473 filter_y_horiz_tap8,
sizeof filter_y_horiz_tap8);
475 filter_y_vert_tap4,
sizeof filter_y_vert_tap4);
477 filter_cr_horiz_tap4,
sizeof filter_cr_horiz_tap4);
480 static void mxr_reg_mxr_dump(
struct mxr_device *mdev)
482 #define DUMPREG(reg_id) \
484 mxr_dbg(mdev, #reg_id " = %08x\n", \
485 (u32)readl(mdev->res.mxr_regs + reg_id)); \
512 static void mxr_reg_vp_dump(
struct mxr_device *mdev)
514 #define DUMPREG(reg_id) \
516 mxr_dbg(mdev, #reg_id " = %08x\n", \
517 (u32) readl(mdev->res.vp_regs + reg_id)); \
550 mxr_reg_mxr_dump(mdev);
551 mxr_reg_vp_dump(mdev);