|
@@ -33,6 +33,7 @@
|
|
|
#include <linux/device.h>
|
|
|
#include <linux/regulator/consumer.h>
|
|
|
#include <linux/suspend.h>
|
|
|
+#include <linux/slab.h>
|
|
|
|
|
|
#include <video/omapdss.h>
|
|
|
|
|
@@ -57,6 +58,11 @@ bool dss_debug;
|
|
|
module_param_named(debug, dss_debug, bool, 0644);
|
|
|
#endif
|
|
|
|
|
|
+const char *dss_get_default_display_name(void)
|
|
|
+{
|
|
|
+ return core.default_display_name;
|
|
|
+}
|
|
|
+
|
|
|
/* REGULATORS */
|
|
|
|
|
|
struct regulator *dss_get_vdds_dsi(void)
|
|
@@ -347,17 +353,14 @@ static int dss_driver_probe(struct device *dev)
|
|
|
int r;
|
|
|
struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
|
|
|
struct omap_dss_device *dssdev = to_dss_device(dev);
|
|
|
- bool force;
|
|
|
|
|
|
DSSDBG("driver_probe: dev %s/%s, drv %s\n",
|
|
|
dev_name(dev), dssdev->driver_name,
|
|
|
dssdrv->driver.name);
|
|
|
|
|
|
- dss_init_device(core.pdev, dssdev);
|
|
|
-
|
|
|
- force = core.default_display_name &&
|
|
|
- strcmp(core.default_display_name, dssdev->name) == 0;
|
|
|
- dss_recheck_connections(dssdev, force);
|
|
|
+ r = dss_init_device(core.pdev, dssdev);
|
|
|
+ if (r)
|
|
|
+ return r;
|
|
|
|
|
|
r = dssdrv->probe(dssdev);
|
|
|
|
|
@@ -416,54 +419,44 @@ void omap_dss_unregister_driver(struct omap_dss_driver *dssdriver)
|
|
|
EXPORT_SYMBOL(omap_dss_unregister_driver);
|
|
|
|
|
|
/* DEVICE */
|
|
|
-static void reset_device(struct device *dev, int check)
|
|
|
-{
|
|
|
- u8 *dev_p = (u8 *)dev;
|
|
|
- u8 *dev_end = dev_p + sizeof(*dev);
|
|
|
- void *saved_pdata;
|
|
|
-
|
|
|
- saved_pdata = dev->platform_data;
|
|
|
- if (check) {
|
|
|
- /*
|
|
|
- * Check if there is any other setting than platform_data
|
|
|
- * in struct device; warn that these will be reset by our
|
|
|
- * init.
|
|
|
- */
|
|
|
- dev->platform_data = NULL;
|
|
|
- while (dev_p < dev_end) {
|
|
|
- if (*dev_p) {
|
|
|
- WARN("%s: struct device fields will be "
|
|
|
- "discarded\n",
|
|
|
- __func__);
|
|
|
- break;
|
|
|
- }
|
|
|
- dev_p++;
|
|
|
- }
|
|
|
- }
|
|
|
- memset(dev, 0, sizeof(*dev));
|
|
|
- dev->platform_data = saved_pdata;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
static void omap_dss_dev_release(struct device *dev)
|
|
|
{
|
|
|
- reset_device(dev, 0);
|
|
|
+ struct omap_dss_device *dssdev = to_dss_device(dev);
|
|
|
+ kfree(dssdev);
|
|
|
}
|
|
|
|
|
|
-int omap_dss_register_device(struct omap_dss_device *dssdev,
|
|
|
- struct device *parent, int disp_num)
|
|
|
+static int disp_num_counter;
|
|
|
+
|
|
|
+struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
|
|
|
{
|
|
|
- WARN_ON(!dssdev->driver_name);
|
|
|
+ struct omap_dss_device *dssdev;
|
|
|
+
|
|
|
+ dssdev = kzalloc(sizeof(*dssdev), GFP_KERNEL);
|
|
|
+ if (!dssdev)
|
|
|
+ return NULL;
|
|
|
|
|
|
- reset_device(&dssdev->dev, 1);
|
|
|
dssdev->dev.bus = &dss_bus_type;
|
|
|
dssdev->dev.parent = parent;
|
|
|
dssdev->dev.release = omap_dss_dev_release;
|
|
|
- dev_set_name(&dssdev->dev, "display%d", disp_num);
|
|
|
- return device_register(&dssdev->dev);
|
|
|
+ dev_set_name(&dssdev->dev, "display%d", disp_num_counter++);
|
|
|
+
|
|
|
+ device_initialize(&dssdev->dev);
|
|
|
+
|
|
|
+ return dssdev;
|
|
|
+}
|
|
|
+
|
|
|
+int dss_add_device(struct omap_dss_device *dssdev)
|
|
|
+{
|
|
|
+ return device_add(&dssdev->dev);
|
|
|
+}
|
|
|
+
|
|
|
+void dss_put_device(struct omap_dss_device *dssdev)
|
|
|
+{
|
|
|
+ put_device(&dssdev->dev);
|
|
|
}
|
|
|
|
|
|
-void omap_dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
+void dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
{
|
|
|
device_unregister(&dssdev->dev);
|
|
|
}
|
|
@@ -471,15 +464,25 @@ void omap_dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
static int dss_unregister_dss_dev(struct device *dev, void *data)
|
|
|
{
|
|
|
struct omap_dss_device *dssdev = to_dss_device(dev);
|
|
|
- omap_dss_unregister_device(dssdev);
|
|
|
+ dss_unregister_device(dssdev);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-void omap_dss_unregister_child_devices(struct device *parent)
|
|
|
+void dss_unregister_child_devices(struct device *parent)
|
|
|
{
|
|
|
device_for_each_child(parent, NULL, dss_unregister_dss_dev);
|
|
|
}
|
|
|
|
|
|
+void dss_copy_device_pdata(struct omap_dss_device *dst,
|
|
|
+ const struct omap_dss_device *src)
|
|
|
+{
|
|
|
+ u8 *d = (u8 *)dst;
|
|
|
+ u8 *s = (u8 *)src;
|
|
|
+ size_t dsize = sizeof(struct device);
|
|
|
+
|
|
|
+ memcpy(d + dsize, s + dsize, sizeof(struct omap_dss_device) - dsize);
|
|
|
+}
|
|
|
+
|
|
|
/* BUS */
|
|
|
static int __init omap_dss_bus_register(void)
|
|
|
{
|