1 // SPDX-License-Identifier: MIT
3 * Copyright © 2023 Intel Corporation
6 #include <drm/drm_edid.h>
7 #include <drm/drm_eld.h>
9 #include "drm_internal.h"
12 * drm_eld_sad_get - get SAD from ELD to struct cea_sad
14 * @sad_index: SAD index
15 * @cta_sad: destination struct cea_sad
17 * @return: 0 on success, or negative on errors
19 int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad)
23 if (sad_index >= drm_eld_sad_count(eld))
26 sad = eld + DRM_ELD_CEA_SAD(drm_eld_mnl(eld), sad_index);
28 drm_edid_cta_sad_set(cta_sad, sad);
32 EXPORT_SYMBOL(drm_eld_sad_get);
35 * drm_eld_sad_set - set SAD to ELD from struct cea_sad
37 * @sad_index: SAD index
38 * @cta_sad: source struct cea_sad
40 * @return: 0 on success, or negative on errors
42 int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad)
46 if (sad_index >= drm_eld_sad_count(eld))
49 sad = eld + DRM_ELD_CEA_SAD(drm_eld_mnl(eld), sad_index);
51 drm_edid_cta_sad_get(cta_sad, sad);
55 EXPORT_SYMBOL(drm_eld_sad_set);