Re: [PATCH v3 3/4] OMAPDSS: HDMI: change the timing match logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2012-01-04 at 16:39 +0530, mythripk@xxxxxx wrote:
> From: Mythri P K <mythripk@xxxxxx>
> 
> Change the timing match logic, Instead of the statically mapped method
> to get the corresponding timings for a given code and mode, move to a
> simpler array indexed method. It  will help to scale up to add more
> timings when needed.
> 
> Signed-off-by: Mythri P K <mythripk@xxxxxx>
> ---
>  drivers/video/omap2/dss/hdmi.c |  177 +++++++++++++++++----------------------
>  1 files changed, 77 insertions(+), 100 deletions(-)

> -static int get_timings_index(void)
> +static const struct hdmi_config *hdmi_find_timing(
> +					const struct hdmi_config *timings_arr,
> +					int len)
>  {
> -	int code;
> +	int i;
> +	const struct hdmi_config *timing = NULL;
>  
> -	if (hdmi.mode == 0)
> -		code = code_vesa[hdmi.code];
> -	else
> -		code = code_cea[hdmi.code];
> +	for (i = 0; i < len; i++) {
> +		if (timings_arr[i].cm.code == hdmi.code) {
> +			timing = &timings_arr[i];
> +			return timing;
> +		}
> +	}
> +	return timing;

You don't need the timing variable at all. Just return &timings_arr[i]
or NULL.
 
> @@ -341,9 +312,15 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
>  		dssdev->panel.timings.x_res,
>  		dssdev->panel.timings.y_res);
>  
> -	code = get_timings_index();
> -	update_hdmi_timings(&hdmi.ip_data.cfg, p, code);
> -
> +	if (hdmi_get_timings() == NULL) {
> +		/* HDMI code 4 corresponds to 640 * 480 VGA */
> +		hdmi.code = 4;
> +		/* DVI mode 1 corresponds to HDMI 0 to DVI */
> +		hdmi.mode = HDMI_DVI;
> +		hdmi.ip_data.cfg = vesa_timings[0];
> +	} else {
> +		hdmi.ip_data.cfg = *(hdmi_get_timings());
> +	}

Now you are searching for the timings twice... Do:

timings = hdmi_get_timings();

if (timings == NULL) {
	/* default to VGA */
	...
} else {
	hdmi.ip_data.cfg = *timings;
}

 Tomi

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux