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/mipi-dsi: Add helper to find input format

Add a helper API that can be used by the DSI hosts to find the required
input bus format for the given output dsi pixel format.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com>
Signed-off-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
Link: https://lore.kernel.org/r/20250329113925.68204-8-aradhya.bhatia@linux.dev
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

authored by

Aradhya Bhatia and committed by
Dmitry Baryshkov
e83967c3 7ad8b344

+38
+37
drivers/gpu/drm/drm_mipi_dsi.c
··· 36 36 #include <drm/drm_mipi_dsi.h> 37 37 #include <drm/drm_print.h> 38 38 39 + #include <linux/media-bus-format.h> 40 + 39 41 #include <video/mipi_display.h> 40 42 41 43 /** ··· 871 869 return mipi_dsi_device_transfer(dsi, &msg); 872 870 } 873 871 EXPORT_SYMBOL(mipi_dsi_generic_read); 872 + 873 + /** 874 + * drm_mipi_dsi_get_input_bus_fmt() - Get the required MEDIA_BUS_FMT_* based 875 + * input pixel format for a given DSI output 876 + * pixel format 877 + * @dsi_format: pixel format that a DSI host needs to output 878 + * 879 + * Various DSI hosts can use this function during their 880 + * &drm_bridge_funcs.atomic_get_input_bus_fmts operation to ascertain 881 + * the MEDIA_BUS_FMT_* pixel format required as input. 882 + * 883 + * RETURNS: 884 + * a 32-bit MEDIA_BUS_FMT_* value on success or 0 in case of failure. 885 + */ 886 + u32 drm_mipi_dsi_get_input_bus_fmt(enum mipi_dsi_pixel_format dsi_format) 887 + { 888 + switch (dsi_format) { 889 + case MIPI_DSI_FMT_RGB888: 890 + return MEDIA_BUS_FMT_RGB888_1X24; 891 + 892 + case MIPI_DSI_FMT_RGB666: 893 + return MEDIA_BUS_FMT_RGB666_1X24_CPADHI; 894 + 895 + case MIPI_DSI_FMT_RGB666_PACKED: 896 + return MEDIA_BUS_FMT_RGB666_1X18; 897 + 898 + case MIPI_DSI_FMT_RGB565: 899 + return MEDIA_BUS_FMT_RGB565_1X16; 900 + 901 + default: 902 + /* Unsupported DSI Format */ 903 + return 0; 904 + } 905 + } 906 + EXPORT_SYMBOL(drm_mipi_dsi_get_input_bus_fmt); 874 907 875 908 /** 876 909 * mipi_dsi_dcs_write_buffer() - transmit a DCS command with payload
+1
include/drm/drm_mipi_dsi.h
··· 293 293 const void *payload, size_t size); 294 294 ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, 295 295 size_t num_params, void *data, size_t size); 296 + u32 drm_mipi_dsi_get_input_bus_fmt(enum mipi_dsi_pixel_format dsi_format); 296 297 297 298 #define mipi_dsi_msleep(ctx, delay) \ 298 299 do { \