Lines Matching defs:dsi
4 * MIPI DSI Bus
45 * DOC: dsi helpers
47 * These functions contain some common logic and helpers to deal with MIPI DSI
50 * Helpers are provided for a number of standard MIPI DSI command as well as a
56 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
62 /* compare DSI device and driver names */
63 if (!strcmp(dsi->name, drv->name))
71 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
79 dsi->name);
96 .name = "mipi-dsi",
103 * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a
107 * Return: A pointer to the MIPI DSI device corresponding to @np or NULL if no
122 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
125 kfree(dsi);
134 struct mipi_dsi_device *dsi;
136 dsi = kzalloc(sizeof(*dsi), GFP_KERNEL);
137 if (!dsi)
140 dsi->host = host;
141 dsi->dev.bus = &mipi_dsi_bus_type;
142 dsi->dev.parent = host->dev;
143 dsi->dev.type = &mipi_dsi_device_type;
145 device_initialize(&dsi->dev);
147 return dsi;
150 static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
152 struct mipi_dsi_host *host = dsi->host;
154 dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), dsi->channel);
156 return device_add(&dsi->dev);
194 * mipi_dsi_device_register_full - create a MIPI DSI device
195 * @host: DSI host to which this device is connected
196 * @info: pointer to template containing DSI device information
198 * Create a MIPI DSI device by using the device information provided by
202 * A pointer to the newly created MIPI DSI device, or, a pointer encoded
209 struct mipi_dsi_device *dsi;
223 dsi = mipi_dsi_device_alloc(host);
224 if (IS_ERR(dsi)) {
225 dev_err(dev, "failed to allocate DSI device %ld\n",
226 PTR_ERR(dsi));
227 return dsi;
230 dsi->dev.of_node = info->node;
231 dsi->channel = info->channel;
232 strlcpy(dsi->name, info->type, sizeof(dsi->name));
234 ret = mipi_dsi_device_add(dsi);
236 dev_err(dev, "failed to add DSI device %d\n", ret);
237 kfree(dsi);
241 return dsi;
246 * mipi_dsi_device_unregister - unregister MIPI DSI device
247 * @dsi: DSI peripheral device
249 void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi)
251 device_unregister(&dsi->dev);
259 * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
264 * A pointer to the MIPI DSI host corresponding to @node or NULL if no
307 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
309 mipi_dsi_device_unregister(dsi);
325 * mipi_dsi_attach - attach a DSI device to its DSI host
326 * @dsi: DSI peripheral
328 int mipi_dsi_attach(struct mipi_dsi_device *dsi)
330 const struct mipi_dsi_host_ops *ops = dsi->host->ops;
335 return ops->attach(dsi->host, dsi);
340 * mipi_dsi_detach - detach a DSI device from its DSI host
341 * @dsi: DSI peripheral
343 int mipi_dsi_detach(struct mipi_dsi_device *dsi)
345 const struct mipi_dsi_host_ops *ops = dsi->host->ops;
350 return ops->detach(dsi->host, dsi);
354 static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi,
357 const struct mipi_dsi_host_ops *ops = dsi->host->ops;
362 if (dsi->mode_flags & MIPI_DSI_MODE_LPM)
365 return ops->transfer(dsi->host, msg);
370 * @type: MIPI DSI data type of the packet
408 * @type: MIPI DSI data type of the packet
441 * DSI protocol
442 * @packet: pointer to a DSI packet structure
494 * @dsi: DSI peripheral device
498 int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi)
501 .channel = dsi->channel,
506 int ret = mipi_dsi_device_transfer(dsi, &msg);
514 * @dsi: DSI peripheral device
518 int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi)
521 .channel = dsi->channel,
526 int ret = mipi_dsi_device_transfer(dsi, &msg);
536 * @dsi: DSI peripheral device
541 int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
546 .channel = dsi->channel,
551 int ret = mipi_dsi_device_transfer(dsi, &msg);
559 * @dsi: DSI peripheral device
567 ssize_t mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable)
572 .channel = dsi->channel,
577 int ret = mipi_dsi_device_transfer(dsi, &msg);
585 * @dsi: DSI peripheral device
592 ssize_t mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi,
596 .channel = dsi->channel,
601 int ret = mipi_dsi_device_transfer(dsi, &msg);
609 * @dsi: DSI peripheral device
619 ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
623 .channel = dsi->channel,
646 return mipi_dsi_device_transfer(dsi, &msg);
652 * @dsi: DSI peripheral device
664 ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
668 .channel = dsi->channel,
692 return mipi_dsi_device_transfer(dsi, &msg);
698 * @dsi: DSI peripheral device
708 ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
712 .channel = dsi->channel,
734 return mipi_dsi_device_transfer(dsi, &msg);
740 * @dsi: DSI peripheral device
751 ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
773 err = mipi_dsi_dcs_write_buffer(dsi, tx, size);
784 * @dsi: DSI peripheral device
791 ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
795 .channel = dsi->channel,
803 return mipi_dsi_device_transfer(dsi, &msg);
809 * @dsi: DSI peripheral device
813 int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi)
817 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_NOP, NULL, 0);
827 * @dsi: DSI peripheral device
831 int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi)
835 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SOFT_RESET, NULL, 0);
846 * @dsi: DSI peripheral device
851 int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode)
855 err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_POWER_MODE, mode,
871 * @dsi: DSI peripheral device
876 int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format)
880 err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_PIXEL_FORMAT, format,
896 * @dsi: DSI peripheral device
900 int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi)
904 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_ENTER_SLEEP_MODE, NULL, 0);
915 * @dsi: DSI peripheral device
919 int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi)
923 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_EXIT_SLEEP_MODE, NULL, 0);
934 * @dsi: DSI peripheral device
938 int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi)
942 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_OFF, NULL, 0);
953 * @dsi: DSI peripheral device
957 int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi)
961 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_ON, NULL, 0);
972 * @dsi: DSI peripheral device
978 int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
984 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_COLUMN_ADDRESS, payload,
996 * @dsi: DSI peripheral device
1002 int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
1008 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PAGE_ADDRESS, payload,
1020 * @dsi: DSI peripheral device
1024 int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi)
1028 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_OFF, NULL, 0);
1039 * @dsi: DSI peripheral device
1044 int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
1050 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_ON, &value,
1062 * @dsi: DSI peripheral device
1067 int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format)
1071 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PIXEL_FORMAT, &format,
1083 * @dsi: DSI peripheral device
1088 int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline)
1094 err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
1105 * @dsi: DSI peripheral device
1110 int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
1116 err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
1128 * @dsi: DSI peripheral device
1133 int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
1138 err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
1154 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
1156 return drv->probe(dsi);
1162 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
1164 return drv->remove(dsi);
1170 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
1172 drv->shutdown(dsi);
1176 * mipi_dsi_driver_register_full() - register a driver for DSI devices
1177 * @drv: DSI driver structure
1200 * mipi_dsi_driver_unregister() - unregister a driver for DSI devices
1201 * @drv: DSI driver structure
1218 MODULE_DESCRIPTION("MIPI DSI Bus");