From patchwork Tue Aug 21 05:58:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1352211 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 0CF0E40B05 for ; Tue, 21 Aug 2012 06:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187Ab2HUGBf (ORCPT ); Tue, 21 Aug 2012 02:01:35 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:60149 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753293Ab2HUGB1 (ORCPT ); Tue, 21 Aug 2012 02:01:27 -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 q7L61RQM019297; Tue, 21 Aug 2012 01:01:27 -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 q7L61QbV018286; Tue, 21 Aug 2012 01:01:26 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Tue, 21 Aug 2012 01:01:26 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7L61Qmq006122; Tue, 21 Aug 2012 01:01:26 -0500 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.137.248]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q7L61Or04276; Tue, 21 Aug 2012 01:01:24 -0500 (CDT) From: Archit Taneja To: CC: , , , , Archit Taneja Subject: [PATCH 18/23] OMAPDSS: HDMI: Add output pointers as arguments to all functions used by hdmi panel driver Date: Tue, 21 Aug 2012 11:28:25 +0530 Message-ID: <1345528711-27801-19-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345528711-27801-1-git-send-email-archit@ti.com> References: <1345528711-27801-1-git-send-email-archit@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 All functions of an output driver used by a panel driver should have an omap_dss_output pointer as an argument. This is needed as the function would somehow need to retrieve the output driver's private data. It may not be needed by some of the outputs for now as driver data is globally visible within them. The correct way to retrieve driver data is to extract the platform device from the output, and then extract the driver data from the platform device. Add output arguments from functions used by panel drivers which currently miss it. This will come to use when the HDMI functions retrieve the driver data in the correct manner. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/dss.h | 17 ++++++++------- drivers/video/omap2/dss/hdmi.c | 16 +++++++------- drivers/video/omap2/dss/hdmi_panel.c | 38 +++++++++++++++++++++++++--------- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index bfa8b4d..dfbc3d9 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -509,17 +509,18 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_output *out, struct omap_video_timings *timings); int omapdss_hdmi_display_check_timing(struct omap_dss_output *out, struct omap_video_timings *timings); -int omapdss_hdmi_read_edid(u8 *buf, int len); -bool omapdss_hdmi_detect(void); +int omapdss_hdmi_read_edid(struct omap_dss_output *out, u8 *buf, int len); +bool omapdss_hdmi_detect(struct omap_dss_output *out); int hdmi_panel_init(void); void hdmi_panel_exit(void); #ifdef CONFIG_OMAP4_DSS_HDMI_AUDIO -int hdmi_audio_enable(void); -void hdmi_audio_disable(void); -int hdmi_audio_start(void); -void hdmi_audio_stop(void); -bool hdmi_mode_has_audio(void); -int hdmi_audio_config(struct omap_dss_audio *audio); +int hdmi_audio_enable(struct omap_dss_output *out); +void hdmi_audio_disable(struct omap_dss_output *out); +int hdmi_audio_start(struct omap_dss_output *out); +void hdmi_audio_stop(struct omap_dss_output *out); +bool hdmi_mode_has_audio(struct omap_dss_output *out); +int hdmi_audio_config(struct omap_dss_output *out, + struct omap_dss_audio *audio); #endif /* RFBI */ diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 16b745c..39dfc2b 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -602,7 +602,7 @@ static void hdmi_dump_regs(struct seq_file *s) mutex_unlock(&hdmi.lock); } -int omapdss_hdmi_read_edid(u8 *buf, int len) +int omapdss_hdmi_read_edid(struct omap_dss_output *out, u8 *buf, int len) { int r; @@ -619,7 +619,7 @@ int omapdss_hdmi_read_edid(u8 *buf, int len) return r; } -bool omapdss_hdmi_detect(void) +bool omapdss_hdmi_detect(struct omap_dss_output *out) { int r; @@ -829,35 +829,35 @@ int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) return 0; } -int hdmi_audio_enable(void) +int hdmi_audio_enable(struct omap_dss_output *out) { DSSDBG("audio_enable\n"); return hdmi.ip_data.ops->audio_enable(&hdmi.ip_data); } -void hdmi_audio_disable(void) +void hdmi_audio_disable(struct omap_dss_output *out) { DSSDBG("audio_disable\n"); hdmi.ip_data.ops->audio_disable(&hdmi.ip_data); } -int hdmi_audio_start(void) +int hdmi_audio_start(struct omap_dss_output *out) { DSSDBG("audio_start\n"); return hdmi.ip_data.ops->audio_start(&hdmi.ip_data); } -void hdmi_audio_stop(void) +void hdmi_audio_stop(struct omap_dss_output *out) { DSSDBG("audio_stop\n"); hdmi.ip_data.ops->audio_stop(&hdmi.ip_data); } -bool hdmi_mode_has_audio(void) +bool hdmi_mode_has_audio(struct omap_dss_output *out) { if (hdmi.ip_data.cfg.cm.mode == HDMI_HDMI) return true; @@ -865,7 +865,7 @@ bool hdmi_mode_has_audio(void) return false; } -int hdmi_audio_config(struct omap_dss_audio *audio) +int hdmi_audio_config(struct omap_dss_output *out, struct omap_dss_audio *audio) { return hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio); } diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c index fb35bbb..532882d 100644 --- a/drivers/video/omap2/dss/hdmi_panel.c +++ b/drivers/video/omap2/dss/hdmi_panel.c @@ -78,21 +78,25 @@ static void hdmi_panel_remove(struct omap_dss_device *dssdev) #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) static int hdmi_panel_audio_enable(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; unsigned long flags; int r; + if (out == NULL) + return -ENODEV; + mutex_lock(&hdmi.lock); spin_lock_irqsave(&hdmi.audio_lock, flags); /* enable audio only if the display is active and supports audio */ if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || - !hdmi_mode_has_audio()) { + !hdmi_mode_has_audio(out)) { DSSERR("audio not supported or display is off\n"); r = -EPERM; goto err; } - r = hdmi_audio_enable(); + r = hdmi_audio_enable(out); if (!r) dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED; @@ -105,11 +109,12 @@ err: static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; unsigned long flags; spin_lock_irqsave(&hdmi.audio_lock, flags); - hdmi_audio_disable(); + hdmi_audio_disable(out); dssdev->audio_state = OMAP_DSS_AUDIO_DISABLED; @@ -118,9 +123,13 @@ static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev) static int hdmi_panel_audio_start(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; unsigned long flags; int r; + if (out == NULL) + return -ENODEV; + spin_lock_irqsave(&hdmi.audio_lock, flags); /* * No need to check the panel state. It was checked when trasitioning @@ -132,7 +141,7 @@ static int hdmi_panel_audio_start(struct omap_dss_device *dssdev) goto err; } - r = hdmi_audio_start(); + r = hdmi_audio_start(out); if (!r) dssdev->audio_state = OMAP_DSS_AUDIO_PLAYING; @@ -144,11 +153,12 @@ err: static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; unsigned long flags; spin_lock_irqsave(&hdmi.audio_lock, flags); - hdmi_audio_stop(); + hdmi_audio_stop(out); dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED; spin_unlock_irqrestore(&hdmi.audio_lock, flags); @@ -156,14 +166,18 @@ static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev) static bool hdmi_panel_audio_supported(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; bool r = false; + if (out == NULL) + return r; + mutex_lock(&hdmi.lock); if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) goto err; - if (!hdmi_mode_has_audio()) + if (!hdmi_mode_has_audio(out)) goto err; r = true; @@ -175,21 +189,25 @@ err: static int hdmi_panel_audio_config(struct omap_dss_device *dssdev, struct omap_dss_audio *audio) { + struct omap_dss_output *out = dssdev->output; unsigned long flags; int r; + if (out == NULL) + return -ENODEV; + mutex_lock(&hdmi.lock); spin_lock_irqsave(&hdmi.audio_lock, flags); /* config audio only if the display is active and supports audio */ if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || - !hdmi_mode_has_audio()) { + !hdmi_mode_has_audio(out)) { DSSERR("audio not supported or display is off\n"); r = -EPERM; goto err; } - r = hdmi_audio_config(audio); + r = hdmi_audio_config(out, audio); if (!r) dssdev->audio_state = OMAP_DSS_AUDIO_CONFIGURED; @@ -407,7 +425,7 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) goto err; } - r = omapdss_hdmi_read_edid(buf, len); + r = omapdss_hdmi_read_edid(out, buf, len); if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) @@ -434,7 +452,7 @@ static bool hdmi_detect(struct omap_dss_device *dssdev) goto err; } - r = omapdss_hdmi_detect(); + r = omapdss_hdmi_detect(out); if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED)