Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2530848rdb; Wed, 21 Feb 2024 10:20:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUZtkWsXGC2lr99DKroQ7RL0DO1fXESOWJEIqa+NhStsj1gNEkozfUqIoOKpOwxKGSW2TmwzvXYp1Mh22JO3f4XNp0GucRYjjow0jieA== X-Google-Smtp-Source: AGHT+IEK4QdWEYu0ZIuX0Dj8fOxCimy4/Y7pS0EhZIFOrtQKD5KsFps9bIz8MolEd7UZGDFMjJDJ X-Received: by 2002:a17:902:f542:b0:1d9:4106:b8b5 with SMTP id h2-20020a170902f54200b001d94106b8b5mr415886plf.11.1708539636888; Wed, 21 Feb 2024 10:20:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708539636; cv=pass; d=google.com; s=arc-20160816; b=kvQJCkArP8fzP3iH/98dFQO23YvL8M8WscWbczdRl7QcChs8aOoA0E6Kfl7J5C2hJe jsO44hzlT5900KLVyNNyADjrzy0oOPP0b7qfp+IjBQKCP4VnKbTIC70nOBhgDLhPnmBc WXc+eEAQxTcdyn3LJA8veE1ic6gli/mURv/HXdng+KkVNUCrccInhLicW3FDx+Mcdhyj q+dXnHxYknri6MZFak+mymk6KTLDBUeClL5fabIpx41K3WyMZhcwRD4RX0KYx2fPPzs2 /ypnfnmKouvs7IpPm1EhSlU8GgNkwlF+1U3ufJOu+NotpB9FPfCLb9MKMkW+TziUyY4Q afmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gL8xjnVTzY1fHOvUe70GUs/vaOVId/l4AK79PmC6RWQ=; fh=0U2nfrt8KFWPaPwfH2r5jm2OptGlFKOAdeErrdnBU6A=; b=SBvxMKyRiCRoNGhQE/uGB/1KaLmNRNHm1HozSJKve5QXhQ2Z3ape9VOt7HgDcaG5Zd Cg163sNOyDTMd+piU0fyexqU5pRtRP4/ClCQJZTbSOT6ru0HULyvUb4oquwrS+LsyiRg VwurBXhuMTtEdYIOq2O6I7tWZtZNVzdoovOdzs/NL1n5NT7oGVXMZR4+vx3A/BoQw+kW uivXszfWQOo7OzmQ18SnZZPM7xCHmwjxrxnBZx5Ds5VgrhFDkV2J22t/VoKjryOkOUOY jOOSRSz+sYp4wf6hrm4hqFMZiY6gUrf43LzH6HhiylizcCLM9lTbJMlp/5bamOYmx9IU twwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g4FWW2wW; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75262-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c4-20020a170903234400b001db6ae778adsi8486149plh.483.2024.02.21.10.20.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 10:20:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75262-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g4FWW2wW; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75262-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 91302283978 for ; Wed, 21 Feb 2024 18:20:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74D9485281; Wed, 21 Feb 2024 18:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g4FWW2wW" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AB3684FD8; Wed, 21 Feb 2024 18:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708539630; cv=none; b=aczU2N/YDtMuNxUE4/H7mgoSIkzmziMh0VGAiw15EXdbGruI4USwZVjpiU10xSNmroz/k96GbSlAyWYCPQm5miiFol5MpVMFWNxlKU6Bm5ongCc6jZgVFZQaH7pAuE1ANL8WyqT8Mkb/bvpjZg2AEH21bM0lPJj1Xr0kXa3dAz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708539630; c=relaxed/simple; bh=SvTDEY+0QcaH0E2UrMugQ8Cuiud8mCTZP++Vpeo4srs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ug7GBVyPdScUQD8x1KVPLfUKwUx+vsqmuVKvo2w1NxWgay51C7JQv8MQcEQoUBLR8OzWjx7y02jsP1lf4LbuKs7K2p7Jbi5L0B2sp0RuoLMVpuFlaJjK9fsKpHI9WzmzqKSVXjmkLsXNdiRl5pZQsIN33Ceu88xiKrqfS07iqdA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=g4FWW2wW; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708539628; x=1740075628; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=SvTDEY+0QcaH0E2UrMugQ8Cuiud8mCTZP++Vpeo4srs=; b=g4FWW2wWthybHSTxVNMghbwA5IRJ3TOWvF+1wOIf9ZlK01d8aB3NzHiV 5xOuApIe0jHQoYXOZeVmzmFrCSsOVQT6+ftE0Tinjqdd4qU9x9N6n2k4L nk3KKGKXaBbotKMpcw4avq4p81sL2jUfpR98mIkfyLfhjv0gaLWNOu1hu WAMoiH+1M0EzZwBYJ2xXltLtJn4w/KeZQ0drDlr0qfBeBDEBrIekWpmaB 8k+nzjzTrhu+Y9WxWHqfqHTFydM7Bmsryw2m8+6RG2vi4h7NbioqNyf3Z tiQZrF4cnpWvuM8fOuHFvKMlEDhP66M2Sfw4bD6LVk+IXtbTp8bxZKpWH Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="20263716" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="20263716" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2024 10:20:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="827390066" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="827390066" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 21 Feb 2024 10:20:22 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 21 Feb 2024 20:20:22 +0200 Date: Wed, 21 Feb 2024 20:20:22 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Karthikeyan Ramasubramanian Cc: LKML , stable@vger.kernel.org, Jani Nikula , 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: Re: [PATCH v1] drivers/i915/intel_bios: Fix parsing backlight BDB data Message-ID: References: <20240220141256.v1.1.I0690aa3e96a83a43b3fc33f50395d334b2981826@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240220141256.v1.1.I0690aa3e96a83a43b3fc33f50395d334b2981826@changeid> X-Patchwork-Hint: comment On Tue, Feb 20, 2024 at 02:12:57PM -0700, Karthikeyan Ramasubramanian wrote: > 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) { The size checks looks like nonsense to me. I guess maybe we needed it before we were guaranteed to have the full struct's worth of memory. But there should be no need for this anymore. > + 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; > -- > 2.44.0.rc0.258.g7320e95886-goog -- Ville Syrj?l? Intel