From patchwork Tue Feb 20 21:12:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Karthikeyan Ramasubramanian X-Patchwork-Id: 203817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp668938dyc; Tue, 20 Feb 2024 13:13:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXzvZBkqUdyv43+In+Xgpqt67q098GL5y4RVvh2D+2mY4Nflj5OcbJrlvqdsRQUYdStXg6kmyYfhlx5FF9hxc59efJDaQ== X-Google-Smtp-Source: AGHT+IGP/BgOPU89quoIcvDCfpzzRKik59sCHMhOM6IZp4Exsyi9eIP3MEi4qxRkmHSgL4tpcEyD X-Received: by 2002:a0c:cb0c:0:b0:68f:1aa5:f80f with SMTP id o12-20020a0ccb0c000000b0068f1aa5f80fmr21334052qvk.1.1708463633521; Tue, 20 Feb 2024 13:13:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708463633; cv=pass; d=google.com; s=arc-20160816; b=0wkR14ruQIpSxgSt5bS7+odqQHtme451sDrnVIy0PONAGVT6zwtX9Se6Z8uNchHY95 vftHaRsvpcQFzpprcLHtOn6xGE0SwQ2YbqEZoWwDlbj7WXQXv17FZ0j24Uk6gNz4K7Ux zOBt4pWvZH1uWy3StByg4mNMnCOxUP/HjsHsCqC1ooCVLjdcknl734hjKHV8uAyPht1e j7rf78414yH1iTUa8hgHFrIlDG6eH2qqg0YShlH26OP2B1qejbJZ9TYtqzgviUZf2kA5 IzIbbXC4Wdiuod1vzEQIIBpvs2bBGo1vH+4Lxsjmu+QxDaDArBI0KQIQytbrqK2QKhwT Y0GA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=LFUM0XDK0ZVTj4kCTskFg/BdpgZIKaoWZSjy/zINkgc=; fh=gm79pu/9oWYBWcJn/KBZppCd9JQN9lh9v9iKWR6iuXo=; b=OSb84efk1ODvbI9mruGKYSD8IglNsxzr+KZ1oNWLZn4B4lgc6RDkN8EkGlvpCMKXOj B/I3cRZckVJr7bh0Ka/wKxDYinf+vUFCSP0s/HCqIazyRjgSTeojXIX/5QnEXmfAuNb0 6jLrFYyqVCUoI9yiAH9C4mbhbZVexsx96mXqScC5p1hxRK8p5VBQUrxIKiy4IzSnah5W lu9wO4MHAOlh6wsVEGlZa7+6afjMrZSkKVU7wiBHUo1jGdDvIHvkM5s2gXWxBUAIXmdk JxNE0KbFmqCGnoQBQsBoNie2MQrJzLURfVqtK+Ji119FfvpcjTgSNnCydlt+CV3t+6IB 0gaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EG3j6/I9"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-73713-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73713-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k1-20020ad45be1000000b0068f0f1b9797si9663025qvc.581.2024.02.20.13.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:13:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73713-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EG3j6/I9"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-73713-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73713-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4243F1C21F40 for ; Tue, 20 Feb 2024 21:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F3931509AC; Tue, 20 Feb 2024 21:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EG3j6/I9" Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08FF2133987 for ; Tue, 20 Feb 2024 21:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463617; cv=none; b=SAH+tcCgy9GPplr4ATw4kk5redPe5NVu/eeO0n3NqjEwsitLo6LpE0/iJag0G82YWyqgIpyfdjvqXMx9Sxdh4k3zNh9d557N051RoJvDU+eE8iK2qUhmjn9S51CsuBUdsfkKuGGbQ55zoVDXTdlOvD/GK1unna89aB92RDCDHMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463617; c=relaxed/simple; bh=mWs5E7X9FqqKixvWnOWdMsVW4SYoh7sLP2BfN7RgoR4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lcmd9hXGOdgkw3tn7r81cpKsUplxe3jl3b/CT1G0bDUuO/vx+nAytF6mRe9439rsGHhSguS4Hkf3NV75YCsJ+wct9YnaxqwWzp4t6rTGUKR74FUH/kGC5XFPZZDdk+9THJw8pmObKOvc1EDHlucatXvuXNmJBAS7QvgANHIEN5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=EG3j6/I9; arc=none smtp.client-ip=209.85.222.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7872614af89so507133885a.0 for ; Tue, 20 Feb 2024 13:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708463613; x=1709068413; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LFUM0XDK0ZVTj4kCTskFg/BdpgZIKaoWZSjy/zINkgc=; b=EG3j6/I9Z5Jm4bWXTV2g1jHigwYYQROjjcSxntOaQrErUExWYCS98lGNVOdmw4Gy0J qoPO4LFT5w7rG3NiXbY4eNmlYtuCM34XJmsIQyEUspvbY16fST2ppN5We/PnJEDaBhqc uVpveO1qD3KjD64uzp+411zJcD+yP6qGXwCDA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708463613; x=1709068413; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LFUM0XDK0ZVTj4kCTskFg/BdpgZIKaoWZSjy/zINkgc=; b=DVd5VauH/aq7C8m2qbdj8EFIRflbk8p+y0F3i3Wn4+6NRvTzY0U7JaFeTVl6K9ihXp lXKjeneOy8aqEzceTj7R7y7E15N9kAHHeLjSJT9OHitnKNYkIOfZhEZrVvraDjB8ws5m EMZINnZAYiXQg/0BglMybiwwgC2cKOmeRfpbwTJDjdftCgSCL1YA/f5CS5GaHSplzv3v 0mHxwEIPsBDl/BYFyagNTmE4JOc/u7r/rSdeUCKCIBS9ayFfkvmf3l0NmcT7GYG0H/Gj cXmtwO0/4qZpfie7khy2XTnP0eRIO83hnmYCEyxHl5FmIXfHCPmmKjA8kOKPOwSQ/nH0 F6LA== X-Gm-Message-State: AOJu0Ywj1mhkZqFwJxcXjBCMUT3fkDe1amphrBLbjRdpIMZx2T0xbC9R 5qs15Mo69AAHp3Z554ceNuCM+RkK09OBBcrKbWXRX4ko4HKCagGZiag8fNyPPUmE3O9AmA8uIPU = X-Received: by 2002:a05:620a:e8b:b0:787:38a4:7bdd with SMTP id w11-20020a05620a0e8b00b0078738a47bddmr22892813qkm.2.1708463613174; Tue, 20 Feb 2024 13:13:33 -0800 (PST) Received: from kramasub2.cros.corp.google.com ([100.107.108.189]) by smtp.gmail.com with ESMTPSA id c1-20020a05620a134100b0078726621376sm3701207qkl.118.2024.02.20.13.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:13:32 -0800 (PST) From: Karthikeyan Ramasubramanian To: LKML Cc: Karthikeyan Ramasubramanian , stable@vger.kernel.org, Jani Nikula , =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Daniel Vetter , David Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Subject: [PATCH v1] drivers/i915/intel_bios: Fix parsing backlight BDB data Date: Tue, 20 Feb 2024 14:12:57 -0700 Message-ID: <20240220141256.v1.1.I0690aa3e96a83a43b3fc33f50395d334b2981826@changeid> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791453963041526147 X-GMAIL-MSGID: 1791453963041526147 Starting BDB version 239, hdr_dpcd_refresh_timeout is introduced to backlight BDB data. Commit 700034566d68 ("drm/i915/bios: Define more BDB contents") updated the backlight BDB data accordingly. This broke the parsing of backlight BDB data in VBT for versions 236 - 238 (both inclusive) and hence the backlight controls are not responding on units with the concerned BDB version. backlight_control information has been present in backlight BDB data from at least BDB version 191 onwards, if not before. Hence this patch extracts the backlight_control information if the block size of backlight BDB is >= version 191 backlight BDB block size. Tested on Chromebooks using Jasperlake SoC (reports bdb->version = 236). Tested on Chromebooks using Raptorlake SoC (reports bdb->version = 251). Fixes: 700034566d68 ("drm/i915/bios: Define more BDB contents") Cc: stable@vger.kernel.org Cc: Jani Nikula Cc: Ville Syrjälä Signed-off-by: Karthikeyan Ramasubramanian --- drivers/gpu/drm/i915/display/intel_bios.c | 22 +++++-------------- drivers/gpu/drm/i915/display/intel_vbt_defs.h | 2 -- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index aa169b0055e97..4ec50903b9e64 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -1041,23 +1041,13 @@ parse_lfp_backlight(struct drm_i915_private *i915, panel->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI; panel->vbt.backlight.controller = 0; - if (i915->display.vbt.version >= 191) { - size_t exp_size; + if (i915->display.vbt.version >= 191 && + get_blocksize(backlight_data) >= EXP_BDB_LFP_BL_DATA_SIZE_REV_191) { + const struct lfp_backlight_control_method *method; - if (i915->display.vbt.version >= 236) - exp_size = sizeof(struct bdb_lfp_backlight_data); - else if (i915->display.vbt.version >= 234) - exp_size = EXP_BDB_LFP_BL_DATA_SIZE_REV_234; - else - exp_size = EXP_BDB_LFP_BL_DATA_SIZE_REV_191; - - if (get_blocksize(backlight_data) >= exp_size) { - const struct lfp_backlight_control_method *method; - - method = &backlight_data->backlight_control[panel_type]; - panel->vbt.backlight.type = method->type; - panel->vbt.backlight.controller = method->controller; - } + method = &backlight_data->backlight_control[panel_type]; + panel->vbt.backlight.type = method->type; + panel->vbt.backlight.controller = method->controller; } panel->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h index a9f44abfc9fc2..aeea5635a37ff 100644 --- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h +++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h @@ -899,8 +899,6 @@ struct lfp_brightness_level { #define EXP_BDB_LFP_BL_DATA_SIZE_REV_191 \ offsetof(struct bdb_lfp_backlight_data, brightness_level) -#define EXP_BDB_LFP_BL_DATA_SIZE_REV_234 \ - offsetof(struct bdb_lfp_backlight_data, brightness_precision_bits) struct bdb_lfp_backlight_data { u8 entry_size;