提交 e745d064 编写于 作者: H Hans de Goede

edid: Add an edid_check_checksum() helper function

Add a helper function to check the checksum of an EDID data block.
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Acked-by: NAnatolij Gustschin <agust@denx.de>
上级 b7ce12dd
......@@ -12,6 +12,7 @@
#include <common.h>
#include <edid.h>
#include <errno.h>
#include <linux/ctype.h>
#include <linux/string.h>
......@@ -29,6 +30,17 @@ int edid_check_info(struct edid1_info *edid_info)
return 0;
}
int edid_check_checksum(u8 *edid_block)
{
u8 checksum = 0;
int i;
for (i = 0; i < 128; i++)
checksum += edid_block[i];
return (checksum == 0) ? 0 : -EINVAL;
}
int edid_get_ranges(struct edid1_info *edid, unsigned int *hmin,
unsigned int *hmax, unsigned int *vmin,
unsigned int *vmax)
......
......@@ -245,6 +245,15 @@ void edid_print_info(struct edid1_info *edid_info);
*/
int edid_check_info(struct edid1_info *info);
/**
* Check checksum of a 128 bytes EDID data block
*
* @param edid_block EDID block data
*
* @return 0 on success, or a negative errno on error
*/
int edid_check_checksum(u8 *edid_block);
/**
* Get the horizontal and vertical rate ranges of the monitor.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册