From: Andre Przywara <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [PATCH 04/19] common: edid: extract code for detailed timing search
Date: Thu, 4 Mar 2021 01:41:45 +0000 [thread overview]
Message-ID: <20210304014145.21912ac3@slackpad.fritz.box> (raw)
In-Reply-To: <20210223204631.1609597-5-jernej.skrabec@siol.net>
On Tue, 23 Feb 2021 21:46:16 +0100
Jernej Skrabec <jernej.skrabec@siol.net> wrote:
> Code which searches for valid detailed timing entry will be used in more
> places. Extract it.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> ---
> common/edid.c | 49 ++++++++++++++++++++++++++++---------------------
> 1 file changed, 28 insertions(+), 21 deletions(-)
>
> diff --git a/common/edid.c b/common/edid.c
> index 1cb7177742e8..a6c875d9c8e8 100644
> --- a/common/edid.c
> +++ b/common/edid.c
> @@ -169,6 +169,29 @@ static bool cea_is_hdmi_vsdb_present(struct edid_cea861_info *info)
> return false;
> }
>
> +static bool edid_find_valid_timing(void *buf, int count,
> + struct display_timing *timing,
> + bool (*mode_valid)(void *priv,
> + const struct display_timing *timing),
> + void *mode_valid_priv)
> +{
> + struct edid_detailed_timing *t = buf;
> + bool found = false;
> + int i;
> +
> + for (i = 0; i < count && !found; i++, t++)
> + if (EDID_DETAILED_TIMING_PIXEL_CLOCK(*t) != 0) {
I am slightly puzzled, edid_detailed_timing is a different structure
from edid_monitor_descriptor, as used below. Effectively the code
checks in both cases for the first halfword to be not 0, but if this
wasn't the correct structure before, and this is fixing it on the
way, can you mention it in the commit message?
Other than that the code looks to be correctly refactored.
Cheers,
Andre
> + decode_timing((u8 *)t, timing);
> + if (mode_valid)
> + found = mode_valid(mode_valid_priv,
> + timing);
> + else
> + found = true;
> + }
> +
> + return found;
> +}
> +
> int edid_get_timing_validate(u8 *buf, int buf_size,
> struct display_timing *timing,
> int *panel_bits_per_colourp,
> @@ -177,8 +200,7 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
> void *mode_valid_priv)
> {
> struct edid1_info *edid = (struct edid1_info *)buf;
> - bool timing_done;
> - int i;
> + bool found;
>
> if (buf_size < sizeof(*edid) || edid_check_info(edid)) {
> debug("%s: Invalid buffer\n", __func__);
> @@ -195,25 +217,10 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
> return -ENOENT;
> }
>
> - /* Look for detailed timing */
> - timing_done = false;
> - for (i = 0; i < 4; i++) {
> - struct edid_monitor_descriptor *desc;
> -
> - desc = &edid->monitor_details.descriptor[i];
> - if (desc->zero_flag_1 != 0) {
> - decode_timing((u8 *)desc, timing);
> - if (mode_valid)
> - timing_done = mode_valid(mode_valid_priv,
> - timing);
> - else
> - timing_done = true;
> -
> - if (timing_done)
> - break;
> - }
> - }
> - if (!timing_done)
> + /* Look for detailed timing in base EDID */
> + found = edid_find_valid_timing(edid->monitor_details.descriptor, 4,
> + timing, mode_valid, mode_valid_priv);
> + if (!found)
> return -EINVAL;
>
> if (edid->version != 1 || edid->revision < 4) {
next prev parent reply other threads:[~2021-03-04 1:41 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 20:46 [PATCH 00/19] video: sunxi: Rework DE2 driver Jernej Skrabec
2021-02-23 20:46 ` [PATCH 01/19] sunxi: video: select dw-hdmi in Kconfig, not Makefile Jernej Skrabec
2021-03-04 1:40 ` Andre Przywara
2021-02-23 20:46 ` [PATCH 02/19] video: sunxi: Add mode_valid callback to sunxi_dw_hdmi Jernej Skrabec
2021-03-04 1:41 ` Andre Przywara
2021-02-23 20:46 ` [PATCH 03/19] common: edid: check for digital display earlier Jernej Skrabec
2021-03-04 1:41 ` Andre Przywara
2021-02-23 20:46 ` [PATCH 04/19] common: edid: extract code for detailed timing search Jernej Skrabec
2021-03-04 1:41 ` Andre Przywara [this message]
2021-03-06 19:16 ` Jernej Škrabec
2021-02-23 20:46 ` [PATCH 05/19] common: edid: Search for valid timing in extension block Jernej Skrabec
2021-02-23 20:46 ` [PATCH 06/19] video: sunxi: Use DW-HDMI hpd function Jernej Skrabec
2021-03-04 1:42 ` Andre Przywara
2021-03-04 17:27 ` Jernej Škrabec
2021-02-23 20:46 ` [PATCH 07/19] video: sunxi: Remove check for ddc-i2c-bus property Jernej Skrabec
2021-03-04 1:42 ` Andre Przywara
2021-03-04 19:41 ` Jernej Škrabec
2021-02-23 20:46 ` [PATCH 08/19] video: sunxi: Remove TV probe from DE2 Jernej Skrabec
2021-02-23 20:46 ` [PATCH 09/19] video: sunxi: de2: switch to public uclass functions Jernej Skrabec
2021-02-23 20:46 ` [PATCH 10/19] video: sunxi: dw-hdmi: probe driver by compatible Jernej Skrabec
2021-02-23 20:46 ` [PATCH 11/19] video: sunxi: dw-hdmi: read address from DT node Jernej Skrabec
2021-02-23 20:46 ` [PATCH 12/19] video: dw-hdmi: modify phy init callback to include full timings Jernej Skrabec
2021-02-23 20:46 ` [PATCH 13/19] video: sunxi: dw-hdmi: move PHY config to appropriate place Jernej Skrabec
2021-02-23 20:46 ` [PATCH 14/19] video: sunxi: dw-hdmi: rework PHY initialization Jernej Skrabec
2021-02-24 18:21 ` [linux-sunxi] " Jernej Škrabec
2021-02-23 20:46 ` [PATCH 15/19] video: sunxi: de2: switch to DT probing Jernej Skrabec
2021-02-23 20:46 ` [PATCH 16/19] video: sunxi: de2: read address from DT node Jernej Skrabec
2021-02-23 20:46 ` [PATCH 17/19] clk: sunxi: Add DE2 clocks to H3 and A64 Jernej Skrabec
2021-02-23 20:46 ` [PATCH 18/19] clk: sunxi: add DE2 clock driver Jernej Skrabec
2021-02-23 20:46 ` [PATCH 19/19] video: sunxi: de2: switch clock setup to DM model Jernej Skrabec
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=20210304014145.21912ac3@slackpad.fritz.box \
--to=andre.przywara@arm.com \
--cc=u-boot@lists.denx.de \
/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