mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
staging: vc04_services: bcm2835-v4l2-isp: Register with vchiq_bus_type
Register the bcm2835-v4l2-isp driver with the vchiq_bus_type instead of using the platform driver/device. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Dom Cobley
parent
8d0a0c411a
commit
386720e595
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/platform_device.h>
|
|
||||||
|
|
||||||
#include <media/v4l2-ctrls.h>
|
#include <media/v4l2-ctrls.h>
|
||||||
#include <media/v4l2-device.h>
|
#include <media/v4l2-device.h>
|
||||||
@@ -17,6 +16,8 @@
|
|||||||
#include <media/v4l2-ioctl.h>
|
#include <media/v4l2-ioctl.h>
|
||||||
#include <media/videobuf2-dma-contig.h>
|
#include <media/videobuf2-dma-contig.h>
|
||||||
|
|
||||||
|
#include "../interface/vchiq_arm/vchiq_bus.h"
|
||||||
|
|
||||||
#include "../vchiq-mmal/mmal-msg.h"
|
#include "../vchiq-mmal/mmal-msg.h"
|
||||||
#include "../vchiq-mmal/mmal-parameters.h"
|
#include "../vchiq-mmal/mmal-parameters.h"
|
||||||
#include "../vchiq-mmal/mmal-vchiq.h"
|
#include "../vchiq-mmal/mmal-vchiq.h"
|
||||||
@@ -1694,7 +1695,7 @@ static void bcm2835_isp_remove_instance(struct bcm2835_isp_dev *dev)
|
|||||||
vchiq_mmal_finalise(dev->mmal_instance);
|
vchiq_mmal_finalise(dev->mmal_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bcm2835_isp_probe_instance(struct platform_device *pdev,
|
static int bcm2835_isp_probe_instance(struct vchiq_device *device,
|
||||||
struct bcm2835_isp_dev **dev_int,
|
struct bcm2835_isp_dev **dev_int,
|
||||||
unsigned int instance)
|
unsigned int instance)
|
||||||
{
|
{
|
||||||
@@ -1702,18 +1703,18 @@ static int bcm2835_isp_probe_instance(struct platform_device *pdev,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
|
dev = devm_kzalloc(&device->dev, sizeof(*dev), GFP_KERNEL);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
*dev_int = dev;
|
*dev_int = dev;
|
||||||
dev->dev = &pdev->dev;
|
dev->dev = &device->dev;
|
||||||
|
|
||||||
ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
|
ret = v4l2_device_register(&device->dev, &dev->v4l2_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = vchiq_mmal_init(&dev->mmal_instance);
|
ret = vchiq_mmal_init(&device->dev, &dev->mmal_instance);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
v4l2_device_unregister(&dev->v4l2_dev);
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1756,52 +1757,50 @@ static int bcm2835_isp_probe_instance(struct platform_device *pdev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bcm2835_isp_remove(struct platform_device *pdev)
|
static void bcm2835_isp_remove(struct vchiq_device *device)
|
||||||
{
|
{
|
||||||
struct bcm2835_isp_dev **bcm2835_isp_instances;
|
struct bcm2835_isp_dev **bcm2835_isp_instances;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
bcm2835_isp_instances = platform_get_drvdata(pdev);
|
bcm2835_isp_instances = vchiq_get_drvdata(device);
|
||||||
for (i = 0; i < BCM2835_ISP_NUM_INSTANCES; i++) {
|
for (i = 0; i < BCM2835_ISP_NUM_INSTANCES; i++) {
|
||||||
if (bcm2835_isp_instances[i])
|
if (bcm2835_isp_instances[i])
|
||||||
bcm2835_isp_remove_instance(bcm2835_isp_instances[i]);
|
bcm2835_isp_remove_instance(bcm2835_isp_instances[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bcm2835_isp_probe(struct platform_device *pdev)
|
static int bcm2835_isp_probe(struct vchiq_device *device)
|
||||||
{
|
{
|
||||||
struct bcm2835_isp_dev **bcm2835_isp_instances;
|
struct bcm2835_isp_dev **bcm2835_isp_instances;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
bcm2835_isp_instances = devm_kzalloc(&pdev->dev,
|
bcm2835_isp_instances = devm_kzalloc(&device->dev,
|
||||||
sizeof(bcm2835_isp_instances) *
|
sizeof(bcm2835_isp_instances) *
|
||||||
BCM2835_ISP_NUM_INSTANCES,
|
BCM2835_ISP_NUM_INSTANCES,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!bcm2835_isp_instances)
|
if (!bcm2835_isp_instances)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, bcm2835_isp_instances);
|
vchiq_set_drvdata(device, bcm2835_isp_instances);
|
||||||
|
|
||||||
for (i = 0; i < BCM2835_ISP_NUM_INSTANCES; i++) {
|
for (i = 0; i < BCM2835_ISP_NUM_INSTANCES; i++) {
|
||||||
ret = bcm2835_isp_probe_instance(pdev,
|
ret = bcm2835_isp_probe_instance(device,
|
||||||
&bcm2835_isp_instances[i], i);
|
&bcm2835_isp_instances[i], i);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&pdev->dev, "Loaded V4L2 %s\n", BCM2835_ISP_NAME);
|
dev_info(&device->dev, "Loaded V4L2 %s\n", BCM2835_ISP_NAME);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
bcm2835_isp_remove(pdev);
|
bcm2835_isp_remove(device);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver bcm2835_isp_pdrv = {
|
static struct vchiq_driver bcm2835_isp_drv = {
|
||||||
.probe = bcm2835_isp_probe,
|
.probe = bcm2835_isp_probe,
|
||||||
.remove = bcm2835_isp_remove,
|
.remove = bcm2835_isp_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
@@ -1809,10 +1808,10 @@ static struct platform_driver bcm2835_isp_pdrv = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(bcm2835_isp_pdrv);
|
module_vchiq_driver(bcm2835_isp_drv);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("BCM2835 ISP driver");
|
MODULE_DESCRIPTION("BCM2835 ISP driver");
|
||||||
MODULE_AUTHOR("Naushir Patuck <naush@raspberrypi.com>");
|
MODULE_AUTHOR("Naushir Patuck <naush@raspberrypi.com>");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_VERSION("1.0");
|
MODULE_VERSION("1.0");
|
||||||
MODULE_ALIAS("platform:bcm2835-isp");
|
MODULE_ALIAS("vchiq:bcm2835-isp");
|
||||||
|
|||||||
Reference in New Issue
Block a user