public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: jaswinder.singh@linaro.org, tomi.valkeinen@ti.com
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	'Mythri P K' <mythripk@ti.com>
Subject: RE: [PATCH] OMAPDSS: HDMI: Discard phy_tx_enabled member
Date: Mon, 18 Jun 2012 08:44:59 +0900	[thread overview]
Message-ID: <000a01cd4ce3$35367160$9fa35420$%han@samsung.com> (raw)
In-Reply-To: <1339797701-11540-1-git-send-email-jaswinder.singh@linaro.org>


On Saturday 16 June 2012 7:02:00 jaswinder.singh wrote:

> From: Jassi Brar <jaswinder.singh@linaro.org>
> 
> Explicitly maintaining HDMI phy power state using a flag is prone to
> race and un-necessary when we have a zero-cost alternative of checking
> the state before trying to set it.

CC'ed 'Mythri P K' as the author for OMAP HDMI.

Hi Jassi, long time no see.

This patch looks good.
If there is no problem, checking register is better way.

Best regards,
Jingoo Han.

> 
> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
> ---
>  drivers/video/omap2/dss/ti_hdmi.h         |    1 -
>  drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c |   11 ++++-------
>  2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
> index e734cb4..d174ca1 100644
> --- a/drivers/video/omap2/dss/ti_hdmi.h
> +++ b/drivers/video/omap2/dss/ti_hdmi.h
> @@ -177,7 +177,6 @@ struct hdmi_ip_data {
> 
>  	/* ti_hdmi_4xxx_ip private data. These should be in a separate struct */
>  	int hpd_gpio;
> -	bool phy_tx_enabled;
>  };
>  int ti_hdmi_4xxx_phy_enable(struct hdmi_ip_data *ip_data);
>  void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data);
> diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
> index 4dae1b2..3fa3d98 100644
> --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
> +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
> @@ -157,6 +157,10 @@ static int hdmi_pll_init(struct hdmi_ip_data *ip_data)
>  /* PHY_PWR_CMD */
>  static int hdmi_set_phy_pwr(struct hdmi_ip_data *ip_data, enum hdmi_phy_pwr val)
>  {
> +	/* Return if already the state */
> +	if (REG_GET(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, 5, 4) == val)
> +		return 0;
> +
>  	/* Command for power control of HDMI PHY */
>  	REG_FLD_MOD(hdmi_wp_base(ip_data), HDMI_WP_PWR_CTRL, val, 7, 6);
> 
> @@ -241,11 +245,6 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
> 
>  	hpd = gpio_get_value(ip_data->hpd_gpio);
> 
> -	if (hpd == ip_data->phy_tx_enabled) {
> -		spin_unlock_irqrestore(&phy_tx_lock, flags);
> -		return 0;
> -	}
> -
>  	if (hpd)
>  		r = hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_TXON);
>  	else
> @@ -257,7 +256,6 @@ static int hdmi_check_hpd_state(struct hdmi_ip_data *ip_data)
>  		goto err;
>  	}
> 
> -	ip_data->phy_tx_enabled = hpd;
>  err:
>  	spin_unlock_irqrestore(&phy_tx_lock, flags);
>  	return r;
> @@ -327,7 +325,6 @@ void ti_hdmi_4xxx_phy_disable(struct hdmi_ip_data *ip_data)
>  	free_irq(gpio_to_irq(ip_data->hpd_gpio), ip_data);
> 
>  	hdmi_set_phy_pwr(ip_data, HDMI_PHYPWRCMD_OFF);
> -	ip_data->phy_tx_enabled = false;
>  }
> 
>  static int hdmi_core_ddc_init(struct hdmi_ip_data *ip_data)
> --
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2012-06-17 23:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 22:01 [PATCH] OMAPDSS: HDMI: Discard phy_tx_enabled member jaswinder.singh
2012-06-17 23:44 ` Jingoo Han [this message]
2012-06-18  8:11 ` Tomi Valkeinen
2012-06-18 10:12   ` Jassi Brar
2012-06-18 10:54     ` Tomi Valkeinen
2012-06-18 11:46       ` Jassi Brar
2012-06-18 12:24         ` Tomi Valkeinen
2012-06-18 13:07           ` Jassi Brar
2012-06-18 13:11             ` Tomi Valkeinen
2012-06-18 13:24               ` Jassi Brar
  -- strict thread matches above, loose matches on Subject: below --
2012-06-23  8:07 jaswinder.singh

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='000a01cd4ce3$35367160$9fa35420$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --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