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