From 7264fef45bd3802ff180cd241e58f7b9fcb3b29e Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Wed, 21 Feb 2024 20:28:21 +0200 Subject: tools/intel_vbt_decode: Decode the backlight i2c stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decode the (obsolete) backlight i2c stuff for completeness. v2: Add missing '<' to "" (Jani) Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- tools/intel_vbt_decode.c | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c index 5b2bdc7e7..5acaf1835 100644 --- a/tools/intel_vbt_decode.c +++ b/tools/intel_vbt_decode.c @@ -620,6 +620,27 @@ static void dump_general_features(struct context *context, printf("\tDP SSC dongle supported: %s\n", YESNO(features->dp_ssc_dongle_supported)); } +static const char *inverter_type(u8 type) +{ + switch (type) { + case 0: return "none/external"; + case 1: return "I2C"; + case 2: return "PWM"; + default: return ""; + } +} + +static const char *i2c_speed(u8 i2c_speed) +{ + switch (i2c_speed) { + case 0: return "100 kHz"; + case 1: return "50 kHz"; + case 2: return "400 kHz"; + case 3: return "1 MHz"; + default: return ""; + } +} + static void dump_backlight_info(struct context *context, const struct bdb_block *block) { @@ -642,11 +663,20 @@ static void dump_backlight_info(struct context *context, blc = &backlight->data[i]; - printf("\t\tInverter type: %u\n", blc->type); - printf("\t\tActive low: %u\n", blc->active_low_pwm); + printf("\t\tInverter type: %s (%u)\n", + inverter_type(blc->type), blc->type); + printf("\t\tActive low: %s\n", YESNO(blc->active_low_pwm)); printf("\t\tPWM freq: %u\n", blc->pwm_freq_hz); printf("\t\tMinimum brightness: %u\n", blc->min_brightness); + if (blc->type == 1) { + printf("\t\tI2C pin: 0x%02x\n", blc->i2c_pin); + printf("\t\tI2C speed: %s (0x%02x)\n", + i2c_speed(blc->i2c_speed), blc->i2c_speed); + printf("\t\tI2C address: 0x%02x\n", blc->i2c_address); + printf("\t\tI2C command: 0x%02x\n", blc->i2c_command); + } + printf("\t\tLevel: %u\n", backlight->level[i]); control = &backlight->backlight_control[i]; @@ -960,17 +990,6 @@ static const char *hdmi_frl_rate(u8 frl_rate) } } -static const char *i2c_speed(u8 i2c_speed) -{ - switch (i2c_speed) { - case 0: return "100 kHz"; - case 1: return "50 kHz"; - case 2: return "400 kHz"; - case 3: return "1 MHz"; - default: return ""; - } -} - static void dump_child_device(struct context *context, const struct child_device_config *child) { -- cgit v1.2.3