Lines Matching refs:hx
248 static void hx8279_set_page(struct hx8279 *hx,
253 if (hx->last_page == page)
258 hx->last_page = page;
261 static void hx8279_set_module_config(struct hx8279 *hx,
264 const struct hx8279_panel_desc *desc = hx->desc;
267 if (hx->skip_voltage_config)
271 hx8279_set_page(hx, dsi_ctx, 0);
302 static void hx8279_set_gmux(struct hx8279 *hx,
305 const struct hx8279_goa_mux *gmux = hx->desc->gmux;
312 hx8279_set_page(hx, dsi_ctx, 1);
329 static void hx8279_set_analog_gamma(struct hx8279 *hx,
332 const struct hx8279_analog_gamma *agamma = hx->desc->agamma;
339 hx8279_set_page(hx, dsi_ctx, 2);
356 static void hx8279_set_goa_timing(struct hx8279 *hx,
359 const struct hx8279_panel_desc *desc = hx->desc;
363 if (hx->skip_goa_timing)
366 hx8279_set_page(hx, dsi_ctx, 3);
383 static void hx8279_set_goa_cfg(struct hx8279 *hx,
386 const struct hx8279_panel_desc *desc = hx->desc;
390 if (hx->skip_goa_config)
393 hx8279_set_page(hx, dsi_ctx, 3);
487 static void hx8279_set_mipi_cfg(struct hx8279 *hx,
490 const struct hx8279_panel_desc *desc = hx->desc;
493 if (hx->skip_mipi_timing)
496 hx8279_set_page(hx, dsi_ctx, 5);
531 static void hx8279_set_adv_cfg(struct hx8279 *hx,
534 const struct hx8279_panel_desc *desc = hx->desc;
543 hx8279_set_page(hx, dsi_ctx, 6);
573 static void hx8279_set_digital_gamma(struct hx8279 *hx,
576 const struct hx8279_digital_gamma *dgamma = hx->desc->dgamma;
591 hx8279_set_page(hx, dsi_ctx, 7 + pg_neg);
600 hx8279_set_page(hx, dsi_ctx, 8 + pg_neg);
609 hx8279_set_page(hx, dsi_ctx, 9 + pg_neg);
620 static int hx8279_on(struct hx8279 *hx)
622 struct mipi_dsi_device *dsi = hx->dsi[0];
626 hx8279_set_mipi_cfg(hx, &dsi_ctx);
629 hx8279_set_gmux(hx, &dsi_ctx);
632 hx8279_set_analog_gamma(hx, &dsi_ctx);
635 hx8279_set_goa_cfg(hx, &dsi_ctx);
636 hx8279_set_goa_timing(hx, &dsi_ctx);
639 hx8279_set_module_config(hx, &dsi_ctx);
642 hx8279_set_adv_cfg(hx, &dsi_ctx);
645 hx8279_set_digital_gamma(hx, &dsi_ctx);
650 static void hx8279_power_off(struct hx8279 *hx)
652 gpiod_set_value_cansleep(hx->reset_gpio, 0);
654 gpiod_set_value_cansleep(hx->enable_gpio, 0);
655 regulator_bulk_disable(ARRAY_SIZE(hx->vregs), hx->vregs);
660 struct hx8279 *hx = to_hx8279(panel);
661 struct mipi_dsi_device *dsi = hx->dsi[0];
671 struct hx8279 *hx = to_hx8279(panel);
672 struct mipi_dsi_device *dsi = hx->dsi[0];
682 struct hx8279 *hx = to_hx8279(panel);
683 struct mipi_dsi_device *dsi = hx->dsi[0];
687 ret = regulator_bulk_enable(ARRAY_SIZE(hx->vregs), hx->vregs);
691 gpiod_set_value_cansleep(hx->enable_gpio, 1);
693 gpiod_set_value_cansleep(hx->reset_gpio, 1);
697 if (hx->dsi[1])
698 hx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM;
700 ret = hx8279_on(hx);
702 hx8279_power_off(hx);
714 struct hx8279 *hx = to_hx8279(panel);
715 struct mipi_dsi_device *dsi = hx->dsi[0];
722 if (hx->dsi[1])
723 hx->dsi[1]->mode_flags &= ~MIPI_DSI_MODE_LPM;
725 hx8279_power_off(hx);
732 struct hx8279 *hx = to_hx8279(panel);
735 for (i = 0; i < hx->desc->num_modes; i++) {
738 mode = drm_mode_duplicate(connector->dev, &hx->desc->mode_data[i].mode);
745 if (hx->desc->num_modes == 1)
751 connector->display_info.bpc = hx->desc->mode_data[0].bpc;
752 connector->display_info.height_mm = hx->desc->mode_data[0].mode.height_mm;
753 connector->display_info.width_mm = hx->desc->mode_data[0].mode.width_mm;
755 return hx->desc->num_modes;
766 static int hx8279_init_vregs(struct hx8279 *hx, struct device *dev)
770 hx->vregs[0].supply = "vdd";
771 hx->vregs[1].supply = "iovcc";
772 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(hx->vregs),
773 hx->vregs);
777 ret = regulator_is_supported_voltage(hx->vregs[0].consumer,
782 ret = regulator_is_supported_voltage(hx->vregs[1].consumer,
790 static int hx8279_check_gmux_config(struct hx8279 *hx, struct device *dev)
792 const struct hx8279_panel_desc *desc = hx->desc;
815 static int hx8279_check_goa_config(struct hx8279 *hx, struct device *dev)
817 const struct hx8279_panel_desc *desc = hx->desc;
845 hx->skip_goa_timing = true;
852 hx->skip_goa_config = true;
894 static int hx8279_check_dig_gamma(struct hx8279 *hx, struct device *dev, const u8 *component)
943 static int hx8279_check_params(struct hx8279 *hx, struct device *dev)
945 const struct hx8279_panel_desc *desc = hx->desc;
950 hx->skip_voltage_config = true;
958 ret = hx8279_check_gmux_config(hx, dev);
963 ret = hx8279_check_goa_config(hx, dev);
971 hx->skip_mipi_timing = true;
979 ret = hx8279_check_dig_gamma(hx, dev, desc->dgamma->r);
983 ret = hx8279_check_dig_gamma(hx, dev, desc->dgamma->g);
987 ret = hx8279_check_dig_gamma(hx, dev, desc->dgamma->b);
999 struct hx8279 *hx;
1002 hx = devm_drm_panel_alloc(dev, struct hx8279, panel,
1004 if (IS_ERR(hx))
1005 return PTR_ERR(hx);
1007 ret = hx8279_init_vregs(hx, dev);
1011 hx->desc = device_get_match_data(dev);
1012 if (!hx->desc)
1025 ret = hx8279_check_params(hx, dev);
1030 hx->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_ASIS);
1031 if (IS_ERR(hx->enable_gpio))
1032 return dev_err_probe(dev, PTR_ERR(hx->enable_gpio),
1035 hx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS);
1036 if (IS_ERR(hx->reset_gpio))
1037 return dev_err_probe(dev, PTR_ERR(hx->reset_gpio),
1043 const struct mipi_dsi_device_info *info = &hx->desc->dsi_info;
1052 hx->dsi[1] = devm_mipi_dsi_device_register_full(dev, dsi_r_host, info);
1053 if (IS_ERR(hx->dsi[1]))
1054 return dev_err_probe(dev, PTR_ERR(hx->dsi[1]),
1056 mipi_dsi_set_drvdata(hx->dsi[1], hx);
1059 hx->dsi[0] = dsi;
1060 mipi_dsi_set_drvdata(dsi, hx);
1062 ret = drm_panel_of_backlight(&hx->panel);
1066 drm_panel_add(&hx->panel);
1069 if (!hx->dsi[i])
1072 hx->dsi[i]->lanes = hx->desc->num_lanes;
1073 hx->dsi[i]->format = MIPI_DSI_FMT_RGB888;
1075 hx->dsi[i]->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
1078 if (hx->desc->mode_data[0].is_video_mode)
1079 hx->dsi[i]->mode_flags |= MIPI_DSI_MODE_VIDEO |
1082 ret = devm_mipi_dsi_attach(dev, hx->dsi[i]);
1084 drm_panel_remove(&hx->panel);
1095 struct hx8279 *hx = mipi_dsi_get_drvdata(dsi);
1097 drm_panel_remove(&hx->panel);