Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/eld: add helpers to modify the SADs of an ELD

Occasionally it's necessary for drivers to modify the SADs of an ELD,
but it's not so cool to have drivers poke at the ELD buffer directly.

Using the helpers to translate between 3-byte SAD and struct cea_sad,
add ELD helpers to get/set the SADs from/to an ELD.

v2: s/i/sad_index/ (Mitul)

Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8e9a05f2b1e0dd184132d636e1e778e8917ec25d.1698747331.git.jani.nikula@intel.com

+64
+3
Documentation/gpu/drm-kms-helpers.rst
··· 366 366 .. kernel-doc:: include/drm/drm_eld.h 367 367 :internal: 368 368 369 + .. kernel-doc:: drivers/gpu/drm/drm_eld.c 370 + :export: 371 + 369 372 SCDC Helper Functions Reference 370 373 =============================== 371 374
+1
drivers/gpu/drm/Makefile
··· 22 22 drm_drv.o \ 23 23 drm_dumb_buffers.o \ 24 24 drm_edid.o \ 25 + drm_eld.o \ 25 26 drm_encoder.o \ 26 27 drm_file.o \ 27 28 drm_fourcc.o \
+55
drivers/gpu/drm/drm_eld.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright © 2023 Intel Corporation 4 + */ 5 + 6 + #include <drm/drm_edid.h> 7 + #include <drm/drm_eld.h> 8 + 9 + #include "drm_internal.h" 10 + 11 + /** 12 + * drm_eld_sad_get - get SAD from ELD to struct cea_sad 13 + * @eld: ELD buffer 14 + * @sad_index: SAD index 15 + * @cta_sad: destination struct cea_sad 16 + * 17 + * @return: 0 on success, or negative on errors 18 + */ 19 + int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad) 20 + { 21 + const u8 *sad; 22 + 23 + if (sad_index >= drm_eld_sad_count(eld)) 24 + return -EINVAL; 25 + 26 + sad = eld + DRM_ELD_CEA_SAD(drm_eld_mnl(eld), sad_index); 27 + 28 + drm_edid_cta_sad_set(cta_sad, sad); 29 + 30 + return 0; 31 + } 32 + EXPORT_SYMBOL(drm_eld_sad_get); 33 + 34 + /** 35 + * drm_eld_sad_set - set SAD to ELD from struct cea_sad 36 + * @eld: ELD buffer 37 + * @sad_index: SAD index 38 + * @cta_sad: source struct cea_sad 39 + * 40 + * @return: 0 on success, or negative on errors 41 + */ 42 + int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad) 43 + { 44 + u8 *sad; 45 + 46 + if (sad_index >= drm_eld_sad_count(eld)) 47 + return -EINVAL; 48 + 49 + sad = eld + DRM_ELD_CEA_SAD(drm_eld_mnl(eld), sad_index); 50 + 51 + drm_edid_cta_sad_get(cta_sad, sad); 52 + 53 + return 0; 54 + } 55 + EXPORT_SYMBOL(drm_eld_sad_set);
+5
include/drm/drm_eld.h
··· 8 8 9 9 #include <linux/types.h> 10 10 11 + struct cea_sad; 12 + 11 13 /* ELD Header Block */ 12 14 #define DRM_ELD_HEADER_BLOCK_SIZE 4 13 15 ··· 76 74 { 77 75 return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT; 78 76 } 77 + 78 + int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad); 79 + int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad); 79 80 80 81 /** 81 82 * drm_eld_sad - Get ELD SAD structures.