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>
20 #include <linux/media-bus-format.h>
24 #include "panel-samsung-s6e63m0.h"
33 #define MAX_BRIGHTNESS (NUM_GAMMA_LEVELS - 1)
227 /* This tells us which ACL level goes with which gamma */
229 /* 30 - 60 cd: ACL off/NULL */
231 /* 70 - 250 cd: 40P ACL */
233 /* 260 - 300 cd: 50P ACL */
242 0x0D, /* 30 cd - 100 cd */
243 0x09, /* 110 cd - 160 cd */
244 0x07, /* 170 cd - 200 cd */
245 0x00, /* 210 cd - 300 cd */
248 /* This tells us which ELVSS level goes with which gamma */
250 /* 30 - 100 cd */
252 /* 110 - 160 cd */
254 /* 170 - 200 cd */
256 /* 210 - 300 cd */
306 int ret = ctx->error; in s6e63m0_clear_error()
308 ctx->error = 0; in s6e63m0_clear_error()
314 if (ctx->error < 0) in s6e63m0_dcs_read()
317 ctx->error = ctx->dcs_read(ctx->dev, ctx->transport_data, cmd, data); in s6e63m0_dcs_read()
322 if (ctx->error < 0 || len == 0) in s6e63m0_dcs_write()
325 ctx->error = ctx->dcs_write(ctx->dev, ctx->transport_data, data, len); in s6e63m0_dcs_write()
345 dev_err(ctx->dev, "error checking LCD type (%d)\n", ret); in s6e63m0_check_lcd_type()
346 ctx->lcd_type = 0x00; in s6e63m0_check_lcd_type()
350 dev_info(ctx->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); in s6e63m0_check_lcd_type()
354 * The third ID byte represents the desired ELVSS pulse for in s6e63m0_check_lcd_type()
359 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI M2\n"); in s6e63m0_check_lcd_type()
360 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
364 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI SM2\n"); in s6e63m0_check_lcd_type()
365 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
368 dev_info(ctx->dev, "unknown LCD panel type %02x\n", id2); in s6e63m0_check_lcd_type()
369 /* Default ELVSS pulse level */ in s6e63m0_check_lcd_type()
370 ctx->elvss_pulse = 0x16; in s6e63m0_check_lcd_type()
374 ctx->lcd_type = id2; in s6e63m0_check_lcd_type()
388 if (ctx->dsi_mode) in s6e63m0_init()
470 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_on()
476 /* Be sure to send a reset pulse */ in s6e63m0_power_on()
477 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_on()
479 gpiod_set_value(ctx->reset_gpio, 0); in s6e63m0_power_on()
489 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_off()
492 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_off()
503 backlight_disable(ctx->bl_dev); in s6e63m0_disable()
569 backlight_enable(ctx->bl_dev); in s6e63m0_enable()
580 mode = drm_mode_duplicate(connector->dev, &default_mode); in s6e63m0_get_modes()
582 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in s6e63m0_get_modes()
585 return -ENOMEM; in s6e63m0_get_modes()
588 connector->display_info.width_mm = mode->width_mm; in s6e63m0_get_modes()
589 connector->display_info.height_mm = mode->height_mm; in s6e63m0_get_modes()
590 drm_display_info_set_bus_formats(&connector->display_info, in s6e63m0_get_modes()
592 connector->display_info.bus_flags = DRM_BUS_FLAG_DE_LOW | in s6e63m0_get_modes()
597 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in s6e63m0_get_modes()
614 int brightness = bd->props.brightness; in s6e63m0_set_brightness()
621 elvss_val = ctx->elvss_pulse + s6e63m0_elvss_offsets[i]; in s6e63m0_set_brightness()
656 struct device *dev = ctx->dev; in s6e63m0_backlight_register()
659 ctx->bl_dev = devm_backlight_device_register(dev, "panel", dev, ctx, in s6e63m0_backlight_register()
662 if (IS_ERR(ctx->bl_dev)) { in s6e63m0_backlight_register()
663 ret = PTR_ERR(ctx->bl_dev); in s6e63m0_backlight_register()
681 return -ENOMEM; in s6e63m0_probe()
683 ctx->transport_data = trsp; in s6e63m0_probe()
684 ctx->dsi_mode = dsi_mode; in s6e63m0_probe()
685 ctx->dcs_read = dcs_read; in s6e63m0_probe()
686 ctx->dcs_write = dcs_write; in s6e63m0_probe()
689 ctx->dev = dev; in s6e63m0_probe()
691 ret = device_property_read_u32(dev, "max-brightness", &max_brightness); in s6e63m0_probe()
699 ctx->supplies[0].supply = "vdd3"; in s6e63m0_probe()
700 ctx->supplies[1].supply = "vci"; in s6e63m0_probe()
701 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6e63m0_probe()
702 ctx->supplies); in s6e63m0_probe()
708 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in s6e63m0_probe()
709 if (IS_ERR(ctx->reset_gpio)) { in s6e63m0_probe()
710 dev_err(dev, "cannot get reset-gpios %ld\n", PTR_ERR(ctx->reset_gpio)); in s6e63m0_probe()
711 return PTR_ERR(ctx->reset_gpio); in s6e63m0_probe()
714 drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs, in s6e63m0_probe()
722 drm_panel_add(&ctx->panel); in s6e63m0_probe()
732 drm_panel_remove(&ctx->panel); in s6e63m0_remove()