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

drm/mipi-dsi: add mipi_dsi_compression_mode_ext()

Add the extended version of mipi_dsi_compression_mode(). It provides
a way to specify the algorithm and PPS selector.

Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240408-lg-sw43408-panel-v5-3-4e092da22991@linaro.org

+47 -11
+38 -11
drivers/gpu/drm/drm_mipi_dsi.c
··· 645 645 EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size); 646 646 647 647 /** 648 + * mipi_dsi_compression_mode_ext() - enable/disable DSC on the peripheral 649 + * @dsi: DSI peripheral device 650 + * @enable: Whether to enable or disable the DSC 651 + * @algo: Selected compression algorithm 652 + * @pps_selector: Select PPS from the table of pre-stored or uploaded PPS entries 653 + * 654 + * Enable or disable Display Stream Compression on the peripheral. 655 + * 656 + * Return: 0 on success or a negative error code on failure. 657 + */ 658 + int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, 659 + enum mipi_dsi_compression_algo algo, 660 + unsigned int pps_selector) 661 + { 662 + u8 tx[2] = { }; 663 + struct mipi_dsi_msg msg = { 664 + .channel = dsi->channel, 665 + .type = MIPI_DSI_COMPRESSION_MODE, 666 + .tx_len = sizeof(tx), 667 + .tx_buf = tx, 668 + }; 669 + int ret; 670 + 671 + if (algo > 3 || pps_selector > 3) 672 + return -EINVAL; 673 + 674 + tx[0] = (enable << 0) | 675 + (algo << 1) | 676 + (pps_selector << 4); 677 + 678 + ret = mipi_dsi_device_transfer(dsi, &msg); 679 + 680 + return (ret < 0) ? ret : 0; 681 + } 682 + EXPORT_SYMBOL(mipi_dsi_compression_mode_ext); 683 + 684 + /** 648 685 * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral 649 686 * @dsi: DSI peripheral device 650 687 * @enable: Whether to enable or disable the DSC ··· 693 656 */ 694 657 int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable) 695 658 { 696 - /* Note: Needs updating for non-default PPS or algorithm */ 697 - u8 tx[2] = { enable << 0, 0 }; 698 - struct mipi_dsi_msg msg = { 699 - .channel = dsi->channel, 700 - .type = MIPI_DSI_COMPRESSION_MODE, 701 - .tx_len = sizeof(tx), 702 - .tx_buf = tx, 703 - }; 704 - int ret = mipi_dsi_device_transfer(dsi, &msg); 705 - 706 - return (ret < 0) ? ret : 0; 659 + return mipi_dsi_compression_mode_ext(dsi, enable, MIPI_DSI_COMPRESSION_DSC, 0); 707 660 } 708 661 EXPORT_SYMBOL(mipi_dsi_compression_mode); 709 662
+9
include/drm/drm_mipi_dsi.h
··· 226 226 return -EINVAL; 227 227 } 228 228 229 + enum mipi_dsi_compression_algo { 230 + MIPI_DSI_COMPRESSION_DSC = 0, 231 + MIPI_DSI_COMPRESSION_VENDOR = 3, 232 + /* other two values are reserved, DSI 1.3 */ 233 + }; 234 + 229 235 struct mipi_dsi_device * 230 236 mipi_dsi_device_register_full(struct mipi_dsi_host *host, 231 237 const struct mipi_dsi_device_info *info); ··· 248 242 int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, 249 243 u16 value); 250 244 int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable); 245 + int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, 246 + enum mipi_dsi_compression_algo algo, 247 + unsigned int pps_selector); 251 248 int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi, 252 249 const struct drm_dsc_picture_parameter_set *pps); 253 250