summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2015-12-30 13:38:33 -0800
committerGreg Kroah-Hartman <gregkh@google.com>2016-01-04 16:05:25 -0800
commit1e5dd1f8279a8a934b9df7adec47b944fe6b10f4 (patch)
tree7ce6b7475044071516d2c29138a06736f1a62a4d /drivers
parentbc142bbb4ceba0891db6bf36cfb7be13c9a2dd72 (diff)
greybus: arche-platform: merge arche-apb-ctrl and arche-platform
No need to have two separate arche platform drivers, that's just crazy, so merge them both together to be only one kernel module. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Tested-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/greybus/Makefile4
-rw-r--r--drivers/staging/greybus/arche-apb-ctrl.c31
-rw-r--r--drivers/staging/greybus/arche-platform.c49
-rw-r--r--drivers/staging/greybus/arche_platform.h17
4 files changed, 70 insertions, 31 deletions
diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile
index b0d53f5228c0..011e87cb32cf 100644
--- a/drivers/staging/greybus/Makefile
+++ b/drivers/staging/greybus/Makefile
@@ -28,8 +28,7 @@ gb-light-y := light.o
gb-raw-y := raw.o
gb-hid-y := hid.o
gb-es2-y := es2.o
-gb-arche-y := arche-platform.o
-gb-arche-apb-ctrl-y := arche-apb-ctrl.o
+gb-arche-y := arche-platform.o arche-apb-ctrl.o
gb-audio-codec-y := audio-codec.o
gb-camera-y := camera.o
@@ -43,7 +42,6 @@ obj-m += gb-hid.o
obj-m += gb-raw.o
obj-m += gb-es2.o
obj-m += gb-arche.o
-obj-m += gb-arche-apb-ctrl.o
obj-m += gb-audio-codec.o
obj-m += gb-camera.o
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
index 68f8d3cc8e97..f02b8add6ebc 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -23,6 +23,7 @@
#include <linux/spinlock.h>
#include <linux/regulator/consumer.h>
#include <linux/pinctrl/consumer.h>
+#include "arche_platform.h"
enum apb_state {
APB_STATE_OFF,
@@ -279,7 +280,7 @@ static void apb_ctrl_cleanup(struct arche_apb_ctrl_drvdata *apb)
/* TODO: May have to send an event to SVC about this exit */
}
-static int arche_apb_ctrl_probe(struct platform_device *pdev)
+int arche_apb_ctrl_probe(struct platform_device *pdev)
{
int ret;
struct arche_apb_ctrl_drvdata *apb;
@@ -335,7 +336,7 @@ exit:
return ret;
}
-static int arche_apb_ctrl_remove(struct platform_device *pdev)
+int arche_apb_ctrl_remove(struct platform_device *pdev)
{
struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
@@ -375,28 +376,8 @@ static int arche_apb_ctrl_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(arche_apb_ctrl_pm_ops,
- arche_apb_ctrl_suspend,
- arche_apb_ctrl_resume);
+SIMPLE_DEV_PM_OPS(arche_apb_ctrl_pm_ops,
+ arche_apb_ctrl_suspend,
+ arche_apb_ctrl_resume);
-static struct of_device_id arche_apb_ctrl_of_match[] = {
- { .compatible = "usbffff,2", },
- { },
-};
-MODULE_DEVICE_TABLE(of, arche_apb_ctrl_of_match);
-
-static struct platform_driver arche_apb_ctrl_device_driver = {
- .probe = arche_apb_ctrl_probe,
- .remove = arche_apb_ctrl_remove,
- .driver = {
- .name = "arche-apb-ctrl",
- .pm = &arche_apb_ctrl_pm_ops,
- .of_match_table = of_match_ptr(arche_apb_ctrl_of_match),
- }
-};
-
-module_platform_driver(arche_apb_ctrl_device_driver);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
-MODULE_DESCRIPTION("Arche APB control Driver");
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index 697180d36acc..50699520834f 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -23,6 +23,7 @@
#include <linux/spinlock.h>
#include <linux/regulator/consumer.h>
#include <linux/pinctrl/consumer.h>
+#include "arche_platform.h"
struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
@@ -208,7 +209,18 @@ static struct of_device_id arche_platform_of_match[] = {
{ .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
{ },
};
-MODULE_DEVICE_TABLE(of, arche_platform_of_match);
+
+static struct of_device_id arche_apb_ctrl_of_match[] = {
+ { .compatible = "usbffff,2", },
+ { },
+};
+
+static struct of_device_id arche_combined_id[] = {
+ { .compatible = "google,arche-platform", }, /* Use PID/VID of SVC device */
+ { .compatible = "usbffff,2", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, arche_combined_id);
static struct platform_driver arche_platform_device_driver = {
.probe = arche_platform_probe,
@@ -216,11 +228,42 @@ static struct platform_driver arche_platform_device_driver = {
.driver = {
.name = "arche-platform-ctrl",
.pm = &arche_platform_pm_ops,
- .of_match_table = of_match_ptr(arche_platform_of_match),
+ .of_match_table = arche_platform_of_match,
}
};
-module_platform_driver(arche_platform_device_driver);
+static struct platform_driver arche_apb_ctrl_device_driver = {
+ .probe = arche_apb_ctrl_probe,
+ .remove = arche_apb_ctrl_remove,
+ .driver = {
+ .name = "arche-apb-ctrl",
+ .pm = &arche_apb_ctrl_pm_ops,
+ .of_match_table = arche_apb_ctrl_of_match,
+ }
+};
+
+static int __init arche_init(void)
+{
+ int retval;
+
+ retval = platform_driver_register(&arche_platform_device_driver);
+ if (retval)
+ return retval;
+
+ retval = platform_driver_register(&arche_apb_ctrl_device_driver);
+ if (retval)
+ platform_driver_unregister(&arche_platform_device_driver);
+
+ return retval;
+}
+module_init(arche_init);
+
+static void __exit arche_exit(void)
+{
+ platform_driver_unregister(&arche_apb_ctrl_device_driver);
+ platform_driver_unregister(&arche_platform_device_driver);
+}
+module_exit(arche_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Vaibhav Hiremath <vaibhav.hiremath@linaro.org>");
diff --git a/drivers/staging/greybus/arche_platform.h b/drivers/staging/greybus/arche_platform.h
new file mode 100644
index 000000000000..22a968a9197e
--- /dev/null
+++ b/drivers/staging/greybus/arche_platform.h
@@ -0,0 +1,17 @@
+/*
+ * Arche Platform driver to enable Unipro link.
+ *
+ * Copyright 2015-2016 Google Inc.
+ * Copyright 2015-2016 Linaro Ltd.
+ *
+ * Released under the GPLv2 only.
+ */
+
+#ifndef __ARCHE_PLATFORM_H
+#define __ARCHE_PLATFORM_H
+
+int arche_apb_ctrl_probe(struct platform_device *pdev);
+int arche_apb_ctrl_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops arche_apb_ctrl_pm_ops;
+
+#endif /* __ARCHE_PLATFORM_H */