aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vsp1
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-04-09 07:13:18 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-23 06:11:24 -0500
commit32d17597d3e299ffe8b07e3afc12f8074e7ae483 (patch)
treead3c5d0d54ec71d652ac2426e53f59831278ea0d /drivers/media/platform/vsp1
parent1b8dc32286a1a4fb73cfc7793ef103f3993a6478 (diff)
[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>
Diffstat (limited to 'drivers/media/platform/vsp1')
-rw-r--r--drivers/media/platform/vsp1/vsp1.h14
-rw-r--r--drivers/media/platform/vsp1/vsp1_drv.c81
-rw-r--r--drivers/media/platform/vsp1/vsp1_wpf.c2
3 files changed, 42 insertions, 55 deletions
diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
index 12467191dff4..989e96f7e360 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -16,7 +16,6 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/platform_data/vsp1.h>
20 19
21#include <media/media-device.h> 20#include <media/media-device.h>
22#include <media/v4l2-device.h> 21#include <media/v4l2-device.h>
@@ -40,9 +39,20 @@ struct vsp1_uds;
40#define VSP1_MAX_UDS 3 39#define VSP1_MAX_UDS 3
41#define VSP1_MAX_WPF 4 40#define VSP1_MAX_WPF 4
42 41
42#define VSP1_HAS_LIF (1 << 0)
43#define VSP1_HAS_LUT (1 << 1)
44#define VSP1_HAS_SRU (1 << 2)
45
46struct vsp1_platform_data {
47 unsigned int features;
48 unsigned int rpf_count;
49 unsigned int uds_count;
50 unsigned int wpf_count;
51};
52
43struct vsp1_device { 53struct vsp1_device {
44 struct device *dev; 54 struct device *dev;
45 struct vsp1_platform_data *pdata; 55 struct vsp1_platform_data pdata;
46 56
47 void __iomem *mmio; 57 void __iomem *mmio;
48 struct clk *clock; 58 struct clk *clock;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index 5eb16e87d53f..913485a90e97 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -40,7 +40,7 @@ static irqreturn_t vsp1_irq_handler(int irq, void *data)
40 irqreturn_t ret = IRQ_NONE; 40 irqreturn_t ret = IRQ_NONE;
41 unsigned int i; 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 struct vsp1_rwpf *wpf = vsp1->wpf[i]; 44 struct vsp1_rwpf *wpf = vsp1->wpf[i];
45 struct vsp1_pipeline *pipe; 45 struct vsp1_pipeline *pipe;
46 u32 status; 46 u32 status;
@@ -181,7 +181,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
181 181
182 list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities); 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 vsp1->lif = vsp1_lif_create(vsp1); 185 vsp1->lif = vsp1_lif_create(vsp1);
186 if (IS_ERR(vsp1->lif)) { 186 if (IS_ERR(vsp1->lif)) {
187 ret = PTR_ERR(vsp1->lif); 187 ret = PTR_ERR(vsp1->lif);
@@ -191,7 +191,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
191 list_add_tail(&vsp1->lif->entity.list_dev, &vsp1->entities); 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 vsp1->lut = vsp1_lut_create(vsp1); 195 vsp1->lut = vsp1_lut_create(vsp1);
196 if (IS_ERR(vsp1->lut)) { 196 if (IS_ERR(vsp1->lut)) {
197 ret = PTR_ERR(vsp1->lut); 197 ret = PTR_ERR(vsp1->lut);
@@ -201,7 +201,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
201 list_add_tail(&vsp1->lut->entity.list_dev, &vsp1->entities); 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 struct vsp1_rwpf *rpf; 205 struct vsp1_rwpf *rpf;
206 206
207 rpf = vsp1_rpf_create(vsp1, i); 207 rpf = vsp1_rpf_create(vsp1, i);
@@ -214,7 +214,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
214 list_add_tail(&rpf->entity.list_dev, &vsp1->entities); 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 vsp1->sru = vsp1_sru_create(vsp1); 218 vsp1->sru = vsp1_sru_create(vsp1);
219 if (IS_ERR(vsp1->sru)) { 219 if (IS_ERR(vsp1->sru)) {
220 ret = PTR_ERR(vsp1->sru); 220 ret = PTR_ERR(vsp1->sru);
@@ -224,7 +224,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
224 list_add_tail(&vsp1->sru->entity.list_dev, &vsp1->entities); 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 struct vsp1_uds *uds; 228 struct vsp1_uds *uds;
229 229
230 uds = vsp1_uds_create(vsp1, i); 230 uds = vsp1_uds_create(vsp1, i);
@@ -237,7 +237,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
237 list_add_tail(&uds->entity.list_dev, &vsp1->entities); 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 struct vsp1_rwpf *wpf; 241 struct vsp1_rwpf *wpf;
242 242
243 wpf = vsp1_wpf_create(vsp1, i); 243 wpf = vsp1_wpf_create(vsp1, i);
@@ -261,7 +261,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
261 goto done; 261 goto done;
262 } 262 }
263 263
264 if (vsp1->pdata->features & VSP1_HAS_LIF) { 264 if (vsp1->pdata.features & VSP1_HAS_LIF) {
265 ret = media_entity_create_link( 265 ret = media_entity_create_link(
266 &vsp1->wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE, 266 &vsp1->wpf[0]->entity.subdev.entity, RWPF_PAD_SOURCE,
267 &vsp1->lif->entity.subdev.entity, LIF_PAD_SINK, 0); 267 &vsp1->lif->entity.subdev.entity, LIF_PAD_SINK, 0);
@@ -294,7 +294,7 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
294 /* Reset any channel that might be running. */ 294 /* Reset any channel that might be running. */
295 status = vsp1_read(vsp1, VI6_STATUS); 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 unsigned int timeout; 298 unsigned int timeout;
299 299
300 if (!(status & VI6_STATUS_SYS_ACT(i))) 300 if (!(status & VI6_STATUS_SYS_ACT(i)))
@@ -318,10 +318,10 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
318 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) | 318 vsp1_write(vsp1, VI6_CLK_DCSWT, (8 << VI6_CLK_DCSWT_CSTPW_SHIFT) |
319 (8 << VI6_CLK_DCSWT_CSTRW_SHIFT)); 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 vsp1_write(vsp1, VI6_DPR_RPF_ROUTE(i), VI6_DPR_NODE_UNUSED); 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 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED); 325 vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
326 326
327 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED); 327 vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
@@ -428,28 +428,36 @@ static const struct dev_pm_ops vsp1_pm_ops = {
428 * Platform Driver 428 * Platform Driver
429 */ 429 */
430 430
431static int vsp1_validate_platform_data(struct platform_device *pdev, 431static int vsp1_parse_dt(struct vsp1_device *vsp1)
432 struct vsp1_platform_data *pdata)
433{ 432{
434 if (pdata == NULL) { 433 struct device_node *np = vsp1->dev->of_node;
435 dev_err(&pdev->dev, "missing platform data\n"); 434 struct vsp1_platform_data *pdata = &vsp1->pdata;
436 return -EINVAL; 435
437 } 436 if (of_property_read_bool(np, "renesas,has-lif"))
437 pdata->features |= VSP1_HAS_LIF;
438 if (of_property_read_bool(np, "renesas,has-lut"))
439 pdata->features |= VSP1_HAS_LUT;
440 if (of_property_read_bool(np, "renesas,has-sru"))
441 pdata->features |= VSP1_HAS_SRU;
442
443 of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
444 of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
445 of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
438 446
439 if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) { 447 if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) {
440 dev_err(&pdev->dev, "invalid number of RPF (%u)\n", 448 dev_err(vsp1->dev, "invalid number of RPF (%u)\n",
441 pdata->rpf_count); 449 pdata->rpf_count);
442 return -EINVAL; 450 return -EINVAL;
443 } 451 }
444 452
445 if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) { 453 if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) {
446 dev_err(&pdev->dev, "invalid number of UDS (%u)\n", 454 dev_err(vsp1->dev, "invalid number of UDS (%u)\n",
447 pdata->uds_count); 455 pdata->uds_count);
448 return -EINVAL; 456 return -EINVAL;
449 } 457 }
450 458
451 if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) { 459 if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) {
452 dev_err(&pdev->dev, "invalid number of WPF (%u)\n", 460 dev_err(vsp1->dev, "invalid number of WPF (%u)\n",
453 pdata->wpf_count); 461 pdata->wpf_count);
454 return -EINVAL; 462 return -EINVAL;
455 } 463 }
@@ -457,33 +465,6 @@ static int vsp1_validate_platform_data(struct platform_device *pdev,
457 return 0; 465 return 0;
458} 466}
459 467
460static struct vsp1_platform_data *
461vsp1_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;
472
473 if (of_property_read_bool(np, "renesas,has-lif"))
474 pdata->features |= VSP1_HAS_LIF;
475 if (of_property_read_bool(np, "renesas,has-lut"))
476 pdata->features |= VSP1_HAS_LUT;
477 if (of_property_read_bool(np, "renesas,has-sru"))
478 pdata->features |= VSP1_HAS_SRU;
479
480 of_property_read_u32(np, "renesas,#rpf", &pdata->rpf_count);
481 of_property_read_u32(np, "renesas,#uds", &pdata->uds_count);
482 of_property_read_u32(np, "renesas,#wpf", &pdata->wpf_count);
483
484 return pdata;
485}
486
487static int vsp1_probe(struct platform_device *pdev) 468static int vsp1_probe(struct platform_device *pdev)
488{ 469{
489 struct vsp1_device *vsp1; 470 struct vsp1_device *vsp1;
@@ -499,11 +480,7 @@ static int vsp1_probe(struct platform_device *pdev)
499 mutex_init(&vsp1->lock); 480 mutex_init(&vsp1->lock);
500 INIT_LIST_HEAD(&vsp1->entities); 481 INIT_LIST_HEAD(&vsp1->entities);
501 482
502 vsp1->pdata = vsp1_get_platform_data(pdev); 483 ret = vsp1_parse_dt(vsp1);
503 if (vsp1->pdata == NULL)
504 return -ENODEV;
505
506 ret = vsp1_validate_platform_data(pdev, vsp1->pdata);
507 if (ret < 0) 484 if (ret < 0)
508 return ret; 485 return ret;
509 486
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
index 6e057762c933..b1089d05583a 100644
--- a/drivers/media/platform/vsp1/vsp1_wpf.c
+++ b/drivers/media/platform/vsp1/vsp1_wpf.c
@@ -280,7 +280,7 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
280 * except for the WPF0 source link if a LIF is present. 280 * except for the WPF0 source link if a LIF is present.
281 */ 281 */
282 flags = MEDIA_LNK_FL_ENABLED; 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 flags |= MEDIA_LNK_FL_IMMUTABLE; 284 flags |= MEDIA_LNK_FL_IMMUTABLE;
285 285
286 ret = media_entity_create_link(&wpf->entity.subdev.entity, 286 ret = media_entity_create_link(&wpf->entity.subdev.entity,