Lines Matching +full:ld +full:- +full:pulse +full:- +full:delay +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0
6 * Derived from drivers/gpu/drm/panel-samsung-ld9040.c
15 #include <linux/delay.h>
19 #include <linux/media-bus-format.h>
23 #include "panel-samsung-s6e63m0.h"
32 #define MAX_BRIGHTNESS (NUM_GAMMA_LEVELS - 1)
226 /* This tells us which ACL level goes with which gamma */
228 /* 30 - 60 cd: ACL off/NULL */
230 /* 70 - 250 cd: 40P ACL */
232 /* 260 - 300 cd: 50P ACL */
241 0x0D, /* 30 cd - 100 cd */
242 0x09, /* 110 cd - 160 cd */
243 0x07, /* 170 cd - 200 cd */
244 0x00, /* 210 cd - 300 cd */
247 /* This tells us which ELVSS level goes with which gamma */
249 /* 30 - 100 cd */
251 /* 110 - 160 cd */
253 /* 170 - 200 cd */
255 /* 210 - 300 cd */
308 int ret = ctx->error; in s6e63m0_clear_error()
310 ctx->error = 0; in s6e63m0_clear_error()
316 if (ctx->error < 0) in s6e63m0_dcs_read()
319 ctx->error = ctx->dcs_read(ctx->dev, ctx->transport_data, cmd, data); in s6e63m0_dcs_read()
324 if (ctx->error < 0 || len == 0) in s6e63m0_dcs_write()
327 ctx->error = ctx->dcs_write(ctx->dev, ctx->transport_data, data, len); in s6e63m0_dcs_write()
347 dev_err(ctx->dev, "error checking LCD type (%d)\n", ret); in s6e63m0_check_lcd_type()
348 ctx->lcd_type = 0x00; in s6e63m0_check_lcd_type()
352 dev_info(ctx->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); in s6e63m0_check_lcd_type()
356 * The third ID byte represents the desired ELVSS pulse for in s6e63m0_check_lcd_type()
361 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI M2\n"); in s6e63m0_check_lcd_type()
362 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
366 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI SM2\n"); in s6e63m0_check_lcd_type()
367 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
370 dev_info(ctx->dev, "unknown LCD panel type %02x\n", id2); in s6e63m0_check_lcd_type()
371 /* Default ELVSS pulse level */ in s6e63m0_check_lcd_type()
372 ctx->elvss_pulse = 0x16; in s6e63m0_check_lcd_type()
376 ctx->lcd_type = id2; in s6e63m0_check_lcd_type()
390 if (ctx->dsi_mode) in s6e63m0_init()
472 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_on()
478 /* Be sure to send a reset pulse */ in s6e63m0_power_on()
479 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_on()
481 gpiod_set_value(ctx->reset_gpio, 0); in s6e63m0_power_on()
491 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_off()
494 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_off()
505 if (!ctx->enabled) in s6e63m0_disable()
508 backlight_disable(ctx->bl_dev); in s6e63m0_disable()
515 ctx->enabled = false; in s6e63m0_disable()
525 if (!ctx->prepared) in s6e63m0_unprepare()
534 ctx->prepared = false; in s6e63m0_unprepare()
544 if (ctx->prepared) in s6e63m0_prepare()
567 ctx->prepared = true; in s6e63m0_prepare()
576 if (ctx->enabled) in s6e63m0_enable()
589 backlight_enable(ctx->bl_dev); in s6e63m0_enable()
591 ctx->enabled = true; in s6e63m0_enable()
602 mode = drm_mode_duplicate(connector->dev, &default_mode); in s6e63m0_get_modes()
604 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in s6e63m0_get_modes()
607 return -ENOMEM; in s6e63m0_get_modes()
610 connector->display_info.width_mm = mode->width_mm; in s6e63m0_get_modes()
611 connector->display_info.height_mm = mode->height_mm; in s6e63m0_get_modes()
612 drm_display_info_set_bus_formats(&connector->display_info, in s6e63m0_get_modes()
614 connector->display_info.bus_flags = DRM_BUS_FLAG_DE_LOW | in s6e63m0_get_modes()
619 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in s6e63m0_get_modes()
636 int brightness = bd->props.brightness; in s6e63m0_set_brightness()
643 elvss_val = ctx->elvss_pulse + s6e63m0_elvss_offsets[i]; in s6e63m0_set_brightness()
678 struct device *dev = ctx->dev; in s6e63m0_backlight_register()
681 ctx->bl_dev = devm_backlight_device_register(dev, "panel", dev, ctx, in s6e63m0_backlight_register()
684 if (IS_ERR(ctx->bl_dev)) { in s6e63m0_backlight_register()
685 ret = PTR_ERR(ctx->bl_dev); in s6e63m0_backlight_register()
703 return -ENOMEM; in s6e63m0_probe()
705 ctx->transport_data = trsp; in s6e63m0_probe()
706 ctx->dsi_mode = dsi_mode; in s6e63m0_probe()
707 ctx->dcs_read = dcs_read; in s6e63m0_probe()
708 ctx->dcs_write = dcs_write; in s6e63m0_probe()
711 ctx->dev = dev; in s6e63m0_probe()
712 ctx->enabled = false; in s6e63m0_probe()
713 ctx->prepared = false; in s6e63m0_probe()
715 ret = device_property_read_u32(dev, "max-brightness", &max_brightness); in s6e63m0_probe()
723 ctx->supplies[0].supply = "vdd3"; in s6e63m0_probe()
724 ctx->supplies[1].supply = "vci"; in s6e63m0_probe()
725 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6e63m0_probe()
726 ctx->supplies); in s6e63m0_probe()
732 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in s6e63m0_probe()
733 if (IS_ERR(ctx->reset_gpio)) { in s6e63m0_probe()
734 dev_err(dev, "cannot get reset-gpios %ld\n", PTR_ERR(ctx->reset_gpio)); in s6e63m0_probe()
735 return PTR_ERR(ctx->reset_gpio); in s6e63m0_probe()
738 drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs, in s6e63m0_probe()
746 drm_panel_add(&ctx->panel); in s6e63m0_probe()
756 drm_panel_remove(&ctx->panel); in s6e63m0_remove()