tw5864-video.c (4d69f155d58d0f75c5404ea502178b1943a04755) tw5864-video.c (6dfcd296576a14bc52d0453e4ba7ed09323a26dc)
1/*
2 * TW5864 driver - video encoding functions
3 *
4 * Copyright (C) 2016 Bluecherry, LLC <maintainers@bluecherrydvr.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 316 unchanged lines hidden (view full) ---

325 /* analog input width / 4 */
326 tw_indir_writeb(TW5864_INDIR_IN_PIC_WIDTH(nr), d1_width / 4);
327 tw_indir_writeb(TW5864_INDIR_IN_PIC_HEIGHT(nr), d1_height / 4);
328
329 /* output width / 4 */
330 tw_indir_writeb(TW5864_INDIR_OUT_PIC_WIDTH(nr), input->width / 4);
331 tw_indir_writeb(TW5864_INDIR_OUT_PIC_HEIGHT(nr), input->height / 4);
332
1/*
2 * TW5864 driver - video encoding functions
3 *
4 * Copyright (C) 2016 Bluecherry, LLC <maintainers@bluecherrydvr.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 316 unchanged lines hidden (view full) ---

325 /* analog input width / 4 */
326 tw_indir_writeb(TW5864_INDIR_IN_PIC_WIDTH(nr), d1_width / 4);
327 tw_indir_writeb(TW5864_INDIR_IN_PIC_HEIGHT(nr), d1_height / 4);
328
329 /* output width / 4 */
330 tw_indir_writeb(TW5864_INDIR_OUT_PIC_WIDTH(nr), input->width / 4);
331 tw_indir_writeb(TW5864_INDIR_OUT_PIC_HEIGHT(nr), input->height / 4);
332
333 /*
334 * Crop width from 720 to 704.
335 * Above register settings need value 720 involved.
336 */
337 input->width = 704;
338 tw_indir_writeb(TW5864_INDIR_CROP_ETC,
339 tw_indir_readb(TW5864_INDIR_CROP_ETC) |
340 TW5864_INDIR_CROP_ETC_CROP_EN);
341
333 tw_writel(TW5864_DSP_PIC_MAX_MB,
334 ((input->width / 16) << 8) | (input->height / 16));
335
336 tw_writel(TW5864_FRAME_WIDTH_BUS_A(nr),
337 frame_width_bus_value);
338 tw_writel(TW5864_FRAME_WIDTH_BUS_B(nr),
339 frame_width_bus_value);
340 tw_writel(TW5864_FRAME_HEIGHT_BUS_A(nr),

--- 186 unchanged lines hidden (view full) ---

527 return 0;
528}
529
530static int tw5864_fmt_vid_cap(struct file *file, void *priv,
531 struct v4l2_format *f)
532{
533 struct tw5864_input *input = video_drvdata(file);
534
342 tw_writel(TW5864_DSP_PIC_MAX_MB,
343 ((input->width / 16) << 8) | (input->height / 16));
344
345 tw_writel(TW5864_FRAME_WIDTH_BUS_A(nr),
346 frame_width_bus_value);
347 tw_writel(TW5864_FRAME_WIDTH_BUS_B(nr),
348 frame_width_bus_value);
349 tw_writel(TW5864_FRAME_HEIGHT_BUS_A(nr),

--- 186 unchanged lines hidden (view full) ---

536 return 0;
537}
538
539static int tw5864_fmt_vid_cap(struct file *file, void *priv,
540 struct v4l2_format *f)
541{
542 struct tw5864_input *input = video_drvdata(file);
543
535 f->fmt.pix.width = 720;
544 f->fmt.pix.width = 704;
536 switch (input->std) {
537 default:
538 WARN_ON_ONCE(1);
539 case STD_NTSC:
540 f->fmt.pix.height = 480;
541 break;
542 case STD_PAL:
543 case STD_SECAM:

--- 189 unchanged lines hidden (view full) ---

733 struct tw5864_input *input = video_drvdata(file);
734
735 if (fsize->index > 0)
736 return -EINVAL;
737 if (fsize->pixel_format != V4L2_PIX_FMT_H264)
738 return -EINVAL;
739
740 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
545 switch (input->std) {
546 default:
547 WARN_ON_ONCE(1);
548 case STD_NTSC:
549 f->fmt.pix.height = 480;
550 break;
551 case STD_PAL:
552 case STD_SECAM:

--- 189 unchanged lines hidden (view full) ---

742 struct tw5864_input *input = video_drvdata(file);
743
744 if (fsize->index > 0)
745 return -EINVAL;
746 if (fsize->pixel_format != V4L2_PIX_FMT_H264)
747 return -EINVAL;
748
749 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
741 fsize->discrete.width = 720;
750 fsize->discrete.width = 704;
742 fsize->discrete.height = input->std == STD_NTSC ? 480 : 576;
743
744 return 0;
745}
746
747static int tw5864_enum_frameintervals(struct file *file, void *priv,
748 struct v4l2_frmivalenum *fintv)
749{

--- 761 unchanged lines hidden ---
751 fsize->discrete.height = input->std == STD_NTSC ? 480 : 576;
752
753 return 0;
754}
755
756static int tw5864_enum_frameintervals(struct file *file, void *priv,
757 struct v4l2_frmivalenum *fintv)
758{

--- 761 unchanged lines hidden ---