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

drm/dsi: Implement DCS {get,set}_pixel_format commands

Provide small convenience wrappers to query or set the pixel format used
by the interface.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>

+48
+46
drivers/gpu/drm/drm_mipi_dsi.c
··· 628 628 EXPORT_SYMBOL(mipi_dsi_dcs_get_power_mode); 629 629 630 630 /** 631 + * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image 632 + * data used by the interface 633 + * @dsi: DSI peripheral device 634 + * @format: return location for the pixel format 635 + * 636 + * Return: 0 on success or a negative error code on failure. 637 + */ 638 + int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format) 639 + { 640 + ssize_t err; 641 + 642 + err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_PIXEL_FORMAT, format, 643 + sizeof(*format)); 644 + if (err <= 0) { 645 + if (err == 0) 646 + err = -ENODATA; 647 + 648 + return err; 649 + } 650 + 651 + return 0; 652 + } 653 + EXPORT_SYMBOL(mipi_dsi_dcs_get_pixel_format); 654 + 655 + /** 631 656 * mipi_dsi_dcs_enter_sleep_mode() - disable all unnecessary blocks inside the 632 657 * display module except interface communication 633 658 * @dsi: DSI peripheral device ··· 769 744 return 0; 770 745 } 771 746 EXPORT_SYMBOL(mipi_dsi_dcs_set_tear_on); 747 + 748 + /** 749 + * mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image 750 + * data used by the interface 751 + * @dsi: DSI peripheral device 752 + * @format: pixel format 753 + * 754 + * Return: 0 on success or a negative error code on failure. 755 + */ 756 + int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format) 757 + { 758 + ssize_t err; 759 + 760 + err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PIXEL_FORMAT, &format, 761 + sizeof(format)); 762 + if (err < 0) 763 + return err; 764 + 765 + return 0; 766 + } 767 + EXPORT_SYMBOL(mipi_dsi_dcs_set_pixel_format); 772 768 773 769 static int mipi_dsi_drv_probe(struct device *dev) 774 770 {
+2
include/drm/drm_mipi_dsi.h
··· 200 200 int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi); 201 201 int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi); 202 202 int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode); 203 + int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format); 203 204 int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi); 204 205 int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi); 205 206 int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi); ··· 208 207 int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi); 209 208 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, 210 209 enum mipi_dsi_dcs_tear_mode mode); 210 + int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format); 211 211 212 212 /** 213 213 * struct mipi_dsi_driver - DSI driver