From patchwork Thu May 30 09:34:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 2634331 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5FDD7DF2A1 for ; Thu, 30 May 2013 09:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030316Ab3E3Jfd (ORCPT ); Thu, 30 May 2013 05:35:33 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:42758 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030278Ab3E3Jfa (ORCPT ); Thu, 30 May 2013 05:35:30 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4U9ZTQH024608; Thu, 30 May 2013 04:35:29 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4U9ZTmv005440; Thu, 30 May 2013 04:35:29 -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; Thu, 30 May 2013 04:35:28 -0500 Received: from deskari.tieu.ti.com (h64-9.vpn.ti.com [172.24.64.9]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4U9ZJ1e002669; Thu, 30 May 2013 04:35:28 -0500 From: Tomi Valkeinen To: , , Archit Taneja CC: Tomi Valkeinen Subject: [PATCH 06/32] OMAPDSS: DPI: fix regulators for DT Date: Thu, 30 May 2013 12:34:27 +0300 Message-ID: <1369906493-27538-7-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369906493-27538-1-git-send-email-tomi.valkeinen@ti.com> References: <1369906493-27538-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 On some platforms DPI requires a regulator to be enabled to power up the output pins. This regulator is, for some reason, currently attached to the virtual omapdss device, instead of the DPI device. This does not work for DT, as the regulator mappings need to be described in the DT data, and the virtual omapdss device is not present there. Fix the issue by acquiring the regulator in the DPI device. To retain compatibility with the current board files, the old method of getting the regulator is kept. The old method can be removed when the board files have been changed to pass the regulator to DPI. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dpi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index ef8fca2..43f6b26 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -37,7 +37,10 @@ #include "dss_features.h" static struct { + struct platform_device *pdev; + struct regulator *vdds_dsi_reg; + bool vdds_dsi_from_core; struct platform_device *dsidev; struct mutex lock; @@ -583,10 +586,15 @@ static int dpi_init_display(struct omap_dss_device *dssdev) struct regulator *vdds_dsi; vdds_dsi = dss_get_vdds_dsi(); - if (IS_ERR(vdds_dsi)) { - DSSERR("can't get VDDS_DSI regulator\n"); - return PTR_ERR(vdds_dsi); + vdds_dsi = regulator_get(&dpi.pdev->dev, "vdds_dsi"); + if (IS_ERR(vdds_dsi)) { + DSSERR("can't get VDDS_DSI regulator\n"); + return PTR_ERR(vdds_dsi); + } + dpi.vdds_dsi_from_core = false; + } else { + dpi.vdds_dsi_from_core = true; } dpi.vdds_dsi_reg = vdds_dsi; @@ -702,6 +710,8 @@ static int omap_dpi_probe(struct platform_device *pdev) { int r; + dpi.pdev = pdev; + mutex_init(&dpi.lock); dpi_init_output(pdev); @@ -725,6 +735,11 @@ static int __exit omap_dpi_remove(struct platform_device *pdev) dpi_uninit_output(pdev); + if (dpi.vdds_dsi_reg != NULL && dpi.vdds_dsi_from_core == false) { + regulator_put(dpi.vdds_dsi_reg); + dpi.vdds_dsi_reg = NULL; + } + return 0; }