Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: atomisp: Remove test pattern generator (TPG) support

The TPG support registers a v4l2-subdev for this, but this is not part of
the media-controller graph in any way. After manually selecting the TPG
as input using the s_input ioctl it does not work.

Several supported sensors have their own working TPG and using the sensor's
TPG means that the same data-flow is used as with actual sensors rather
then the quite different data-flow from the ISP's builtin TPG.

Remove the broken TPG support, when a test-pattern is needed for testing
a sensor's TPG can be used. Using a sensor's TPG is actually better for
testing since then the actual normal data-flow is being tested.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Hans de Goede and committed by
Mauro Carvalho Chehab
a0821ca1 36a14185

+21 -585
-1
drivers/staging/media/atomisp/Makefile
··· 21 21 pci/atomisp_fops.o \ 22 22 pci/atomisp_ioctl.o \ 23 23 pci/atomisp_subdev.o \ 24 - pci/atomisp_tpg.o \ 25 24 pci/atomisp_v4l2.o \ 26 25 pci/sh_css_firmware.o \ 27 26 pci/sh_css_host_data.o \
-1
drivers/staging/media/atomisp/include/linux/atomisp_platform.h
··· 112 112 enum intel_v4l2_subdev_type { 113 113 RAW_CAMERA = 1, 114 114 LED_FLASH = 2, 115 - TEST_PATTERN = 3, 116 115 }; 117 116 118 117 struct intel_v4l2_subdev_id {
+18 -19
drivers/staging/media/atomisp/pci/atomisp_cmd.c
··· 4133 4133 unsigned int width, unsigned int height) = 4134 4134 configure_pp_input_nop; 4135 4135 const struct atomisp_in_fmt_conv *fc = NULL; 4136 + struct v4l2_mbus_framefmt *ffmt; 4136 4137 int ret, i; 4137 4138 4138 4139 isp_sink_crop = atomisp_subdev_get_rect( ··· 4144 4143 if (!format) 4145 4144 return -EINVAL; 4146 4145 4147 - if (input->type != TEST_PATTERN) { 4148 - mipi_info = atomisp_to_sensor_mipi_info(input->camera); 4146 + mipi_info = atomisp_to_sensor_mipi_info(input->camera); 4149 4147 4150 - if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, 4151 - mipi_info)) 4152 - return -EINVAL; 4148 + if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, 4149 + mipi_info)) 4150 + return -EINVAL; 4153 4151 4154 - if (mipi_info) 4155 - fc = atomisp_find_in_fmt_conv_by_atomisp_in_fmt(mipi_info->input_format); 4156 - 4157 - if (!fc) 4158 - fc = atomisp_find_in_fmt_conv( 4159 - atomisp_subdev_get_ffmt(&asd->subdev, 4160 - NULL, V4L2_SUBDEV_FORMAT_ACTIVE, 4161 - ATOMISP_SUBDEV_PAD_SINK)->code); 4162 - if (!fc) 4163 - return -EINVAL; 4164 - if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW && 4165 - raw_output_format_match_input(fc->atomisp_in_fmt, 4166 - pix->pixelformat)) 4167 - return -EINVAL; 4152 + if (mipi_info) 4153 + fc = atomisp_find_in_fmt_conv_by_atomisp_in_fmt(mipi_info->input_format); 4154 + if (!fc) { 4155 + ffmt = atomisp_subdev_get_ffmt(&asd->subdev, NULL, 4156 + V4L2_SUBDEV_FORMAT_ACTIVE, 4157 + ATOMISP_SUBDEV_PAD_SINK); 4158 + fc = atomisp_find_in_fmt_conv(ffmt->code); 4168 4159 } 4160 + if (!fc) 4161 + return -EINVAL; 4162 + 4163 + if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW && 4164 + raw_output_format_match_input(fc->atomisp_in_fmt, pix->pixelformat)) 4165 + return -EINVAL; 4169 4166 4170 4167 /* 4171 4168 * Configure viewfinder also when vfpp is disabled: the
+1 -30
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
··· 302 302 "stream_config.source.port.compression.uncompressed_bits_per_pixel=%d.\n", 303 303 s_config->source.port.compression. 304 304 uncompressed_bits_per_pixel); 305 - } else if (s_config->mode == IA_CSS_INPUT_MODE_TPG) { 306 - dev_dbg(isp->dev, "stream_config.source.tpg.id=%d.\n", 307 - s_config->source.tpg.id); 308 - dev_dbg(isp->dev, "stream_config.source.tpg.mode=%d.\n", 309 - s_config->source.tpg.mode); 310 - dev_dbg(isp->dev, "stream_config.source.tpg.x_mask=%d.\n", 311 - s_config->source.tpg.x_mask); 312 - dev_dbg(isp->dev, "stream_config.source.tpg.x_delta=%d.\n", 313 - s_config->source.tpg.x_delta); 314 - dev_dbg(isp->dev, "stream_config.source.tpg.y_mask=%d.\n", 315 - s_config->source.tpg.y_mask); 316 - dev_dbg(isp->dev, "stream_config.source.tpg.y_delta=%d.\n", 317 - s_config->source.tpg.y_delta); 318 - dev_dbg(isp->dev, "stream_config.source.tpg.xy_mask=%d.\n", 319 - s_config->source.tpg.xy_mask); 320 305 } else if (s_config->mode == IA_CSS_INPUT_MODE_PRBS) { 321 306 dev_dbg(isp->dev, "stream_config.source.prbs.id=%d.\n", 322 307 s_config->source.prbs.id); ··· 1657 1672 void atomisp_css_input_set_mode(struct atomisp_sub_device *asd, 1658 1673 enum ia_css_input_mode mode) 1659 1674 { 1660 - int i; 1661 - struct atomisp_device *isp = asd->isp; 1662 1675 unsigned int size_mem_words; 1676 + int i; 1663 1677 1664 1678 for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) 1665 1679 asd->stream_env[i].stream_config.mode = mode; 1666 - 1667 - if (isp->inputs[asd->input_curr].type == TEST_PATTERN) { 1668 - struct ia_css_stream_config *s_config = 1669 - &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream_config; 1670 - s_config->mode = IA_CSS_INPUT_MODE_TPG; 1671 - s_config->source.tpg.mode = IA_CSS_TPG_MODE_CHECKERBOARD; 1672 - s_config->source.tpg.x_mask = (1 << 4) - 1; 1673 - s_config->source.tpg.x_delta = -2; 1674 - s_config->source.tpg.y_mask = (1 << 4) - 1; 1675 - s_config->source.tpg.y_delta = 3; 1676 - s_config->source.tpg.xy_mask = (1 << 8) - 1; 1677 - return; 1678 - } 1679 1680 1680 1681 if (mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR) 1681 1682 return;
-2
drivers/staging/media/atomisp/pci/atomisp_internal.h
··· 36 36 37 37 #include "atomisp_csi2.h" 38 38 #include "atomisp_subdev.h" 39 - #include "atomisp_tpg.h" 40 39 #include "atomisp_compat.h" 41 40 42 41 #include "gp_device.h" ··· 187 188 bool pm_only; 188 189 189 190 struct atomisp_mipi_csi2_device csi2_port[ATOMISP_CAMERA_NR_PORTS]; 190 - struct atomisp_tpg_device tpg; 191 191 192 192 /* Purpose of mutex is to protect and serialize use of isp data 193 193 * structures and css API calls. */
-164
drivers/staging/media/atomisp/pci/atomisp_tpg.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Support for Medifield PNW Camera Imaging ISP subsystem. 4 - * 5 - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 6 - * 7 - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU General Public License version 11 - * 2 as published by the Free Software Foundation. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * 19 - */ 20 - 21 - #include <media/v4l2-event.h> 22 - #include <media/v4l2-mediabus.h> 23 - #include "atomisp_internal.h" 24 - #include "atomisp_tpg.h" 25 - 26 - static int tpg_s_stream(struct v4l2_subdev *sd, int enable) 27 - { 28 - return 0; 29 - } 30 - 31 - static int tpg_get_fmt(struct v4l2_subdev *sd, 32 - struct v4l2_subdev_state *sd_state, 33 - struct v4l2_subdev_format *format) 34 - { 35 - /*to fake*/ 36 - return 0; 37 - } 38 - 39 - static int tpg_set_fmt(struct v4l2_subdev *sd, 40 - struct v4l2_subdev_state *sd_state, 41 - struct v4l2_subdev_format *format) 42 - { 43 - struct v4l2_mbus_framefmt *fmt = &format->format; 44 - 45 - if (format->pad) 46 - return -EINVAL; 47 - /* only raw8 grbg is supported by TPG */ 48 - fmt->code = MEDIA_BUS_FMT_SGRBG8_1X8; 49 - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 50 - *v4l2_subdev_state_get_format(sd_state, 0) = *fmt; 51 - return 0; 52 - } 53 - return 0; 54 - } 55 - 56 - static int tpg_log_status(struct v4l2_subdev *sd) 57 - { 58 - /*to fake*/ 59 - return 0; 60 - } 61 - 62 - static int tpg_s_power(struct v4l2_subdev *sd, int on) 63 - { 64 - return 0; 65 - } 66 - 67 - static int tpg_enum_mbus_code(struct v4l2_subdev *sd, 68 - struct v4l2_subdev_state *sd_state, 69 - struct v4l2_subdev_mbus_code_enum *code) 70 - { 71 - /*to fake*/ 72 - return 0; 73 - } 74 - 75 - static int tpg_enum_frame_size(struct v4l2_subdev *sd, 76 - struct v4l2_subdev_state *sd_state, 77 - struct v4l2_subdev_frame_size_enum *fse) 78 - { 79 - /*to fake*/ 80 - return 0; 81 - } 82 - 83 - static int tpg_enum_frame_ival(struct v4l2_subdev *sd, 84 - struct v4l2_subdev_state *sd_state, 85 - struct v4l2_subdev_frame_interval_enum *fie) 86 - { 87 - /*to fake*/ 88 - return 0; 89 - } 90 - 91 - static const struct v4l2_subdev_video_ops tpg_video_ops = { 92 - .s_stream = tpg_s_stream, 93 - }; 94 - 95 - static const struct v4l2_subdev_core_ops tpg_core_ops = { 96 - .log_status = tpg_log_status, 97 - .s_power = tpg_s_power, 98 - }; 99 - 100 - static const struct v4l2_subdev_pad_ops tpg_pad_ops = { 101 - .enum_mbus_code = tpg_enum_mbus_code, 102 - .enum_frame_size = tpg_enum_frame_size, 103 - .enum_frame_interval = tpg_enum_frame_ival, 104 - .get_fmt = tpg_get_fmt, 105 - .set_fmt = tpg_set_fmt, 106 - }; 107 - 108 - static const struct v4l2_subdev_ops tpg_ops = { 109 - .core = &tpg_core_ops, 110 - .video = &tpg_video_ops, 111 - .pad = &tpg_pad_ops, 112 - }; 113 - 114 - void atomisp_tpg_unregister_entities(struct atomisp_tpg_device *tpg) 115 - { 116 - media_entity_cleanup(&tpg->sd.entity); 117 - v4l2_device_unregister_subdev(&tpg->sd); 118 - } 119 - 120 - int atomisp_tpg_register_entities(struct atomisp_tpg_device *tpg, 121 - struct v4l2_device *vdev) 122 - { 123 - int ret; 124 - /* Register the subdev and video nodes. */ 125 - ret = v4l2_device_register_subdev(vdev, &tpg->sd); 126 - if (ret < 0) 127 - goto error; 128 - 129 - return 0; 130 - 131 - error: 132 - atomisp_tpg_unregister_entities(tpg); 133 - return ret; 134 - } 135 - 136 - void atomisp_tpg_cleanup(struct atomisp_device *isp) 137 - { 138 - } 139 - 140 - int atomisp_tpg_init(struct atomisp_device *isp) 141 - { 142 - struct atomisp_tpg_device *tpg = &isp->tpg; 143 - struct v4l2_subdev *sd = &tpg->sd; 144 - struct media_pad *pads = tpg->pads; 145 - struct media_entity *me = &sd->entity; 146 - int ret; 147 - 148 - tpg->isp = isp; 149 - v4l2_subdev_init(sd, &tpg_ops); 150 - sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 151 - strscpy(sd->name, "tpg_subdev", sizeof(sd->name)); 152 - v4l2_set_subdevdata(sd, tpg); 153 - 154 - pads[0].flags = MEDIA_PAD_FL_SINK; 155 - me->function = MEDIA_ENT_F_PROC_VIDEO_ISP; 156 - 157 - ret = media_entity_pads_init(me, 1, pads); 158 - if (ret < 0) 159 - goto fail; 160 - return 0; 161 - fail: 162 - atomisp_tpg_cleanup(isp); 163 - return ret; 164 - }
-39
drivers/staging/media/atomisp/pci/atomisp_tpg.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Support for Medifield PNW Camera Imaging ISP subsystem. 4 - * 5 - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 6 - * 7 - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU General Public License version 11 - * 2 as published by the Free Software Foundation. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * 19 - */ 20 - 21 - #ifndef __ATOMISP_TPG_H__ 22 - #define __ATOMISP_TPG_H__ 23 - 24 - #include <media/media-entity.h> 25 - #include <media/v4l2-subdev.h> 26 - 27 - struct atomisp_tpg_device { 28 - struct v4l2_subdev sd; 29 - struct atomisp_device *isp; 30 - struct media_pad pads[1]; 31 - }; 32 - 33 - void atomisp_tpg_cleanup(struct atomisp_device *isp); 34 - int atomisp_tpg_init(struct atomisp_device *isp); 35 - void atomisp_tpg_unregister_entities(struct atomisp_tpg_device *tpg); 36 - int atomisp_tpg_register_entities(struct atomisp_tpg_device *tpg, 37 - struct v4l2_device *vdev); 38 - 39 - #endif /* __ATOMISP_TPG_H__ */
-27
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
··· 847 847 struct v4l2_subdev *sd, *next; 848 848 849 849 atomisp_subdev_unregister_entities(&isp->asd); 850 - atomisp_tpg_unregister_entities(&isp->tpg); 851 850 for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) 852 851 atomisp_mipi_csi2_unregister_entities(&isp->csi2_port[i]); 853 852 ··· 901 902 goto csi_and_subdev_probe_failed; 902 903 } 903 904 904 - ret = atomisp_tpg_register_entities(&isp->tpg, &isp->v4l2_dev); 905 - if (ret < 0) { 906 - dev_err(isp->dev, "atomisp_tpg_register_entities\n"); 907 - goto tpg_register_failed; 908 - } 909 - 910 905 ret = atomisp_subdev_register_subdev(&isp->asd, &isp->v4l2_dev); 911 906 if (ret < 0) { 912 907 dev_err(isp->dev, "atomisp_subdev_register_subdev fail\n"); ··· 910 917 return 0; 911 918 912 919 subdev_register_failed: 913 - atomisp_tpg_unregister_entities(&isp->tpg); 914 - tpg_register_failed: 915 920 for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) 916 921 atomisp_mipi_csi2_unregister_entities(&isp->csi2_port[i]); 917 922 csi_and_subdev_probe_failed: ··· 1068 1077 else 1069 1078 dev_info(isp->dev, "detected %d camera sensors\n", isp->input_cnt); 1070 1079 1071 - if (isp->input_cnt < ATOM_ISP_MAX_INPUTS) { 1072 - dev_dbg(isp->dev, "TPG detected, camera_cnt: %d\n", isp->input_cnt); 1073 - isp->inputs[isp->input_cnt].type = TEST_PATTERN; 1074 - isp->inputs[isp->input_cnt].port = -1; 1075 - isp->inputs[isp->input_cnt++].camera = &isp->tpg.sd; 1076 - } else { 1077 - dev_warn(isp->dev, "too many atomisp inputs, TPG ignored.\n"); 1078 - } 1079 - 1080 1080 mutex_lock(&isp->media_dev.graph_mutex); 1081 1081 atomisp_setup_input_links(isp); 1082 1082 mutex_unlock(&isp->media_dev.graph_mutex); ··· 1101 1119 goto error_mipi_csi2; 1102 1120 } 1103 1121 1104 - ret = atomisp_tpg_init(isp); 1105 - if (ret < 0) { 1106 - dev_err(isp->dev, "tpg initialization failed\n"); 1107 - goto error_tpg; 1108 - } 1109 - 1110 1122 ret = atomisp_subdev_init(isp); 1111 1123 if (ret < 0) { 1112 1124 dev_err(isp->dev, "ISP subdev initialization failed\n"); ··· 1110 1134 return 0; 1111 1135 1112 1136 error_isp_subdev: 1113 - error_tpg: 1114 - atomisp_tpg_cleanup(isp); 1115 1137 error_mipi_csi2: 1116 1138 atomisp_mipi_csi2_cleanup(isp); 1117 1139 return ret; ··· 1117 1143 1118 1144 static void atomisp_uninitialize_modules(struct atomisp_device *isp) 1119 1145 { 1120 - atomisp_tpg_cleanup(isp); 1121 1146 atomisp_mipi_csi2_cleanup(isp); 1122 1147 } 1123 1148
-38
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c
··· 426 426 case INPUT_SYSTEM_SOURCE_SENSOR: 427 427 error = input_system_configure_channel_sensor(channel); 428 428 break; 429 - case INPUT_SYSTEM_SOURCE_TPG: 430 429 case INPUT_SYSTEM_SOURCE_PRBS: 431 430 case INPUT_SYSTEM_SOURCE_FIFO: 432 431 default: ··· 813 814 //... 814 815 break; 815 816 816 - case INPUT_SYSTEM_SOURCE_TPG: 817 817 case INPUT_SYSTEM_SOURCE_PRBS: 818 818 case INPUT_SYSTEM_SOURCE_FIFO: 819 819 break; ··· 1060 1062 1061 1063 channel.target_cfg = target; 1062 1064 1063 - return input_system_configure_channel(channel); 1064 - } 1065 - 1066 - input_system_err_t input_system_tpg_channel_cfg( 1067 - u32 ch_id, 1068 - u32 nof_frames,//not used yet 1069 - u32 x_mask, 1070 - u32 y_mask, 1071 - u32 x_delta, 1072 - u32 y_delta, 1073 - u32 xy_mask, 1074 - u32 sync_gen_width, 1075 - u32 sync_gen_height, 1076 - u32 sync_gen_hblank_cycles, 1077 - u32 sync_gen_vblank_cycles, 1078 - target_cfg2400_t target 1079 - ) 1080 - { 1081 - channel_cfg_t channel; 1082 - 1083 - (void)nof_frames; 1084 - 1085 - channel.ch_id = ch_id; 1086 - channel.source_type = INPUT_SYSTEM_SOURCE_TPG; 1087 - 1088 - channel.source_cfg.tpg_cfg.x_mask = x_mask; 1089 - channel.source_cfg.tpg_cfg.y_mask = y_mask; 1090 - channel.source_cfg.tpg_cfg.x_delta = x_delta; 1091 - channel.source_cfg.tpg_cfg.y_delta = y_delta; 1092 - channel.source_cfg.tpg_cfg.xy_mask = xy_mask; 1093 - channel.source_cfg.tpg_cfg.sync_gen_cfg.width = sync_gen_width; 1094 - channel.source_cfg.tpg_cfg.sync_gen_cfg.height = sync_gen_height; 1095 - channel.source_cfg.tpg_cfg.sync_gen_cfg.hblank_cycles = sync_gen_hblank_cycles; 1096 - channel.source_cfg.tpg_cfg.sync_gen_cfg.vblank_cycles = sync_gen_vblank_cycles; 1097 - 1098 - channel.target_cfg = target; 1099 1065 return input_system_configure_channel(channel); 1100 1066 } 1101 1067
-1
drivers/staging/media/atomisp/pci/ia_css.h
··· 42 42 #include "ia_css_properties.h" 43 43 #include "ia_css_stream_format.h" 44 44 #include "ia_css_stream_public.h" 45 - #include "ia_css_tpg.h" 46 45 #include "ia_css_version.h" 47 46 #include "ia_css_mmu.h" 48 47 #include "ia_css_morph.h"
-3
drivers/staging/media/atomisp/pci/ia_css_stream_public.h
··· 24 24 #include "ia_css_types.h" 25 25 #include "ia_css_pipe_public.h" 26 26 #include "ia_css_metadata.h" 27 - #include "ia_css_tpg.h" 28 27 #include "ia_css_prbs.h" 29 28 #include "ia_css_input_port.h" 30 29 ··· 33 34 enum ia_css_input_mode { 34 35 IA_CSS_INPUT_MODE_SENSOR, /** data from sensor */ 35 36 IA_CSS_INPUT_MODE_FIFO, /** data from input-fifo */ 36 - IA_CSS_INPUT_MODE_TPG, /** data from test-pattern generator */ 37 37 IA_CSS_INPUT_MODE_PRBS, /** data from pseudo-random bit stream */ 38 38 IA_CSS_INPUT_MODE_MEMORY, /** data from a frame in memory */ 39 39 IA_CSS_INPUT_MODE_BUFFERED_SENSOR /** data is sent through mipi buffer */ ··· 89 91 enum ia_css_input_mode mode; /** Input mode */ 90 92 union { 91 93 struct ia_css_input_port port; /** Port, for sensor only. */ 92 - struct ia_css_tpg_config tpg; /** TPG configuration */ 93 94 struct ia_css_prbs_config prbs; /** PRBS configuration */ 94 95 } source; /** Source of input data */ 95 96 unsigned int channel_id; /** Channel on which input data
-79
drivers/staging/media/atomisp/pci/ia_css_tpg.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Support for Intel Camera Imaging ISP subsystem. 4 - * Copyright (c) 2015, Intel Corporation. 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms and conditions of the GNU General Public License, 8 - * version 2, as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope it will be useful, but WITHOUT 11 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 - * more details. 14 - */ 15 - 16 - #ifndef __IA_CSS_TPG_H 17 - #define __IA_CSS_TPG_H 18 - 19 - /* @file 20 - * This file contains support for the test pattern generator (TPG) 21 - */ 22 - 23 - /* Enumerate the TPG IDs. 24 - */ 25 - enum ia_css_tpg_id { 26 - IA_CSS_TPG_ID0, 27 - IA_CSS_TPG_ID1, 28 - IA_CSS_TPG_ID2 29 - }; 30 - 31 - /** 32 - * Maximum number of TPG IDs. 33 - * 34 - * Make sure the value of this define gets changed to reflect the correct 35 - * number of ia_css_tpg_id enum if you add/delete an item in the enum. 36 - */ 37 - #define N_CSS_TPG_IDS (IA_CSS_TPG_ID2 + 1) 38 - 39 - /* Enumerate the TPG modes. 40 - */ 41 - enum ia_css_tpg_mode { 42 - IA_CSS_TPG_MODE_RAMP, 43 - IA_CSS_TPG_MODE_CHECKERBOARD, 44 - IA_CSS_TPG_MODE_FRAME_BASED_COLOR, 45 - IA_CSS_TPG_MODE_MONO 46 - }; 47 - 48 - /* @brief Configure the test pattern generator. 49 - * 50 - * Configure the Test Pattern Generator, the way these values are used to 51 - * generate the pattern can be seen in the HRT extension for the test pattern 52 - * generator: 53 - * devices/test_pat_gen/hrt/include/test_pat_gen.h: hrt_calc_tpg_data(). 54 - * 55 - * This interface is deprecated, it is not portable -> move to input system API 56 - * 57 - @code 58 - unsigned int test_pattern_value(unsigned int x, unsigned int y) 59 - { 60 - unsigned int x_val, y_val; 61 - if (x_delta > 0) (x_val = (x << x_delta) & x_mask; 62 - else (x_val = (x >> -x_delta) & x_mask; 63 - if (y_delta > 0) (y_val = (y << y_delta) & y_mask; 64 - else (y_val = (y >> -y_delta) & x_mask; 65 - return (x_val + y_val) & xy_mask; 66 - } 67 - @endcode 68 - */ 69 - struct ia_css_tpg_config { 70 - enum ia_css_tpg_id id; 71 - enum ia_css_tpg_mode mode; 72 - unsigned int x_mask; 73 - int x_delta; 74 - unsigned int y_mask; 75 - int y_delta; 76 - unsigned int xy_mask; 77 - }; 78 - 79 - #endif /* __IA_CSS_TPG_H */
-1
drivers/staging/media/atomisp/pci/isp2400_input_system_global.h
··· 35 35 typedef enum { 36 36 INPUT_SYSTEM_SOURCE_SENSOR = 0, 37 37 INPUT_SYSTEM_SOURCE_FIFO, 38 - INPUT_SYSTEM_SOURCE_TPG, 39 38 INPUT_SYSTEM_SOURCE_PRBS, 40 39 INPUT_SYSTEM_SOURCE_MEMORY, 41 40 N_INPUT_SYSTEM_SOURCE
-15
drivers/staging/media/atomisp/pci/isp2400_input_system_public.h
··· 308 308 target_cfg2400_t target 309 309 ); 310 310 311 - input_system_err_t input_system_tpg_channel_cfg( 312 - u32 ch_id, 313 - u32 nof_frames,//not used yet 314 - u32 x_mask, 315 - u32 y_mask, 316 - u32 x_delta, 317 - u32 y_delta, 318 - u32 xy_mask, 319 - u32 sync_gen_width, 320 - u32 sync_gen_height, 321 - u32 sync_gen_hblank_cycles, 322 - u32 sync_gen_vblank_cycles, 323 - target_cfg2400_t target 324 - ); 325 - 326 311 input_system_err_t input_system_gpfifo_channel_cfg( 327 312 u32 ch_id, 328 313 u32 nof_frames,
-1
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h
··· 39 39 typedef enum { 40 40 INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0, 41 41 INPUT_SYSTEM_SOURCE_TYPE_SENSOR, 42 - INPUT_SYSTEM_SOURCE_TYPE_TPG, 43 42 INPUT_SYSTEM_SOURCE_TYPE_PRBS, 44 43 N_INPUT_SYSTEM_SOURCE_TYPE 45 44 } input_system_source_type_t;
-17
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
··· 1549 1549 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "compression: %d\n", 1550 1550 config->source.port.compression.type); 1551 1551 break; 1552 - case IA_CSS_INPUT_MODE_TPG: 1553 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.tpg\n"); 1554 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "id: %d\n", 1555 - config->source.tpg.id); 1556 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "mode: %d\n", 1557 - config->source.tpg.mode); 1558 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "x_mask: 0x%x\n", 1559 - config->source.tpg.x_mask); 1560 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "x_delta: %d\n", 1561 - config->source.tpg.x_delta); 1562 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "y_mask: 0x%x\n", 1563 - config->source.tpg.y_mask); 1564 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "y_delta: %d\n", 1565 - config->source.tpg.y_delta); 1566 - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "xy_mask: 0x%x\n", 1567 - config->source.tpg.xy_mask); 1568 - break; 1569 1552 case IA_CSS_INPUT_MODE_PRBS: 1570 1553 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.prbs\n"); 1571 1554 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "id: %d\n",
-11
drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c
··· 382 382 383 383 vectors_per_buffer = buffer_height * buffer_width / ISP_VEC_NELEMS; 384 384 385 - if (config->mode == IA_CSS_INPUT_MODE_TPG && 386 - ((binary && binary->info->sp.pipeline.mode == IA_CSS_BINARY_MODE_VIDEO) || 387 - (!binary))) { 388 - /* !binary -> sp raw copy pipe */ 389 - /* workaround for TPG in video mode */ 390 - start_line = 0; 391 - start_column = 0; 392 - cropped_height -= start_line; 393 - width_a -= start_column; 394 - } 395 - 396 385 if_a_config.start_line = start_line; 397 386 if_a_config.start_column = start_column; 398 387 if_a_config.left_padding = left_padding / deinterleaving;
+1 -27
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c
··· 96 96 csi_mipi_packet_type_t packet_type, 97 97 csi_rx_backend_lut_entry_t *entry); 98 98 99 - static bool calculate_tpg_cfg( 100 - input_system_channel_t *channel, 101 - input_system_input_port_t *input_port, 102 - isp2401_input_system_cfg_t *isys_cfg, 103 - pixelgen_tpg_cfg_t *cfg); 104 - 105 99 static bool calculate_prbs_cfg( 106 100 input_system_channel_t *channel, 107 101 input_system_input_port_t *input_port, ··· 511 517 rc &= calculate_be_cfg(input_port, isys_cfg, true, 512 518 &input_port_cfg->csi_rx_cfg.md_backend_cfg); 513 519 break; 514 - case INPUT_SYSTEM_SOURCE_TYPE_TPG: 515 - rc = calculate_tpg_cfg( 516 - channel, 517 - input_port, 518 - isys_cfg, 519 - &input_port_cfg->pixelgen_cfg.tpg_cfg); 520 - break; 521 520 case INPUT_SYSTEM_SOURCE_TYPE_PRBS: 522 521 rc = calculate_prbs_cfg( 523 522 channel, ··· 620 633 ia_css_isys_csi_rx_lut_rmgr_release(backend, packet_type, entry); 621 634 } 622 635 623 - static bool calculate_tpg_cfg( 624 - input_system_channel_t *channel, 625 - input_system_input_port_t *input_port, 626 - isp2401_input_system_cfg_t *isys_cfg, 627 - pixelgen_tpg_cfg_t *cfg) 628 - { 629 - memcpy(cfg, &isys_cfg->tpg_port_attr, sizeof(pixelgen_tpg_cfg_t)); 630 - 631 - return true; 632 - } 633 - 634 636 static bool calculate_prbs_cfg( 635 637 input_system_channel_t *channel, 636 638 input_system_input_port_t *input_port, ··· 679 703 cfg->bits_per_pixel = metadata ? isys_cfg->metadata.bits_per_pixel : 680 704 isys_cfg->input_port_resolution.bits_per_pixel; 681 705 682 - cfg->enable_blocking = 683 - ((isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_TPG) || 684 - (isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_PRBS)); 706 + cfg->enable_blocking = isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_PRBS; 685 707 686 708 return true; 687 709 }
+1 -87
drivers/staging/media/atomisp/pci/sh_css.c
··· 462 462 return bpp; 463 463 } 464 464 465 - /* TODO: move define to proper file in tools */ 466 - #define GP_ISEL_TPG_MODE 0x90058 467 - 468 465 static int 469 466 sh_css_config_input_network_2400(struct ia_css_stream *stream) 470 467 { ··· 497 500 return err; 498 501 } 499 502 500 - if (stream->config.mode == IA_CSS_INPUT_MODE_TPG || 501 - stream->config.mode == IA_CSS_INPUT_MODE_PRBS) { 503 + if (stream->config.mode == IA_CSS_INPUT_MODE_PRBS) { 502 504 unsigned int hblank_cycles = 100, 503 505 vblank_lines = 6, 504 506 width, ··· 509 513 vblank_cycles = vblank_lines * (width + hblank_cycles); 510 514 sh_css_sp_configure_sync_gen(width, height, hblank_cycles, 511 515 vblank_cycles); 512 - if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) 513 - ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); 514 516 } 515 517 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, 516 518 "sh_css_config_input_network() leave:\n"); ··· 648 654 649 655 rc = true; 650 656 switch (stream_cfg->mode) { 651 - case IA_CSS_INPUT_MODE_TPG: 652 - 653 - if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID0) 654 - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT0_ID; 655 - else if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID1) 656 - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT1_ID; 657 - else if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID2) 658 - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT2_ID; 659 - 660 - break; 661 657 case IA_CSS_INPUT_MODE_PRBS: 662 658 663 659 if (stream_cfg->source.prbs.id == IA_CSS_PRBS_ID0) ··· 684 700 685 701 rc = true; 686 702 switch (stream_cfg->mode) { 687 - case IA_CSS_INPUT_MODE_TPG: 688 - 689 - isys_stream_descr->mode = INPUT_SYSTEM_SOURCE_TYPE_TPG; 690 - 691 - break; 692 703 case IA_CSS_INPUT_MODE_PRBS: 693 704 694 705 isys_stream_descr->mode = INPUT_SYSTEM_SOURCE_TYPE_PRBS; ··· 712 733 713 734 rc = true; 714 735 switch (stream_cfg->mode) { 715 - case IA_CSS_INPUT_MODE_TPG: 716 - if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_RAMP) 717 - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_RAMP; 718 - else if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_CHECKERBOARD) 719 - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_CHBO; 720 - else if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_MONO) 721 - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_MONO; 722 - else 723 - rc = false; 724 - 725 - /* 726 - * TODO 727 - * - Make "color_cfg" as part of "ia_css_tpg_config". 728 - */ 729 - isys_stream_descr->tpg_port_attr.color_cfg.R1 = 51; 730 - isys_stream_descr->tpg_port_attr.color_cfg.G1 = 102; 731 - isys_stream_descr->tpg_port_attr.color_cfg.B1 = 255; 732 - isys_stream_descr->tpg_port_attr.color_cfg.R2 = 0; 733 - isys_stream_descr->tpg_port_attr.color_cfg.G2 = 100; 734 - isys_stream_descr->tpg_port_attr.color_cfg.B2 = 160; 735 - 736 - isys_stream_descr->tpg_port_attr.mask_cfg.h_mask = 737 - stream_cfg->source.tpg.x_mask; 738 - isys_stream_descr->tpg_port_attr.mask_cfg.v_mask = 739 - stream_cfg->source.tpg.y_mask; 740 - isys_stream_descr->tpg_port_attr.mask_cfg.hv_mask = 741 - stream_cfg->source.tpg.xy_mask; 742 - 743 - isys_stream_descr->tpg_port_attr.delta_cfg.h_delta = 744 - stream_cfg->source.tpg.x_delta; 745 - isys_stream_descr->tpg_port_attr.delta_cfg.v_delta = 746 - stream_cfg->source.tpg.y_delta; 747 - 748 - /* 749 - * TODO 750 - * - Make "sync_gen_cfg" as part of "ia_css_tpg_config". 751 - */ 752 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.hblank_cycles = 100; 753 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.vblank_cycles = 100; 754 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.pixels_per_clock = 755 - stream_cfg->pixels_per_clock; 756 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.nr_of_frames = (uint32_t)~(0x0); 757 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.pixels_per_line = 758 - stream_cfg->isys_config[IA_CSS_STREAM_DEFAULT_ISYS_STREAM_IDX].input_res.width; 759 - isys_stream_descr->tpg_port_attr.sync_gen_cfg.lines_per_frame = 760 - stream_cfg->isys_config[IA_CSS_STREAM_DEFAULT_ISYS_STREAM_IDX].input_res.height; 761 - 762 - break; 763 736 case IA_CSS_INPUT_MODE_PRBS: 764 737 765 738 isys_stream_descr->prbs_port_attr.seed0 = stream_cfg->source.prbs.seed; ··· 8083 8152 case IA_CSS_INPUT_MODE_BUFFERED_SENSOR: 8084 8153 if (!IS_ISP2401) 8085 8154 ia_css_stream_configure_rx(curr_stream); 8086 - break; 8087 - case IA_CSS_INPUT_MODE_TPG: 8088 - if (!IS_ISP2401) { 8089 - IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d", 8090 - curr_stream->config.source.tpg.x_mask, 8091 - curr_stream->config.source.tpg.y_mask, 8092 - curr_stream->config.source.tpg.x_delta, 8093 - curr_stream->config.source.tpg.y_delta, 8094 - curr_stream->config.source.tpg.xy_mask); 8095 - 8096 - sh_css_sp_configure_tpg( 8097 - curr_stream->config.source.tpg.x_mask, 8098 - curr_stream->config.source.tpg.y_mask, 8099 - curr_stream->config.source.tpg.x_delta, 8100 - curr_stream->config.source.tpg.y_delta, 8101 - curr_stream->config.source.tpg.xy_mask); 8102 - } 8103 8155 break; 8104 8156 case IA_CSS_INPUT_MODE_PRBS: 8105 8157 if (!IS_ISP2401) {
-1
drivers/staging/media/atomisp/pci/sh_css_internal.h
··· 360 360 } input_formatter; 361 361 362 362 sync_generator_cfg_t sync_gen; 363 - tpg_cfg_t tpg; 364 363 prbs_cfg_t prbs; 365 364 input_system_cfg_t input_circuit; 366 365 u8 input_circuit_cfg_changed;
-14
drivers/staging/media/atomisp/pci/sh_css_sp.c
··· 670 670 } 671 671 672 672 void 673 - sh_css_sp_configure_tpg(int x_mask, 674 - int y_mask, 675 - int x_delta, 676 - int y_delta, 677 - int xy_mask) 678 - { 679 - sh_css_sp_group.config.tpg.x_mask = x_mask; 680 - sh_css_sp_group.config.tpg.y_mask = y_mask; 681 - sh_css_sp_group.config.tpg.x_delta = x_delta; 682 - sh_css_sp_group.config.tpg.y_delta = y_delta; 683 - sh_css_sp_group.config.tpg.xy_mask = xy_mask; 684 - } 685 - 686 - void 687 673 sh_css_sp_configure_prbs(int seed) 688 674 { 689 675 sh_css_sp_group.config.prbs.seed = seed;
-7
drivers/staging/media/atomisp/pci/sh_css_sp.h
··· 165 165 int vblank_cycles); 166 166 167 167 void 168 - sh_css_sp_configure_tpg(int x_mask, 169 - int y_mask, 170 - int x_delta, 171 - int y_delta, 172 - int xy_mask); 173 - 174 - void 175 168 sh_css_sp_configure_prbs(int seed); 176 169 177 170 void