linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shubhrajyoti <shubhrajyoti@ti.com>
To: mythripk@ti.com
Cc: tomi.valkeinen@ti.com, linux-omap@vger.kernel.org
Subject: Re: [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver
Date: Tue, 10 Jan 2012 13:28:56 +0530	[thread overview]
Message-ID: <4F0BEFC0.9010705@ti.com> (raw)
In-Reply-To: <1325853877-6712-4-git-send-email-mythripk@ti.com>

Hi Mythri,

On Friday 06 January 2012 06:14 PM, mythripk@ti.com wrote:
> From: Mythri P K <mythripk@ti.com>
>
> GPIO based handling of connect/disconnect of the HDMI cable
> (Hot-plug detect)is added to the HDMI driver.
>
> Signed-off-by: Mythri P K <mythripk@ti.com>
> ---
>  drivers/video/omap2/dss/dss_features.c |    1 +
>  drivers/video/omap2/dss/hdmi.c         |   49 ++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
> index 544b172..ef3f666 100644
> --- a/drivers/video/omap2/dss/dss_features.c
> +++ b/drivers/video/omap2/dss/dss_features.c
> @@ -477,6 +477,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
>  	.audio_enable		=       ti_hdmi_4xxx_wp_audio_enable,
>  #endif
>  	.configure_range	=	ti_hdmi_4xxx_configure_range,
> +	.notify_hpd		=	ti_hdmi_4xxx_notify_hpd,
>  
>  };
>  
> diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
> index 29de79f..4c3110d 100644
> --- a/drivers/video/omap2/dss/hdmi.c
> +++ b/drivers/video/omap2/dss/hdmi.c
> @@ -66,6 +66,9 @@ static struct {
>  	struct omap_display_platform_data *pdata;
>  	struct platform_device *pdev;
>  	struct hdmi_ip_data ip_data;
> +	struct omap_dss_device *dssdev;
> +
> +	bool hpd;
>  
>  	struct clk *sys_clk;
>  } hdmi;
> @@ -461,6 +464,29 @@ void hdmi_dump_regs(struct seq_file *s)
>  	mutex_unlock(&hdmi.lock);
>  }
>  
> +static int hdmi_get_current_hpd(void)
> +{
> +	return gpio_get_value(hdmi.dssdev->hpd_gpio);
> +}
> +
> +static irqreturn_t hpd_enable_handler(int irq, void *ptr)
> +{
> +	DSSDBG("hpd enable %d\n", hdmi.hpd);
> +
> +	hdmi.ip_data.ops->notify_hpd(&hdmi.ip_data, hdmi.hpd);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t hpd_irq_handler(int irq, void *ptr)
> +{
> +	if (hdmi.dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
> +		hdmi.hpd = hdmi_get_current_hpd();
> +		return IRQ_WAKE_THREAD;
> +	}
> +	return IRQ_HANDLED;
> +}
> +
>  int omapdss_hdmi_read_edid(u8 *buf, int len)
>  {
>  	int r;
> @@ -782,11 +808,22 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
>  {
>  	struct resource *hdmi_mem;
>  	int r;
> +	struct omap_dss_board_info *board_data;
>  
>  	hdmi.pdata = pdev->dev.platform_data;
>  	hdmi.pdev = pdev;
>  
>  	mutex_init(&hdmi.lock);
> +	/* save reference to HDMI device */
> +	board_data = hdmi.pdata->board_data;
> +	for (r = 0; r < board_data->num_devices; r++) {
> +		if (board_data->devices[r]->type == OMAP_DISPLAY_TYPE_HDMI)
> +			hdmi.dssdev = board_data->devices[r];
> +	}
> +	if (!hdmi.dssdev) {
> +		DSSERR("can't get HDMI device\n");
> +		return -EINVAL;
> +	}
>  
>  	hdmi_mem = platform_get_resource(hdmi.pdev, IORESOURCE_MEM, 0);
>  	if (!hdmi_mem) {
> @@ -810,6 +847,16 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
>  
>  	pm_runtime_enable(&pdev->dev);
>  
> +	r = request_threaded_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio),
> +			hpd_irq_handler, hpd_enable_handler,
> +			IRQF_DISABLED | IRQF_TRIGGER_RISING |
Why is  IRQF_DISABLED needed?
> +			IRQF_TRIGGER_FALLING, "hpd", NULL);
> +	if (r < 0) {
> +		pr_err("hdmi: request_irq %d failed\n",
> +			gpio_to_irq(hdmi.dssdev->hpd_gpio));
> +		return -EINVAL;
Could we return the error from  request_threaded_irq instead of masking
with EINVAL.
> +	}
> +
>  	hdmi.ip_data.core_sys_offset = HDMI_CORE_SYS;
>  	hdmi.ip_data.core_av_offset = HDMI_CORE_AV;
>  	hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
> @@ -840,6 +887,8 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
>  	snd_soc_unregister_codec(&pdev->dev);
>  #endif
>  
> +	free_irq(gpio_to_irq(hdmi.dssdev->hpd_gpio), hpd_irq_handler);
> +
>  	pm_runtime_disable(&pdev->dev);
>  
>  	hdmi_put_clocks();


  reply	other threads:[~2012-01-10  7:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 12:44 [PATCH 0/3] OMAPDSS: HDMI: HDMI Hot-plug detect support mythripk
2012-01-06 12:44 ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile mythripk
2012-01-06 12:44   ` [PATCH v2 2/3] OMAPDSS: HDMI: Handle HPD event in ip mythripk
2012-01-06 12:44     ` [PATCH v2 3/3] OMAPDSS: HDMI: HPD support added to HDMI driver mythripk
2012-01-10  7:58       ` Shubhrajyoti [this message]
2012-01-10  7:37   ` [PATCH v2 1/3] OMAPDSS: HDMI: HPD support in boardfile Tomi Valkeinen
2012-01-10  7:43     ` Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F0BEFC0.9010705@ti.com \
    --to=shubhrajyoti@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=mythripk@ti.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).