From patchwork Tue Oct 17 18:01:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Ballway X-Patchwork-Id: 154407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4310515vqb; Tue, 17 Oct 2023 11:04:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFI8tra3Q0qm7AvBdekJnPDQVm+KLyZ+paEoczGBeZNfIgjpsvT8zi937lDPFhtuDEp3IP X-Received: by 2002:a17:90b:38cf:b0:27c:f88f:11a5 with SMTP id nn15-20020a17090b38cf00b0027cf88f11a5mr3149282pjb.2.1697565850760; Tue, 17 Oct 2023 11:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697565850; cv=none; d=google.com; s=arc-20160816; b=rRfaSoEEaCezSJb3/cftEQZ3h1/0Rhd3TFip4WCXtPT0Kx8idg7BKZ5SP8F3Ha7AvL WjCpLPcjp6zwnMZdMcX87OjRgPvf1dJ4Ut8pohoaXI9XrHScV54vIznlcESdWC2TJMWa oIzjKjAt9hyfsptNrnB55f/H8XEF+qX4czx75ebyVdTT0UVZP90M7wpKYvrq36cZcqEa NYSZg2ze9DpLkZ9LUGkVqHiFhhMZ1bou4EHdOM+M+An3qDlaHp1KSVOMnNjez97delP+ GBFmYbPuFzhc3bCmnGZBwUe9lAsuS7VQf/eDG8zE1wWX38NcD6p+XAv+S++t9W5IozqR 7dpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FZe4Izl0NOH1/nIrnEIDX6DLuh+4li4EhUKl+KwsF4Q=; fh=HlAhbt/IoViaIOvtgQh3lBUaNJw8uGROsR85ndHdhWc=; b=00GhAD+gtdZ/z1RMpkKMO678wShSO4bxttyUukbFyxy6gPtTBBHqVN6Fpd5ZOszaxb W4cSBQKwL4YhuViAdjDbGlthaXasrNYjyhyOB40mP11GM/v1CXLMdtY4JB3hN2ymG3BO Ekpuu9UkZiTX9Y78DRqgeNmIW2ERtmRAHLdu7cdfkZP0C/afaktXg7NqcBCgXlUiAj6s a4y071aUI38F21zPWbkd6J7m6SObDDdqkFxeO1P7AmgOJ4D1NEzWZorH3CqeU5el/+Iu qWcaHZMHhvPGZTMtG+SxXpa9JNNcqsaUt+b3B7nv+4XImfD8NN/icdnlpdLR2Z7uvI7g 7N0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OYyok9zb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id h17-20020a17090ac39100b00273fa934cc1si9144437pjt.167.2023.10.17.11.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 11:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OYyok9zb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B4C4280942DF; Tue, 17 Oct 2023 11:04:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234968AbjJQSD6 (ORCPT + 21 others); Tue, 17 Oct 2023 14:03:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234891AbjJQSDu (ORCPT ); Tue, 17 Oct 2023 14:03:50 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670659E for ; Tue, 17 Oct 2023 11:03:46 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-27d0acd0903so3757757a91.1 for ; Tue, 17 Oct 2023 11:03:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697565826; x=1698170626; 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=FZe4Izl0NOH1/nIrnEIDX6DLuh+4li4EhUKl+KwsF4Q=; b=OYyok9zbirWgLWCXpgvjJ6E2SWCzIrAb6HqGQg4/TrIKsyEV6TUe9K866oQkxs5DE2 hyowsA5jZW5IqttbCldSbP/C5XvjXGDXbu/5olQhRAMspP6ufSEzqsbNXMP5Y1xecLT7 Nfqvhg32jhNVW1J/uQLJ3iE7NAQ2Wr+v9U7q0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697565826; x=1698170626; 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=FZe4Izl0NOH1/nIrnEIDX6DLuh+4li4EhUKl+KwsF4Q=; b=tJkA0ZMGbevYvoBwfr7It5AzAyr84dcymhk7moIIrpaoRcakETJ2Ob4ysUI/oMFLFn urJXDfoeRhMM0Q1hGBaImstTgOxHEgJmEv3doL2FlCRkmAHlpudXP87l/3yxi1Tk50SA WK0PDuv4heniE1ujdY0j0+2hjzfmWiegVJ0eJxnIG0dUiUhLYKf9rdw6CMeKR1+SXoBM DhEzL1OvPBlm/wlCj14R5QWUTNZTt7Raz5BljX8jkKwYcIfu/+GzBL5hMCS6EJn+ApgF og5JNdegTQvrigP2rfOtHU2rUvZOP7z4p/O25SKpWoK/GfUkPe8w6eEN/itaRmlNPquT iDKQ== X-Gm-Message-State: AOJu0Yw/3ujQOKpLmMScbpdadJuu+GwrmJfUvn/SPibJeWVlsRpwP75b uuvOoCiawQXoKSLubcd+0u6Eaw== X-Received: by 2002:a17:90a:1dd:b0:27d:4282:e3d2 with SMTP id 29-20020a17090a01dd00b0027d4282e3d2mr2754844pjd.30.1697565825722; Tue, 17 Oct 2023 11:03:45 -0700 (PDT) Received: from ballway1.c.googlers.com.com (155.248.125.34.bc.googleusercontent.com. [34.125.248.155]) by smtp.gmail.com with ESMTPSA id gz24-20020a17090b0ed800b0027d0af2e9c3sm6675469pjb.40.2023.10.17.11.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 11:03:45 -0700 (PDT) From: Allen Ballway To: dri-devel@lists.freedesktop.org Cc: arun.r.murthy@intel.com, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, linux-kernel@vger.kernel.org, Allen Ballway Subject: [PATCH] drm/i915/quirk: Add quirk for devices with incorrect PWM frequency Date: Tue, 17 Oct 2023 18:01:39 +0000 Message-ID: <20231017175728.1.Ibc6408a8ff1f334974104c5bcc25f2f35a57f36e@changeid> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 17 Oct 2023 11:04:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780026809716132637 X-GMAIL-MSGID: 1780026809716132637 Cyernet T10C has a bad default PWM frequency causing the display to strobe when the brightness is less than 100%. Create a new quirk to use the value from the BIOS rather than the default register value. Signed-off-by: Allen Ballway --- .../gpu/drm/i915/display/intel_backlight.c | 3 ++- drivers/gpu/drm/i915/display/intel_quirks.c | 26 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_quirks.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) -- 2.42.0.655.g421f12c284-goog diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c index 2e8f17c045222..c4dcfece9deca 100644 --- a/drivers/gpu/drm/i915/display/intel_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_backlight.c @@ -1388,7 +1388,8 @@ static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe ctl = intel_de_read(i915, VLV_BLC_PWM_CTL(pipe)); panel->backlight.pwm_level_max = ctl >> 16; - if (!panel->backlight.pwm_level_max) + if (!panel->backlight.pwm_level_max || + intel_has_quirk(i915, QUIRK_IGNORE_DEFAULT_PWM_FREQUENCY)) panel->backlight.pwm_level_max = get_backlight_max_vbt(connector); if (!panel->backlight.pwm_level_max) diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c index a280448df771a..ff6cb499428ce 100644 --- a/drivers/gpu/drm/i915/display/intel_quirks.c +++ b/drivers/gpu/drm/i915/display/intel_quirks.c @@ -65,6 +65,12 @@ static void quirk_no_pps_backlight_power_hook(struct drm_i915_private *i915) drm_info(&i915->drm, "Applying no pps backlight power quirk\n"); } +static void quirk_ignore_default_pwm_frequency(struct drm_i915_private *i915) +{ + intel_set_quirk(i915, QUIRK_IGNORE_DEFAULT_PWM_FREQUENCY); + drm_info(&i915->drm, "Applying ignore default pwm frequency quirk"); +} + struct intel_quirk { int device; int subsystem_vendor; @@ -90,6 +96,12 @@ static int intel_dmi_no_pps_backlight(const struct dmi_system_id *id) return 1; } +static int intel_dmi_ignore_default_pwm_frequency(const struct dmi_system_id *id) +{ + DRM_INFO("Default PWM frequency is incorrect and is overridden on %s\n", id->ident); + return 1; +} + static const struct intel_dmi_quirk intel_dmi_quirks[] = { { .dmi_id_list = &(const struct dmi_system_id[]) { @@ -136,6 +148,20 @@ static const struct intel_dmi_quirk intel_dmi_quirks[] = { }, .hook = quirk_no_pps_backlight_power_hook, }, + { + .dmi_id_list = &(const struct dmi_system_id[]) { + { + .callback = intel_dmi_ignore_default_pwm_frequency, + .ident = "Cybernet T10C Tablet", + .matches = {DMI_EXACT_MATCH(DMI_BOARD_VENDOR, + "Cybernet Manufacturing Inc."), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "T10C Tablet"), + }, + }, + { } + }, + .hook = quirk_ignore_default_pwm_frequency, + }, }; static struct intel_quirk intel_quirks[] = { diff --git a/drivers/gpu/drm/i915/display/intel_quirks.h b/drivers/gpu/drm/i915/display/intel_quirks.h index 10a4d163149fd..70589505e5a0e 100644 --- a/drivers/gpu/drm/i915/display/intel_quirks.h +++ b/drivers/gpu/drm/i915/display/intel_quirks.h @@ -17,6 +17,7 @@ enum intel_quirk_id { QUIRK_INVERT_BRIGHTNESS, QUIRK_LVDS_SSC_DISABLE, QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK, + QUIRK_IGNORE_DEFAULT_PWM_FREQUENCY }; void intel_init_quirks(struct drm_i915_private *i915);