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
28 #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()
257 * devm_mipi_dsi_device_register_full - create a managed MIPI DSI device
258 * @dev: device to tie the MIPI-DSI device lifetime to
259 * @host: DSI host to which this device is connected
260 * @info: pointer to template containing DSI device information
262 * Create a MIPI DSI device by using the device information provided by
270 * A pointer to the newly created MIPI DSI device, or, a pointer encoded
274 devm_mipi_dsi_device_register_full(struct device *dev, in devm_mipi_dsi_device_register_full()
299 * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
300 * device tree node
301 * @node: device tree node
305 * such device exists (or has not been registered yet).
314 if (host->dev->of_node == node) { in of_find_mipi_dsi_host_by_node()
330 for_each_available_child_of_node(host->dev->of_node, node) { in mipi_dsi_host_register()
338 list_add_tail(&host->list, &host_list); in mipi_dsi_host_register()
345 static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) in mipi_dsi_remove_device_fn()
357 device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn); in mipi_dsi_host_unregister()
360 list_del_init(&host->list); in mipi_dsi_host_unregister()
366 * mipi_dsi_attach - attach a DSI device to its DSI host
371 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_attach()
373 if (!ops || !ops->attach) in mipi_dsi_attach()
374 return -ENOSYS; in mipi_dsi_attach()
376 return ops->attach(dsi->host, dsi); in mipi_dsi_attach()
381 * mipi_dsi_detach - detach a DSI device from its DSI host
386 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_detach()
388 if (!ops || !ops->detach) in mipi_dsi_detach()
389 return -ENOSYS; in mipi_dsi_detach()
391 return ops->detach(dsi->host, dsi); in mipi_dsi_detach()
403 * devm_mipi_dsi_attach - Attach a MIPI-DSI device to its DSI Host
404 * @dev: device to tie the MIPI-DSI device attachment lifetime to
411 * 0 on success, a negative error code on failure.
413 int devm_mipi_dsi_attach(struct device *dev, in devm_mipi_dsi_attach()
433 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_device_transfer()
435 if (!ops || !ops->transfer) in mipi_dsi_device_transfer()
436 return -ENOSYS; in mipi_dsi_device_transfer()
438 if (dsi->mode_flags & MIPI_DSI_MODE_LPM) in mipi_dsi_device_transfer()
439 msg->flags |= MIPI_DSI_MSG_USE_LPM; in mipi_dsi_device_transfer()
441 return ops->transfer(dsi->host, msg); in mipi_dsi_device_transfer()
445 * mipi_dsi_packet_format_is_short - check if a packet is of the short format
483 * mipi_dsi_packet_format_is_long - check if a packet is of the long format
516 * mipi_dsi_create_packet - create a packet from a message according to the
521 * Return: 0 on success or a negative error code on failure.
527 return -EINVAL; in mipi_dsi_create_packet()
530 if (!mipi_dsi_packet_format_is_short(msg->type) && in mipi_dsi_create_packet()
531 !mipi_dsi_packet_format_is_long(msg->type)) in mipi_dsi_create_packet()
532 return -EINVAL; in mipi_dsi_create_packet()
534 if (msg->channel > 3) in mipi_dsi_create_packet()
535 return -EINVAL; in mipi_dsi_create_packet()
538 packet->header[0] = ((msg->channel & 0x3) << 6) | (msg->type & 0x3f); in mipi_dsi_create_packet()
549 if (mipi_dsi_packet_format_is_long(msg->type)) { in mipi_dsi_create_packet()
550 packet->header[1] = (msg->tx_len >> 0) & 0xff; in mipi_dsi_create_packet()
551 packet->header[2] = (msg->tx_len >> 8) & 0xff; in mipi_dsi_create_packet()
553 packet->payload_length = msg->tx_len; in mipi_dsi_create_packet()
554 packet->payload = msg->tx_buf; in mipi_dsi_create_packet()
556 const u8 *tx = msg->tx_buf; in mipi_dsi_create_packet()
558 packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0; in mipi_dsi_create_packet()
559 packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0; in mipi_dsi_create_packet()
562 packet->size = sizeof(packet->header) + packet->payload_length; in mipi_dsi_create_packet()
569 * mipi_dsi_shutdown_peripheral() - sends a Shutdown Peripheral command
570 * @dsi: DSI peripheral device
572 * Return: 0 on success or a negative error code on failure.
577 .channel = dsi->channel, in mipi_dsi_shutdown_peripheral()
589 * mipi_dsi_turn_on_peripheral() - sends a Turn On Peripheral command
590 * @dsi: DSI peripheral device
592 * Return: 0 on success or a negative error code on failure.
597 .channel = dsi->channel, in mipi_dsi_turn_on_peripheral()
609 * mipi_dsi_set_maximum_return_packet_size() - specify the maximum size of the
612 * @dsi: DSI peripheral device
615 * Return: 0 on success or a negative error code on failure.
622 .channel = dsi->channel, in mipi_dsi_set_maximum_return_packet_size()
634 * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral
635 * @dsi: DSI peripheral device
638 * Enable or disable Display Stream Compression on the peripheral using the
641 * Return: 0 on success or a negative error code on failure.
645 /* Note: Needs updating for non-default PPS or algorithm */ in mipi_dsi_compression_mode()
648 .channel = dsi->channel, in mipi_dsi_compression_mode()
660 * mipi_dsi_picture_parameter_set() - transmit the DSC PPS to the peripheral
661 * @dsi: DSI peripheral device
666 * Return: 0 on success or a negative error code on failure.
672 .channel = dsi->channel, in mipi_dsi_picture_parameter_set()
684 * mipi_dsi_generic_write() - transmit data using a generic write packet
685 * @dsi: DSI peripheral device
689 * This function will automatically choose the right data type depending on
692 * Return: The number of bytes transmitted on success or a negative error code
693 * on failure.
699 .channel = dsi->channel, in mipi_dsi_generic_write()
727 * mipi_dsi_generic_read() - receive data using a generic read packet
728 * @dsi: DSI peripheral device
734 * This function will automatically choose the right data type depending on
737 * Return: The number of bytes successfully read or a negative error code on
744 .channel = dsi->channel, in mipi_dsi_generic_read()
765 return -EINVAL; in mipi_dsi_generic_read()
773 * mipi_dsi_dcs_write_buffer() - transmit a DCS command with payload
774 * @dsi: DSI peripheral device
778 * This function will automatically choose the right data type depending on
782 * code on failure.
788 .channel = dsi->channel, in mipi_dsi_dcs_write_buffer()
795 return -EINVAL; in mipi_dsi_dcs_write_buffer()
815 * mipi_dsi_dcs_write() - send DCS write command
816 * @dsi: DSI peripheral device
821 * This function will automatically choose the right data type depending on
825 * code on failure.
836 if (len > ARRAY_SIZE(stack_tx) - 1) { in mipi_dsi_dcs_write()
839 return -ENOMEM; in mipi_dsi_dcs_write()
859 * mipi_dsi_dcs_read() - send DCS read request command
860 * @dsi: DSI peripheral device
865 * Return: The number of bytes read or a negative error code on failure.
871 .channel = dsi->channel, in mipi_dsi_dcs_read()
884 * mipi_dsi_dcs_nop() - send DCS nop packet
885 * @dsi: DSI peripheral device
887 * Return: 0 on success or a negative error code on failure.
902 * mipi_dsi_dcs_soft_reset() - perform a software reset of the display module
903 * @dsi: DSI peripheral device
905 * Return: 0 on success or a negative error code on failure.
920 * mipi_dsi_dcs_get_power_mode() - query the display module's current power
922 * @dsi: DSI peripheral device
925 * Return: 0 on success or a negative error code on failure.
935 err = -ENODATA; in mipi_dsi_dcs_get_power_mode()
945 * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image
947 * @dsi: DSI peripheral device
950 * Return: 0 on success or a negative error code on failure.
960 err = -ENODATA; in mipi_dsi_dcs_get_pixel_format()
970 * mipi_dsi_dcs_enter_sleep_mode() - disable all unnecessary blocks inside the
972 * @dsi: DSI peripheral device
974 * Return: 0 on success or a negative error code on failure.
989 * mipi_dsi_dcs_exit_sleep_mode() - enable all blocks inside the display
991 * @dsi: DSI peripheral device
993 * Return: 0 on success or a negative error code on failure.
1008 * mipi_dsi_dcs_set_display_off() - stop displaying the image data on the
1009 * display device
1010 * @dsi: DSI peripheral device
1012 * Return: 0 on success or a negative error code on failure.
1027 * mipi_dsi_dcs_set_display_on() - start displaying the image data on the
1028 * display device
1029 * @dsi: DSI peripheral device
1031 * Return: 0 on success or a negative error code on failure
1046 * mipi_dsi_dcs_set_column_address() - define the column extent of the frame
1048 * @dsi: DSI peripheral device
1052 * Return: 0 on success or a negative error code on failure.
1070 * mipi_dsi_dcs_set_page_address() - define the page extent of the frame
1072 * @dsi: DSI peripheral device
1076 * Return: 0 on success or a negative error code on failure.
1094 * mipi_dsi_dcs_set_tear_off() - turn off the display module's Tearing Effect
1095 * output signal on the TE signal line
1096 * @dsi: DSI peripheral device
1098 * Return: 0 on success or a negative error code on failure
1113 * mipi_dsi_dcs_set_tear_on() - turn on the display module's Tearing Effect
1114 * output signal on the TE signal line.
1115 * @dsi: DSI peripheral device
1118 * Return: 0 on success or a negative error code on failure
1136 * mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image
1138 * @dsi: DSI peripheral device
1141 * Return: 0 on success or a negative error code on failure.
1157 * mipi_dsi_dcs_set_tear_scanline() - set the scanline to use as trigger for
1159 * @dsi: DSI peripheral device
1162 * Return: 0 on success or a negative error code on failure
1179 * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of the
1181 * @dsi: DSI peripheral device
1184 * Return: 0 on success or a negative error code on failure.
1202 * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
1204 * @dsi: DSI peripheral device
1207 * Return: 0 on success or a negative error code on failure.
1218 err = -ENODATA; in mipi_dsi_dcs_get_display_brightness()
1227 static int mipi_dsi_drv_probe(struct device *dev) in mipi_dsi_drv_probe()
1229 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_probe()
1232 return drv->probe(dsi); in mipi_dsi_drv_probe()
1235 static int mipi_dsi_drv_remove(struct device *dev) in mipi_dsi_drv_remove()
1237 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_remove()
1240 drv->remove(dsi); in mipi_dsi_drv_remove()
1245 static void mipi_dsi_drv_shutdown(struct device *dev) in mipi_dsi_drv_shutdown()
1247 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_shutdown()
1250 drv->shutdown(dsi); in mipi_dsi_drv_shutdown()
1254 * mipi_dsi_driver_register_full() - register a driver for DSI devices
1258 * Return: 0 on success or a negative error code on failure.
1263 drv->driver.bus = &mipi_dsi_bus_type; in mipi_dsi_driver_register_full()
1264 drv->driver.owner = owner; in mipi_dsi_driver_register_full()
1266 if (drv->probe) in mipi_dsi_driver_register_full()
1267 drv->driver.probe = mipi_dsi_drv_probe; in mipi_dsi_driver_register_full()
1268 if (drv->remove) in mipi_dsi_driver_register_full()
1269 drv->driver.remove = mipi_dsi_drv_remove; in mipi_dsi_driver_register_full()
1270 if (drv->shutdown) in mipi_dsi_driver_register_full()
1271 drv->driver.shutdown = mipi_dsi_drv_shutdown; in mipi_dsi_driver_register_full()
1273 return driver_register(&drv->driver); in mipi_dsi_driver_register_full()
1278 * mipi_dsi_driver_unregister() - unregister a driver for DSI devices
1281 * Return: 0 on success or a negative error code on failure.
1285 driver_unregister(&drv->driver); in mipi_dsi_driver_unregister()