* [freescale-fslc:5.10-2.1.x-imx 13121/15840] drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5178:17: warning: cast to pointer from integer of different size
@ 2021-12-02 18:14 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-12-02 18:14 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 26418 bytes --]
tree: https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head: c0604ebbd45934a2c42df8382b674244d1963fa2
commit: 54afb73e27b624db97f55baee1b45800db182cd0 [13121/15840] LF-4159-3 video: epdc: add support for imx8ulp
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20211203/202112030244.t46oJA11-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/Freescale/linux-fslc/commit/54afb73e27b624db97f55baee1b45800db182cd0
git remote add freescale-fslc https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
git checkout 54afb73e27b624db97f55baee1b45800db182cd0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/android/ drivers/mfd/ drivers/staging/fsl_qbman/ drivers/video/fbdev/mxc/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'draw_mode0':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:4686:14: warning: variable 'upd_buf_ptr' set but not used [-Wunused-but-set-variable]
4686 | u32 *upd_buf_ptr;
| ^~~~~~~~~~~
In file included from include/linux/printk.h:409,
from include/linux/kernel.h:16,
from include/linux/list.h:9,
from include/linux/mutex.h:15,
from include/linux/notifier.h:14,
from include/linux/busfreq-imx.h:12,
from drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:10:
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'mxc_epdc_fb_probe':
>> drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5178:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
5178 | (void*)fb_data->phys_start);
| ^
include/linux/dynamic_debug.h:129:29: note: in definition of macro '__dynamic_func_call'
129 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:161:9: note: in expansion of macro '_dynamic_func_call'
161 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:9: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5177:9: note: in expansion of macro 'dev_dbg'
5177 | dev_dbg(&pdev->dev, "allocated at %p:%p\n", info->screen_base,
| ^~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5362:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
5362 | fb_data->max_pix_size, (void *)fb_data->phys_addr_updbuf[i]);
| ^
include/linux/dynamic_debug.h:129:29: note: in definition of macro '__dynamic_func_call'
129 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:161:9: note: in expansion of macro '_dynamic_func_call'
161 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:9: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5361:17: note: in expansion of macro 'dev_dbg'
5361 | dev_dbg(fb_data->info.device, "allocated %d bytes @ %p\n",
| ^~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'pxp_wfe_a_process_clear_workingbuffer':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:6014:54: warning: implicit conversion from 'enum dma_data_direction' to 'enum dma_transfer_direction' [-Wenum-conversion]
6014 | DMA_TO_DEVICE,
| ^~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'pxp_legacy_process':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:6195:54: warning: implicit conversion from 'enum dma_data_direction' to 'enum dma_transfer_direction' [-Wenum-conversion]
6195 | DMA_TO_DEVICE,
| ^~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'pxp_process_dithering':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:6332:54: warning: implicit conversion from 'enum dma_data_direction' to 'enum dma_transfer_direction' [-Wenum-conversion]
6332 | DMA_TO_DEVICE,
| ^~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'pxp_wfe_a_process':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:6480:54: warning: implicit conversion from 'enum dma_data_direction' to 'enum dma_transfer_direction' [-Wenum-conversion]
6480 | DMA_TO_DEVICE,
| ^~~~~~~~~~~~~
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c: In function 'pxp_wfe_b_process_update':
drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:6677:54: warning: implicit conversion from 'enum dma_data_direction' to 'enum dma_transfer_direction' [-Wenum-conversion]
6677 | DMA_TO_DEVICE,
| ^~~~~~~~~~~~~
vim +5178 drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c
4958
4959 static int mxc_epdc_fb_probe(struct platform_device *pdev)
4960 {
4961 int ret = 0;
4962 struct pinctrl *pinctrl;
4963 struct mxc_epdc_fb_data *fb_data;
4964 struct resource *res;
4965 struct fb_info *info;
4966 char *options, *opt;
4967 char *panel_str = NULL;
4968 char name[] = "mxcepdcfb";
4969 struct fb_videomode *vmode;
4970 int xres_virt, yres_virt, buf_size;
4971 int xres_virt_rot, yres_virt_rot, pix_size_rot;
4972 struct fb_var_screeninfo *var_info;
4973 struct fb_fix_screeninfo *fix_info;
4974 struct pxp_config_data *pxp_conf;
4975 struct pxp_proc_data *proc_data;
4976 struct scatterlist *sg;
4977 struct update_data_list *upd_list;
4978 struct update_data_list *plist, *temp_list;
4979 int i;
4980 unsigned long x_mem_size = 0;
4981 u32 val;
4982 int irq;
4983 struct device_node *np = pdev->dev.of_node;
4984 struct device_node *node;
4985 phandle phandle;
4986 u32 out_val[3];
4987 int enable_gpio;
4988 enum of_gpio_flags flag;
4989 unsigned short *wk_p;
4990
4991 if (!np)
4992 return -EINVAL;
4993
4994 fb_data = (struct mxc_epdc_fb_data *)framebuffer_alloc(
4995 sizeof(struct mxc_epdc_fb_data), &pdev->dev);
4996 if (fb_data == NULL) {
4997 ret = -ENOMEM;
4998 goto out;
4999 }
5000
5001 ret = of_property_read_u32_array(np, "epdc-ram", out_val, 3);
5002 if (ret) {
5003 dev_dbg(&pdev->dev, "no epdc-ram property found\n");
5004 } else {
5005 phandle = *out_val;
5006
5007 node = of_find_node_by_phandle(phandle);
5008 if (!node) {
5009 dev_dbg(&pdev->dev, "not find gpr node by phandle\n");
5010 ret = PTR_ERR(node);
5011 goto out_fbdata;
5012 }
5013 fb_data->gpr = syscon_node_to_regmap(node);
5014 if (IS_ERR(fb_data->gpr)) {
5015 dev_err(&pdev->dev, "failed to get gpr regmap\n");
5016 ret = PTR_ERR(fb_data->gpr);
5017 goto out_fbdata;
5018 }
5019 of_node_put(node);
5020 fb_data->req_gpr = out_val[1];
5021 fb_data->req_bit = out_val[2];
5022
5023 regmap_update_bits(fb_data->gpr, fb_data->req_gpr,
5024 1 << fb_data->req_bit, 0);
5025 }
5026
5027 if (of_find_property(np, "en-gpios", NULL)) {
5028 enable_gpio = of_get_named_gpio_flags(np, "en-gpios", 0, &flag);
5029 if (enable_gpio == -EPROBE_DEFER) {
5030 dev_info(&pdev->dev, "GPIO requested is not"
5031 "here yet, deferring the probe\n");
5032 return -EPROBE_DEFER;
5033 }
5034 if (!gpio_is_valid(enable_gpio)) {
5035 dev_warn(&pdev->dev, "No dt property: en-gpios\n");
5036 } else {
5037
5038 ret = devm_gpio_request_one(&pdev->dev,
5039 enable_gpio,
5040 (flag & OF_GPIO_ACTIVE_LOW)
5041 ? GPIOF_OUT_INIT_LOW :
5042 GPIOF_OUT_INIT_HIGH,
5043 "en_pins");
5044 if (ret) {
5045 dev_err(&pdev->dev, "failed to request gpio"
5046 " %d: %d\n", enable_gpio, ret);
5047 return -EINVAL;
5048 }
5049 }
5050 }
5051
5052 fb_data->qos_regmap = syscon_regmap_lookup_by_phandle(np, "qos");
5053 if (IS_ERR(fb_data->qos_regmap)) {
5054 dev_warn(&pdev->dev, "No qos phandle specified. Ignored.\n");
5055 }
5056
5057 /* Get platform data and check validity */
5058 fb_data->pdata = &epdc_data;
5059 if ((fb_data->pdata == NULL) || (fb_data->pdata->num_modes < 1)
5060 || (fb_data->pdata->epdc_mode == NULL)
5061 || (fb_data->pdata->epdc_mode->vmode == NULL)) {
5062 ret = -EINVAL;
5063 goto out_fbdata;
5064 }
5065
5066 if (fb_get_options(name, &options)) {
5067 ret = -ENODEV;
5068 goto out_fbdata;
5069 }
5070
5071 fb_data->epdc_wb_mode = 1;
5072 fb_data->tce_prevent = 0;
5073
5074 if (options)
5075 while ((opt = strsep(&options, ",")) != NULL) {
5076 if (!*opt)
5077 continue;
5078
5079 if (!strncmp(opt, "bpp=", 4))
5080 fb_data->default_bpp =
5081 simple_strtoul(opt + 4, NULL, 0);
5082 else if (!strncmp(opt, "x_mem=", 6))
5083 x_mem_size = memparse(opt + 6, NULL);
5084 else if (!strncmp(opt, "tce_prevent", 11))
5085 fb_data->tce_prevent = 1;
5086 else
5087 panel_str = opt;
5088 }
5089
5090 fb_data->dev = &pdev->dev;
5091
5092 if (!fb_data->default_bpp)
5093 fb_data->default_bpp = 16;
5094
5095 /* Set default (first defined mode) before searching for a match */
5096 fb_data->cur_mode = &fb_data->pdata->epdc_mode[0];
5097
5098 if (panel_str)
5099 for (i = 0; i < fb_data->pdata->num_modes; i++)
5100 if (!strcmp(fb_data->pdata->epdc_mode[i].vmode->name,
5101 panel_str)) {
5102 fb_data->cur_mode =
5103 &fb_data->pdata->epdc_mode[i];
5104 break;
5105 }
5106
5107 vmode = fb_data->cur_mode->vmode;
5108
5109 platform_set_drvdata(pdev, fb_data);
5110 info = &fb_data->info;
5111
5112 /* Allocate color map for the FB */
5113 ret = fb_alloc_cmap(&info->cmap, 256, 0);
5114 if (ret)
5115 goto out_fbdata;
5116
5117 dev_dbg(&pdev->dev, "resolution %dx%d, bpp %d\n",
5118 vmode->xres, vmode->yres, fb_data->default_bpp);
5119
5120 /*
5121 * GPU alignment restrictions dictate framebuffer parameters:
5122 * - 32-byte alignment for buffer width
5123 * - 128-byte alignment for buffer height
5124 * => 4K buffer alignment for buffer start
5125 */
5126 xres_virt = ALIGN(vmode->xres, 32);
5127 yres_virt = ALIGN(vmode->yres, 128);
5128 fb_data->max_pix_size = PAGE_ALIGN(xres_virt * yres_virt);
5129
5130 /*
5131 * Have to check to see if aligned buffer size when rotated
5132 * is bigger than when not rotated, and use the max
5133 */
5134 xres_virt_rot = ALIGN(vmode->yres, 32);
5135 yres_virt_rot = ALIGN(vmode->xres, 128);
5136 pix_size_rot = PAGE_ALIGN(xres_virt_rot * yres_virt_rot);
5137 fb_data->max_pix_size = (fb_data->max_pix_size > pix_size_rot) ?
5138 fb_data->max_pix_size : pix_size_rot;
5139
5140 buf_size = fb_data->max_pix_size * fb_data->default_bpp/8;
5141
5142 /* Compute the number of screens needed based on X memory requested */
5143 if (x_mem_size > 0) {
5144 fb_data->num_screens = DIV_ROUND_UP(x_mem_size, buf_size);
5145 if (fb_data->num_screens < NUM_SCREENS_MIN)
5146 fb_data->num_screens = NUM_SCREENS_MIN;
5147 else if (buf_size * fb_data->num_screens > SZ_16M)
5148 fb_data->num_screens = SZ_16M / buf_size;
5149 } else
5150 fb_data->num_screens = NUM_SCREENS_MIN;
5151
5152 fb_data->map_size = buf_size * fb_data->num_screens;
5153 dev_dbg(&pdev->dev, "memory to allocate: %zx\n", fb_data->map_size);
5154
5155 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5156 if (res == NULL) {
5157 ret = -ENODEV;
5158 goto out_cmap;
5159 }
5160
5161 epdc_v2_base = devm_ioremap_resource(&pdev->dev, res);
5162 if (epdc_v2_base == NULL) {
5163 ret = -ENOMEM;
5164 goto out_cmap;
5165 }
5166
5167 /* Allocate FB memory */
5168 info->screen_base = dma_alloc_wc(&pdev->dev,
5169 fb_data->map_size,
5170 &fb_data->phys_start,
5171 GFP_DMA | GFP_KERNEL);
5172
5173 if (info->screen_base == NULL) {
5174 ret = -ENOMEM;
5175 goto out_cmap;
5176 }
5177 dev_dbg(&pdev->dev, "allocated at %p:%p\n", info->screen_base,
> 5178 (void*)fb_data->phys_start);
5179
5180 var_info = &info->var;
5181 var_info->activate = FB_ACTIVATE_TEST;
5182 var_info->bits_per_pixel = fb_data->default_bpp;
5183 var_info->xres = vmode->xres;
5184 var_info->yres = vmode->yres;
5185 var_info->xres_virtual = xres_virt;
5186 /* Additional screens allow for panning and buffer flipping */
5187 var_info->yres_virtual = yres_virt * fb_data->num_screens;
5188
5189 var_info->pixclock = vmode->pixclock;
5190 var_info->left_margin = vmode->left_margin;
5191 var_info->right_margin = vmode->right_margin;
5192 var_info->upper_margin = vmode->upper_margin;
5193 var_info->lower_margin = vmode->lower_margin;
5194 var_info->hsync_len = vmode->hsync_len;
5195 var_info->vsync_len = vmode->vsync_len;
5196 var_info->vmode = FB_VMODE_NONINTERLACED;
5197
5198 switch (fb_data->default_bpp) {
5199 case 32:
5200 case 24:
5201 var_info->red.offset = 16;
5202 var_info->red.length = 8;
5203 var_info->green.offset = 8;
5204 var_info->green.length = 8;
5205 var_info->blue.offset = 0;
5206 var_info->blue.length = 8;
5207 break;
5208
5209 case 16:
5210 var_info->red.offset = 11;
5211 var_info->red.length = 5;
5212 var_info->green.offset = 5;
5213 var_info->green.length = 6;
5214 var_info->blue.offset = 0;
5215 var_info->blue.length = 5;
5216 break;
5217
5218 case 8:
5219 /*
5220 * For 8-bit grayscale, R, G, and B offset are equal.
5221 *
5222 */
5223 var_info->grayscale = GRAYSCALE_8BIT;
5224
5225 var_info->red.length = 8;
5226 var_info->red.offset = 0;
5227 var_info->red.msb_right = 0;
5228 var_info->green.length = 8;
5229 var_info->green.offset = 0;
5230 var_info->green.msb_right = 0;
5231 var_info->blue.length = 8;
5232 var_info->blue.offset = 0;
5233 var_info->blue.msb_right = 0;
5234 break;
5235
5236 default:
5237 dev_err(&pdev->dev, "unsupported bitwidth %d\n",
5238 fb_data->default_bpp);
5239 ret = -EINVAL;
5240 goto out_dma_fb;
5241 }
5242
5243 fix_info = &info->fix;
5244
5245 strcpy(fix_info->id, "mxc_epdc_fb");
5246 fix_info->type = FB_TYPE_PACKED_PIXELS;
5247 fix_info->visual = FB_VISUAL_TRUECOLOR;
5248 fix_info->xpanstep = 0;
5249 fix_info->ypanstep = 0;
5250 fix_info->ywrapstep = 0;
5251 fix_info->accel = FB_ACCEL_NONE;
5252 fix_info->smem_start = fb_data->phys_start;
5253 fix_info->smem_len = fb_data->map_size;
5254 fix_info->ypanstep = 0;
5255
5256 fb_data->native_width = vmode->xres;
5257 fb_data->native_height = vmode->yres;
5258
5259 info->fbops = &mxc_epdc_fb_ops;
5260 info->var.activate = FB_ACTIVATE_NOW;
5261 info->pseudo_palette = fb_data->pseudo_palette;
5262 info->screen_size = info->fix.smem_len;
5263 info->flags = FBINFO_FLAG_DEFAULT;
5264
5265 mxc_epdc_fb_set_fix(info);
5266
5267 fb_data->auto_mode = AUTO_UPDATE_MODE_REGION_MODE;
5268 fb_data->upd_scheme = UPDATE_SCHEME_QUEUE_AND_MERGE;
5269
5270 /* Initialize our internal copy of the screeninfo */
5271 fb_data->epdc_fb_var = *var_info;
5272 fb_data->fb_offset = 0;
5273 fb_data->eof_sync_period = 0;
5274
5275 fb_data->epdc_clk_axi = clk_get(fb_data->dev, "epdc_axi");
5276 if (IS_ERR(fb_data->epdc_clk_axi)) {
5277 ret = PTR_ERR(fb_data->epdc_clk_axi);
5278 dev_err(&pdev->dev, "Unable to get EPDC AXI clk."
5279 "err = %d\n", ret);
5280 goto out_dma_fb;
5281 }
5282 fb_data->epdc_clk_ahb = clk_get(fb_data->dev, "epdc_ahb");
5283 if (IS_ERR(fb_data->epdc_clk_ahb)) {
5284 ret = PTR_ERR(fb_data->epdc_clk_ahb);
5285 dev_err(&pdev->dev, "Unable to get EPDC ahb clk."
5286 "err = %d\n", ret);
5287 goto out_dma_fb;
5288 }
5289 fb_data->epdc_clk_pix = clk_get(fb_data->dev, "epdc_pix");
5290 if (IS_ERR(fb_data->epdc_clk_pix)) {
5291 ret = PTR_ERR(fb_data->epdc_clk_pix);
5292 dev_err(&pdev->dev, "Unable to get EPDC pix clk."
5293 "err = %d\n", ret);
5294 goto out_dma_fb;
5295 }
5296
5297 clk_prepare_enable(fb_data->epdc_clk_axi);
5298 clk_prepare_enable(fb_data->epdc_clk_pix);
5299 val = __raw_readl(EPDC_VERSION);
5300 clk_disable_unprepare(fb_data->epdc_clk_pix);
5301 clk_disable_unprepare(fb_data->epdc_clk_axi);
5302 fb_data->rev = ((val & EPDC_VERSION_MAJOR_MASK) >>
5303 EPDC_VERSION_MAJOR_OFFSET) * 10
5304 + ((val & EPDC_VERSION_MINOR_MASK) >>
5305 EPDC_VERSION_MINOR_OFFSET);
5306 dev_dbg(&pdev->dev, "EPDC version = %d\n", fb_data->rev);
5307
5308 if (fb_data->rev < 20) {
5309 fb_data->num_luts = EPDC_V1_NUM_LUTS;
5310 fb_data->max_num_updates = EPDC_V1_MAX_NUM_UPDATES;
5311 } else {
5312 fb_data->num_luts = EPDC_V2_NUM_LUTS;
5313 fb_data->max_num_updates = EPDC_V2_MAX_NUM_UPDATES;
5314 if (vmode->xres > EPDC_V2_MAX_UPDATE_WIDTH)
5315 fb_data->restrict_width = true;
5316 }
5317 fb_data->max_num_buffers = EPDC_MAX_NUM_BUFFERS;
5318
5319 /*
5320 * Initialize lists for pending updates,
5321 * active update requests, update collisions,
5322 * and freely available updates.
5323 */
5324 INIT_LIST_HEAD(&fb_data->upd_pending_list);
5325 INIT_LIST_HEAD(&fb_data->upd_buf_queue);
5326 INIT_LIST_HEAD(&fb_data->upd_buf_free_list);
5327 INIT_LIST_HEAD(&fb_data->upd_buf_collision_list);
5328
5329 /* Allocate update buffers and add them to the list */
5330 for (i = 0; i < fb_data->max_num_updates; i++) {
5331 upd_list = kzalloc(sizeof(*upd_list), GFP_KERNEL);
5332 if (upd_list == NULL) {
5333 ret = -ENOMEM;
5334 goto out_upd_lists;
5335 }
5336
5337 /* Add newly allocated buffer to free list */
5338 list_add(&upd_list->list, &fb_data->upd_buf_free_list);
5339 }
5340
5341 fb_data->virt_addr_updbuf =
5342 kzalloc(sizeof(void *) * fb_data->max_num_buffers, GFP_KERNEL);
5343 fb_data->phys_addr_updbuf =
5344 kzalloc(sizeof(dma_addr_t) * fb_data->max_num_buffers,
5345 GFP_KERNEL);
5346 for (i = 0; i < fb_data->max_num_buffers; i++) {
5347 /*
5348 * Allocate memory for PxP output buffer.
5349 * Each update buffer is 1 byte per pixel, and can
5350 * be as big as the full-screen frame buffer
5351 */
5352 fb_data->virt_addr_updbuf[i] =
5353 kmalloc(fb_data->max_pix_size, GFP_KERNEL);
5354 fb_data->phys_addr_updbuf[i] =
5355 virt_to_phys(fb_data->virt_addr_updbuf[i]);
5356 if (fb_data->virt_addr_updbuf[i] == NULL) {
5357 ret = -ENOMEM;
5358 goto out_upd_buffers;
5359 }
5360
5361 dev_dbg(fb_data->info.device, "allocated %d bytes @ %p\n",
5362 fb_data->max_pix_size, (void *)fb_data->phys_addr_updbuf[i]);
5363 }
5364
5365 /* Counter indicating which update buffer should be used next. */
5366 fb_data->upd_buffer_num = 0;
5367
5368 /*
5369 * Allocate memory for PxP SW workaround buffer
5370 * These buffers are used to hold copy of the update region,
5371 * before sending it to PxP for processing.
5372 */
5373 fb_data->virt_addr_copybuf =
5374 dma_alloc_coherent(fb_data->info.device, fb_data->max_pix_size*2,
5375 &fb_data->phys_addr_copybuf,
5376 GFP_DMA | GFP_KERNEL);
5377 if (fb_data->virt_addr_copybuf == NULL) {
5378 ret = -ENOMEM;
5379 goto out_upd_buffers;
5380 }
5381
5382 fb_data->virt_addr_y4 =
5383 dma_alloc_coherent(fb_data->info.device, fb_data->max_pix_size*2,
5384 &fb_data->phys_addr_y4,
5385 GFP_DMA | GFP_KERNEL);
5386 if (fb_data->virt_addr_y4 == NULL) {
5387 ret = -ENOMEM;
5388 goto out_upd_buffers;
5389 }
5390
5391 fb_data->virt_addr_y4c =
5392 dma_alloc_coherent(fb_data->info.device, fb_data->max_pix_size*2,
5393 &fb_data->phys_addr_y4c,
5394 GFP_DMA | GFP_KERNEL);
5395 if (fb_data->virt_addr_y4c == NULL) {
5396 ret = -ENOMEM;
5397 goto out_upd_buffers;
5398 }
5399
5400 fb_data->virt_addr_black =
5401 dma_alloc_coherent(fb_data->info.device, fb_data->max_pix_size*2,
5402 &fb_data->phys_addr_black,
5403 GFP_DMA | GFP_KERNEL);
5404 if (fb_data->virt_addr_black == NULL) {
5405 ret = -ENOMEM;
5406 goto out_upd_buffers;
5407 }
5408
5409 fb_data->working_buffer_size = vmode->yres * vmode->xres * 2;
5410
5411 /* Allocate memory for EPDC working buffer */
5412 fb_data->working_buffer_virt =
5413 dma_alloc_coherent(&pdev->dev, fb_data->working_buffer_size,
5414 &fb_data->working_buffer_phys,
5415 GFP_DMA | GFP_KERNEL);
5416 if (fb_data->working_buffer_virt == NULL) {
5417 dev_err(&pdev->dev, "Can't allocate mem for working buf!\n");
5418 ret = -ENOMEM;
5419 goto out_copybuffer;
5420 }
5421
5422 /* initialize the working buffer */
5423 wk_p = (unsigned short *)fb_data->working_buffer_virt;
5424 for (i = 0; i < fb_data->cur_mode->vmode->xres *
5425 fb_data->cur_mode->vmode->yres; i++) {
5426 *wk_p = 0x00F0;
5427 wk_p++;
5428 }
5429
5430 fb_data->tmp_working_buffer_virt =
5431 dma_alloc_coherent(&pdev->dev, fb_data->working_buffer_size,
5432 &fb_data->tmp_working_buffer_phys,
5433 GFP_DMA | GFP_KERNEL);
5434 if (fb_data->tmp_working_buffer_virt == NULL) {
5435 dev_err(&pdev->dev, "Can't allocate mem for tmp working buf!\n");
5436 ret = -ENOMEM;
5437 goto out_copybuffer;
5438 }
5439
5440 /* Initialize EPDC pins */
5441 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
5442 if (IS_ERR(pinctrl)) {
5443 dev_err(&pdev->dev, "can't get/select pinctrl\n");
5444 ret = PTR_ERR(pinctrl);
5445 goto out_copybuffer;
5446 }
5447
5448 fb_data->in_init = false;
5449
5450 fb_data->hw_ready = false;
5451 fb_data->hw_initializing = false;
5452
5453 /*
5454 * Set default waveform mode values.
5455 * Should be overwritten via ioctl.
5456 */
5457 fb_data->wv_modes.mode_init = 0;
5458 fb_data->wv_modes.mode_du = 1;
5459 fb_data->wv_modes.mode_gc4 = 3;
5460 fb_data->wv_modes.mode_gc8 = 2;
5461 fb_data->wv_modes.mode_gc16 = 2;
5462 fb_data->wv_modes.mode_gc32 = 2;
5463 fb_data->wv_modes_update = true;
5464
5465 /* Initialize marker list */
5466 INIT_LIST_HEAD(&fb_data->full_marker_list);
5467
5468 /* Initialize all LUTs to inactive */
5469 fb_data->lut_update_order =
5470 kzalloc(fb_data->num_luts * sizeof(u32), GFP_KERNEL);
5471 for (i = 0; i < fb_data->num_luts; i++)
5472 fb_data->lut_update_order[i] = 0;
5473
5474 INIT_DELAYED_WORK(&fb_data->epdc_done_work, epdc_done_work_func);
5475 fb_data->epdc_submit_workqueue = alloc_workqueue("EPDC Submit",
5476 WQ_MEM_RECLAIM | WQ_HIGHPRI |
5477 WQ_CPU_INTENSIVE | WQ_UNBOUND, 1);
5478 INIT_WORK(&fb_data->epdc_submit_work, epdc_submit_work_func);
5479 fb_data->epdc_intr_workqueue = alloc_workqueue("EPDC Interrupt",
5480 WQ_MEM_RECLAIM | WQ_HIGHPRI |
5481 WQ_CPU_INTENSIVE | WQ_UNBOUND, 1);
5482 INIT_WORK(&fb_data->epdc_intr_work, epdc_intr_work_func);
5483
5484 /* Retrieve EPDC IRQ num */
5485 irq = platform_get_irq(pdev, 0);
5486 if (irq < 0) {
5487 dev_err(&pdev->dev, "cannot get IRQ resource\n");
5488 ret = -ENODEV;
5489 goto out_dma_work_buf;
5490 }
5491 fb_data->epdc_irq = irq;
5492
5493 /* Register IRQ handler */
5494 ret = devm_request_irq(&pdev->dev, fb_data->epdc_irq,
5495 mxc_epdc_irq_handler, 0, "epdc", fb_data);
5496 if (ret) {
5497 dev_err(&pdev->dev, "request_irq (%d) failed with error %d\n",
5498 fb_data->epdc_irq, ret);
5499 ret = -ENODEV;
5500 goto out_dma_work_buf;
5501 }
5502
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-02 18:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 18:14 [freescale-fslc:5.10-2.1.x-imx 13121/15840] drivers/video/fbdev/mxc/mxc_epdc_v2_fb.c:5178:17: warning: cast to pointer from integer of different size kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.