• Home
  • Raw
  • Download

Lines Matching refs:ctx

245 static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len)  in s6e3ha2_dcs_write()  argument
247 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in s6e3ha2_dcs_write()
252 #define s6e3ha2_dcs_write_seq_static(ctx, seq...) do { \ argument
255 ret = s6e3ha2_dcs_write(ctx, d, ARRAY_SIZE(d)); \
266 static int s6e3ha2_test_key_on_f0(struct s6e3ha2 *ctx) in s6e3ha2_test_key_on_f0() argument
268 s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0x5a, 0x5a); in s6e3ha2_test_key_on_f0()
272 static int s6e3ha2_test_key_off_f0(struct s6e3ha2 *ctx) in s6e3ha2_test_key_off_f0() argument
274 s6e3ha2_dcs_write_seq_static(ctx, 0xf0, 0xa5, 0xa5); in s6e3ha2_test_key_off_f0()
278 static int s6e3ha2_test_key_on_fc(struct s6e3ha2 *ctx) in s6e3ha2_test_key_on_fc() argument
280 s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0x5a, 0x5a); in s6e3ha2_test_key_on_fc()
284 static int s6e3ha2_test_key_off_fc(struct s6e3ha2 *ctx) in s6e3ha2_test_key_off_fc() argument
286 s6e3ha2_dcs_write_seq_static(ctx, 0xfc, 0xa5, 0xa5); in s6e3ha2_test_key_off_fc()
290 static int s6e3ha2_single_dsi_set(struct s6e3ha2 *ctx) in s6e3ha2_single_dsi_set() argument
292 s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67); in s6e3ha2_single_dsi_set()
293 s6e3ha2_dcs_write_seq_static(ctx, 0xf9, 0x09); in s6e3ha2_single_dsi_set()
297 static int s6e3ha2_freq_calibration(struct s6e3ha2 *ctx) in s6e3ha2_freq_calibration() argument
299 s6e3ha2_dcs_write_seq_static(ctx, 0xfd, 0x1c); in s6e3ha2_freq_calibration()
300 if (ctx->desc->type == HF2_TYPE) in s6e3ha2_freq_calibration()
301 s6e3ha2_dcs_write_seq_static(ctx, 0xf2, 0x67, 0x40, 0xc5); in s6e3ha2_freq_calibration()
302 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20, 0x39); in s6e3ha2_freq_calibration()
303 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0xa0); in s6e3ha2_freq_calibration()
304 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x20); in s6e3ha2_freq_calibration()
306 if (ctx->desc->type == HA2_TYPE) in s6e3ha2_freq_calibration()
307 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x12, 0x62, in s6e3ha2_freq_calibration()
311 s6e3ha2_dcs_write_seq_static(ctx, 0xce, 0x03, 0x3b, 0x14, 0x6d, in s6e3ha2_freq_calibration()
318 static int s6e3ha2_aor_control(struct s6e3ha2 *ctx) in s6e3ha2_aor_control() argument
320 s6e3ha2_dcs_write_seq_static(ctx, 0xb2, 0x03, 0x10); in s6e3ha2_aor_control()
324 static int s6e3ha2_caps_elvss_set(struct s6e3ha2 *ctx) in s6e3ha2_caps_elvss_set() argument
326 s6e3ha2_dcs_write_seq_static(ctx, 0xb6, 0x9c, 0x0a); in s6e3ha2_caps_elvss_set()
330 static int s6e3ha2_acl_off(struct s6e3ha2 *ctx) in s6e3ha2_acl_off() argument
332 s6e3ha2_dcs_write_seq_static(ctx, 0x55, 0x00); in s6e3ha2_acl_off()
336 static int s6e3ha2_acl_off_opr(struct s6e3ha2 *ctx) in s6e3ha2_acl_off_opr() argument
338 s6e3ha2_dcs_write_seq_static(ctx, 0xb5, 0x40); in s6e3ha2_acl_off_opr()
342 static int s6e3ha2_test_global(struct s6e3ha2 *ctx) in s6e3ha2_test_global() argument
344 s6e3ha2_dcs_write_seq_static(ctx, 0xb0, 0x07); in s6e3ha2_test_global()
348 static int s6e3ha2_test(struct s6e3ha2 *ctx) in s6e3ha2_test() argument
350 s6e3ha2_dcs_write_seq_static(ctx, 0xb8, 0x19); in s6e3ha2_test()
354 static int s6e3ha2_touch_hsync_on1(struct s6e3ha2 *ctx) in s6e3ha2_touch_hsync_on1() argument
356 s6e3ha2_dcs_write_seq_static(ctx, 0xbd, 0x33, 0x11, 0x02, in s6e3ha2_touch_hsync_on1()
361 static int s6e3ha2_pentile_control(struct s6e3ha2 *ctx) in s6e3ha2_pentile_control() argument
363 s6e3ha2_dcs_write_seq_static(ctx, 0xc0, 0x00, 0x00, 0xd8, 0xd8); in s6e3ha2_pentile_control()
367 static int s6e3ha2_poc_global(struct s6e3ha2 *ctx) in s6e3ha2_poc_global() argument
369 s6e3ha2_dcs_write_seq_static(ctx, 0xb0, 0x20); in s6e3ha2_poc_global()
373 static int s6e3ha2_poc_setting(struct s6e3ha2 *ctx) in s6e3ha2_poc_setting() argument
375 s6e3ha2_dcs_write_seq_static(ctx, 0xfe, 0x08); in s6e3ha2_poc_setting()
379 static int s6e3ha2_pcd_set_off(struct s6e3ha2 *ctx) in s6e3ha2_pcd_set_off() argument
381 s6e3ha2_dcs_write_seq_static(ctx, 0xcc, 0x40, 0x51); in s6e3ha2_pcd_set_off()
385 static int s6e3ha2_err_fg_set(struct s6e3ha2 *ctx) in s6e3ha2_err_fg_set() argument
387 s6e3ha2_dcs_write_seq_static(ctx, 0xed, 0x44); in s6e3ha2_err_fg_set()
391 static int s6e3ha2_hbm_off(struct s6e3ha2 *ctx) in s6e3ha2_hbm_off() argument
393 s6e3ha2_dcs_write_seq_static(ctx, 0x53, 0x00); in s6e3ha2_hbm_off()
397 static int s6e3ha2_te_start_setting(struct s6e3ha2 *ctx) in s6e3ha2_te_start_setting() argument
399 s6e3ha2_dcs_write_seq_static(ctx, 0xb9, 0x10, 0x09, 0xff, 0x00, 0x09); in s6e3ha2_te_start_setting()
403 static int s6e3ha2_gamma_update(struct s6e3ha2 *ctx) in s6e3ha2_gamma_update() argument
405 s6e3ha2_dcs_write_seq_static(ctx, 0xf7, 0x03); in s6e3ha2_gamma_update()
407 s6e3ha2_dcs_write_seq_static(ctx, 0xf7, 0x00); in s6e3ha2_gamma_update()
416 static int s6e3ha2_set_vint(struct s6e3ha2 *ctx) in s6e3ha2_set_vint() argument
418 struct backlight_device *bl_dev = ctx->bl_dev; in s6e3ha2_set_vint()
424 return s6e3ha2_dcs_write(ctx, data, ARRAY_SIZE(data)); in s6e3ha2_set_vint()
433 static int s6e3ha2_update_gamma(struct s6e3ha2 *ctx, unsigned int brightness) in s6e3ha2_update_gamma() argument
435 struct backlight_device *bl_dev = ctx->bl_dev; in s6e3ha2_update_gamma()
442 s6e3ha2_dcs_write(ctx, data, ARRAY_SIZE(data))); in s6e3ha2_update_gamma()
444 s6e3ha2_call_write_func(ret, s6e3ha2_gamma_update(ctx)); in s6e3ha2_update_gamma()
452 struct s6e3ha2 *ctx = bl_get_data(bl_dev); in s6e3ha2_set_brightness() local
458 dev_err(ctx->dev, "Invalid brightness: %u\n", brightness); in s6e3ha2_set_brightness()
465 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx)); in s6e3ha2_set_brightness()
466 s6e3ha2_call_write_func(ret, s6e3ha2_update_gamma(ctx, brightness)); in s6e3ha2_set_brightness()
467 s6e3ha2_call_write_func(ret, s6e3ha2_aor_control(ctx)); in s6e3ha2_set_brightness()
468 s6e3ha2_call_write_func(ret, s6e3ha2_set_vint(ctx)); in s6e3ha2_set_brightness()
469 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx)); in s6e3ha2_set_brightness()
479 static int s6e3ha2_panel_init(struct s6e3ha2 *ctx) in s6e3ha2_panel_init() argument
481 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in s6e3ha2_panel_init()
487 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx)); in s6e3ha2_panel_init()
488 s6e3ha2_call_write_func(ret, s6e3ha2_single_dsi_set(ctx)); in s6e3ha2_panel_init()
489 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx)); in s6e3ha2_panel_init()
490 s6e3ha2_call_write_func(ret, s6e3ha2_freq_calibration(ctx)); in s6e3ha2_panel_init()
491 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx)); in s6e3ha2_panel_init()
492 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx)); in s6e3ha2_panel_init()
497 static int s6e3ha2_power_off(struct s6e3ha2 *ctx) in s6e3ha2_power_off() argument
499 return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e3ha2_power_off()
504 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); in s6e3ha2_disable() local
505 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in s6e3ha2_disable()
512 ctx->bl_dev->props.power = FB_BLANK_NORMAL; in s6e3ha2_disable()
519 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); in s6e3ha2_unprepare() local
521 return s6e3ha2_power_off(ctx); in s6e3ha2_unprepare()
524 static int s6e3ha2_power_on(struct s6e3ha2 *ctx) in s6e3ha2_power_on() argument
528 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e3ha2_power_on()
534 gpiod_set_value(ctx->enable_gpio, 0); in s6e3ha2_power_on()
536 gpiod_set_value(ctx->enable_gpio, 1); in s6e3ha2_power_on()
538 gpiod_set_value(ctx->reset_gpio, 1); in s6e3ha2_power_on()
540 gpiod_set_value(ctx->reset_gpio, 0); in s6e3ha2_power_on()
547 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); in s6e3ha2_prepare() local
550 ret = s6e3ha2_power_on(ctx); in s6e3ha2_prepare()
554 ret = s6e3ha2_panel_init(ctx); in s6e3ha2_prepare()
558 ctx->bl_dev->props.power = FB_BLANK_NORMAL; in s6e3ha2_prepare()
563 s6e3ha2_power_off(ctx); in s6e3ha2_prepare()
569 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); in s6e3ha2_enable() local
570 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in s6e3ha2_enable()
577 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx)); in s6e3ha2_enable()
578 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx)); in s6e3ha2_enable()
579 s6e3ha2_call_write_func(ret, s6e3ha2_touch_hsync_on1(ctx)); in s6e3ha2_enable()
580 s6e3ha2_call_write_func(ret, s6e3ha2_pentile_control(ctx)); in s6e3ha2_enable()
581 s6e3ha2_call_write_func(ret, s6e3ha2_poc_global(ctx)); in s6e3ha2_enable()
582 s6e3ha2_call_write_func(ret, s6e3ha2_poc_setting(ctx)); in s6e3ha2_enable()
583 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx)); in s6e3ha2_enable()
586 s6e3ha2_call_write_func(ret, s6e3ha2_pcd_set_off(ctx)); in s6e3ha2_enable()
587 s6e3ha2_call_write_func(ret, s6e3ha2_err_fg_set(ctx)); in s6e3ha2_enable()
588 s6e3ha2_call_write_func(ret, s6e3ha2_te_start_setting(ctx)); in s6e3ha2_enable()
591 s6e3ha2_call_write_func(ret, s6e3ha2_set_brightness(ctx->bl_dev)); in s6e3ha2_enable()
592 s6e3ha2_call_write_func(ret, s6e3ha2_aor_control(ctx)); in s6e3ha2_enable()
593 s6e3ha2_call_write_func(ret, s6e3ha2_caps_elvss_set(ctx)); in s6e3ha2_enable()
594 s6e3ha2_call_write_func(ret, s6e3ha2_gamma_update(ctx)); in s6e3ha2_enable()
595 s6e3ha2_call_write_func(ret, s6e3ha2_acl_off(ctx)); in s6e3ha2_enable()
596 s6e3ha2_call_write_func(ret, s6e3ha2_acl_off_opr(ctx)); in s6e3ha2_enable()
597 s6e3ha2_call_write_func(ret, s6e3ha2_hbm_off(ctx)); in s6e3ha2_enable()
600 s6e3ha2_call_write_func(ret, s6e3ha2_test_global(ctx)); in s6e3ha2_enable()
601 s6e3ha2_call_write_func(ret, s6e3ha2_test(ctx)); in s6e3ha2_enable()
602 s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx)); in s6e3ha2_enable()
605 ctx->bl_dev->props.power = FB_BLANK_UNBLANK; in s6e3ha2_enable()
651 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel); in s6e3ha2_get_modes() local
654 mode = drm_mode_duplicate(panel->drm, ctx->desc->mode); in s6e3ha2_get_modes()
657 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, in s6e3ha2_get_modes()
658 ctx->desc->mode->vrefresh); in s6e3ha2_get_modes()
684 struct s6e3ha2 *ctx; in s6e3ha2_probe() local
687 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); in s6e3ha2_probe()
688 if (!ctx) in s6e3ha2_probe()
691 mipi_dsi_set_drvdata(dsi, ctx); in s6e3ha2_probe()
693 ctx->dev = dev; in s6e3ha2_probe()
694 ctx->desc = of_device_get_match_data(dev); in s6e3ha2_probe()
700 ctx->supplies[0].supply = "vdd3"; in s6e3ha2_probe()
701 ctx->supplies[1].supply = "vci"; in s6e3ha2_probe()
703 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6e3ha2_probe()
704 ctx->supplies); in s6e3ha2_probe()
710 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in s6e3ha2_probe()
711 if (IS_ERR(ctx->reset_gpio)) { in s6e3ha2_probe()
713 PTR_ERR(ctx->reset_gpio)); in s6e3ha2_probe()
714 return PTR_ERR(ctx->reset_gpio); in s6e3ha2_probe()
717 ctx->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); in s6e3ha2_probe()
718 if (IS_ERR(ctx->enable_gpio)) { in s6e3ha2_probe()
720 PTR_ERR(ctx->enable_gpio)); in s6e3ha2_probe()
721 return PTR_ERR(ctx->enable_gpio); in s6e3ha2_probe()
724 ctx->bl_dev = backlight_device_register("s6e3ha2", dev, ctx, in s6e3ha2_probe()
726 if (IS_ERR(ctx->bl_dev)) { in s6e3ha2_probe()
728 return PTR_ERR(ctx->bl_dev); in s6e3ha2_probe()
731 ctx->bl_dev->props.max_brightness = S6E3HA2_MAX_BRIGHTNESS; in s6e3ha2_probe()
732 ctx->bl_dev->props.brightness = S6E3HA2_DEFAULT_BRIGHTNESS; in s6e3ha2_probe()
733 ctx->bl_dev->props.power = FB_BLANK_POWERDOWN; in s6e3ha2_probe()
735 drm_panel_init(&ctx->panel); in s6e3ha2_probe()
736 ctx->panel.dev = dev; in s6e3ha2_probe()
737 ctx->panel.funcs = &s6e3ha2_drm_funcs; in s6e3ha2_probe()
739 ret = drm_panel_add(&ctx->panel); in s6e3ha2_probe()
750 drm_panel_remove(&ctx->panel); in s6e3ha2_probe()
753 backlight_device_unregister(ctx->bl_dev); in s6e3ha2_probe()
760 struct s6e3ha2 *ctx = mipi_dsi_get_drvdata(dsi); in s6e3ha2_remove() local
763 drm_panel_remove(&ctx->panel); in s6e3ha2_remove()
764 backlight_device_unregister(ctx->bl_dev); in s6e3ha2_remove()