staticint truly_dcs_write(struct drm_panel *panel, u32 command)
{ struct truly_nt35597 *ctx = panel_to_ctx(panel); int i, ret;
for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) {
ret = mipi_dsi_dcs_write(ctx->dsi[i], command, NULL, 0); if (ret < 0) {
dev_err(ctx->dev, "cmd 0x%x failed for dsi = %d\n", command, i);
}
}
return ret;
}
staticint truly_dcs_write_buf(struct drm_panel *panel,
u32 size, const u8 *buf)
{ struct truly_nt35597 *ctx = panel_to_ctx(panel); int ret = 0; int i;
for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) {
ret = mipi_dsi_dcs_write_buffer(ctx->dsi[i], buf, size); if (ret < 0) {
dev_err(ctx->dev, "failed to tx cmd [%d], err: %d\n", i, ret); return ret;
}
}
return ret;
}
staticint truly_35597_power_on(struct truly_nt35597 *ctx)
{ int ret, i;
for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) {
ret = regulator_set_load(ctx->supplies[i].consumer,
regulator_enable_loads[i]); if (ret) return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret < 0) return ret;
/* * Reset sequence of truly panel requires the panel to be * out of reset for 10ms, followed by being held in reset * for 10ms and then out again
*/
gpiod_set_value(ctx->reset_gpio, 0);
usleep_range(10000, 20000);
gpiod_set_value(ctx->reset_gpio, 1);
usleep_range(10000, 20000);
gpiod_set_value(ctx->reset_gpio, 0);
usleep_range(10000, 20000);
return 0;
}
staticint truly_nt35597_power_off(struct truly_nt35597 *ctx)
{ int ret = 0; int i;
gpiod_set_value(ctx->reset_gpio, 1);
for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) {
ret = regulator_set_load(ctx->supplies[i].consumer,
regulator_disable_loads[i]); if (ret) {
dev_err(ctx->dev, "regulator_set_load failed %d\n", ret); return ret;
}
}
ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); if (ret) {
dev_err(ctx->dev, "regulator_bulk_disable failed %d\n", ret);
} return ret;
}
for (i = 0; i < num_cmds; i++) {
ret = truly_dcs_write_buf(panel,
panel_on_cmds[i].size,
panel_on_cmds[i].commands); if (ret < 0) {
dev_err(ctx->dev, "cmd set tx failed i = %d ret = %d\n", i, ret); goto power_off;
}
}
ret = truly_dcs_write(panel, MIPI_DCS_EXIT_SLEEP_MODE); if (ret < 0) {
dev_err(ctx->dev, "exit_sleep_mode cmd failed ret = %d\n", ret); goto power_off;
}
/* Per DSI spec wait 120ms after sending exit sleep DCS command */
msleep(120);
ret = truly_dcs_write(panel, MIPI_DCS_SET_DISPLAY_ON); if (ret < 0) {
dev_err(ctx->dev, "set_display_on cmd failed ret = %d\n", ret); goto power_off;
}
/* Per DSI spec wait 120ms after sending set_display_on DCS command */
msleep(120);
return 0;
power_off: if (truly_nt35597_power_off(ctx))
dev_err(ctx->dev, "power_off failed\n"); return ret;
}
/* * This device represents itself as one with two input ports which are * fed by the output ports of the two DSI controllers . The DSI0 is * the master controller and has most of the panel related info in its * child node.
*/
ctx->config = of_device_get_match_data(dev);
if (!ctx->config) {
dev_err(dev, "missing device configuration\n"); return -ENODEV;
}
dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1); if (!dsi1) {
dev_err(dev, "failed to get remote node for dsi1_device\n"); return -ENODEV;
}
dsi1_host = of_find_mipi_dsi_host_by_node(dsi1);
of_node_put(dsi1); if (!dsi1_host) return dev_err_probe(dev, -EPROBE_DEFER, "failed to find dsi host\n");
/* register the second DSI device */
dsi1_device = mipi_dsi_device_register_full(dsi1_host, &info); if (IS_ERR(dsi1_device)) {
dev_err(dev, "failed to create dsi device\n"); return PTR_ERR(dsi1_device);
}
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.