Skip to content

Commit b724455

Browse files
committed
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 <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent de1c705 commit b724455

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

drivers/gpu/drm/drm_mipi_dsi.c

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,29 +645,56 @@ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
645645
EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size);
646646

647647
/**
648-
* mipi_dsi_compression_mode() - enable/disable DSC on the peripheral
648+
* mipi_dsi_compression_mode_ext() - enable/disable DSC on the peripheral
649649
* @dsi: DSI peripheral device
650650
* @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
651653
*
652-
* Enable or disable Display Stream Compression on the peripheral using the
653-
* default Picture Parameter Set and VESA DSC 1.1 algorithm.
654+
* Enable or disable Display Stream Compression on the peripheral.
654655
*
655656
* Return: 0 on success or a negative error code on failure.
656657
*/
657-
int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable)
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)
658661
{
659-
/* Note: Needs updating for non-default PPS or algorithm */
660-
u8 tx[2] = { enable << 0, 0 };
662+
u8 tx[2] = { };
661663
struct mipi_dsi_msg msg = {
662664
.channel = dsi->channel,
663665
.type = MIPI_DSI_COMPRESSION_MODE,
664666
.tx_len = sizeof(tx),
665667
.tx_buf = tx,
666668
};
667-
int ret = mipi_dsi_device_transfer(dsi, &msg);
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);
668679

669680
return (ret < 0) ? ret : 0;
670681
}
682+
EXPORT_SYMBOL(mipi_dsi_compression_mode_ext);
683+
684+
/**
685+
* mipi_dsi_compression_mode() - enable/disable DSC on the peripheral
686+
* @dsi: DSI peripheral device
687+
* @enable: Whether to enable or disable the DSC
688+
*
689+
* Enable or disable Display Stream Compression on the peripheral using the
690+
* default Picture Parameter Set and VESA DSC 1.1 algorithm.
691+
*
692+
* Return: 0 on success or a negative error code on failure.
693+
*/
694+
int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable)
695+
{
696+
return mipi_dsi_compression_mode_ext(dsi, enable, MIPI_DSI_COMPRESSION_DSC, 0);
697+
}
671698
EXPORT_SYMBOL(mipi_dsi_compression_mode);
672699

673700
/**

include/drm/drm_mipi_dsi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt)
226226
return -EINVAL;
227227
}
228228

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+
229235
struct mipi_dsi_device *
230236
mipi_dsi_device_register_full(struct mipi_dsi_host *host,
231237
const struct mipi_dsi_device_info *info);
@@ -242,6 +248,9 @@ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi);
242248
int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
243249
u16 value);
244250
int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable);
251+
int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable,
252+
enum mipi_dsi_compression_algo algo,
253+
unsigned int pps_selector);
245254
int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
246255
const struct drm_dsc_picture_parameter_set *pps);
247256

0 commit comments

Comments
 (0)