Lines Matching +full:on +full:- +full:device
4 * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
21 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
30 #include <linux/device.h>
50 static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv) in mipi_dsi_device_match()
58 /* compare DSI device and driver names */ in mipi_dsi_device_match()
59 if (!strcmp(dsi->name, drv->name)) in mipi_dsi_device_match()
65 static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env) in mipi_dsi_uevent()
71 if (err != -ENODEV) in mipi_dsi_uevent()
75 dsi->name); in mipi_dsi_uevent()
92 .name = "mipi-dsi",
99 * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a
100 * device tree node
101 * @np: device tree node
103 * Return: A pointer to the MIPI DSI device corresponding to @np or NULL if no
104 * such device exists (or has not been registered yet).
108 struct device *dev; in of_find_mipi_dsi_device_by_node()
116 static void mipi_dsi_dev_release(struct device *dev) in mipi_dsi_dev_release()
120 of_node_put(dev->of_node); in mipi_dsi_dev_release()
134 return ERR_PTR(-ENOMEM); in mipi_dsi_device_alloc()
136 dsi->host = host; in mipi_dsi_device_alloc()
137 dsi->dev.bus = &mipi_dsi_bus_type; in mipi_dsi_device_alloc()
138 dsi->dev.parent = host->dev; in mipi_dsi_device_alloc()
139 dsi->dev.type = &mipi_dsi_device_type; in mipi_dsi_device_alloc()
141 device_initialize(&dsi->dev); in mipi_dsi_device_alloc()
148 struct mipi_dsi_host *host = dsi->host; in mipi_dsi_device_add()
150 dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), dsi->channel); in mipi_dsi_device_add()
152 return device_add(&dsi->dev); in mipi_dsi_device_add()
164 drm_err(host, "modalias failure on %pOF\n", node); in of_mipi_dsi_device_add()
165 return ERR_PTR(-EINVAL); in of_mipi_dsi_device_add()
170 drm_err(host, "device node %pOF has no valid reg property: %d\n", in of_mipi_dsi_device_add()
172 return ERR_PTR(-EINVAL); in of_mipi_dsi_device_add()
184 return ERR_PTR(-ENODEV); in of_mipi_dsi_device_add()
189 * mipi_dsi_device_register_full - create a MIPI DSI device
190 * @host: DSI host to which this device is connected
191 * @info: pointer to template containing DSI device information
193 * Create a MIPI DSI device by using the device information provided by
197 * A pointer to the newly created MIPI DSI device, or, a pointer encoded
209 return ERR_PTR(-EINVAL); in mipi_dsi_device_register_full()
212 if (info->channel > 3) { in mipi_dsi_device_register_full()
213 drm_err(host, "invalid virtual channel: %u\n", info->channel); in mipi_dsi_device_register_full()
214 return ERR_PTR(-EINVAL); in mipi_dsi_device_register_full()
219 drm_err(host, "failed to allocate DSI device %ld\n", in mipi_dsi_device_register_full()
224 dsi->dev.of_node = info->node; in mipi_dsi_device_register_full()
225 dsi->channel = info->channel; in mipi_dsi_device_register_full()
226 strlcpy(dsi->name, info->type, sizeof(dsi->name)); in mipi_dsi_device_register_full()
230 drm_err(host, "failed to add DSI device %d\n", ret); in mipi_dsi_device_register_full()
240 * mipi_dsi_device_unregister - unregister MIPI DSI device
241 * @dsi: DSI peripheral device
245 device_unregister(&dsi->dev); in mipi_dsi_device_unregister()
253 * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
254 * device tree node
255 * @node: device tree node
259 * such device exists (or has not been registered yet).
268 if (host->dev->of_node == node) { in of_find_mipi_dsi_host_by_node()
284 for_each_available_child_of_node(host->dev->of_node, node) { in mipi_dsi_host_register()
292 list_add_tail(&host->list, &host_list); in mipi_dsi_host_register()
299 static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) in mipi_dsi_remove_device_fn()
310 device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn); in mipi_dsi_host_unregister()
313 list_del_init(&host->list); in mipi_dsi_host_unregister()
319 * mipi_dsi_attach - attach a DSI device to its DSI host
324 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_attach()
326 if (!ops || !ops->attach) in mipi_dsi_attach()
327 return -ENOSYS; in mipi_dsi_attach()
329 return ops->attach(dsi->host, dsi); in mipi_dsi_attach()
334 * mipi_dsi_detach - detach a DSI device from its DSI host
339 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_detach()
341 if (!ops || !ops->detach) in mipi_dsi_detach()
342 return -ENOSYS; in mipi_dsi_detach()
344 return ops->detach(dsi->host, dsi); in mipi_dsi_detach()
351 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_device_transfer()
353 if (!ops || !ops->transfer) in mipi_dsi_device_transfer()
354 return -ENOSYS; in mipi_dsi_device_transfer()
356 if (dsi->mode_flags & MIPI_DSI_MODE_LPM) in mipi_dsi_device_transfer()
357 msg->flags |= MIPI_DSI_MSG_USE_LPM; in mipi_dsi_device_transfer()
359 return ops->transfer(dsi->host, msg); in mipi_dsi_device_transfer()
363 * mipi_dsi_packet_format_is_short - check if a packet is of the short format
401 * mipi_dsi_packet_format_is_long - check if a packet is of the long format
434 * mipi_dsi_create_packet - create a packet from a message according to the
439 * Return: 0 on success or a negative error code on failure.
445 return -EINVAL; in mipi_dsi_create_packet()
448 if (!mipi_dsi_packet_format_is_short(msg->type) && in mipi_dsi_create_packet()
449 !mipi_dsi_packet_format_is_long(msg->type)) in mipi_dsi_create_packet()
450 return -EINVAL; in mipi_dsi_create_packet()
452 if (msg->channel > 3) in mipi_dsi_create_packet()
453 return -EINVAL; in mipi_dsi_create_packet()
456 packet->header[0] = ((msg->channel & 0x3) << 6) | (msg->type & 0x3f); in mipi_dsi_create_packet()
467 if (mipi_dsi_packet_format_is_long(msg->type)) { in mipi_dsi_create_packet()
468 packet->header[1] = (msg->tx_len >> 0) & 0xff; in mipi_dsi_create_packet()
469 packet->header[2] = (msg->tx_len >> 8) & 0xff; in mipi_dsi_create_packet()
471 packet->payload_length = msg->tx_len; in mipi_dsi_create_packet()
472 packet->payload = msg->tx_buf; in mipi_dsi_create_packet()
474 const u8 *tx = msg->tx_buf; in mipi_dsi_create_packet()
476 packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0; in mipi_dsi_create_packet()
477 packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0; in mipi_dsi_create_packet()
480 packet->size = sizeof(packet->header) + packet->payload_length; in mipi_dsi_create_packet()
487 * mipi_dsi_shutdown_peripheral() - sends a Shutdown Peripheral command
488 * @dsi: DSI peripheral device
490 * Return: 0 on success or a negative error code on failure.
495 .channel = dsi->channel, in mipi_dsi_shutdown_peripheral()
507 * mipi_dsi_turn_on_peripheral() - sends a Turn On Peripheral command
508 * @dsi: DSI peripheral device
510 * Return: 0 on success or a negative error code on failure.
515 .channel = dsi->channel, in mipi_dsi_turn_on_peripheral()
527 * mipi_dsi_set_maximum_return_packet_size() - specify the maximum size of the
530 * @dsi: DSI peripheral device
533 * Return: 0 on success or a negative error code on failure.
540 .channel = dsi->channel, in mipi_dsi_set_maximum_return_packet_size()
552 * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral
553 * @dsi: DSI peripheral device
556 * Enable or disable Display Stream Compression on the peripheral using the
559 * Return: 0 on success or a negative error code on failure.
563 /* Note: Needs updating for non-default PPS or algorithm */ in mipi_dsi_compression_mode()
566 .channel = dsi->channel, in mipi_dsi_compression_mode()
578 * mipi_dsi_picture_parameter_set() - transmit the DSC PPS to the peripheral
579 * @dsi: DSI peripheral device
584 * Return: 0 on success or a negative error code on failure.
590 .channel = dsi->channel, in mipi_dsi_picture_parameter_set()
602 * mipi_dsi_generic_write() - transmit data using a generic write packet
603 * @dsi: DSI peripheral device
607 * This function will automatically choose the right data type depending on
610 * Return: The number of bytes transmitted on success or a negative error code
611 * on failure.
617 .channel = dsi->channel, in mipi_dsi_generic_write()
645 * mipi_dsi_generic_read() - receive data using a generic read packet
646 * @dsi: DSI peripheral device
652 * This function will automatically choose the right data type depending on
655 * Return: The number of bytes successfully read or a negative error code on
662 .channel = dsi->channel, in mipi_dsi_generic_read()
683 return -EINVAL; in mipi_dsi_generic_read()
691 * mipi_dsi_dcs_write_buffer() - transmit a DCS command with payload
692 * @dsi: DSI peripheral device
696 * This function will automatically choose the right data type depending on
700 * code on failure.
706 .channel = dsi->channel, in mipi_dsi_dcs_write_buffer()
713 return -EINVAL; in mipi_dsi_dcs_write_buffer()
733 * mipi_dsi_dcs_write() - send DCS write command
734 * @dsi: DSI peripheral device
739 * This function will automatically choose the right data type depending on
743 * code on failure.
754 if (len > ARRAY_SIZE(stack_tx) - 1) { in mipi_dsi_dcs_write()
757 return -ENOMEM; in mipi_dsi_dcs_write()
777 * mipi_dsi_dcs_read() - send DCS read request command
778 * @dsi: DSI peripheral device
783 * Return: The number of bytes read or a negative error code on failure.
789 .channel = dsi->channel, in mipi_dsi_dcs_read()
802 * mipi_dsi_dcs_nop() - send DCS nop packet
803 * @dsi: DSI peripheral device
805 * Return: 0 on success or a negative error code on failure.
820 * mipi_dsi_dcs_soft_reset() - perform a software reset of the display module
821 * @dsi: DSI peripheral device
823 * Return: 0 on success or a negative error code on failure.
838 * mipi_dsi_dcs_get_power_mode() - query the display module's current power
840 * @dsi: DSI peripheral device
843 * Return: 0 on success or a negative error code on failure.
853 err = -ENODATA; in mipi_dsi_dcs_get_power_mode()
863 * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image
865 * @dsi: DSI peripheral device
868 * Return: 0 on success or a negative error code on failure.
878 err = -ENODATA; in mipi_dsi_dcs_get_pixel_format()
888 * mipi_dsi_dcs_enter_sleep_mode() - disable all unnecessary blocks inside the
890 * @dsi: DSI peripheral device
892 * Return: 0 on success or a negative error code on failure.
907 * mipi_dsi_dcs_exit_sleep_mode() - enable all blocks inside the display
909 * @dsi: DSI peripheral device
911 * Return: 0 on success or a negative error code on failure.
926 * mipi_dsi_dcs_set_display_off() - stop displaying the image data on the
927 * display device
928 * @dsi: DSI peripheral device
930 * Return: 0 on success or a negative error code on failure.
945 * mipi_dsi_dcs_set_display_on() - start displaying the image data on the
946 * display device
947 * @dsi: DSI peripheral device
949 * Return: 0 on success or a negative error code on failure
964 * mipi_dsi_dcs_set_column_address() - define the column extent of the frame
966 * @dsi: DSI peripheral device
970 * Return: 0 on success or a negative error code on failure.
988 * mipi_dsi_dcs_set_page_address() - define the page extent of the frame
990 * @dsi: DSI peripheral device
994 * Return: 0 on success or a negative error code on failure.
1012 * mipi_dsi_dcs_set_tear_off() - turn off the display module's Tearing Effect
1013 * output signal on the TE signal line
1014 * @dsi: DSI peripheral device
1016 * Return: 0 on success or a negative error code on failure
1031 * mipi_dsi_dcs_set_tear_on() - turn on the display module's Tearing Effect
1032 * output signal on the TE signal line.
1033 * @dsi: DSI peripheral device
1036 * Return: 0 on success or a negative error code on failure
1054 * mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image
1056 * @dsi: DSI peripheral device
1059 * Return: 0 on success or a negative error code on failure.
1075 * mipi_dsi_dcs_set_tear_scanline() - set the scanline to use as trigger for
1077 * @dsi: DSI peripheral device
1080 * Return: 0 on success or a negative error code on failure
1097 * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of the
1099 * @dsi: DSI peripheral device
1102 * Return: 0 on success or a negative error code on failure.
1120 * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
1122 * @dsi: DSI peripheral device
1125 * Return: 0 on success or a negative error code on failure.
1136 err = -ENODATA; in mipi_dsi_dcs_get_display_brightness()
1145 static int mipi_dsi_drv_probe(struct device *dev) in mipi_dsi_drv_probe()
1147 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_probe()
1150 return drv->probe(dsi); in mipi_dsi_drv_probe()
1153 static int mipi_dsi_drv_remove(struct device *dev) in mipi_dsi_drv_remove()
1155 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_remove()
1158 return drv->remove(dsi); in mipi_dsi_drv_remove()
1161 static void mipi_dsi_drv_shutdown(struct device *dev) in mipi_dsi_drv_shutdown()
1163 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_shutdown()
1166 drv->shutdown(dsi); in mipi_dsi_drv_shutdown()
1170 * mipi_dsi_driver_register_full() - register a driver for DSI devices
1174 * Return: 0 on success or a negative error code on failure.
1179 drv->driver.bus = &mipi_dsi_bus_type; in mipi_dsi_driver_register_full()
1180 drv->driver.owner = owner; in mipi_dsi_driver_register_full()
1182 if (drv->probe) in mipi_dsi_driver_register_full()
1183 drv->driver.probe = mipi_dsi_drv_probe; in mipi_dsi_driver_register_full()
1184 if (drv->remove) in mipi_dsi_driver_register_full()
1185 drv->driver.remove = mipi_dsi_drv_remove; in mipi_dsi_driver_register_full()
1186 if (drv->shutdown) in mipi_dsi_driver_register_full()
1187 drv->driver.shutdown = mipi_dsi_drv_shutdown; in mipi_dsi_driver_register_full()
1189 return driver_register(&drv->driver); in mipi_dsi_driver_register_full()
1194 * mipi_dsi_driver_unregister() - unregister a driver for DSI devices
1197 * Return: 0 on success or a negative error code on failure.
1201 driver_unregister(&drv->driver); in mipi_dsi_driver_unregister()