Lines Matching +full:elvss +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0
6 * Derived from drivers/gpu/drm/panel-samsung-ld9040.c
19 #include <linux/media-bus-format.h>
23 #include "panel-samsung-s6e63m0.h"
32 #define MAX_BRIGHTNESS (NUM_GAMMA_LEVELS - 1)
228 /* 30 - 60 cd: ACL off/NULL */
230 /* 70 - 250 cd: 40P ACL */
232 /* 260 - 300 cd: 50P ACL */
236 /* The ELVSS backlight regulator has 5 levels */
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 */
305 int ret = ctx->error; in s6e63m0_clear_error()
307 ctx->error = 0; in s6e63m0_clear_error()
313 if (ctx->error < 0) in s6e63m0_dcs_read()
316 ctx->error = ctx->dcs_read(ctx->dev, ctx->transport_data, cmd, data); in s6e63m0_dcs_read()
321 if (ctx->error < 0 || len == 0) in s6e63m0_dcs_write()
324 ctx->error = ctx->dcs_write(ctx->dev, ctx->transport_data, data, len); in s6e63m0_dcs_write()
344 dev_err(ctx->dev, "error checking LCD type (%d)\n", ret); in s6e63m0_check_lcd_type()
345 ctx->lcd_type = 0x00; in s6e63m0_check_lcd_type()
349 dev_info(ctx->dev, "MTP ID: %02x %02x %02x\n", id1, id2, id3); in s6e63m0_check_lcd_type()
353 * The third ID byte represents the desired ELVSS pulse for in s6e63m0_check_lcd_type()
358 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI M2\n"); in s6e63m0_check_lcd_type()
359 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
363 dev_info(ctx->dev, "detected LCD panel AMS397GE MIPI SM2\n"); in s6e63m0_check_lcd_type()
364 ctx->elvss_pulse = id3; in s6e63m0_check_lcd_type()
367 dev_info(ctx->dev, "unknown LCD panel type %02x\n", id2); in s6e63m0_check_lcd_type()
368 /* Default ELVSS pulse level */ in s6e63m0_check_lcd_type()
369 ctx->elvss_pulse = 0x16; in s6e63m0_check_lcd_type()
373 ctx->lcd_type = id2; in s6e63m0_check_lcd_type()
387 if (ctx->dsi_mode) in s6e63m0_init()
469 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_on()
476 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_on()
478 gpiod_set_value(ctx->reset_gpio, 0); in s6e63m0_power_on()
488 gpiod_set_value(ctx->reset_gpio, 1); in s6e63m0_power_off()
491 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6e63m0_power_off()
502 backlight_disable(ctx->bl_dev); in s6e63m0_disable()
568 backlight_enable(ctx->bl_dev); in s6e63m0_enable()
579 mode = drm_mode_duplicate(connector->dev, &default_mode); in s6e63m0_get_modes()
581 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in s6e63m0_get_modes()
584 return -ENOMEM; in s6e63m0_get_modes()
587 connector->display_info.width_mm = mode->width_mm; in s6e63m0_get_modes()
588 connector->display_info.height_mm = mode->height_mm; in s6e63m0_get_modes()
589 drm_display_info_set_bus_formats(&connector->display_info, in s6e63m0_get_modes()
591 connector->display_info.bus_flags = DRM_BUS_FLAG_DE_LOW | in s6e63m0_get_modes()
596 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in s6e63m0_get_modes()
613 int brightness = bd->props.brightness; in s6e63m0_set_brightness()
618 /* Adjust ELVSS to candela level */ in s6e63m0_set_brightness()
620 elvss_val = ctx->elvss_pulse + s6e63m0_elvss_offsets[i]; in s6e63m0_set_brightness()
655 struct device *dev = ctx->dev; in s6e63m0_backlight_register()
658 ctx->bl_dev = devm_backlight_device_register(dev, "panel", dev, ctx, in s6e63m0_backlight_register()
661 if (IS_ERR(ctx->bl_dev)) { in s6e63m0_backlight_register()
662 ret = PTR_ERR(ctx->bl_dev); in s6e63m0_backlight_register()
680 return -ENOMEM; in s6e63m0_probe()
682 ctx->transport_data = trsp; in s6e63m0_probe()
683 ctx->dsi_mode = dsi_mode; in s6e63m0_probe()
684 ctx->dcs_read = dcs_read; in s6e63m0_probe()
685 ctx->dcs_write = dcs_write; in s6e63m0_probe()
688 ctx->dev = dev; in s6e63m0_probe()
690 ret = device_property_read_u32(dev, "max-brightness", &max_brightness); in s6e63m0_probe()
698 ctx->supplies[0].supply = "vdd3"; in s6e63m0_probe()
699 ctx->supplies[1].supply = "vci"; in s6e63m0_probe()
700 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6e63m0_probe()
701 ctx->supplies); in s6e63m0_probe()
707 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in s6e63m0_probe()
708 if (IS_ERR(ctx->reset_gpio)) { in s6e63m0_probe()
709 dev_err(dev, "cannot get reset-gpios %ld\n", PTR_ERR(ctx->reset_gpio)); in s6e63m0_probe()
710 return PTR_ERR(ctx->reset_gpio); in s6e63m0_probe()
713 drm_panel_init(&ctx->panel, dev, &s6e63m0_drm_funcs, in s6e63m0_probe()
721 drm_panel_add(&ctx->panel); in s6e63m0_probe()
731 drm_panel_remove(&ctx->panel); in s6e63m0_remove()