From patchwork Thu Nov 2 21:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 161130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp673496vqu; Thu, 2 Nov 2023 15:13:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA8uYTaH88dPXLMmWKrJDII2VaUdsITEOzgYlXzFkjxveOUd5uwDLfrRkNAWtANeeXvX2M X-Received: by 2002:a05:6a20:9184:b0:181:594b:fb77 with SMTP id v4-20020a056a20918400b00181594bfb77mr1235005pzd.29.1698963212125; Thu, 02 Nov 2023 15:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698963212; cv=none; d=google.com; s=arc-20160816; b=C4o4u+BLWeJezlyMKPbBPM4Twao5yjh2hidweqyG+ur+zOkXI+inXZWXE73Pe3RfEK PdyFvjUNaI+r0pcRPEWbXa0CqykKaJUehtPXjNkFvLwIfzUjLsX2C647EtpV4Pxe6NGt klvu+Lx08QZAYC5arxJuMu3JPoEGT47NlZ0W64b6iyPb+dmHc2qfbjZjQCn9BgkJBd/N 3u6y/+K2pxbzD88CpJyBk/mQuQSEnnAC31r486kwSWcePWvz4/+P1XqP86cGE8Fcn4Ws CVpI9UeE7vpxILVAg8iXPZoOGxdWKurSkY6udITNMCN1dEWiD2luKNoaqsf6qkhtQCl6 ZiSQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y06i8Y7ERebYf/tho68vkzbllD+e/f8ccnIKfy6txBE=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=obZpzKQfnyQ71Lg6rdFjlqo2yLkCYBNzIwi1CPg3WsmP4BEONg8jQjEoZlTwOQemKs 4uaO9mSIJzcrgt6dJ6rCmev9JC5N/aA2kjT9qxl2WN/OfGP1wD1cpTMVT3uCW19slnP9 ZkO8lQGP6MFxA2FnwembdYCyswBWsO1dN2g2iSm5StgR9J0QFvSK0+LdDy+VJG9MOV61 gDbS41rWCP1d7Nb+2fWGIGRSrN8HRWN0seGraBNsWz58TEHtVzBDcxbwti11UOwruGfq mdX1JYcFkquZ6tK1VBN3sH6FXGldE7QJCgwdfHyOznYoFvz5pbMYv2cdQc6W274O3rqf VrNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Kk/E6RU9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fa36-20020a056a002d2400b006c128a7f813si364061pfb.177.2023.11.02.15.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 15:13:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Kk/E6RU9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 5BAF882F05EA; Thu, 2 Nov 2023 15:13:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377465AbjKBWN2 (ORCPT + 37 others); Thu, 2 Nov 2023 18:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjKBWNY (ORCPT ); Thu, 2 Nov 2023 18:13:24 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91A9138 for ; Thu, 2 Nov 2023 15:13:18 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1cc53d0030fso12058365ad.0 for ; Thu, 02 Nov 2023 15:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1698963198; x=1699567998; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y06i8Y7ERebYf/tho68vkzbllD+e/f8ccnIKfy6txBE=; b=Kk/E6RU9Ao0Fd5cORJG34sAFudLpkSB5HJKfNVioSDwluCr4Al57WsBQPX+iI8+AUl CSToW8Fs+mkke6j9aTpTc4u/hYu597q6EMHK7hnHBYA776DfsANFZID1Y/iCfiMmRi6G ewlft7Smn8jojhDIUkKn58OBlaUSv6vodklQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698963198; x=1699567998; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y06i8Y7ERebYf/tho68vkzbllD+e/f8ccnIKfy6txBE=; b=cgkcgyvrRuB6KKvbiaw5uPADqYTJbNZxUMa2wJW0T/L1CC00ax8S2UbukOiBNdBC6e XRq04AuWx012Hv7BsrLhVQ85AsBy2Jjfqs7869mz2OI7iVF9KEQcEGPxN1sVsYZ9cBt9 6aSmqBXSYFl3AvOdoeqUvXZfXUsYmpeiqOXgjH+fr5efDDNpoa3MlM7eqD8PP2cZ4oht VBoHhw+EJTM6DDgx/Nohoeco0pW31vkKqjfjNa+hOxrSgCMhuMPOPo+jyPF0UoHlojSO dZTXUCVfwD7GhIZTd3fF5U8HfvTG3mLi/gc/NqOsMt4DwXkDMDKkipSVGkQ86SNZL2M3 b82g== X-Gm-Message-State: AOJu0YzG4ClVtscTAMVPVNWfhgQoLedSRCMXZxfNdmw7jsYe95RUMjif Z0ira/9cpqm4AC94J3kQf8YyzNU3fxRE2QK5pVE= X-Received: by 2002:a17:903:41c6:b0:1cc:55d4:a715 with SMTP id u6-20020a17090341c600b001cc55d4a715mr1007326ple.3.1698963198271; Thu, 02 Nov 2023 15:13:18 -0700 (PDT) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:6ec1:79de:6e50:d6fa]) by smtp.gmail.com with ESMTPSA id y6-20020a63ce06000000b00565e96d9874sm196057pgf.89.2023.11.02.15.13.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 15:13:17 -0700 (PDT) From: Hsin-Yi Wang To: Douglas Anderson Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] drm/modes: Add a function to clear preferred modes Date: Thu, 2 Nov 2023 14:47:49 -0700 Message-ID: <20231102221309.1971910-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231102221309.1971910-1-hsinyi@chromium.org> References: <20231102221309.1971910-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 02 Nov 2023 15:13:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781492048821863889 X-GMAIL-MSGID: 1781492048821863889 Add a function to clear the preferred bit of a connector's existing modes. This is useful for edp panel to unset the preferred modes read from edid if the panel has hard-coded modes. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v1->v2: - fix doc string (reported by kernel test robot). - split mode and panel patches. --- drivers/gpu/drm/drm_modes.c | 16 ++++++++++++++++ include/drm/drm_modes.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index ac9a406250c5..be3e9e931219 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1933,6 +1933,22 @@ void drm_connector_list_update(struct drm_connector *connector) } EXPORT_SYMBOL(drm_connector_list_update); +/** + * drm_mode_unset_preferred_modes - clear the preferred bit on existing modes. + * @connector: the connector to update + * + * Walk the mode list for connector, clearing the preferred status on existing + * modes. + */ +void drm_mode_unset_preferred_modes(struct drm_connector *connector) +{ + struct drm_display_mode *cur_mode; + + list_for_each_entry(cur_mode, &connector->probed_modes, head) + cur_mode->type &= ~DRM_MODE_TYPE_PREFERRED; +} +EXPORT_SYMBOL_GPL(drm_mode_unset_preferred_modes); + static int drm_mode_parse_cmdline_bpp(const char *str, char **end_ptr, struct drm_cmdline_mode *mode) { diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index c613f0abe9dc..301817e00a15 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -560,6 +560,7 @@ void drm_mode_prune_invalid(struct drm_device *dev, struct list_head *mode_list, bool verbose); void drm_mode_sort(struct list_head *mode_list); void drm_connector_list_update(struct drm_connector *connector); +void drm_mode_unset_preferred_modes(struct drm_connector *connector); /* parsing cmdline modes */ bool