26
26
#include <linux/timer.h>
27
27
#include <linux/sched.h>
28
28
#include <linux/slab.h>
29
- #include <linux/platform_device.h>
30
29
#include <linux/syscalls.h>
31
30
32
31
#include <media/v4l2-mem2mem.h>
36
35
#include <media/v4l2-event.h>
37
36
#include <media/videobuf2-dma-contig.h>
38
37
38
+ #include "../interface/vchiq_arm/vchiq_bus.h"
39
+
39
40
#include "../vchiq-mmal/mmal-encodings.h"
40
41
#include "../vchiq-mmal/mmal-msg.h"
41
42
#include "../vchiq-mmal/mmal-parameters.h"
@@ -674,7 +675,7 @@ struct bcm2835_codec_q_data {
674
675
};
675
676
676
677
struct bcm2835_codec_dev {
677
- struct platform_device * pdev ;
678
+ struct vchiq_device * device ;
678
679
679
680
/* v4l2 devices */
680
681
struct v4l2_device v4l2_dev ;
@@ -731,7 +732,7 @@ struct bcm2835_codec_ctx {
731
732
};
732
733
733
734
struct bcm2835_codec_driver {
734
- struct platform_device * pdev ;
735
+ struct vchiq_device * device ;
735
736
struct media_device mdev ;
736
737
737
738
struct bcm2835_codec_dev * encode ;
@@ -3232,7 +3233,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
3232
3233
src_vq -> buf_struct_size = sizeof (struct m2m_mmal_buffer );
3233
3234
src_vq -> ops = & bcm2835_codec_qops ;
3234
3235
src_vq -> mem_ops = & vb2_dma_contig_memops ;
3235
- src_vq -> dev = & ctx -> dev -> pdev -> dev ;
3236
+ src_vq -> dev = & ctx -> dev -> device -> dev ;
3236
3237
src_vq -> timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY ;
3237
3238
src_vq -> lock = & ctx -> dev -> dev_mutex ;
3238
3239
@@ -3246,7 +3247,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
3246
3247
dst_vq -> buf_struct_size = sizeof (struct m2m_mmal_buffer );
3247
3248
dst_vq -> ops = & bcm2835_codec_qops ;
3248
3249
dst_vq -> mem_ops = & vb2_dma_contig_memops ;
3249
- dst_vq -> dev = & ctx -> dev -> pdev -> dev ;
3250
+ dst_vq -> dev = & ctx -> dev -> device -> dev ;
3250
3251
dst_vq -> timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY ;
3251
3252
dst_vq -> lock = & ctx -> dev -> dev_mutex ;
3252
3253
@@ -3678,7 +3679,7 @@ static int bcm2835_codec_get_supported_fmts(struct bcm2835_codec_dev *dev)
3678
3679
/* Assume at this stage that all encodings will be supported in V4L2.
3679
3680
* Any that aren't supported will waste a very small amount of memory.
3680
3681
*/
3681
- list = devm_kzalloc (& dev -> pdev -> dev ,
3682
+ list = devm_kzalloc (& dev -> device -> dev ,
3682
3683
sizeof (struct bcm2835_codec_fmt ) * num_encodings ,
3683
3684
GFP_KERNEL );
3684
3685
if (!list ) {
@@ -3719,7 +3720,7 @@ static int bcm2835_codec_get_supported_fmts(struct bcm2835_codec_dev *dev)
3719
3720
num_encodings = param_size / sizeof (u32 );
3720
3721
}
3721
3722
/* Assume at this stage that all encodings will be supported in V4L2. */
3722
- list = devm_kzalloc (& dev -> pdev -> dev ,
3723
+ list = devm_kzalloc (& dev -> device -> dev ,
3723
3724
sizeof (struct bcm2835_codec_fmt ) * num_encodings ,
3724
3725
GFP_KERNEL );
3725
3726
if (!list ) {
@@ -3750,22 +3751,22 @@ static int bcm2835_codec_create(struct bcm2835_codec_driver *drv,
3750
3751
struct bcm2835_codec_dev * * new_dev ,
3751
3752
enum bcm2835_codec_role role )
3752
3753
{
3753
- struct platform_device * pdev = drv -> pdev ;
3754
+ struct vchiq_device * device = drv -> device ;
3754
3755
struct bcm2835_codec_dev * dev ;
3755
3756
struct video_device * vfd ;
3756
3757
int function ;
3757
3758
int video_nr ;
3758
3759
int ret ;
3759
3760
3760
- dev = devm_kzalloc (& pdev -> dev , sizeof (* dev ), GFP_KERNEL );
3761
+ dev = devm_kzalloc (& device -> dev , sizeof (* dev ), GFP_KERNEL );
3761
3762
if (!dev )
3762
3763
return - ENOMEM ;
3763
3764
3764
- dev -> pdev = pdev ;
3765
+ dev -> device = device ;
3765
3766
3766
3767
dev -> role = role ;
3767
3768
3768
- ret = vchiq_mmal_init (& dev -> instance );
3769
+ ret = vchiq_mmal_init (& device -> dev , & dev -> instance );
3769
3770
if (ret )
3770
3771
return ret ;
3771
3772
@@ -3785,7 +3786,7 @@ static int bcm2835_codec_create(struct bcm2835_codec_driver *drv,
3785
3786
vfd -> device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING ;
3786
3787
vfd -> v4l2_dev -> mdev = & drv -> mdev ;
3787
3788
3788
- ret = v4l2_device_register (& pdev -> dev , & dev -> v4l2_dev );
3789
+ ret = v4l2_device_register (& device -> dev , & dev -> v4l2_dev );
3789
3790
if (ret )
3790
3791
goto vchiq_finalise ;
3791
3792
@@ -3891,24 +3892,24 @@ static int bcm2835_codec_destroy(struct bcm2835_codec_dev *dev)
3891
3892
return 0 ;
3892
3893
}
3893
3894
3894
- static int bcm2835_codec_probe (struct platform_device * pdev )
3895
+ static int bcm2835_codec_probe (struct vchiq_device * device )
3895
3896
{
3896
3897
struct bcm2835_codec_driver * drv ;
3897
3898
struct media_device * mdev ;
3898
3899
int ret = 0 ;
3899
3900
3900
- drv = devm_kzalloc (& pdev -> dev , sizeof (* drv ), GFP_KERNEL );
3901
+ drv = devm_kzalloc (& device -> dev , sizeof (* drv ), GFP_KERNEL );
3901
3902
if (!drv )
3902
3903
return - ENOMEM ;
3903
3904
3904
- drv -> pdev = pdev ;
3905
+ drv -> device = device ;
3905
3906
mdev = & drv -> mdev ;
3906
- mdev -> dev = & pdev -> dev ;
3907
+ mdev -> dev = & device -> dev ;
3907
3908
3908
3909
strscpy (mdev -> model , bcm2835_codec_videodev .name , sizeof (mdev -> model ));
3909
3910
strscpy (mdev -> serial , "0000" , sizeof (mdev -> serial ));
3910
- snprintf (mdev -> bus_info , sizeof (mdev -> bus_info ), "platform :%s" ,
3911
- pdev -> name );
3911
+ snprintf (mdev -> bus_info , sizeof (mdev -> bus_info ), "vchiq :%s" ,
3912
+ MEM2MEM_NAME );
3912
3913
3913
3914
/* This should return the vgencmd version information or such .. */
3914
3915
mdev -> hw_revision = 1 ;
@@ -3938,7 +3939,7 @@ static int bcm2835_codec_probe(struct platform_device *pdev)
3938
3939
if (media_device_register (mdev ) < 0 )
3939
3940
goto out ;
3940
3941
3941
- platform_set_drvdata ( pdev , drv );
3942
+ vchiq_set_drvdata ( device , drv );
3942
3943
3943
3944
return 0 ;
3944
3945
@@ -3966,9 +3967,9 @@ static int bcm2835_codec_probe(struct platform_device *pdev)
3966
3967
return ret ;
3967
3968
}
3968
3969
3969
- static int bcm2835_codec_remove (struct platform_device * pdev )
3970
+ static void bcm2835_codec_remove (struct vchiq_device * device )
3970
3971
{
3971
- struct bcm2835_codec_driver * drv = platform_get_drvdata ( pdev );
3972
+ struct bcm2835_codec_driver * drv = vchiq_get_drvdata ( device );
3972
3973
3973
3974
media_device_unregister (& drv -> mdev );
3974
3975
@@ -3983,11 +3984,9 @@ static int bcm2835_codec_remove(struct platform_device *pdev)
3983
3984
bcm2835_codec_destroy (drv -> decode );
3984
3985
3985
3986
media_device_cleanup (& drv -> mdev );
3986
-
3987
- return 0 ;
3988
3987
}
3989
3988
3990
- static struct platform_driver bcm2835_v4l2_codec_driver = {
3989
+ static struct vchiq_driver bcm2835_v4l2_codec_driver = {
3991
3990
.probe = bcm2835_codec_probe ,
3992
3991
.remove = bcm2835_codec_remove ,
3993
3992
.driver = {
@@ -3996,10 +3995,10 @@ static struct platform_driver bcm2835_v4l2_codec_driver = {
3996
3995
},
3997
3996
};
3998
3997
3999
- module_platform_driver (bcm2835_v4l2_codec_driver );
3998
+ module_vchiq_driver (bcm2835_v4l2_codec_driver );
4000
3999
4001
4000
MODULE_DESCRIPTION ("BCM2835 codec V4L2 driver" );
4002
4001
MODULE_AUTHOR (
"Dave Stevenson, <[email protected] >" );
4003
4002
MODULE_LICENSE ("GPL" );
4004
4003
MODULE_VERSION ("0.0.1" );
4005
- MODULE_ALIAS ("platform :bcm2835-codec" );
4004
+ MODULE_ALIAS ("vchiq :bcm2835-codec" );
0 commit comments