* [PATCH 1/2] staging/vc04_services: Register a platform device for the camera driver.
@ 2018-05-10 1:43 Eric Anholt
2018-05-10 1:43 ` [PATCH 2/2] staging/bcm2835-camera: Set ourselves up as a platform driver Eric Anholt
0 siblings, 1 reply; 3+ messages in thread
From: Eric Anholt @ 2018-05-10 1:43 UTC (permalink / raw)
To: devel, linux-kernel, linux-rpi-kernel, Stefan Wahren; +Cc: Eric Anholt
We had the camera driver set up in a module_init function, but that
meant that the camera driver would fail to load if it was initialized
before VCHI. This enforces that it loads after we've successfully set
up.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
I'm going to try to get Dave Stevenson's new v4l2 codec driver merged
to staging (my primary motivation for getting vchi merged in the first
place!), and since his series touches the camera driver I needed to
probe the camera successfully in order to test it.
.../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 3cd6177a7373..aaa264f3b598 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -168,6 +168,7 @@ static VCHIQ_STATE_T g_state;
static struct class *vchiq_class;
static struct device *vchiq_dev;
static DEFINE_SPINLOCK(msg_queue_spinlock);
+static struct platform_device *bcm2835_camera;
static const char *const ioctl_names[] = {
"CONNECT",
@@ -3638,6 +3639,10 @@ static int vchiq_probe(struct platform_device *pdev)
VCHIQ_VERSION, VCHIQ_VERSION_MIN,
MAJOR(vchiq_devid), MINOR(vchiq_devid));
+ bcm2835_camera = platform_device_register_data(&pdev->dev,
+ "bcm2835-camera", -1,
+ NULL, 0);
+
return 0;
failed_debugfs_init:
@@ -3655,6 +3660,7 @@ static int vchiq_probe(struct platform_device *pdev)
static int vchiq_remove(struct platform_device *pdev)
{
+ platform_device_unregister(bcm2835_camera);
vchiq_debugfs_deinit();
device_destroy(vchiq_class, vchiq_devid);
class_destroy(vchiq_class);
--
2.17.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] staging/bcm2835-camera: Set ourselves up as a platform driver.
2018-05-10 1:43 [PATCH 1/2] staging/vc04_services: Register a platform device for the camera driver Eric Anholt
@ 2018-05-10 1:43 ` Eric Anholt
2018-05-10 11:46 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Eric Anholt @ 2018-05-10 1:43 UTC (permalink / raw)
To: devel, linux-kernel, linux-rpi-kernel, Stefan Wahren; +Cc: Eric Anholt
This allows bcm2835-camera to automatically probe after VCHI has
loaded, rather than only successfully probing if the arbitrary probe
order chooses us after VCHI.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
.../staging/vc04_services/bcm2835-camera/TODO | 11 -----------
.../bcm2835-camera/bcm2835-camera.c | 18 ++++++++++++++----
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-camera/TODO b/drivers/staging/vc04_services/bcm2835-camera/TODO
index 0ab9e88d769a..cefce72d814f 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/TODO
+++ b/drivers/staging/vc04_services/bcm2835-camera/TODO
@@ -21,14 +21,3 @@ less copy it needed to do.
The bulk_receive() does some manual cache flushing that are 32-bit ARM
only, which we should convert to proper cross-platform APIs.
-4) Convert to be a platform driver.
-
-Right now when the module probes, it tries to initialize VCHI and
-errors out if it wasn't ready yet. If bcm2835-v4l2 was built in, then
-VCHI generally isn't ready because it depends on both the firmware and
-mailbox drivers having already loaded.
-
-We should have VCHI create a platform device once it's initialized,
-and have this driver bind to it, so that we automatically load the
-v4l2 module after VCHI loads.
-
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index d2262275a870..aac876c35dea 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -23,6 +23,7 @@
#include <media/v4l2-event.h>
#include <media/v4l2-common.h>
#include <linux/delay.h>
+#include <linux/platform_device.h>
#include "mmal-common.h"
#include "mmal-encodings.h"
@@ -1803,7 +1804,7 @@ static struct v4l2_format default_v4l2_format = {
.fmt.pix.sizeimage = 1024 * 768,
};
-static int __init bm2835_mmal_init(void)
+static int __init bcm2835_mmal_probe(struct platform_device *pdev)
{
int ret;
struct bm2835_mmal_dev *dev;
@@ -1923,7 +1924,7 @@ static int __init bm2835_mmal_init(void)
return ret;
}
-static void __exit bm2835_mmal_exit(void)
+static int bcm2835_mmal_remove(struct platform_device *pdev)
{
int camera;
struct vchiq_mmal_instance *instance = gdev[0]->instance;
@@ -1933,7 +1934,16 @@ static void __exit bm2835_mmal_exit(void)
gdev[camera] = NULL;
}
vchiq_mmal_finalise(instance);
+
+ return 0;
}
-module_init(bm2835_mmal_init);
-module_exit(bm2835_mmal_exit);
+static struct platform_driver bcm2835_camera_driver = {
+ .probe = bcm2835_mmal_probe,
+ .remove = bcm2835_mmal_remove,
+ .driver = {
+ .name = "bcm2835-camera",
+ },
+};
+
+module_platform_driver(bcm2835_camera_driver)
--
2.17.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] staging/bcm2835-camera: Set ourselves up as a platform driver.
2018-05-10 1:43 ` [PATCH 2/2] staging/bcm2835-camera: Set ourselves up as a platform driver Eric Anholt
@ 2018-05-10 11:46 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-05-10 11:46 UTC (permalink / raw)
To: Eric Anholt
Cc: kbuild-all, devel, linux-kernel, linux-rpi-kernel, Stefan Wahren,
Eric Anholt
[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]
Hi Eric,
I love your patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.17-rc4 next-20180510]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Eric-Anholt/staging-vc04_services-Register-a-platform-device-for-the-camera-driver/20180510-181250
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All errors (new ones prefixed by >>):
>> ERROR: "ia64_delay_loop" undefined!
>> ERROR: "__sw_hweight8" undefined!
>> ERROR: "ia64_delay_loop" undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49873 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-10 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 1:43 [PATCH 1/2] staging/vc04_services: Register a platform device for the camera driver Eric Anholt
2018-05-10 1:43 ` [PATCH 2/2] staging/bcm2835-camera: Set ourselves up as a platform driver Eric Anholt
2018-05-10 11:46 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®