From patchwork Tue Mar 26 13:33:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 2336511 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 99FFD3FD40 for ; Tue, 26 Mar 2013 13:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934324Ab3CZNem (ORCPT ); Tue, 26 Mar 2013 09:34:42 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:36230 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934319Ab3CZNek (ORCPT ); Tue, 26 Mar 2013 09:34:40 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2QDYe3G011535; Tue, 26 Mar 2013 08:34:40 -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 r2QDYdMx015445; Tue, 26 Mar 2013 08:34:40 -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:39 -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 r2QDYUbw025381; Tue, 26 Mar 2013 08:34:38 -0500 From: Tomi Valkeinen To: , , Archit Taneja CC: Tomi Valkeinen Subject: [PATCH 06/26] OMAPDSS: SDI: fix regulators Date: Tue, 26 Mar 2013 15:33:36 +0200 Message-ID: <1364304836-18134-7-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 SDI requires a regulator to operate. This regulator is, for some reason, currently attached to the virtual omapdss device, instead of the SDI 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 SDI 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 SDI. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/sdi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 0155c7e..607244a 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -31,8 +31,11 @@ #include "dss.h" static struct { + struct platform_device *pdev; + bool update_enabled; struct regulator *vdds_sdi_reg; + bool vdds_sdi_from_core; struct dss_lcd_mgr_config mgr_config; struct omap_video_timings timings; @@ -258,8 +261,14 @@ static int __init sdi_init_display(struct omap_dss_device *dssdev) vdds_sdi = dss_get_vdds_sdi(); if (IS_ERR(vdds_sdi)) { - DSSERR("can't get VDDS_SDI regulator\n"); - return PTR_ERR(vdds_sdi); + vdds_sdi = regulator_get(&sdi.pdev->dev, "vdds_sdi"); + if (IS_ERR(vdds_sdi)) { + DSSERR("can't get VDDS_SDI regulator\n"); + return PTR_ERR(vdds_sdi); + } + sdi.vdds_sdi_from_core = false; + } else { + sdi.vdds_sdi_from_core = true; } sdi.vdds_sdi_reg = vdds_sdi; @@ -359,6 +368,8 @@ static void __exit sdi_uninit_output(struct platform_device *pdev) static int __init omap_sdi_probe(struct platform_device *pdev) { + sdi.pdev = pdev; + sdi_init_output(pdev); if (pdev->dev.platform_data) @@ -373,6 +384,11 @@ static int __exit omap_sdi_remove(struct platform_device *pdev) sdi_uninit_output(pdev); + if (sdi.vdds_sdi_reg != NULL && sdi.vdds_sdi_from_core == false) { + regulator_put(sdi.vdds_sdi_reg); + sdi.vdds_sdi_reg = NULL; + } + return 0; }