From patchwork Tue Mar 26 13:33:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 2336561 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7EAC03FD40 for ; Tue, 26 Mar 2013 13:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934347Ab3CZNet (ORCPT ); Tue, 26 Mar 2013 09:34:49 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:55865 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934241Ab3CZNer (ORCPT ); Tue, 26 Mar 2013 09:34:47 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2QDYkDr028409; Tue, 26 Mar 2013 08:34:46 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2QDYkO1015532; Tue, 26 Mar 2013 08:34:46 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Tue, 26 Mar 2013 08:34:46 -0500 Received: from deskari.tieu.ti.com (h64-3.vpn.ti.com [172.24.64.3]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2QDYUc3025381; Tue, 26 Mar 2013 08:34:45 -0500 From: Tomi Valkeinen To: , , Archit Taneja CC: Tomi Valkeinen Subject: [PATCH 11/26] OMAPDSS: Add panel_dev pointer to dssdev Date: Tue, 26 Mar 2013 15:33:41 +0200 Message-ID: <1364304836-18134-12-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364304836-18134-1-git-send-email-tomi.valkeinen@ti.com> References: <1364304836-18134-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org We are about to remove the dss bus support, which also means that the omap_dss_device won't be a real device anymore. This means that the embedded "dev" struct needs to be removed from omap_dss_device. After we've finished the removal of the dss bus, we see the following changes: - struct omap_dss_device won't be a real Linux device anymore, but more like a "display entity". - struct omap_dss_driver won't be a Linux device driver, but "display entity ops". - The panel devices/drivers won't be omapdss devices/drivers, but platform/i2c/spi/etc devices/drivers, whichever fits the control mechanism of the panel. - The panel drivers will create omap_dss_device and omap_dss_driver, fill the required fields, and register the omap_dss_device to omapdss. - omap_dss_device won't have an embedded dev struct anymore, but a dev pointer to the actual device that manages the omap_dss_device. The model described above resembles the model that has been discussed with CDF (common display framework). For the duration of the conversion, we temporarily have two devs in the dssdev, the old "dev", which is a full embedded device struct, and the new "panel_dev", which is a pointer to the device. "dev" will be removed in the future, and "panel_dev" will be renamed "dev". For devices belonging to dss bus the panel_dev is initialized to point to dev. This way all the code can just use the panel_dev, for both old and new style panels. Both the new and old style panel drivers work during the conversion, and only after the dss bus support is removed will the old style panels stop to compile. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/core.c | 2 ++ drivers/video/omap2/dss/display-sysfs.c | 7 ++++--- drivers/video/omap2/dss/display.c | 8 ++++---- include/video/omapdss.h | 4 ++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 054e980..5a6ac3b 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -400,6 +400,8 @@ struct omap_dss_device *dss_alloc_and_init_device(struct device *parent) int dss_add_device(struct omap_dss_device *dssdev) { + dssdev->panel_dev = &dssdev->dev; + dss_add_panel(dssdev); return device_add(&dssdev->dev); } diff --git a/drivers/video/omap2/dss/display-sysfs.c b/drivers/video/omap2/dss/display-sysfs.c index 537921b..af90bff 100644 --- a/drivers/video/omap2/dss/display-sysfs.c +++ b/drivers/video/omap2/dss/display-sysfs.c @@ -33,7 +33,7 @@ static struct omap_dss_device *to_dss_device_sysfs(struct device *dev) struct omap_dss_device *dssdev = NULL; for_each_dss_dev(dssdev) { - if (&dssdev->dev == dev) { + if (dssdev->panel_dev == dev) { omap_dss_put_device(dssdev); return dssdev; } @@ -304,7 +304,7 @@ int display_init_sysfs(struct platform_device *pdev) int r; for_each_dss_dev(dssdev) { - struct kobject *kobj = &dssdev->dev.kobj; + struct kobject *kobj = &dssdev->panel_dev->kobj; r = sysfs_create_files(kobj, display_sysfs_attrs); if (r) { @@ -335,6 +335,7 @@ void display_uninit_sysfs(struct platform_device *pdev) for_each_dss_dev(dssdev) { sysfs_remove_link(&pdev->dev.kobj, dssdev->alias); - sysfs_remove_files(&dssdev->dev.kobj, display_sysfs_attrs); + sysfs_remove_files(&dssdev->panel_dev->kobj, + display_sysfs_attrs); } } diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 85e1cd3..fbadefe 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -158,13 +158,13 @@ void dss_remove_panel(struct omap_dss_device *dssdev) void omap_dss_get_device(struct omap_dss_device *dssdev) { - get_device(&dssdev->dev); + get_device(dssdev->panel_dev); } EXPORT_SYMBOL(omap_dss_get_device); void omap_dss_put_device(struct omap_dss_device *dssdev) { - put_device(&dssdev->dev); + put_device(dssdev->panel_dev); } EXPORT_SYMBOL(omap_dss_put_device); @@ -243,7 +243,7 @@ int omap_dss_start_device(struct omap_dss_device *dssdev) return -ENODEV; } - if (!try_module_get(dssdev->dev.driver->owner)) { + if (!try_module_get(dssdev->panel_dev->driver->owner)) { return -ENODEV; } @@ -253,7 +253,7 @@ EXPORT_SYMBOL(omap_dss_start_device); void omap_dss_stop_device(struct omap_dss_device *dssdev) { - module_put(dssdev->dev.driver->owner); + module_put(dssdev->panel_dev->driver->owner); } EXPORT_SYMBOL(omap_dss_stop_device); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index ab4ea37..ab36ee3 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -594,8 +594,12 @@ struct omap_dss_output { }; struct omap_dss_device { + /* old device, to be removed */ struct device dev; + /* new device, pointer to panel device */ + struct device *panel_dev; + struct list_head panel_list; /* alias in the form of "display%d" */