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

[media] v4l: vsp1: Remove support for platform data

Now that all platforms instantiate the VSP1 through DT, platform data
support isn't needed anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
32d17597 1b8dc322

+48 -88
+1 -1
drivers/media/platform/Kconfig
··· 223 223 config VIDEO_RENESAS_VSP1 224 224 tristate "Renesas VSP1 Video Processing Engine" 225 225 depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA 226 - depends on ARCH_SHMOBILE || COMPILE_TEST 226 + depends on (ARCH_SHMOBILE && OF) || COMPILE_TEST 227 227 select VIDEOBUF2_DMA_CONTIG 228 228 ---help--- 229 229 This is a V4L2 driver for the Renesas VSP1 video processing engine.
+12 -2
drivers/media/platform/vsp1/vsp1.h
··· 16 16 #include <linux/io.h> 17 17 #include <linux/list.h> 18 18 #include <linux/mutex.h> 19 - #include <linux/platform_data/vsp1.h> 20 19 21 20 #include <media/media-device.h> 22 21 #include <media/v4l2-device.h> ··· 39 40 #define VSP1_MAX_UDS 3 40 41 #define VSP1_MAX_WPF 4 41 42 43 + #define VSP1_HAS_LIF (1 << 0) 44 + #define VSP1_HAS_LUT (1 << 1) 45 + #define VSP1_HAS_SRU (1 << 2) 46 + 47 + struct vsp1_platform_data { 48 + unsigned int features; 49 + unsigned int rpf_count; 50 + unsigned int uds_count; 51 + unsigned int wpf_count; 52 + }; 53 + 42 54 struct vsp1_device { 43 55 struct device *dev; 44 - struct vsp1_platform_data *pdata; 56 + struct vsp1_platform_data pdata; 45 57 46 58 void __iomem *mmio; 47 59 struct clk *clock;
+34 -57
drivers/media/platform/vsp1/vsp1_drv.c
··· 40 40 irqreturn_t ret = IRQ_NONE; 41 41 unsigned int i; 42 42 43 - for (i = 0; i < vsp1->pdata->wpf_count; ++i) { 43 + for (i = 0; i < vsp1->pdata.wpf_count; ++i) { 44 44 struct vsp1_rwpf *wpf = vsp1->wpf[i]; 45 45 struct vsp1_pipeline *pipe; 46 46 u32 status; ··· 181 181 182 182 list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities); 183 183 184 - if (vsp1->pdata->features & VSP1_HAS_LIF) { 184 + if (vsp1->pdata.features & VSP1_HAS_LIF) { 185 185 vsp1->lif = vsp1_lif_create(vsp1); 186 186 if (IS_ERR(vsp1->lif)) { 187 187 ret = PTR_ERR(vsp1->lif); ··· 191 191 list_add_tail(&vsp1->lif->entity.list_dev, &vsp1->entities); 192 192 } 193 193 194 - if (vsp1->pdata->features & VSP1_HAS_LUT) { 194 + if (vsp1->pdata.features & VSP1_HAS_LUT) { 195 195 vsp1->lut = vsp1_lut_create(vsp1); 196 196 if (IS_ERR(vsp1->lut)) { 197 197 ret = PTR_ERR(vsp1->lut); ··· 201 201 list_add_tail(&vsp1->lut->entity.list_dev, &vsp1->entities); 202 202 } 203 203 204 - for (i = 0; i < vsp1->pdata->rpf_count; ++i) { 204 + for (i = 0; i < vsp1->pdata.rpf_count; ++i) { 205 205 struct vsp1_rwpf *rpf; 206 206 207 207 rpf = vsp1_rpf_create(vsp1, i); ··· 214 214 list_add_tail(&rpf->entity.list_dev, &vsp1->entities); 215 215 } 216 216 217 - if (vsp1->pdata->features & VSP1_HAS_SRU) { 217 + if (vsp1->pdata.features & VSP1_HAS_SRU) { 218 218 vsp1->sru = vsp1_sru_create(vsp1); 219 219 if (IS_ERR(vsp1->sru)) { 220 220 ret = PTR_ERR(vsp1->sru); ··· 224 224 list_add_tail(&vsp1->sru->entity.list_dev, &vsp1->entities); 225 225 } 226 226 227 - for (i = 0; i < vsp1->pdata->uds_count; ++i) { 227 + for (i = 0; i < vsp1->pdata.uds_count; ++i) { 228 228 struct vsp1_uds *uds; 229 229 230 230 uds = vsp1_uds_create(vsp1, i); ··· 237 237 list_add_tail(&uds->entity.list_dev, &vsp1->entities); 238 238 } 239 239 240 - for (i = 0; i < vsp1->pdata->wpf_count; ++i) { 240 + for (i = 0; i < vsp1->pdata.wpf_count; ++i) { 241 241 struct vsp1_rwpf *wpf; 242 242 243 243 wpf = vsp1_wpf_create(vsp1, i); ··· 261 261 goto done; 262 262 } 263 263 264 - if (vsp1->pdata->features & VSP1_HAS_LIF) { 264 + if (vsp1->pdata.features & VSP1_HAS_LIF) { 265 265 ret = media_entity_create_link( 266 266 &vsp1->wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE, 267 267 &vsp1->lif->entity.subdev.entity, LIF_PAD_SINK, 0); ··· 294 294 /* Reset any channel that might be running. */ 295 295 status = vsp1_read(vsp1, VI6_STATUS); 296 296 297 - for (i = 0; i < vsp1->pdata->wpf_count; ++i) { 297 + for (i = 0; i < vsp1->pdata.wpf_count; ++i) { 298 298 unsigned int timeout; 299 299 300 300 if (!(status & VI6_STATUS_SYS_ACT(i))) ··· 318 318 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) | 319 319 (8 << VI6_CLK_DCSWT_CSTRW_SHIFT)); 320 320 321 - for (i = 0; i < vsp1->pdata->rpf_count; ++i) 321 + for (i = 0; i < vsp1->pdata.rpf_count; ++i) 322 322 vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED); 323 323 324 - for (i = 0; i < vsp1->pdata->uds_count; ++i) 324 + for (i = 0; i < vsp1->pdata.uds_count; ++i) 325 325 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED); 326 326 327 327 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED); ··· 428 428 * Platform Driver 429 429 */ 430 430 431 - static int vsp1_validate_platform_data(struct platform_device *pdev, 432 - struct vsp1_platform_data *pdata) 431 + static int vsp1_parse_dt(struct vsp1_device *vsp1) 433 432 { 434 - if (pdata == NULL) { 435 - dev_err(&pdev->dev, "missing platform data\n"); 436 - return -EINVAL; 437 - } 438 - 439 - if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) { 440 - dev_err(&pdev->dev, "invalid number of RPF (%u)\n", 441 - pdata->rpf_count); 442 - return -EINVAL; 443 - } 444 - 445 - if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) { 446 - dev_err(&pdev->dev, "invalid number of UDS (%u)\n", 447 - pdata->uds_count); 448 - return -EINVAL; 449 - } 450 - 451 - if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) { 452 - dev_err(&pdev->dev, "invalid number of WPF (%u)\n", 453 - pdata->wpf_count); 454 - return -EINVAL; 455 - } 456 - 457 - return 0; 458 - } 459 - 460 - static struct vsp1_platform_data * 461 - vsp1_get_platform_data(struct platform_device *pdev) 462 - { 463 - struct device_node *np = pdev->dev.of_node; 464 - struct vsp1_platform_data *pdata; 465 - 466 - if (!IS_ENABLED(CONFIG_OF) || np == NULL) 467 - return pdev->dev.platform_data; 468 - 469 - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 470 - if (pdata == NULL) 471 - return NULL; 433 + struct device_node *np = vsp1->dev->of_node; 434 + struct vsp1_platform_data *pdata = &vsp1->pdata; 472 435 473 436 if (of_property_read_bool(np, "renesas,has-lif")) 474 437 pdata->features |= VSP1_HAS_LIF; ··· 444 481 of_property_read_u32(np, "renesas,#uds", &pdata->uds_count); 445 482 of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count); 446 483 447 - return pdata; 484 + if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) { 485 + dev_err(vsp1->dev, "invalid number of RPF (%u)\n", 486 + pdata->rpf_count); 487 + return -EINVAL; 488 + } 489 + 490 + if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) { 491 + dev_err(vsp1->dev, "invalid number of UDS (%u)\n", 492 + pdata->uds_count); 493 + return -EINVAL; 494 + } 495 + 496 + if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) { 497 + dev_err(vsp1->dev, "invalid number of WPF (%u)\n", 498 + pdata->wpf_count); 499 + return -EINVAL; 500 + } 501 + 502 + return 0; 448 503 } 449 504 450 505 static int vsp1_probe(struct platform_device *pdev) ··· 480 499 mutex_init(&vsp1->lock); 481 500 INIT_LIST_HEAD(&vsp1->entities); 482 501 483 - vsp1->pdata = vsp1_get_platform_data(pdev); 484 - if (vsp1->pdata == NULL) 485 - return -ENODEV; 486 - 487 - ret = vsp1_validate_platform_data(pdev, vsp1->pdata); 502 + ret = vsp1_parse_dt(vsp1); 488 503 if (ret < 0) 489 504 return ret; 490 505
+1 -1
drivers/media/platform/vsp1/vsp1_wpf.c
··· 280 280 * except for the WPF0 source link if a LIF is present. 281 281 */ 282 282 flags = MEDIA_LNK_FL_ENABLED; 283 - if (!(vsp1->pdata->features & VSP1_HAS_LIF) || index != 0) 283 + if (!(vsp1->pdata.features & VSP1_HAS_LIF) || index != 0) 284 284 flags |= MEDIA_LNK_FL_IMMUTABLE; 285 285 286 286 ret = media_entity_create_link(&wpf->entity.subdev.entity,
-27
include/linux/platform_data/vsp1.h
··· 1 - /* 2 - * vsp1.h -- R-Car VSP1 Platform Data 3 - * 4 - * Copyright (C) 2013 Renesas Corporation 5 - * 6 - * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - */ 13 - #ifndef __PLATFORM_VSP1_H__ 14 - #define __PLATFORM_VSP1_H__ 15 - 16 - #define VSP1_HAS_LIF (1 << 0) 17 - #define VSP1_HAS_LUT (1 << 1) 18 - #define VSP1_HAS_SRU (1 << 2) 19 - 20 - struct vsp1_platform_data { 21 - unsigned int features; 22 - unsigned int rpf_count; 23 - unsigned int uds_count; 24 - unsigned int wpf_count; 25 - }; 26 - 27 - #endif /* __PLATFORM_VSP1_H__ */