aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c8
-rw-r--r--arch/arm/mach-davinci/dm644x.c10
-rw-r--r--drivers/media/platform/davinci/vpbe.c4
-rw-r--r--drivers/media/platform/davinci/vpbe_display.c2
-rw-r--r--drivers/media/platform/davinci/vpbe_osd.c35
-rw-r--r--drivers/media/platform/davinci/vpbe_venc.c65
-rw-r--r--include/media/davinci/vpbe_osd.h5
-rw-r--r--include/media/davinci/vpbe_venc.h5
8 files changed, 84 insertions, 50 deletions
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f22572cee49d..b00ade498077 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -689,7 +689,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = {
689 .std = VENC_STD_ALL, 689 .std = VENC_STD_ALL,
690 .capabilities = V4L2_OUT_CAP_STD, 690 .capabilities = V4L2_OUT_CAP_STD,
691 }, 691 },
692 .subdev_name = VPBE_VENC_SUBDEV_NAME, 692 .subdev_name = DM644X_VPBE_VENC_SUBDEV_NAME,
693 .default_mode = "ntsc", 693 .default_mode = "ntsc",
694 .num_modes = ARRAY_SIZE(dm644xevm_enc_std_timing), 694 .num_modes = ARRAY_SIZE(dm644xevm_enc_std_timing),
695 .modes = dm644xevm_enc_std_timing, 695 .modes = dm644xevm_enc_std_timing,
@@ -701,7 +701,7 @@ static struct vpbe_output dm644xevm_vpbe_outputs[] = {
701 .type = V4L2_OUTPUT_TYPE_ANALOG, 701 .type = V4L2_OUTPUT_TYPE_ANALOG,
702 .capabilities = V4L2_OUT_CAP_DV_TIMINGS, 702 .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
703 }, 703 },
704 .subdev_name = VPBE_VENC_SUBDEV_NAME, 704 .subdev_name = DM644X_VPBE_VENC_SUBDEV_NAME,
705 .default_mode = "480p59_94", 705 .default_mode = "480p59_94",
706 .num_modes = ARRAY_SIZE(dm644xevm_enc_preset_timing), 706 .num_modes = ARRAY_SIZE(dm644xevm_enc_preset_timing),
707 .modes = dm644xevm_enc_preset_timing, 707 .modes = dm644xevm_enc_preset_timing,
@@ -712,10 +712,10 @@ static struct vpbe_config dm644xevm_display_cfg = {
712 .module_name = "dm644x-vpbe-display", 712 .module_name = "dm644x-vpbe-display",
713 .i2c_adapter_id = 1, 713 .i2c_adapter_id = 1,
714 .osd = { 714 .osd = {
715 .module_name = VPBE_OSD_SUBDEV_NAME, 715 .module_name = DM644X_VPBE_OSD_SUBDEV_NAME,
716 }, 716 },
717 .venc = { 717 .venc = {
718 .module_name = VPBE_VENC_SUBDEV_NAME, 718 .module_name = DM644X_VPBE_VENC_SUBDEV_NAME,
719 }, 719 },
720 .num_outputs = ARRAY_SIZE(dm644xevm_vpbe_outputs), 720 .num_outputs = ARRAY_SIZE(dm644xevm_vpbe_outputs),
721 .outputs = dm644xevm_vpbe_outputs, 721 .outputs = dm644xevm_vpbe_outputs,
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 14e9947bad6e..0849d5768d99 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -669,19 +669,14 @@ static struct resource dm644x_osd_resources[] = {
669 }, 669 },
670}; 670};
671 671
672static struct osd_platform_data dm644x_osd_data = {
673 .vpbe_type = VPBE_VERSION_1,
674};
675
676static struct platform_device dm644x_osd_dev = { 672static struct platform_device dm644x_osd_dev = {
677 .name = VPBE_OSD_SUBDEV_NAME, 673 .name = DM644X_VPBE_OSD_SUBDEV_NAME,
678 .id = -1, 674 .id = -1,
679 .num_resources = ARRAY_SIZE(dm644x_osd_resources), 675 .num_resources = ARRAY_SIZE(dm644x_osd_resources),
680 .resource = dm644x_osd_resources, 676 .resource = dm644x_osd_resources,
681 .dev = { 677 .dev = {
682 .dma_mask = &dm644x_video_dma_mask, 678 .dma_mask = &dm644x_video_dma_mask,
683 .coherent_dma_mask = DMA_BIT_MASK(32), 679 .coherent_dma_mask = DMA_BIT_MASK(32),
684 .platform_data = &dm644x_osd_data,
685 }, 680 },
686}; 681};
687 682
@@ -751,12 +746,11 @@ static struct platform_device dm644x_vpbe_display = {
751}; 746};
752 747
753static struct venc_platform_data dm644x_venc_pdata = { 748static struct venc_platform_data dm644x_venc_pdata = {
754 .venc_type = VPBE_VERSION_1,
755 .setup_clock = dm644x_venc_setup_clock, 749 .setup_clock = dm644x_venc_setup_clock,
756}; 750};
757 751
758static struct platform_device dm644x_venc_dev = { 752static struct platform_device dm644x_venc_dev = {
759 .name = VPBE_VENC_SUBDEV_NAME, 753 .name = DM644X_VPBE_VENC_SUBDEV_NAME,
760 .id = -1, 754 .id = -1,
761 .num_resources = ARRAY_SIZE(dm644x_venc_resources), 755 .num_resources = ARRAY_SIZE(dm644x_venc_resources),
762 .resource = dm644x_venc_resources, 756 .resource = dm644x_venc_resources,
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 7f5cf9b347b2..dd670cdb2c2a 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -558,9 +558,9 @@ static int platform_device_get(struct device *dev, void *data)
558 struct platform_device *pdev = to_platform_device(dev); 558 struct platform_device *pdev = to_platform_device(dev);
559 struct vpbe_device *vpbe_dev = data; 559 struct vpbe_device *vpbe_dev = data;
560 560
561 if (strcmp("vpbe-osd", pdev->name) == 0) 561 if (strstr(pdev->name, "vpbe-osd") != NULL)
562 vpbe_dev->osd_device = platform_get_drvdata(pdev); 562 vpbe_dev->osd_device = platform_get_drvdata(pdev);
563 if (strcmp("vpbe-venc", pdev->name) == 0) 563 if (strstr(pdev->name, "vpbe-venc") != NULL)
564 vpbe_dev->venc_device = dev_get_platdata(&pdev->dev); 564 vpbe_dev->venc_device = dev_get_platdata(&pdev->dev);
565 565
566 return 0; 566 return 0;
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index 2bfde7958fef..3846890ea707 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1656,7 +1656,7 @@ static int vpbe_device_get(struct device *dev, void *data)
1656 if (strcmp("vpbe_controller", pdev->name) == 0) 1656 if (strcmp("vpbe_controller", pdev->name) == 0)
1657 vpbe_disp->vpbe_dev = platform_get_drvdata(pdev); 1657 vpbe_disp->vpbe_dev = platform_get_drvdata(pdev);
1658 1658
1659 if (strcmp("vpbe-osd", pdev->name) == 0) 1659 if (strstr(pdev->name, "vpbe-osd") != NULL)
1660 vpbe_disp->osd_device = platform_get_drvdata(pdev); 1660 vpbe_disp->osd_device = platform_get_drvdata(pdev);
1661 1661
1662 return 0; 1662 return 0;
diff --git a/drivers/media/platform/davinci/vpbe_osd.c b/drivers/media/platform/davinci/vpbe_osd.c
index 707f243f810d..12ad17c52ef3 100644
--- a/drivers/media/platform/davinci/vpbe_osd.c
+++ b/drivers/media/platform/davinci/vpbe_osd.c
@@ -39,7 +39,22 @@
39#include <linux/io.h> 39#include <linux/io.h>
40#include "vpbe_osd_regs.h" 40#include "vpbe_osd_regs.h"
41 41
42#define MODULE_NAME VPBE_OSD_SUBDEV_NAME 42#define MODULE_NAME "davinci-vpbe-osd"
43
44static struct platform_device_id vpbe_osd_devtype[] = {
45 {
46 .name = DM644X_VPBE_OSD_SUBDEV_NAME,
47 .driver_data = VPBE_VERSION_1,
48 }, {
49 .name = DM365_VPBE_OSD_SUBDEV_NAME,
50 .driver_data = VPBE_VERSION_2,
51 }, {
52 .name = DM355_VPBE_OSD_SUBDEV_NAME,
53 .driver_data = VPBE_VERSION_3,
54 },
55};
56
57MODULE_DEVICE_TABLE(platform, vpbe_osd_devtype);
43 58
44/* register access routines */ 59/* register access routines */
45static inline u32 osd_read(struct osd_state *sd, u32 offset) 60static inline u32 osd_read(struct osd_state *sd, u32 offset)
@@ -129,7 +144,7 @@ static int _osd_dm6446_vid0_pingpong(struct osd_state *sd,
129 struct osd_platform_data *pdata; 144 struct osd_platform_data *pdata;
130 145
131 pdata = (struct osd_platform_data *)sd->dev->platform_data; 146 pdata = (struct osd_platform_data *)sd->dev->platform_data;
132 if (pdata->field_inv_wa_enable) { 147 if (pdata != NULL && pdata->field_inv_wa_enable) {
133 148
134 if (!field_inversion || !lconfig->interlaced) { 149 if (!field_inversion || !lconfig->interlaced) {
135 osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR); 150 osd_write(sd, fb_base_phys & ~0x1F, OSD_VIDWIN0ADR);
@@ -1526,7 +1541,7 @@ static const struct vpbe_osd_ops osd_ops = {
1526 1541
1527static int osd_probe(struct platform_device *pdev) 1542static int osd_probe(struct platform_device *pdev)
1528{ 1543{
1529 struct osd_platform_data *pdata; 1544 const struct platform_device_id *pdev_id;
1530 struct osd_state *osd; 1545 struct osd_state *osd;
1531 struct resource *res; 1546 struct resource *res;
1532 int ret = 0; 1547 int ret = 0;
@@ -1535,16 +1550,15 @@ static int osd_probe(struct platform_device *pdev)
1535 if (osd == NULL) 1550 if (osd == NULL)
1536 return -ENOMEM; 1551 return -ENOMEM;
1537 1552
1538 osd->dev = &pdev->dev; 1553 pdev_id = platform_get_device_id(pdev);
1539 pdata = (struct osd_platform_data *)pdev->dev.platform_data; 1554 if (!pdev_id) {
1540 osd->vpbe_type = (enum vpbe_version)pdata->vpbe_type; 1555 ret = -EINVAL;
1541 if (NULL == pdev->dev.platform_data) {
1542 dev_err(osd->dev, "No platform data defined for OSD"
1543 " sub device\n");
1544 ret = -ENOENT;
1545 goto free_mem; 1556 goto free_mem;
1546 } 1557 }
1547 1558
1559 osd->dev = &pdev->dev;
1560 osd->vpbe_type = pdev_id->driver_data;
1561
1548 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1562 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1549 if (!res) { 1563 if (!res) {
1550 dev_err(osd->dev, "Unable to get OSD register address map\n"); 1564 dev_err(osd->dev, "Unable to get OSD register address map\n");
@@ -1595,6 +1609,7 @@ static struct platform_driver osd_driver = {
1595 .name = MODULE_NAME, 1609 .name = MODULE_NAME,
1596 .owner = THIS_MODULE, 1610 .owner = THIS_MODULE,
1597 }, 1611 },
1612 .id_table = vpbe_osd_devtype
1598}; 1613};
1599 1614
1600module_platform_driver(osd_driver); 1615module_platform_driver(osd_driver);
diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c
index aed7369b962a..bdbebd59df98 100644
--- a/drivers/media/platform/davinci/vpbe_venc.c
+++ b/drivers/media/platform/davinci/vpbe_venc.c
@@ -38,7 +38,22 @@
38 38
39#include "vpbe_venc_regs.h" 39#include "vpbe_venc_regs.h"
40 40
41#define MODULE_NAME VPBE_VENC_SUBDEV_NAME 41#define MODULE_NAME "davinci-vpbe-venc"
42
43static struct platform_device_id vpbe_venc_devtype[] = {
44 {
45 .name = DM644X_VPBE_VENC_SUBDEV_NAME,
46 .driver_data = VPBE_VERSION_1,
47 }, {
48 .name = DM365_VPBE_VENC_SUBDEV_NAME,
49 .driver_data = VPBE_VERSION_2,
50 }, {
51 .name = DM355_VPBE_VENC_SUBDEV_NAME,
52 .driver_data = VPBE_VERSION_3,
53 },
54};
55
56MODULE_DEVICE_TABLE(platform, vpbe_venc_devtype);
42 57
43static int debug = 2; 58static int debug = 2;
44module_param(debug, int, 0644); 59module_param(debug, int, 0644);
@@ -54,6 +69,7 @@ struct venc_state {
54 spinlock_t lock; 69 spinlock_t lock;
55 void __iomem *venc_base; 70 void __iomem *venc_base;
56 void __iomem *vdaccfg_reg; 71 void __iomem *vdaccfg_reg;
72 enum vpbe_version venc_type;
57}; 73};
58 74
59static inline struct venc_state *to_state(struct v4l2_subdev *sd) 75static inline struct venc_state *to_state(struct v4l2_subdev *sd)
@@ -127,7 +143,7 @@ static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index)
127static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable) 143static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable)
128{ 144{
129 struct venc_state *venc = to_state(sd); 145 struct venc_state *venc = to_state(sd);
130 struct venc_platform_data *pdata = venc->pdata; 146
131 v4l2_dbg(debug, 2, sd, "venc_enabledigitaloutput\n"); 147 v4l2_dbg(debug, 2, sd, "venc_enabledigitaloutput\n");
132 148
133 if (benable) { 149 if (benable) {
@@ -159,7 +175,7 @@ static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable)
159 175
160 /* Disable LCD output control (accepting default polarity) */ 176 /* Disable LCD output control (accepting default polarity) */
161 venc_write(sd, VENC_LCDOUT, 0); 177 venc_write(sd, VENC_LCDOUT, 0);
162 if (pdata->venc_type != VPBE_VERSION_3) 178 if (venc->venc_type != VPBE_VERSION_3)
163 venc_write(sd, VENC_CMPNT, 0x100); 179 venc_write(sd, VENC_CMPNT, 0x100);
164 venc_write(sd, VENC_HSPLS, 0); 180 venc_write(sd, VENC_HSPLS, 0);
165 venc_write(sd, VENC_HINT, 0); 181 venc_write(sd, VENC_HINT, 0);
@@ -203,11 +219,11 @@ static int venc_set_ntsc(struct v4l2_subdev *sd)
203 219
204 venc_enabledigitaloutput(sd, 0); 220 venc_enabledigitaloutput(sd, 0);
205 221
206 if (pdata->venc_type == VPBE_VERSION_3) { 222 if (venc->venc_type == VPBE_VERSION_3) {
207 venc_write(sd, VENC_CLKCTL, 0x01); 223 venc_write(sd, VENC_CLKCTL, 0x01);
208 venc_write(sd, VENC_VIDCTL, 0); 224 venc_write(sd, VENC_VIDCTL, 0);
209 val = vdaccfg_write(sd, VDAC_CONFIG_SD_V3); 225 val = vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
210 } else if (pdata->venc_type == VPBE_VERSION_2) { 226 } else if (venc->venc_type == VPBE_VERSION_2) {
211 venc_write(sd, VENC_CLKCTL, 0x01); 227 venc_write(sd, VENC_CLKCTL, 0x01);
212 venc_write(sd, VENC_VIDCTL, 0); 228 venc_write(sd, VENC_VIDCTL, 0);
213 vdaccfg_write(sd, VDAC_CONFIG_SD_V2); 229 vdaccfg_write(sd, VDAC_CONFIG_SD_V2);
@@ -238,7 +254,6 @@ static int venc_set_ntsc(struct v4l2_subdev *sd)
238static int venc_set_pal(struct v4l2_subdev *sd) 254static int venc_set_pal(struct v4l2_subdev *sd)
239{ 255{
240 struct venc_state *venc = to_state(sd); 256 struct venc_state *venc = to_state(sd);
241 struct venc_platform_data *pdata = venc->pdata;
242 257
243 v4l2_dbg(debug, 2, sd, "venc_set_pal\n"); 258 v4l2_dbg(debug, 2, sd, "venc_set_pal\n");
244 259
@@ -249,11 +264,11 @@ static int venc_set_pal(struct v4l2_subdev *sd)
249 264
250 venc_enabledigitaloutput(sd, 0); 265 venc_enabledigitaloutput(sd, 0);
251 266
252 if (pdata->venc_type == VPBE_VERSION_3) { 267 if (venc->venc_type == VPBE_VERSION_3) {
253 venc_write(sd, VENC_CLKCTL, 0x1); 268 venc_write(sd, VENC_CLKCTL, 0x1);
254 venc_write(sd, VENC_VIDCTL, 0); 269 venc_write(sd, VENC_VIDCTL, 0);
255 vdaccfg_write(sd, VDAC_CONFIG_SD_V3); 270 vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
256 } else if (pdata->venc_type == VPBE_VERSION_2) { 271 } else if (venc->venc_type == VPBE_VERSION_2) {
257 venc_write(sd, VENC_CLKCTL, 0x1); 272 venc_write(sd, VENC_CLKCTL, 0x1);
258 venc_write(sd, VENC_VIDCTL, 0); 273 venc_write(sd, VENC_VIDCTL, 0);
259 vdaccfg_write(sd, VDAC_CONFIG_SD_V2); 274 vdaccfg_write(sd, VDAC_CONFIG_SD_V2);
@@ -293,8 +308,8 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
293 struct venc_platform_data *pdata = venc->pdata; 308 struct venc_platform_data *pdata = venc->pdata;
294 309
295 v4l2_dbg(debug, 2, sd, "venc_set_480p59_94\n"); 310 v4l2_dbg(debug, 2, sd, "venc_set_480p59_94\n");
296 if ((pdata->venc_type != VPBE_VERSION_1) && 311 if (venc->venc_type != VPBE_VERSION_1 &&
297 (pdata->venc_type != VPBE_VERSION_2)) 312 venc->venc_type != VPBE_VERSION_2)
298 return -EINVAL; 313 return -EINVAL;
299 314
300 /* Setup clock at VPSS & VENC for SD */ 315 /* Setup clock at VPSS & VENC for SD */
@@ -303,12 +318,12 @@ static int venc_set_480p59_94(struct v4l2_subdev *sd)
303 318
304 venc_enabledigitaloutput(sd, 0); 319 venc_enabledigitaloutput(sd, 0);
305 320
306 if (pdata->venc_type == VPBE_VERSION_2) 321 if (venc->venc_type == VPBE_VERSION_2)
307 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); 322 vdaccfg_write(sd, VDAC_CONFIG_HD_V2);
308 venc_write(sd, VENC_OSDCLK0, 0); 323 venc_write(sd, VENC_OSDCLK0, 0);
309 venc_write(sd, VENC_OSDCLK1, 1); 324 venc_write(sd, VENC_OSDCLK1, 1);
310 325
311 if (pdata->venc_type == VPBE_VERSION_1) { 326 if (venc->venc_type == VPBE_VERSION_1) {
312 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, 327 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ,
313 VENC_VDPRO_DAFRQ); 328 VENC_VDPRO_DAFRQ);
314 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, 329 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS,
@@ -341,8 +356,8 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
341 356
342 v4l2_dbg(debug, 2, sd, "venc_set_576p50\n"); 357 v4l2_dbg(debug, 2, sd, "venc_set_576p50\n");
343 358
344 if ((pdata->venc_type != VPBE_VERSION_1) && 359 if (venc->venc_type != VPBE_VERSION_1 &&
345 (pdata->venc_type != VPBE_VERSION_2)) 360 venc->venc_type != VPBE_VERSION_2)
346 return -EINVAL; 361 return -EINVAL;
347 /* Setup clock at VPSS & VENC for SD */ 362 /* Setup clock at VPSS & VENC for SD */
348 if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0) 363 if (pdata->setup_clock(VPBE_ENC_CUSTOM_TIMINGS, 27000000) < 0)
@@ -350,13 +365,13 @@ static int venc_set_576p50(struct v4l2_subdev *sd)
350 365
351 venc_enabledigitaloutput(sd, 0); 366 venc_enabledigitaloutput(sd, 0);
352 367
353 if (pdata->venc_type == VPBE_VERSION_2) 368 if (venc->venc_type == VPBE_VERSION_2)
354 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); 369 vdaccfg_write(sd, VDAC_CONFIG_HD_V2);
355 370
356 venc_write(sd, VENC_OSDCLK0, 0); 371 venc_write(sd, VENC_OSDCLK0, 0);
357 venc_write(sd, VENC_OSDCLK1, 1); 372 venc_write(sd, VENC_OSDCLK1, 1);
358 373
359 if (pdata->venc_type == VPBE_VERSION_1) { 374 if (venc->venc_type == VPBE_VERSION_1) {
360 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ, 375 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAFRQ,
361 VENC_VDPRO_DAFRQ); 376 VENC_VDPRO_DAFRQ);
362 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS, 377 venc_modify(sd, VENC_VDPRO, VENC_VDPRO_DAUPS,
@@ -460,14 +475,14 @@ static int venc_s_dv_timings(struct v4l2_subdev *sd,
460 else if (height == 480) 475 else if (height == 480)
461 return venc_set_480p59_94(sd); 476 return venc_set_480p59_94(sd);
462 else if ((height == 720) && 477 else if ((height == 720) &&
463 (venc->pdata->venc_type == VPBE_VERSION_2)) { 478 (venc->venc_type == VPBE_VERSION_2)) {
464 /* TBD setup internal 720p mode here */ 479 /* TBD setup internal 720p mode here */
465 ret = venc_set_720p60_internal(sd); 480 ret = venc_set_720p60_internal(sd);
466 /* for DM365 VPBE, there is DAC inside */ 481 /* for DM365 VPBE, there is DAC inside */
467 vdaccfg_write(sd, VDAC_CONFIG_HD_V2); 482 vdaccfg_write(sd, VDAC_CONFIG_HD_V2);
468 return ret; 483 return ret;
469 } else if ((height == 1080) && 484 } else if ((height == 1080) &&
470 (venc->pdata->venc_type == VPBE_VERSION_2)) { 485 (venc->venc_type == VPBE_VERSION_2)) {
471 /* TBD setup internal 1080i mode here */ 486 /* TBD setup internal 1080i mode here */
472 ret = venc_set_1080i30_internal(sd); 487 ret = venc_set_1080i30_internal(sd);
473 /* for DM365 VPBE, there is DAC inside */ 488 /* for DM365 VPBE, there is DAC inside */
@@ -556,7 +571,7 @@ static int venc_device_get(struct device *dev, void *data)
556 struct platform_device *pdev = to_platform_device(dev); 571 struct platform_device *pdev = to_platform_device(dev);
557 struct venc_state **venc = data; 572 struct venc_state **venc = data;
558 573
559 if (strcmp(MODULE_NAME, pdev->name) == 0) 574 if (strstr(pdev->name, "vpbe-venc") != NULL)
560 *venc = platform_get_drvdata(pdev); 575 *venc = platform_get_drvdata(pdev);
561 576
562 return 0; 577 return 0;
@@ -593,6 +608,7 @@ EXPORT_SYMBOL(venc_sub_dev_init);
593 608
594static int venc_probe(struct platform_device *pdev) 609static int venc_probe(struct platform_device *pdev)
595{ 610{
611 const struct platform_device_id *pdev_id;
596 struct venc_state *venc; 612 struct venc_state *venc;
597 struct resource *res; 613 struct resource *res;
598 int ret; 614 int ret;
@@ -601,6 +617,12 @@ static int venc_probe(struct platform_device *pdev)
601 if (venc == NULL) 617 if (venc == NULL)
602 return -ENOMEM; 618 return -ENOMEM;
603 619
620 pdev_id = platform_get_device_id(pdev);
621 if (!pdev_id) {
622 ret = -EINVAL;
623 goto free_mem;
624 }
625 venc->venc_type = pdev_id->driver_data;
604 venc->pdev = &pdev->dev; 626 venc->pdev = &pdev->dev;
605 venc->pdata = pdev->dev.platform_data; 627 venc->pdata = pdev->dev.platform_data;
606 if (NULL == venc->pdata) { 628 if (NULL == venc->pdata) {
@@ -630,7 +652,7 @@ static int venc_probe(struct platform_device *pdev)
630 goto release_venc_mem_region; 652 goto release_venc_mem_region;
631 } 653 }
632 654
633 if (venc->pdata->venc_type != VPBE_VERSION_1) { 655 if (venc->venc_type != VPBE_VERSION_1) {
634 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 656 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
635 if (!res) { 657 if (!res) {
636 dev_err(venc->pdev, 658 dev_err(venc->pdev,
@@ -681,7 +703,7 @@ static int venc_remove(struct platform_device *pdev)
681 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 703 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
682 iounmap((void *)venc->venc_base); 704 iounmap((void *)venc->venc_base);
683 release_mem_region(res->start, resource_size(res)); 705 release_mem_region(res->start, resource_size(res));
684 if (venc->pdata->venc_type != VPBE_VERSION_1) { 706 if (venc->venc_type != VPBE_VERSION_1) {
685 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 707 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
686 iounmap((void *)venc->vdaccfg_reg); 708 iounmap((void *)venc->vdaccfg_reg);
687 release_mem_region(res->start, resource_size(res)); 709 release_mem_region(res->start, resource_size(res));
@@ -698,6 +720,7 @@ static struct platform_driver venc_driver = {
698 .name = MODULE_NAME, 720 .name = MODULE_NAME,
699 .owner = THIS_MODULE, 721 .owner = THIS_MODULE,
700 }, 722 },
723 .id_table = vpbe_venc_devtype
701}; 724};
702 725
703module_platform_driver(venc_driver); 726module_platform_driver(venc_driver);
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h
index 5ab0d8d41f68..42628fcfe1bd 100644
--- a/include/media/davinci/vpbe_osd.h
+++ b/include/media/davinci/vpbe_osd.h
@@ -26,7 +26,9 @@
26 26
27#include <media/davinci/vpbe_types.h> 27#include <media/davinci/vpbe_types.h>
28 28
29#define VPBE_OSD_SUBDEV_NAME "vpbe-osd" 29#define DM644X_VPBE_OSD_SUBDEV_NAME "dm644x,vpbe-osd"
30#define DM365_VPBE_OSD_SUBDEV_NAME "dm365,vpbe-osd"
31#define DM355_VPBE_OSD_SUBDEV_NAME "dm355,vpbe-osd"
30 32
31/** 33/**
32 * enum osd_layer 34 * enum osd_layer
@@ -387,7 +389,6 @@ struct osd_state {
387}; 389};
388 390
389struct osd_platform_data { 391struct osd_platform_data {
390 enum vpbe_version vpbe_type;
391 int field_inv_wa_enable; 392 int field_inv_wa_enable;
392}; 393};
393 394
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h
index cc78c2eb16da..476fafc2f522 100644
--- a/include/media/davinci/vpbe_venc.h
+++ b/include/media/davinci/vpbe_venc.h
@@ -20,7 +20,9 @@
20#include <media/v4l2-subdev.h> 20#include <media/v4l2-subdev.h>
21#include <media/davinci/vpbe_types.h> 21#include <media/davinci/vpbe_types.h>
22 22
23#define VPBE_VENC_SUBDEV_NAME "vpbe-venc" 23#define DM644X_VPBE_VENC_SUBDEV_NAME "dm644x,vpbe-venc"
24#define DM365_VPBE_VENC_SUBDEV_NAME "dm365,vpbe-venc"
25#define DM355_VPBE_VENC_SUBDEV_NAME "dm355,vpbe-venc"
24 26
25/* venc events */ 27/* venc events */
26#define VENC_END_OF_FRAME BIT(0) 28#define VENC_END_OF_FRAME BIT(0)
@@ -28,7 +30,6 @@
28#define VENC_SECOND_FIELD BIT(2) 30#define VENC_SECOND_FIELD BIT(2)
29 31
30struct venc_platform_data { 32struct venc_platform_data {
31 enum vpbe_version venc_type;
32 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, 33 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type,
33 int field); 34 int field);
34 int (*setup_clock)(enum vpbe_enc_timings_type type, 35 int (*setup_clock)(enum vpbe_enc_timings_type type,