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>
51 static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv) in mipi_dsi_device_match()
59 /* compare DSI device and driver names */ in mipi_dsi_device_match()
60 if (!strcmp(dsi->name, drv->name)) in mipi_dsi_device_match()
66 static int mipi_dsi_uevent(const struct device *dev, struct kobj_uevent_env *env) in mipi_dsi_uevent()
72 if (err != -ENODEV) in mipi_dsi_uevent()
76 dsi->name); in mipi_dsi_uevent()
93 .name = "mipi-dsi",
100 * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a
101 * device tree node
102 * @np: device tree node
104 * Return: A pointer to the MIPI DSI device corresponding to @np or NULL if no
105 * such device exists (or has not been registered yet).
109 struct device *dev; in of_find_mipi_dsi_device_by_node()
117 static void mipi_dsi_dev_release(struct device *dev) in mipi_dsi_dev_release()
121 of_node_put(dev->of_node); in mipi_dsi_dev_release()
135 return ERR_PTR(-ENOMEM); in mipi_dsi_device_alloc()
137 dsi->host = host; in mipi_dsi_device_alloc()
138 dsi->dev.bus = &mipi_dsi_bus_type; in mipi_dsi_device_alloc()
139 dsi->dev.parent = host->dev; in mipi_dsi_device_alloc()
140 dsi->dev.type = &mipi_dsi_device_type; in mipi_dsi_device_alloc()
142 device_initialize(&dsi->dev); in mipi_dsi_device_alloc()
149 struct mipi_dsi_host *host = dsi->host; in mipi_dsi_device_add()
151 dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), dsi->channel); in mipi_dsi_device_add()
153 return device_add(&dsi->dev); in mipi_dsi_device_add()
165 drm_err(host, "modalias failure on %pOF\n", node); in of_mipi_dsi_device_add()
166 return ERR_PTR(-EINVAL); in of_mipi_dsi_device_add()
171 drm_err(host, "device node %pOF has no valid reg property: %d\n", in of_mipi_dsi_device_add()
173 return ERR_PTR(-EINVAL); in of_mipi_dsi_device_add()
185 return ERR_PTR(-ENODEV); in of_mipi_dsi_device_add()
190 * mipi_dsi_device_register_full - create a MIPI DSI device
191 * @host: DSI host to which this device is connected
192 * @info: pointer to template containing DSI device information
194 * Create a MIPI DSI device by using the device information provided by
198 * A pointer to the newly created MIPI DSI device, or, a pointer encoded
210 return ERR_PTR(-EINVAL); in mipi_dsi_device_register_full()
213 if (info->channel > 3) { in mipi_dsi_device_register_full()
214 drm_err(host, "invalid virtual channel: %u\n", info->channel); in mipi_dsi_device_register_full()
215 return ERR_PTR(-EINVAL); in mipi_dsi_device_register_full()
220 drm_err(host, "failed to allocate DSI device %ld\n", in mipi_dsi_device_register_full()
225 device_set_node(&dsi->dev, of_fwnode_handle(info->node)); in mipi_dsi_device_register_full()
226 dsi->channel = info->channel; in mipi_dsi_device_register_full()
227 strscpy(dsi->name, info->type, sizeof(dsi->name)); in mipi_dsi_device_register_full()
231 drm_err(host, "failed to add DSI device %d\n", ret); in mipi_dsi_device_register_full()
241 * mipi_dsi_device_unregister - unregister MIPI DSI device
242 * @dsi: DSI peripheral device
246 device_unregister(&dsi->dev); in mipi_dsi_device_unregister()
258 * devm_mipi_dsi_device_register_full - create a managed MIPI DSI device
259 * @dev: device to tie the MIPI-DSI device lifetime to
260 * @host: DSI host to which this device is connected
261 * @info: pointer to template containing DSI device information
263 * Create a MIPI DSI device by using the device information provided by
271 * A pointer to the newly created MIPI DSI device, or, a pointer encoded
275 devm_mipi_dsi_device_register_full(struct device *dev, in devm_mipi_dsi_device_register_full()
300 * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
301 * device tree node
302 * @node: device tree node
306 * such device exists (or has not been registered yet).
315 if (host->dev->of_node == node) { in of_find_mipi_dsi_host_by_node()
331 for_each_available_child_of_node(host->dev->of_node, node) { in mipi_dsi_host_register()
339 list_add_tail(&host->list, &host_list); in mipi_dsi_host_register()
346 static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) in mipi_dsi_remove_device_fn()
358 device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn); in mipi_dsi_host_unregister()
361 list_del_init(&host->list); in mipi_dsi_host_unregister()
367 * mipi_dsi_attach - attach a DSI device to its DSI host
372 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_attach()
374 if (!ops || !ops->attach) in mipi_dsi_attach()
375 return -ENOSYS; in mipi_dsi_attach()
377 return ops->attach(dsi->host, dsi); in mipi_dsi_attach()
382 * mipi_dsi_detach - detach a DSI device from its DSI host
387 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_detach()
389 if (!ops || !ops->detach) in mipi_dsi_detach()
390 return -ENOSYS; in mipi_dsi_detach()
392 return ops->detach(dsi->host, dsi); in mipi_dsi_detach()
404 * devm_mipi_dsi_attach - Attach a MIPI-DSI device to its DSI Host
405 * @dev: device to tie the MIPI-DSI device attachment lifetime to
412 * 0 on success, a negative error code on failure.
414 int devm_mipi_dsi_attach(struct device *dev, in devm_mipi_dsi_attach()
434 const struct mipi_dsi_host_ops *ops = dsi->host->ops; in mipi_dsi_device_transfer()
436 if (!ops || !ops->transfer) in mipi_dsi_device_transfer()
437 return -ENOSYS; in mipi_dsi_device_transfer()
439 if (dsi->mode_flags & MIPI_DSI_MODE_LPM) in mipi_dsi_device_transfer()
440 msg->flags |= MIPI_DSI_MSG_USE_LPM; in mipi_dsi_device_transfer()
442 return ops->transfer(dsi->host, msg); in mipi_dsi_device_transfer()
446 * mipi_dsi_packet_format_is_short - check if a packet is of the short format
484 * mipi_dsi_packet_format_is_long - check if a packet is of the long format
517 * mipi_dsi_create_packet - create a packet from a message according to the
522 * Return: 0 on success or a negative error code on failure.
528 return -EINVAL; in mipi_dsi_create_packet()
531 if (!mipi_dsi_packet_format_is_short(msg->type) && in mipi_dsi_create_packet()
532 !mipi_dsi_packet_format_is_long(msg->type)) in mipi_dsi_create_packet()
533 return -EINVAL; in mipi_dsi_create_packet()
535 if (msg->channel > 3) in mipi_dsi_create_packet()
536 return -EINVAL; in mipi_dsi_create_packet()
539 packet->header[0] = ((msg->channel & 0x3) << 6) | (msg->type & 0x3f); in mipi_dsi_create_packet()
550 if (mipi_dsi_packet_format_is_long(msg->type)) { in mipi_dsi_create_packet()
551 packet->header[1] = (msg->tx_len >> 0) & 0xff; in mipi_dsi_create_packet()
552 packet->header[2] = (msg->tx_len >> 8) & 0xff; in mipi_dsi_create_packet()
554 packet->payload_length = msg->tx_len; in mipi_dsi_create_packet()
555 packet->payload = msg->tx_buf; in mipi_dsi_create_packet()
557 const u8 *tx = msg->tx_buf; in mipi_dsi_create_packet()
559 packet->header[1] = (msg->tx_len > 0) ? tx[0] : 0; in mipi_dsi_create_packet()
560 packet->header[2] = (msg->tx_len > 1) ? tx[1] : 0; in mipi_dsi_create_packet()
563 packet->size = sizeof(packet->header) + packet->payload_length; in mipi_dsi_create_packet()
570 * mipi_dsi_shutdown_peripheral() - sends a Shutdown Peripheral command
571 * @dsi: DSI peripheral device
573 * Return: 0 on success or a negative error code on failure.
578 .channel = dsi->channel, in mipi_dsi_shutdown_peripheral()
590 * mipi_dsi_turn_on_peripheral() - sends a Turn On Peripheral command
591 * @dsi: DSI peripheral device
593 * Return: 0 on success or a negative error code on failure.
598 .channel = dsi->channel, in mipi_dsi_turn_on_peripheral()
610 * mipi_dsi_set_maximum_return_packet_size() - specify the maximum size of
613 * @dsi: DSI peripheral device
616 * Return: 0 on success or a negative error code on failure.
623 .channel = dsi->channel, in mipi_dsi_set_maximum_return_packet_size()
635 * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral
636 * @dsi: DSI peripheral device
639 * Enable or disable Display Stream Compression on the peripheral using the
642 * Return: 0 on success or a negative error code on failure.
646 /* Note: Needs updating for non-default PPS or algorithm */ in mipi_dsi_compression_mode()
649 .channel = dsi->channel, in mipi_dsi_compression_mode()
661 * mipi_dsi_picture_parameter_set() - transmit the DSC PPS to the peripheral
662 * @dsi: DSI peripheral device
667 * Return: 0 on success or a negative error code on failure.
673 .channel = dsi->channel, in mipi_dsi_picture_parameter_set()
685 * mipi_dsi_generic_write() - transmit data using a generic write packet
686 * @dsi: DSI peripheral device
690 * This function will automatically choose the right data type depending on
693 * Return: The number of bytes transmitted on success or a negative error code
694 * on failure.
700 .channel = dsi->channel, in mipi_dsi_generic_write()
728 * mipi_dsi_generic_read() - receive data using a generic read packet
729 * @dsi: DSI peripheral device
735 * This function will automatically choose the right data type depending on
738 * Return: The number of bytes successfully read or a negative error code on
745 .channel = dsi->channel, in mipi_dsi_generic_read()
766 return -EINVAL; in mipi_dsi_generic_read()
774 * mipi_dsi_dcs_write_buffer() - transmit a DCS command with payload
775 * @dsi: DSI peripheral device
779 * This function will automatically choose the right data type depending on
783 * code on failure.
789 .channel = dsi->channel, in mipi_dsi_dcs_write_buffer()
796 return -EINVAL; in mipi_dsi_dcs_write_buffer()
816 * mipi_dsi_dcs_write() - send DCS write command
817 * @dsi: DSI peripheral device
822 * This function will automatically choose the right data type depending on
826 * code on failure.
837 if (len > ARRAY_SIZE(stack_tx) - 1) { in mipi_dsi_dcs_write()
840 return -ENOMEM; in mipi_dsi_dcs_write()
860 * mipi_dsi_dcs_read() - send DCS read request command
861 * @dsi: DSI peripheral device
866 * Return: The number of bytes read or a negative error code on failure.
872 .channel = dsi->channel, in mipi_dsi_dcs_read()
885 * mipi_dsi_dcs_nop() - send DCS nop packet
886 * @dsi: DSI peripheral device
888 * Return: 0 on success or a negative error code on failure.
903 * mipi_dsi_dcs_soft_reset() - perform a software reset of the display module
904 * @dsi: DSI peripheral device
906 * Return: 0 on success or a negative error code on failure.
921 * mipi_dsi_dcs_get_power_mode() - query the display module's current power
923 * @dsi: DSI peripheral device
926 * Return: 0 on success or a negative error code on failure.
936 err = -ENODATA; in mipi_dsi_dcs_get_power_mode()
946 * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image
948 * @dsi: DSI peripheral device
951 * Return: 0 on success or a negative error code on failure.
961 err = -ENODATA; in mipi_dsi_dcs_get_pixel_format()
971 * mipi_dsi_dcs_enter_sleep_mode() - disable all unnecessary blocks inside the
973 * @dsi: DSI peripheral device
975 * Return: 0 on success or a negative error code on failure.
990 * mipi_dsi_dcs_exit_sleep_mode() - enable all blocks inside the display
992 * @dsi: DSI peripheral device
994 * Return: 0 on success or a negative error code on failure.
1009 * mipi_dsi_dcs_set_display_off() - stop displaying the image data on the
1010 * display device
1011 * @dsi: DSI peripheral device
1013 * Return: 0 on success or a negative error code on failure.
1028 * mipi_dsi_dcs_set_display_on() - start displaying the image data on the
1029 * display device
1030 * @dsi: DSI peripheral device
1032 * Return: 0 on success or a negative error code on failure
1047 * mipi_dsi_dcs_set_column_address() - define the column extent of the frame
1049 * @dsi: DSI peripheral device
1053 * Return: 0 on success or a negative error code on failure.
1071 * mipi_dsi_dcs_set_page_address() - define the page extent of the frame
1073 * @dsi: DSI peripheral device
1077 * Return: 0 on success or a negative error code on failure.
1095 * mipi_dsi_dcs_set_tear_off() - turn off the display module's Tearing Effect
1096 * output signal on the TE signal line
1097 * @dsi: DSI peripheral device
1099 * Return: 0 on success or a negative error code on failure
1114 * mipi_dsi_dcs_set_tear_on() - turn on the display module's Tearing Effect
1115 * output signal on the TE signal line.
1116 * @dsi: DSI peripheral device
1119 * Return: 0 on success or a negative error code on failure
1137 * mipi_dsi_dcs_set_pixel_format() - sets the pixel format for the RGB image
1139 * @dsi: DSI peripheral device
1142 * Return: 0 on success or a negative error code on failure.
1158 * mipi_dsi_dcs_set_tear_scanline() - set the scanline to use as trigger for
1160 * @dsi: DSI peripheral device
1163 * Return: 0 on success or a negative error code on failure
1180 * mipi_dsi_dcs_set_display_brightness() - sets the brightness value of the
1182 * @dsi: DSI peripheral device
1185 * Return: 0 on success or a negative error code on failure.
1203 * mipi_dsi_dcs_get_display_brightness() - gets the current brightness value
1205 * @dsi: DSI peripheral device
1208 * Return: 0 on success or a negative error code on failure.
1219 err = -ENODATA; in mipi_dsi_dcs_get_display_brightness()
1229 * mipi_dsi_dcs_set_display_brightness_large() - sets the 16-bit brightness value
1231 * @dsi: DSI peripheral device
1234 * Return: 0 on success or a negative error code on failure.
1252 * mipi_dsi_dcs_get_display_brightness_large() - gets the current 16-bit
1254 * @dsi: DSI peripheral device
1257 * Return: 0 on success or a negative error code on failure.
1269 err = -ENODATA; in mipi_dsi_dcs_get_display_brightness_large()
1280 static int mipi_dsi_drv_probe(struct device *dev) in mipi_dsi_drv_probe()
1282 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_probe()
1285 return drv->probe(dsi); in mipi_dsi_drv_probe()
1288 static int mipi_dsi_drv_remove(struct device *dev) in mipi_dsi_drv_remove()
1290 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_remove()
1293 drv->remove(dsi); in mipi_dsi_drv_remove()
1298 static void mipi_dsi_drv_shutdown(struct device *dev) in mipi_dsi_drv_shutdown()
1300 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver); in mipi_dsi_drv_shutdown()
1303 drv->shutdown(dsi); in mipi_dsi_drv_shutdown()
1307 * mipi_dsi_driver_register_full() - register a driver for DSI devices
1311 * Return: 0 on success or a negative error code on failure.
1316 drv->driver.bus = &mipi_dsi_bus_type; in mipi_dsi_driver_register_full()
1317 drv->driver.owner = owner; in mipi_dsi_driver_register_full()
1319 if (drv->probe) in mipi_dsi_driver_register_full()
1320 drv->driver.probe = mipi_dsi_drv_probe; in mipi_dsi_driver_register_full()
1321 if (drv->remove) in mipi_dsi_driver_register_full()
1322 drv->driver.remove = mipi_dsi_drv_remove; in mipi_dsi_driver_register_full()
1323 if (drv->shutdown) in mipi_dsi_driver_register_full()
1324 drv->driver.shutdown = mipi_dsi_drv_shutdown; in mipi_dsi_driver_register_full()
1326 return driver_register(&drv->driver); in mipi_dsi_driver_register_full()
1331 * mipi_dsi_driver_unregister() - unregister a driver for DSI devices
1334 * Return: 0 on success or a negative error code on failure.
1338 driver_unregister(&drv->driver); in mipi_dsi_driver_unregister()