Lines Matching +full:abs +full:- +full:flat
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 #include "cx25821-medusa-video.h"
13 #include "cx25821-biffuncs.h"
63 value = cx25821_i2c_read(&dev->i2c_bus[0], out_ctrl, &tmp); in medusa_enable_bluefield_output()
67 cx25821_i2c_write(&dev->i2c_bus[0], out_ctrl, value); in medusa_enable_bluefield_output()
69 value = cx25821_i2c_read(&dev->i2c_bus[0], out_ctrl_ns, &tmp); in medusa_enable_bluefield_output()
73 cx25821_i2c_write(&dev->i2c_bus[0], out_ctrl_ns, value); in medusa_enable_bluefield_output()
84 /* set video format NTSC-M */ in medusa_initialize_ntsc()
85 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
90 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
94 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
98 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
101 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
105 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
109 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
113 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
117 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
121 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
125 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
132 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
137 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
141 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
144 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
153 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
157 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
161 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
165 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
168 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
172 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
176 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
180 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
183 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_ntsc()
187 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
190 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
194 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_ntsc()
199 /* 0 - 720 */ in medusa_initialize_ntsc()
200 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); in medusa_initialize_ntsc()
201 /* 0 - 480 */ in medusa_initialize_ntsc()
202 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); in medusa_initialize_ntsc()
205 value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); in medusa_initialize_ntsc()
207 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); in medusa_initialize_ntsc()
214 int ret_val = -1; in medusa_PALCombInit()
218 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
220 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
222 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
225 /* Setup flat chroma and luma thresholds */ in medusa_PALCombInit()
226 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_PALCombInit()
229 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
233 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
237 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_PALCombInit()
251 /* set video format PAL-BDGHI */ in medusa_initialize_pal()
252 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
257 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
261 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
265 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
269 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
273 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
277 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
281 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
285 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
289 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
293 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
300 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
305 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
309 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
312 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
323 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
327 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
331 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
335 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
339 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
343 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
347 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
351 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
354 value = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_initialize_pal()
358 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
361 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
365 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], in medusa_initialize_pal()
370 /* 0 - 720 */ in medusa_initialize_pal()
371 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); in medusa_initialize_pal()
372 /* 0 - 576 */ in medusa_initialize_pal()
373 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); in medusa_initialize_pal()
376 value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); in medusa_initialize_pal()
378 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); in medusa_initialize_pal()
388 if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) in medusa_set_videostandard()
394 value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_4, &tmp); in medusa_set_videostandard()
396 status = cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_4, value); in medusa_set_videostandard()
399 value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_B_REG_4, &tmp); in medusa_set_videostandard()
401 status = cx25821_i2c_write(&dev->i2c_bus[0], DENC_B_REG_4, value); in medusa_set_videostandard()
427 decoder_count = dev->_max_num_decoders; in medusa_set_resolution()
459 cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_resolution()
461 cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_resolution()
496 fld_cnt = cx25821_i2c_read(&dev->i2c_bus[0], disp_cnt_reg, &tmp); in medusa_set_decoderduration()
506 cx25821_i2c_write(&dev->i2c_bus[0], disp_cnt_reg, fld_cnt); in medusa_set_decoderduration()
518 return -1; in mapM()
522 * (srcVal - srcMin)*(dstMax - dstMin) / (srcMax - srcMin) + dstMin; in mapM()
526 numerator = (srcVal - srcMin) * (dstMax - dstMin); in mapM()
527 denominator = srcMax - srcMin; in mapM()
545 temp = ~(abs(numeric) & 0xFF); in convert_to_twos()
559 return -1; in medusa_set_brightness()
564 val = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_set_brightness()
567 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_brightness()
579 return -1; in medusa_set_contrast()
584 val = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_set_contrast()
587 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_contrast()
600 return -1; in medusa_set_hue()
607 val = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_set_hue()
611 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_hue()
625 return -1; in medusa_set_saturation()
631 val = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_set_saturation()
634 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_saturation()
637 val = cx25821_i2c_read(&dev->i2c_bus[0], in medusa_set_saturation()
640 ret_val |= cx25821_i2c_write(&dev->i2c_bus[0], in medusa_set_saturation()
655 value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); in medusa_video_init()
657 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); in medusa_video_init()
663 value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); in medusa_video_init()
665 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); in medusa_video_init()
676 for (i = 0; i < dev->_max_num_decoders; i++) in medusa_video_init()
680 value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp); in medusa_video_init()
683 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_AB_CTRL, value); in medusa_video_init()
689 value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); in medusa_video_init()
691 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); in medusa_video_init()
697 value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); in medusa_video_init()
699 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, in medusa_video_init()
706 value = cx25821_i2c_read(&dev->i2c_bus[0], PIN_OE_CTRL, &tmp); in medusa_video_init()
708 if (dev->_max_num_decoders == MAX_DECODERS) { in medusa_video_init()
710 * Note: The octal board does not support control pins(bit16-19) in medusa_video_init()
713 * disable VDEC A-C port, default to Mobilygen Interface in medusa_video_init()
717 /* disable VDEC A-C port, default to Mobilygen Interface */ in medusa_video_init()
722 ret_val = cx25821_i2c_write(&dev->i2c_bus[0], PIN_OE_CTRL, value); in medusa_video_init()