Lines Matching defs:ctx

244 static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len)
246 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
251 #define s6e3ha2_dcs_write_seq_static(ctx, seq...) do { \
254 ret = s6e3ha2_dcs_write(ctx, d, ARRAY_SIZE(d)); \
265 static int s6e3ha2_test_key_on_f0(struct s6e3ha2 *ctx)
267 s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0x5a, 0x5a);
271 static int s6e3ha2_test_key_off_f0(struct s6e3ha2 *ctx)
273 s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0xa5, 0xa5);
277 static int s6e3ha2_test_key_on_fc(struct s6e3ha2 *ctx)
279 s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0x5a, 0x5a);
283 static int s6e3ha2_test_key_off_fc(struct s6e3ha2 *ctx)
285 s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0xa5, 0xa5);
289 static int s6e3ha2_single_dsi_set(struct s6e3ha2 *ctx)
291 s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67);
292 s6e3ha2_dcs_write_seq_static(ctx, 0xf9, 0x09);
296 static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx)
298 s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c);
299 if (ctx->desc->type == HF2_TYPE)
300 s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67, 0x40, 0xc5);
301 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39);
302 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0);
303 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20);
305 if (ctx->desc->type == HA2_TYPE)
306 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62,
310 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x14, 0x6d,
317 static int s6e3ha2_aor_control(struct s6e3ha2 *ctx)
319 s6e3ha2_dcs_write_seq_static(ctx, 0xb2, 0x03, 0x10);
323 static int s6e3ha2_caps_elvss_set(struct s6e3ha2 *ctx)
325 s6e3ha2_dcs_write_seq_static(ctx, 0xb6, 0x9c, 0x0a);
329 static int s6e3ha2_acl_off(struct s6e3ha2 *ctx)
331 s6e3ha2_dcs_write_seq_static(ctx, 0x55, 0x00);
335 static int s6e3ha2_acl_off_opr(struct s6e3ha2 *ctx)
337 s6e3ha2_dcs_write_seq_static(ctx, 0xb5, 0x40);
341 static int s6e3ha2_test_global(struct s6e3ha2 *ctx)
343 s6e3ha2_dcs_write_seq_static(ctx, 0xb0, 0x07);
347 static int s6e3ha2_test(struct s6e3ha2 *ctx)
349 s6e3ha2_dcs_write_seq_static(ctx, 0xb8, 0x19);
353 static int s6e3ha2_touch_hsync_on1(struct s6e3ha2 *ctx)
355 s6e3ha2_dcs_write_seq_static(ctx, 0xbd, 0x33, 0x11, 0x02,
360 static int s6e3ha2_pentile_control(struct s6e3ha2 *ctx)
362 s6e3ha2_dcs_write_seq_static(ctx, 0xc0, 0x00, 0x00, 0xd8, 0xd8);
366 static int s6e3ha2_poc_global(struct s6e3ha2 *ctx)
368 s6e3ha2_dcs_write_seq_static(ctx, 0xb0, 0x20);
372 static int s6e3ha2_poc_setting(struct s6e3ha2 *ctx)
374 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x08);
378 static int s6e3ha2_pcd_set_off(struct s6e3ha2 *ctx)
380 s6e3ha2_dcs_write_seq_static(ctx, 0xcc, 0x40, 0x51);
384 static int s6e3ha2_err_fg_set(struct s6e3ha2 *ctx)
386 s6e3ha2_dcs_write_seq_static(ctx, 0xed, 0x44);
390 static int s6e3ha2_hbm_off(struct s6e3ha2 *ctx)
392 s6e3ha2_dcs_write_seq_static(ctx, 0x53, 0x00);
396 static int s6e3ha2_te_start_setting(struct s6e3ha2 *ctx)
398 s6e3ha2_dcs_write_seq_static(ctx, 0xb9, 0x10, 0x09, 0xff, 0x00, 0x09);
402 static int s6e3ha2_gamma_update(struct s6e3ha2 *ctx)
404 s6e3ha2_dcs_write_seq_static(ctx, 0xf7, 0x03);
406 s6e3ha2_dcs_write_seq_static(ctx, 0xf7, 0x00);
415 static int s6e3ha2_set_vint(struct s6e3ha2 *ctx)
417 struct backlight_device *bl_dev = ctx->bl_dev;
423 return s6e3ha2_dcs_write(ctx, data, ARRAY_SIZE(data));
432 static int s6e3ha2_update_gamma(struct s6e3ha2 *ctx, unsigned int brightness)
434 struct backlight_device *bl_dev = ctx->bl_dev;
441 s6e3ha2_dcs_write(ctx, data, ARRAY_SIZE(data)));
443 s6e3ha2_call_write_func(ret, s6e3ha2_gamma_update(ctx));
451 struct s6e3ha2 *ctx = bl_get_data(bl_dev);
457 dev_err(ctx->dev, "Invalid brightness: %u\n", brightness);
464 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx));
465 s6e3ha2_call_write_func(ret, s6e3ha2_update_gamma(ctx, brightness));
466 s6e3ha2_call_write_func(ret, s6e3ha2_aor_control(ctx));
467 s6e3ha2_call_write_func(ret, s6e3ha2_set_vint(ctx));
468 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx));
478 static int s6e3ha2_panel_init(struct s6e3ha2 *ctx)
480 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
486 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx));
487 s6e3ha2_call_write_func(ret, s6e3ha2_single_dsi_set(ctx));
488 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx));
489 s6e3ha2_call_write_func(ret, s6e3ha2_freq_calibration(ctx));
490 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx));
491 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx));
496 static int s6e3ha2_power_off(struct s6e3ha2 *ctx)
498 return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
503 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
504 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
511 ctx->bl_dev->props.power = BACKLIGHT_POWER_REDUCED;
518 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
520 return s6e3ha2_power_off(ctx);
523 static int s6e3ha2_power_on(struct s6e3ha2 *ctx)
527 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
533 gpiod_set_value(ctx->enable_gpio, 0);
535 gpiod_set_value(ctx->enable_gpio, 1);
537 gpiod_set_value(ctx->reset_gpio, 1);
539 gpiod_set_value(ctx->reset_gpio, 0);
546 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
549 ret = s6e3ha2_power_on(ctx);
553 ret = s6e3ha2_panel_init(ctx);
557 ctx->bl_dev->props.power = BACKLIGHT_POWER_REDUCED;
562 s6e3ha2_power_off(ctx);
568 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
569 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
576 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx));
577 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx));
578 s6e3ha2_call_write_func(ret, s6e3ha2_touch_hsync_on1(ctx));
579 s6e3ha2_call_write_func(ret, s6e3ha2_pentile_control(ctx));
580 s6e3ha2_call_write_func(ret, s6e3ha2_poc_global(ctx));
581 s6e3ha2_call_write_func(ret, s6e3ha2_poc_setting(ctx));
582 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx));
585 s6e3ha2_call_write_func(ret, s6e3ha2_pcd_set_off(ctx));
586 s6e3ha2_call_write_func(ret, s6e3ha2_err_fg_set(ctx));
587 s6e3ha2_call_write_func(ret, s6e3ha2_te_start_setting(ctx));
590 s6e3ha2_call_write_func(ret, s6e3ha2_set_brightness(ctx->bl_dev));
591 s6e3ha2_call_write_func(ret, s6e3ha2_aor_control(ctx));
592 s6e3ha2_call_write_func(ret, s6e3ha2_caps_elvss_set(ctx));
593 s6e3ha2_call_write_func(ret, s6e3ha2_gamma_update(ctx));
594 s6e3ha2_call_write_func(ret, s6e3ha2_acl_off(ctx));
595 s6e3ha2_call_write_func(ret, s6e3ha2_acl_off_opr(ctx));
596 s6e3ha2_call_write_func(ret, s6e3ha2_hbm_off(ctx));
599 s6e3ha2_call_write_func(ret, s6e3ha2_test_global(ctx));
600 s6e3ha2_call_write_func(ret, s6e3ha2_test(ctx));
601 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx));
604 ctx->bl_dev->props.power = BACKLIGHT_POWER_ON;
648 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
651 mode = drm_mode_duplicate(connector->dev, ctx->desc->mode);
654 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
655 drm_mode_vrefresh(ctx->desc->mode));
681 struct s6e3ha2 *ctx;
684 ctx = devm_drm_panel_alloc(dev, struct s6e3ha2, panel,
687 if (IS_ERR(ctx))
688 return PTR_ERR(ctx);
690 mipi_dsi_set_drvdata(dsi, ctx);
692 ctx->dev = dev;
693 ctx->desc = of_device_get_match_data(dev);
701 ctx->supplies[0].supply = "vdd3";
702 ctx->supplies[1].supply = "vci";
704 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
705 ctx->supplies);
711 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
712 if (IS_ERR(ctx->reset_gpio)) {
714 PTR_ERR(ctx->reset_gpio));
715 return PTR_ERR(ctx->reset_gpio);
718 ctx->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
719 if (IS_ERR(ctx->enable_gpio)) {
721 PTR_ERR(ctx->enable_gpio));
722 return PTR_ERR(ctx->enable_gpio);
725 ctx->bl_dev = backlight_device_register("s6e3ha2", dev, ctx,
727 if (IS_ERR(ctx->bl_dev)) {
729 return PTR_ERR(ctx->bl_dev);
732 ctx->bl_dev->props.max_brightness = S6E3HA2_MAX_BRIGHTNESS;
733 ctx->bl_dev->props.brightness = S6E3HA2_DEFAULT_BRIGHTNESS;
734 ctx->bl_dev->props.power = BACKLIGHT_POWER_OFF;
736 ctx->panel.prepare_prev_first = true;
738 drm_panel_add(&ctx->panel);
747 drm_panel_remove(&ctx->panel);
748 backlight_device_unregister(ctx->bl_dev);
755 struct s6e3ha2 *ctx = mipi_dsi_get_drvdata(dsi);
758 drm_panel_remove(&ctx->panel);
759 backlight_device_unregister(ctx->bl_dev);