Lines Matching +full:fpd +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2021-2023 Digiteq Automotive
25 return sprintf(buf, "%d\n", vindev->config->id); in input_id_show()
33 struct mgb4_dev *mgbdev = vindev->mgbdev; in oldi_lane_width_show()
44 mutex_lock(&mgbdev->i2c_lock); in oldi_lane_width_show()
45 ret = mgb4_i2c_read_byte(&vindev->deser, i2c_reg); in oldi_lane_width_show()
46 mutex_unlock(&mgbdev->i2c_lock); in oldi_lane_width_show()
48 return -EIO; in oldi_lane_width_show()
50 config = mgb4_read_reg(&mgbdev->video, vindev->config->regs.config); in oldi_lane_width_show()
55 return -EINVAL; in oldi_lane_width_show()
71 struct mgb4_dev *mgbdev = vindev->mgbdev; in oldi_lane_width_store()
92 return -EINVAL; in oldi_lane_width_store()
98 mutex_lock(&mgbdev->i2c_lock); in oldi_lane_width_store()
99 ret = mgb4_i2c_mask_byte(&vindev->deser, i2c_reg, i2c_mask, i2c_data); in oldi_lane_width_store()
100 mutex_unlock(&mgbdev->i2c_lock); in oldi_lane_width_store()
102 return -EIO; in oldi_lane_width_store()
103 mgb4_mask_reg(&mgbdev->video, vindev->config->regs.config, 1U << 9, in oldi_lane_width_store()
106 /* reset input link */ in oldi_lane_width_store()
107 mutex_lock(&mgbdev->i2c_lock); in oldi_lane_width_store()
108 ret = mgb4_i2c_mask_byte(&vindev->deser, 0x10, 1U << 5, 1U << 5); in oldi_lane_width_store()
109 mutex_unlock(&mgbdev->i2c_lock); in oldi_lane_width_store()
111 return -EIO; in oldi_lane_width_store()
122 u32 config = mgb4_read_reg(&vindev->mgbdev->video, in color_mapping_show()
123 vindev->config->regs.config); in color_mapping_show()
154 return -EINVAL; in color_mapping_store()
157 mgb4_mask_reg(&vindev->mgbdev->video, vindev->config->regs.config, in color_mapping_store()
168 u32 status = mgb4_read_reg(&vindev->mgbdev->video, in link_status_show()
169 vindev->config->regs.status); in link_status_show()
179 u32 status = mgb4_read_reg(&vindev->mgbdev->video, in stream_status_show()
180 vindev->config->regs.status); in stream_status_show()
191 u32 config = mgb4_read_reg(&vindev->mgbdev->video, in video_width_show()
192 vindev->config->regs.resolution); in video_width_show()
202 u32 config = mgb4_read_reg(&vindev->mgbdev->video, in video_height_show()
203 vindev->config->regs.resolution); in video_height_show()
213 u32 status = mgb4_read_reg(&vindev->mgbdev->video, in hsync_status_show()
214 vindev->config->regs.status); in hsync_status_show()
232 u32 status = mgb4_read_reg(&vindev->mgbdev->video, in vsync_status_show()
233 vindev->config->regs.status); in vsync_status_show()
252 u32 sync = mgb4_read_reg(&vindev->mgbdev->video, in hsync_gap_length_show()
253 vindev->config->regs.sync); in hsync_gap_length_show()
275 return -EINVAL; in hsync_gap_length_store()
277 mgb4_mask_reg(&vindev->mgbdev->video, vindev->config->regs.sync, in hsync_gap_length_store()
288 u32 sync = mgb4_read_reg(&vindev->mgbdev->video, in vsync_gap_length_show()
289 vindev->config->regs.sync); in vsync_gap_length_show()
311 return -EINVAL; in vsync_gap_length_store()
313 mgb4_mask_reg(&vindev->mgbdev->video, vindev->config->regs.sync, 0xFFFF, in vsync_gap_length_store()
324 u32 freq = mgb4_read_reg(&vindev->mgbdev->video, in pclk_frequency_show()
325 vindev->config->regs.pclk); in pclk_frequency_show()
335 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in hsync_width_show()
336 vindev->config->regs.signal); in hsync_width_show()
346 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in vsync_width_show()
347 vindev->config->regs.signal2); in vsync_width_show()
357 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in hback_porch_show()
358 vindev->config->regs.signal); in hback_porch_show()
368 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in hfront_porch_show()
369 vindev->config->regs.signal); in hfront_porch_show()
379 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in vback_porch_show()
380 vindev->config->regs.signal2); in vback_porch_show()
390 u32 sig = mgb4_read_reg(&vindev->mgbdev->video, in vfront_porch_show()
391 vindev->config->regs.signal2); in vfront_porch_show()
402 return sprintf(buf, "%d\n", vindev->freq_range); in frequency_range_show()
418 return -EINVAL; in frequency_range_store()
420 mutex_lock(vindev->vdev.lock); in frequency_range_store()
421 if (vb2_is_busy(vindev->vdev.queue)) { in frequency_range_store()
422 mutex_unlock(vindev->vdev.lock); in frequency_range_store()
423 return -EBUSY; in frequency_range_store()
427 vindev->freq_range = val; in frequency_range_store()
429 mutex_unlock(vindev->vdev.lock); in frequency_range_store()
443 mutex_lock(&vindev->mgbdev->i2c_lock); in fpdl3_input_width_show()
444 ret = mgb4_i2c_read_byte(&vindev->deser, 0x34); in fpdl3_input_width_show()
445 mutex_unlock(&vindev->mgbdev->i2c_lock); in fpdl3_input_width_show()
447 return -EIO; in fpdl3_input_width_show()
457 return -EINVAL; in fpdl3_input_width_show()
462 * FPD-Link width change is expected to be called on live streams. Video device
490 return -EINVAL; in fpdl3_input_width_store()
493 mutex_lock(&vindev->mgbdev->i2c_lock); in fpdl3_input_width_store()
494 ret = mgb4_i2c_mask_byte(&vindev->deser, 0x34, 0x18, i2c_data); in fpdl3_input_width_store()
495 mutex_unlock(&vindev->mgbdev->i2c_lock); in fpdl3_input_width_store()
497 return -EIO; in fpdl3_input_width_store()
511 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_mode_show()
512 r1 = mgb4_i2c_read_byte(&vindev->deser, 0x01); in gmsl_mode_show()
513 r300 = mgb4_i2c_read_byte(&vindev->deser, 0x300); in gmsl_mode_show()
514 r3 = mgb4_i2c_read_byte(&vindev->deser, 0x03); in gmsl_mode_show()
515 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_mode_show()
517 return -EIO; in gmsl_mode_show()
528 return -EINVAL; in gmsl_mode_show()
573 return -EINVAL; in gmsl_mode_store()
576 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_mode_store()
577 ret = mgb4_i2c_configure(&vindev->deser, values, 3); in gmsl_mode_store()
578 ret |= mgb4_i2c_configure(&vindev->deser, reset, 2); in gmsl_mode_store()
579 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_mode_store()
581 return -EIO; in gmsl_mode_store()
593 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_stream_id_show()
594 ret = mgb4_i2c_read_byte(&vindev->deser, 0xA0); in gmsl_stream_id_show()
595 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_stream_id_show()
597 return -EIO; in gmsl_stream_id_show()
615 return -EINVAL; in gmsl_stream_id_store()
617 mutex_lock(vindev->vdev.lock); in gmsl_stream_id_store()
618 if (vb2_is_busy(vindev->vdev.queue)) { in gmsl_stream_id_store()
619 mutex_unlock(vindev->vdev.lock); in gmsl_stream_id_store()
620 return -EBUSY; in gmsl_stream_id_store()
623 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_stream_id_store()
624 ret = mgb4_i2c_mask_byte(&vindev->deser, 0xA0, 0x03, (u8)val); in gmsl_stream_id_store()
625 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_stream_id_store()
627 mutex_unlock(vindev->vdev.lock); in gmsl_stream_id_store()
629 return (ret < 0) ? -EIO : count; in gmsl_stream_id_store()
639 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_fec_show()
640 r3e0 = mgb4_i2c_read_byte(&vindev->deser, 0x3E0); in gmsl_fec_show()
641 r308 = mgb4_i2c_read_byte(&vindev->deser, 0x308); in gmsl_fec_show()
642 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_fec_show()
644 return -EIO; in gmsl_fec_show()
651 return -EINVAL; in gmsl_fec_show()
685 return -EINVAL; in gmsl_fec_store()
688 mutex_lock(&vindev->mgbdev->i2c_lock); in gmsl_fec_store()
689 ret = mgb4_i2c_configure(&vindev->deser, values, 2); in gmsl_fec_store()
690 ret |= mgb4_i2c_configure(&vindev->deser, reset, 2); in gmsl_fec_store()
691 mutex_unlock(&vindev->mgbdev->i2c_lock); in gmsl_fec_store()
693 return -EIO; in gmsl_fec_store()