28 #include <linux/module.h>
39 static int LABC_control = 1;
45 static int __init parse_LABC_control(
char *
arg)
69 u32 GEN_BF_time_out_count;
72 for (GEN_BF_time_out_count = 0;
74 GEN_BF_time_out_count++) {
75 if ((
REG_READ(gen_fifo_stat_reg) & fifo_stat) == fifo_stat)
80 if (GEN_BF_time_out_count == GEN_FB_TIME_OUT)
81 DRM_ERROR(
"mdfld_dsi_gen_fifo_ready, Timeout. gen_fifo_stat_reg = 0x%x.\n",
94 mdfld_dsi_get_pkg_sender(dsi_config);
100 DRM_ERROR(
"No sender found\n");
114 if (LABC_control == 1)
118 if (LABC_control == 1)
134 u32 gen_ctrl_val = 0;
137 if (!dev || (pipe != 0 && pipe != 2)) {
138 DRM_ERROR(
"Invalid parameter\n");
144 dev_priv = dev->dev_private;
151 sender = mdfld_dsi_get_pkg_sender(dsi_config);
154 DRM_ERROR(
"No sender found\n");
160 dev_dbg(sender->
dev->dev,
"pipe = %d, gen_ctrl_val = %d.\n",
166 (
u8)gen_ctrl_val, 1,
true);
170 (
u8)gen_ctrl_val, 1,
true);
179 (
u8)gen_ctrl_val, 1,
true);
187 = mdfld_dsi_get_pkg_sender(dsi_config);
189 if (!sender || !data) {
190 DRM_ERROR(
"Invalid parameter\n");
200 if (!dsi_config || !mode) {
201 DRM_ERROR(
"Invalid parameter\n");
205 return mdfld_dsi_get_panel_status(dsi_config, 0x0a, mode, hs);
214 if (!dsi_config || ((pipe != 0) && (pipe != 2))) {
215 DRM_ERROR(
"Invalid parameters\n");
239 return dsi_connector->
status;
248 if (!
strcmp(property->
name,
"scaling mode") && encoder) {
298 }
else if (!
strcmp(property->
name,
"backlight") && encoder) {
311 static void mdfld_dsi_connector_destroy(
struct drm_connector *connector)
323 kfree(dsi_connector);
326 static int mdfld_dsi_connector_get_modes(
struct drm_connector *connector)
331 mdfld_dsi_get_config(dsi_connector);
342 dev_dbg(dev->dev,
"fixed_mode %dx%d\n",
348 DRM_ERROR(
"Didn't get any modes!\n");
352 static int mdfld_dsi_connector_mode_valid(
struct drm_connector *connector,
358 mdfld_dsi_get_config(dsi_connector);
383 static void mdfld_dsi_connector_dpms(
struct drm_connector *connector,
int mode)
385 if (mode == connector->
dpms)
393 static struct drm_encoder *mdfld_dsi_connector_best_encoder(
399 mdfld_dsi_get_config(dsi_connector);
400 return &dsi_config->
encoder->base.base;
405 .dpms = mdfld_dsi_connector_dpms,
406 .save = mdfld_dsi_connector_save,
407 .restore = mdfld_dsi_connector_restore,
408 .detect = mdfld_dsi_connector_detect,
410 .set_property = mdfld_dsi_connector_set_property,
411 .destroy = mdfld_dsi_connector_destroy,
416 mdfld_dsi_connector_helper_funcs = {
417 .get_modes = mdfld_dsi_connector_get_modes,
418 .mode_valid = mdfld_dsi_connector_mode_valid,
419 .best_encoder = mdfld_dsi_connector_best_encoder,
422 static int mdfld_dsi_get_default_config(
struct drm_device *dev,
425 if (!dev || !config) {
426 DRM_ERROR(
"Invalid parameters");
461 DRM_ERROR(
"Invalid output\n");
467 DRM_ERROR(
"gpio_rqueset failed\n");
473 DRM_ERROR(
"gpio_direction_output failed\n");
480 if (gpio_is_valid(gpio))
507 dev_dbg(dev->dev,
"init DSI output on pipe %d\n", pipe);
509 if (!dev || ((pipe != 0) && (pipe != 2))) {
510 DRM_ERROR(
"Invalid parameter\n");
516 if (!dsi_connector) {
517 DRM_ERROR(
"No memory");
526 DRM_ERROR(
"cannot allocate memory for DSI config\n");
529 mdfld_dsi_get_default_config(dev, dsi_config, pipe);
531 dsi_connector->
private = dsi_config;
547 DRM_ERROR(
"No pannel fixed mode was found\n");
554 }
else if (pipe == 0) {
558 DRM_ERROR(
"Trying to init MIPI1 before MIPI0\n");
563 connector = &dsi_connector->
base.base;
566 drm_connector_helper_add(connector, &mdfld_dsi_connector_helper_funcs);
576 dev->mode_config.scaling_mode_property,
584 DRM_ERROR(
"Package Sender initialization failed on pipe %d\n",
591 DRM_ERROR(
"Create DPI encoder failed\n");
611 kfree(dsi_connector);