/* request ACK from peripheral */ #define MIPI_DSI_MSG_REQ_ACK BIT(0) /* use Low Power Mode to transmit message */ #define MIPI_DSI_MSG_USE_LPM BIT(1)
/** * struct mipi_dsi_msg - read/write DSI buffer * @channel: virtual channel id * @type: payload data type * @flags: flags controlling this message transmission * @tx_len: length of @tx_buf * @tx_buf: data to be written * @rx_len: length of @rx_buf * @rx_buf: data to be read, or NULL
*/ struct mipi_dsi_msg {
u8 channel;
u8 type;
u16 flags;
/** * struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format * @size: size (in bytes) of the packet * @header: the four bytes that make up the header (Data ID, Word Count or * Packet Data, and ECC) * @payload_length: number of bytes in the payload * @payload: a pointer to a buffer containing the payload, if any
*/ struct mipi_dsi_packet {
size_t size;
u8 header[4];
size_t payload_length; const u8 *payload;
};
int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, conststruct mipi_dsi_msg *msg);
/** * struct mipi_dsi_host_ops - DSI bus operations * @attach: attach DSI device to DSI host * @detach: detach DSI device from DSI host * @transfer: transmit a DSI packet * * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg * structures. This structure contains information about the type of packet * being transmitted as well as the transmit and receive buffers. When an * error is encountered during transmission, this function will return a * negative error code. On success it shall return the number of bytes * transmitted for write packets or the number of bytes received for read * packets. * * Note that typically DSI packet transmission is atomic, so the .transfer() * function will seldomly return anything other than the number of bytes * contained in the transmit buffer on success. * * Also note that those callbacks can be called no matter the state the * host is in. Drivers that need the underlying device to be powered to * perform these operations will first need to make sure it's been * properly enabled.
*/ struct mipi_dsi_host_ops { int (*attach)(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi); int (*detach)(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi);
ssize_t (*transfer)(struct mipi_dsi_host *host, conststruct mipi_dsi_msg *msg);
};
/** * struct mipi_dsi_device_info - template for creating a mipi_dsi_device * @type: DSI peripheral chip type * @channel: DSI virtual channel assigned to peripheral * @node: pointer to OF device node or NULL * * This is populated and passed to mipi_dsi_device_new to create a new * DSI device
*/ struct mipi_dsi_device_info { char type[DSI_DEV_NAME_SIZE];
u32 channel; struct device_node *node;
};
/** * struct mipi_dsi_device - DSI peripheral device * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral * @attached: the DSI device has been successfully attached * @name: DSI peripheral chip type * @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode * @lanes: number of active data lanes * @mode_flags: DSI operation mode related flags * @hs_rate: maximum lane frequency for high speed mode in hertz, this should * be set to the real limits of the hardware, zero is only accepted for * legacy drivers * @lp_rate: maximum lane frequency for low power mode in hertz, this should * be set to the real limits of the hardware, zero is only accepted for * legacy drivers * @dsc: panel/bridge DSC pps payload to be sent
*/ struct mipi_dsi_device { struct mipi_dsi_host *host; struct device dev; bool attached;
/** * struct mipi_dsi_multi_context - Context to call multiple MIPI DSI funcs in a row
*/ struct mipi_dsi_multi_context { /** * @dsi: Pointer to the MIPI DSI device
*/ struct mipi_dsi_device *dsi;
/** * @accum_err: Storage for the accumulated error over the multiple calls * * Init to 0. If a function encounters an error then the error code * will be stored here. If you call a function and this points to a * non-zero value then the function will be a noop. This allows calling * a function many times in a row and just checking the error at the * end to see if any of them failed.
*/ int accum_err;
};
/** * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for any * given pixel format defined by the MIPI DSI * specification * @fmt: MIPI DSI pixel format * * Returns: The number of bits per pixel of the given pixel format.
*/ staticinlineint mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt)
{ switch (fmt) { case MIPI_DSI_FMT_RGB888: case MIPI_DSI_FMT_RGB666: return 24;
case MIPI_DSI_FMT_RGB666_PACKED: return 18;
case MIPI_DSI_FMT_RGB565: return 16;
}
return -EINVAL;
}
enum mipi_dsi_compression_algo {
MIPI_DSI_COMPRESSION_DSC = 0,
MIPI_DSI_COMPRESSION_VENDOR = 3, /* other two values are reserved, DSI 1.3 */
};
struct mipi_dsi_device *
mipi_dsi_device_register_full(struct mipi_dsi_host *host, conststruct mipi_dsi_device_info *info); void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi); struct mipi_dsi_device *
devm_mipi_dsi_device_register_full(struct device *dev, struct mipi_dsi_host *host, conststruct mipi_dsi_device_info *info); struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi); int devm_mipi_dsi_attach(struct device *dev, struct mipi_dsi_device *dsi); int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi); int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi); int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
u16 value); int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable); int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, enum mipi_dsi_compression_algo algo, unsignedint pps_selector); int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi, conststruct drm_dsc_picture_parameter_set *pps);
#define mipi_dsi_msleep(ctx, delay) \ do { \ if (!(ctx)->accum_err) \
msleep(delay); \
} while (0)
#define mipi_dsi_usleep_range(ctx, min, max) \ do { \ if (!(ctx)->accum_err) \
usleep_range(min, max); \
} while (0)
/** * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking * information only * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both * V-Blanking and H-Blanking information
*/ enum mipi_dsi_dcs_tear_mode {
MIPI_DSI_DCS_TEAR_MODE_VBLANK,
MIPI_DSI_DCS_TEAR_MODE_VHBLANK,
};
/** * mipi_dsi_generic_write_seq - transmit data using a generic write packet * * This macro will print errors for you and will RETURN FROM THE CALLING * FUNCTION (yes this is non-intuitive) upon error. * * Because of the non-intuitive return behavior, THIS MACRO IS DEPRECATED. * Please replace calls of it with mipi_dsi_generic_write_seq_multi(). * * @dsi: DSI peripheral device * @seq: buffer containing the payload
*/ #define mipi_dsi_generic_write_seq(dsi, seq...) \ do { \ staticconst u8 d[] = { seq }; \ int ret; \
ret = mipi_dsi_generic_write_chatty(dsi, d, ARRAY_SIZE(d)); \ if (ret < 0) \ return ret; \
} while (0)
/** * mipi_dsi_generic_write_seq_multi - transmit data using a generic write packet * * This macro will print errors for you and error handling is optimized for * callers that call this multiple times in a row. * * @ctx: Context for multiple DSI transactions * @seq: buffer containing the payload
*/ #define mipi_dsi_generic_write_seq_multi(ctx, seq...) \ do { \ staticconst u8 d[] = { seq }; \
mipi_dsi_generic_write_multi(ctx, d, ARRAY_SIZE(d)); \
} while (0)
/** * mipi_dsi_dcs_write_seq_multi - transmit a DCS command with payload * * This macro will print errors for you and error handling is optimized for * callers that call this multiple times in a row. * * @ctx: Context for multiple DSI transactions * @cmd: Command * @seq: buffer containing data to be transmitted
*/ #define mipi_dsi_dcs_write_seq_multi(ctx, cmd, seq...) \ do { \ staticconst u8 d[] = { cmd, seq }; \
mipi_dsi_dcs_write_buffer_multi(ctx, d, ARRAY_SIZE(d)); \
} while (0)
/** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver * @probe: callback for device binding * @remove: callback for device unbinding * @shutdown: called at shutdown time to quiesce the device
*/ struct mipi_dsi_driver { struct device_driver driver; int(*probe)(struct mipi_dsi_device *dsi); void (*remove)(struct mipi_dsi_device *dsi); void (*shutdown)(struct mipi_dsi_device *dsi);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.