From patchwork Mon Nov 6 20:22:48 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: 162179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2909585vqu; Mon, 6 Nov 2023 12:27:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEs8HR35nOqFJ6EGzq2iJAd9VUIFCqXCgHXKtEXohxR2gr5F4PNV2IMDbP301C99WF3Ruzh X-Received: by 2002:a05:6358:921d:b0:16b:588b:bbd0 with SMTP id d29-20020a056358921d00b0016b588bbbd0mr9889825rwb.27.1699302457920; Mon, 06 Nov 2023 12:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699302457; cv=none; d=google.com; s=arc-20160816; b=0uqU1TJxPyYC0pgPQR0RYnlvNi3w0ugabtwpjlNMs5R0G64O+CEPhlZJwtlHhjs5+4 l83haPLDuF8KRCFywTfE3Y+nmCFcQFNmCQ0+Un9rNMjFtyjSd0XmHdkpWgdi9J0Kgrhg y2Y6dVvqtzbWZh4zSt0I1FIcfB4bkzACil+/0Z9U8Uuyo3qfFYtPjOiHil3V2MVCD2OT sU4ISq5FHBaMW7EncGDL1iLOZolFuQkpEclOkTjHH7w4gqo5b5sdv6LLxbp1wFE+76kO dKTompR4iFpM/HK0DnI6QOfNU1adtlAClSP5azLCNrFpLGBaDuyt/jdPvlWlZTOSdkO9 +Xzw== 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=39PlCE3mzpArW9CORTm1xmZNhDHILoffTBso2uy6jYw=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=etlZgnTitCpO8V+a9bMsrNpF2xnzrNMaoC7hjDgAle3mWc7cRPX3aXjdQTW+Q+6unc EOlhrdghU6GWnQdiJTIVbuUHtZXd083sxpz/VmbcZ9a3NxEDDRmKEfuGvJONOjs1BmRX ju9IeY6K+/+JFmBUlsuOkwQpje1QLN/g1gKsN9zIU8mZjc4uy4gEsxdXjrYDXmzu8gV4 Iq4cm205bxkTxfogg0B5WBEN3VmQTHFlh5FvCBFZe+LtHR5ZnHCitrKBnLh9id2YrHb0 O52KNBR6/ghvcBWk8Pkmy8sMIv79FgXYrurEk7q+AHQ4HRDGvEW7t7aBmiVpNtGjb+ir rUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="JP62pm3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id f20-20020a656294000000b00578c64433c9si408290pgv.894.2023.11.06.12.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="JP62pm3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 DEA03801B650; Mon, 6 Nov 2023 12:27:35 -0800 (PST) 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 S232949AbjKFU13 (ORCPT + 34 others); Mon, 6 Nov 2023 15:27:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232893AbjKFU11 (ORCPT ); Mon, 6 Nov 2023 15:27:27 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF191D71 for ; Mon, 6 Nov 2023 12:27:24 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5a9bc2ec556so3846237a12.0 for ; Mon, 06 Nov 2023 12:27:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699302444; x=1699907244; 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=39PlCE3mzpArW9CORTm1xmZNhDHILoffTBso2uy6jYw=; b=JP62pm3/L+krd7PbC+JIopiwXCvmBMUDm93XfNpls/VY1lVfdLtr/1rx2L9ANGusyH GU2xJ6kNhNQsQDFcsZL2Oa23GDPAbKbs3c4hzq9OTz3ST3OljrB7hFA0FSWkoVQENc/U ECa9cbnq/ZzbJsd0jj0KGfGmAC582iC3+wiO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302444; x=1699907244; 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=39PlCE3mzpArW9CORTm1xmZNhDHILoffTBso2uy6jYw=; b=KsxbjJaNXvbQwH0vaxREaRJDwiUPgSscG9AyKO1bgIu986s7x7LPDckhtDpEVXj7Ln G3PPtiKFl7LBBQU/0+NRpZ82frNdcd1SPF23pYJMUgz6NvK90ulYqtwDEg4pD9LgnIpO NjMwOuG6+qeaq2dkG0pjSGOHBj3XSCSw31SBLw6OBBsRiys4G529Eu6Aj7Fw+wiEOx5j z4VkhQA2LKht6vhymXMcZEJwcj71cRX6idjbGVTX1DOI7osB1p1/03Dp+9aJMHnGuIhK zD08w1GqmdJIR0Kr2fnhO/saoBoWyke8G5TSl8lx8v+FYSVcT+vMWSyVRMC0BRicEB9E Hr6Q== X-Gm-Message-State: AOJu0YzKulgpbKXTfKjE7EfJAikxHxRpEw7QtZaEk1b9xNepJt/2V/ye VM4aY4XlD1WS2NVz7BrSwzSpBQ== X-Received: by 2002:a05:6a20:da9a:b0:13d:d5bd:7593 with SMTP id iy26-20020a056a20da9a00b0013dd5bd7593mr33834710pzb.12.1699302444316; Mon, 06 Nov 2023 12:27:24 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:3374:ff6c:474e:a78]) by smtp.gmail.com with ESMTPSA id fj36-20020a056a003a2400b00689f5940061sm6144150pfb.17.2023.11.06.12.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:24 -0800 (PST) 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 v3 1/3] drm/panel-edp: drm/panel-edp: Add several generic edp panels Date: Mon, 6 Nov 2023 12:22:48 -0800 Message-ID: <20231106202718.2770821-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231106202718.2770821-1-hsinyi@chromium.org> References: <20231106202718.2770821-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 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 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]); Mon, 06 Nov 2023 12:27:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781847774237834272 X-GMAIL-MSGID: 1781847774237834272 Add a few generic edp panels used by mt8186 chromebooks. Besides, modify the following panel: - AUO 0x235c B116XTN02 renamed to B116XTN02.3. - AUO 0x405c B116XAK01 adjust the timing of auo_b116xak01. According to the datasheet: T3=200, T12=500, T7_max = 50. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v2->v3: fix title --- drivers/gpu/drm/panel/panel-edp.c | 57 +++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 9dce4c702414..599a949d74d1 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -973,6 +973,8 @@ static const struct panel_desc auo_b116xak01 = { }, .delay = { .hpd_absent = 200, + .unprepare = 500, + .enable = 50, }, }; @@ -1830,6 +1832,12 @@ static const struct panel_delay delay_200_500_e50 = { .enable = 50, }; +static const struct panel_delay delay_200_500_e80 = { + .hpd_absent = 200, + .unprepare = 500, + .enable = 80, +}; + static const struct panel_delay delay_200_500_e80_d50 = { .hpd_absent = 200, .unprepare = 500, @@ -1849,6 +1857,19 @@ static const struct panel_delay delay_200_500_e200 = { .enable = 200, }; +static const struct panel_delay delay_200_500_e200_d10 = { + .hpd_absent = 200, + .unprepare = 500, + .enable = 200, + .disable = 10, +}; + +static const struct panel_delay delay_200_150_e200 = { + .hpd_absent = 200, + .unprepare = 150, + .enable = 200, +}; + #define EDP_PANEL_ENTRY(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name) \ { \ .name = _name, \ @@ -1869,37 +1890,69 @@ static const struct edp_panel_entry edp_panels[] = { EDP_PANEL_ENTRY('A', 'U', 'O', 0x145c, &delay_200_500_e50, "B116XAB01.4"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x1e9b, &delay_200_500_e50, "B133UAN02.1"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x1ea5, &delay_200_500_e50, "B116XAK01.6"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x235c, &delay_200_500_e50, "B116XTN02"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x208d, &delay_200_500_e50, "B140HTN02.1"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x235c, &delay_200_500_e50, "B116XTN02.3"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x635c, &delay_200_500_e50, "B116XAN06.3"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x639c, &delay_200_500_e50, "B140HAK02.7"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x8594, &delay_200_500_e50, "B133UAN01.0"), + EDP_PANEL_ENTRY('A', 'U', 'O', 0xf390, &delay_200_500_e50, "B140XTN07.7"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0715, &delay_200_150_e200, "NT116WHM-N21"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0731, &delay_200_500_e80, "NT116WHM-N42"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0741, &delay_200_500_e200, "NT116WHM-N44"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x0786, &delay_200_500_p2e80, "NV116WHM-T01"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x07d1, &boe_nv133fhm_n61.delay, "NV133FHM-N61"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x07f6, &delay_200_500_e200, "NT140FHM-N44"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x082d, &boe_nv133fhm_n61.delay, "NV133FHM-N62"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x08b2, &delay_200_500_e200, "NT140WHM-N49"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x09c3, &delay_200_500_e50, "NT116WHM-N21,836X2"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x094b, &delay_200_500_e50, "NT116WHM-N21"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0951, &delay_200_500_e80, "NV116WHM-N47"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x095f, &delay_200_500_e50, "NE135FBM-N41 v8.1"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x0979, &delay_200_500_e50, "NV116WHM-N49 V8.0"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x098d, &boe_nv110wtm_n61.delay, "NV110WTM-N61"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x09ae, &delay_200_500_e200, "NT140FHM-N45"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x09dd, &delay_200_500_e50, "NT116WHM-N21"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x0a5d, &delay_200_500_e50, "NV116WHM-N45"), EDP_PANEL_ENTRY('B', 'O', 'E', 0x0ac5, &delay_200_500_e50, "NV116WHM-N4C"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0b43, &delay_200_500_e200, "NV140FHM-T09"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0b56, &delay_200_500_e80, "NT140FHM-N47"), + EDP_PANEL_ENTRY('B', 'O', 'E', 0x0c20, &delay_200_500_e80, "NT140FHM-N47"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x1132, &delay_200_500_e80_d50, "N116BGE-EA2"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x1138, &innolux_n116bca_ea1.delay, "N116BCA-EA1-RC4"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1139, &delay_200_500_e80_d50, "N116BGE-EA2"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x1145, &delay_200_500_e80_d50, "N116BCN-EB1"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x114c, &innolux_n116bca_ea1.delay, "N116BCA-EA1"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1152, &delay_200_500_e80_d50, "N116BCN-EA1"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1153, &delay_200_500_e80_d50, "N116BGE-EA2"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1154, &delay_200_500_e80_d50, "N116BCA-EA2"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x1157, &delay_200_500_e80_d50, "N116BGE-EA2"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x115b, &delay_200_500_e80_d50, "N116BCN-EB1"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x1247, &delay_200_500_e80_d50, "N120ACA-EA1"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x142b, &delay_200_500_e80_d50, "N140HCA-EAC"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x144f, &delay_200_500_e80_d50, "N140HGA-EA1"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x1468, &delay_200_500_e80, "N140HGA-EA1"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x14e5, &delay_200_500_e80_d50, "N140HGA-EA1"), EDP_PANEL_ENTRY('C', 'M', 'N', 0x14d4, &delay_200_500_e80_d50, "N140HCA-EAC"), + EDP_PANEL_ENTRY('C', 'M', 'N', 0x14d6, &delay_200_500_e80_d50, "N140BGA-EA4"), + + EDP_PANEL_ENTRY('H', 'K', 'C', 0x2d5c, &delay_200_500_e200, "MB116AN01-2"), + EDP_PANEL_ENTRY('I', 'V', 'O', 0x048e, &delay_200_500_e200_d10, "M116NWR6 R5"), EDP_PANEL_ENTRY('I', 'V', 'O', 0x057d, &delay_200_500_e200, "R140NWF5 RH"), EDP_PANEL_ENTRY('I', 'V', 'O', 0x854a, &delay_200_500_p2e100, "M133NW4J"), EDP_PANEL_ENTRY('I', 'V', 'O', 0x854b, &delay_200_500_p2e100, "R133NW4K-R0"), + EDP_PANEL_ENTRY('I', 'V', 'O', 0x8c4d, &delay_200_150_e200, "R140NWFM R1"), EDP_PANEL_ENTRY('K', 'D', 'B', 0x0624, &kingdisplay_kd116n21_30nv_a010.delay, "116N21-30NV-A010"), + EDP_PANEL_ENTRY('K', 'D', 'C', 0x0809, &delay_200_500_e50, "KD116N2930A15"), EDP_PANEL_ENTRY('K', 'D', 'B', 0x1120, &delay_200_500_e80_d50, "116N29-30NK-C007"), EDP_PANEL_ENTRY('S', 'H', 'P', 0x1511, &delay_200_500_e50, "LQ140M1JW48"), From patchwork Mon Nov 6 20:22: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: 162180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2909728vqu; Mon, 6 Nov 2023 12:28:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBA1GaswkQZz2Isn+Ge+zqtgWHrZ9wMre+3oeSZuDd3a5fuHZTCH1s9qMi7zf3uPLdwV9K X-Received: by 2002:a05:6a00:339b:b0:6c3:3989:c88b with SMTP id cm27-20020a056a00339b00b006c33989c88bmr10509925pfb.17.1699302480729; Mon, 06 Nov 2023 12:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699302480; cv=none; d=google.com; s=arc-20160816; b=03qqE99WKeb+DsNbgUW8PvpurXe1WuiyTt4YNMqbFXZkbJ6g406Qbdm65lulVU02mW /Y0hFiOUh2ioqFZtxhUNr+J9fz0gJdXQ/Is9ug6Mv1wB8yMYnkgUa2z1TcAtKQbbiUF7 9VVNITkykvaFusR09J1PCSc4JkIh6kleaPt2h21SagrhgITItG05pumqCDv6ve8VZHjy o5ATK0gqGo1we8j1Pv5VlpuYFmsX6B4PL0+e126Lk0HyWIScmKDsprmXbcyhiNe6Qz0N o9SglAHbDOFcQZfKd3aumRy+FPc94AnR6ovAeR9t8nPlNt7AZqP1FyQfSSd10RkK6OmC DAmw== 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=QPhsID+q93OjsSxKAgkiiMJkhHyPCqUVxHPEAVkAeW0=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=FaCIWff5fssp544mEr9oXSi7fyKmvuMlDyss/Iy8Kf/2z5RA/0IVYor2iVQlgZpDfx LGGBlsYKoqoK07EOeDZ0OtuSZ/BwLD1wN0C/sL352OV3N1vQO1DG4dBYOjHcO5/Me+be uizKkCM77iuWu4iTweblk4xrBmu+1U0x6NsdwsooaWC3UcN7V90Cz9TLQ0pFWwTbMGRI dC2ehMp76lFeme/+0NFlAXdkfABnCgbL66d0KujiVukttn+y4RObd/8WKn6z4WgG1RGg LW5lTGC+NFTqpCm8xGqseKWrtMOF2gFeoIC2RN1WdANCwy9IlPkckQW9sQLjmMfbyfwf p26Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="RHb0P/Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id m28-20020a63581c000000b005b95ee3edc6si404065pgb.628.2023.11.06.12.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:28:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="RHb0P/Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 DD5538051A3B; Mon, 6 Nov 2023 12:27:54 -0800 (PST) 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 S233039AbjKFU1f (ORCPT + 34 others); Mon, 6 Nov 2023 15:27:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbjKFU13 (ORCPT ); Mon, 6 Nov 2023 15:27:29 -0500 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2878BD73 for ; Mon, 6 Nov 2023 12:27:26 -0800 (PST) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3b2e330033fso2980655b6e.3 for ; Mon, 06 Nov 2023 12:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699302445; x=1699907245; 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=QPhsID+q93OjsSxKAgkiiMJkhHyPCqUVxHPEAVkAeW0=; b=RHb0P/FjISW/zbAyvPPK2A8eNvMN4kdEe27s5rFSJoZ5Wk4mpLKx/U4YZzoeC1xOfo o4UE70Og2ZF2LT/Mqmc/OhS0xD4JfGq2WnMZICxK+kuPzHterUnvfQfUxNJpUjb8tpM3 PtRffVEq3lMpHCB06zUtxsmk/zmzr48Wria04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302445; x=1699907245; 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=QPhsID+q93OjsSxKAgkiiMJkhHyPCqUVxHPEAVkAeW0=; b=vYRrEypt27F0eQUykf3E41m/JqM1D9UxdaSwmzJK1GhJYEeyYwgCcgvsmU/qJZzavR s8LJpkdqYQH+nUnYEm1oShVciu8WHDTKGO68c/ouWj6IQ1j6jB+UKE83QfxX7ShbZ2dx NWxwrst4kJOLEsxLl7olfwRhFxjIsuO9DiUDDH04F9ungNIJdl8EGzxmMmynX1KDGi1A RXORFg34eginCmJ7QyjVAQOWVX56U8M5ul1cvNAp00UJrVPvoZhOqaPDiABztj2QXHw4 DqtLAM+kwY7s6UDHjiqYb/UpXeA7gTIWOgYorRSmD/jGVV2DkIw9S6KK7wANOp8c7EgF nukQ== X-Gm-Message-State: AOJu0YwyPc2fOF7YlcmN9DJQxCWSAwxmsYUwsDQNKBathvcM7w8ZNd2d VuFf7oi0y64W1QrZrwM/81sBMR2/kgd1zqL7H+E= X-Received: by 2002:a05:6808:23cd:b0:3a7:9e15:fbfb with SMTP id bq13-20020a05680823cd00b003a79e15fbfbmr39556635oib.9.1699302445450; Mon, 06 Nov 2023 12:27:25 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:3374:ff6c:474e:a78]) by smtp.gmail.com with ESMTPSA id fj36-20020a056a003a2400b00689f5940061sm6144150pfb.17.2023.11.06.12.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:25 -0800 (PST) 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 v3 2/3] drm/panel-edp: Add override_edid_mode quirk for generic edp Date: Mon, 6 Nov 2023 12:22:49 -0800 Message-ID: <20231106202718.2770821-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231106202718.2770821-1-hsinyi@chromium.org> References: <20231106202718.2770821-1-hsinyi@chromium.org> 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,T_SCC_BODY_TEXT_LINE 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]); Mon, 06 Nov 2023 12:27:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781847797971815189 X-GMAIL-MSGID: 1781847797971815189 Generic edp gets mode from edid. However, some panels report incorrect mode in this way, resulting in glitches on panel. Introduce a new quirk additional_mode to the generic edid to pick a correct hardcoded mode. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v2->v3: no change. --- drivers/gpu/drm/panel/panel-edp.c | 68 ++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 599a949d74d1..0fb439b5efb1 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -203,6 +203,9 @@ struct edp_panel_entry { /** @name: Name of this panel (for printing to logs). */ const char *name; + + /** @override_edid_mode: Override the mode obtained by edid. */ + const struct drm_display_mode *override_edid_mode; }; struct panel_edp { @@ -301,6 +304,25 @@ static unsigned int panel_edp_get_display_modes(struct panel_edp *panel, return num; } +static int panel_edp_override_edid_mode(struct panel_edp *panel, + struct drm_connector *connector, + const struct drm_display_mode *override_mode) +{ + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(connector->dev, override_mode); + if (mode) { + mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + drm_mode_set_name(mode); + drm_mode_probed_add(connector, mode); + return 1; + } + + dev_err(panel->base.dev, "failed to add additional mode\n"); + + return 0; +} + static int panel_edp_get_non_edid_modes(struct panel_edp *panel, struct drm_connector *connector) { @@ -568,6 +590,9 @@ static int panel_edp_get_modes(struct drm_panel *panel, { struct panel_edp *p = to_panel_edp(panel); int num = 0; + bool has_override_edid_mode = p->detected_panel && + p->detected_panel != ERR_PTR(-EINVAL) && + p->detected_panel->override_edid_mode; /* probe EDID if a DDC bus is available */ if (p->ddc) { @@ -575,9 +600,18 @@ static int panel_edp_get_modes(struct drm_panel *panel, if (!p->edid) p->edid = drm_get_edid(connector, p->ddc); - - if (p->edid) - num += drm_add_edid_modes(connector, p->edid); + if (p->edid) { + if (has_override_edid_mode) { + /* + * override_edid_mode is specified. Use + * override_edid_mode instead of from edid. + */ + num += panel_edp_override_edid_mode(p, connector, + p->detected_panel->override_edid_mode); + } else { + num += drm_add_edid_modes(connector, p->edid); + } + } pm_runtime_mark_last_busy(panel->dev); pm_runtime_put_autosuspend(panel->dev); @@ -950,6 +984,19 @@ static const struct panel_desc auo_b101ean01 = { }, }; +static const struct drm_display_mode auo_b116xa3_mode = { + .clock = 70589, + .hdisplay = 1366, + .hsync_start = 1366 + 40, + .hsync_end = 1366 + 40 + 40, + .htotal = 1366 + 40 + 40 + 32, + .vdisplay = 768, + .vsync_start = 768 + 10, + .vsync_end = 768 + 10 + 12, + .vtotal = 768 + 10 + 12 + 6, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + static const struct drm_display_mode auo_b116xak01_mode = { .clock = 69300, .hdisplay = 1366, @@ -1878,6 +1925,15 @@ static const struct panel_delay delay_200_150_e200 = { .delay = _delay \ } +#define EDP_PANEL_ENTRY2(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name, _mode) \ +{ \ + .name = _name, \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ + product_id), \ + .delay = _delay, \ + .override_edid_mode = _mode \ +} + /* * This table is used to figure out power sequencing delays for panels that * are detected by EDID. Entries here may point to entries in the @@ -1895,9 +1951,11 @@ static const struct edp_panel_entry edp_panels[] = { EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0"), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0", + &auo_b116xa3_mode), EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1"), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1", + &auo_b116xa3_mode), EDP_PANEL_ENTRY('A', 'U', 'O', 0x635c, &delay_200_500_e50, "B116XAN06.3"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x639c, &delay_200_500_e50, "B140HAK02.7"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x8594, &delay_200_500_e50, "B133UAN01.0"), From patchwork Mon Nov 6 20:22:50 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: 162178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2909582vqu; Mon, 6 Nov 2023 12:27:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDtXCcOkNiniLkgh0Pxs1Ta/VQvG6QQcjggRA565jnCQPA6r9C9PDR+UxkCXuRVAAO6yZG X-Received: by 2002:a17:90b:696:b0:280:4829:52cc with SMTP id m22-20020a17090b069600b00280482952ccmr20171523pjz.37.1699302457877; Mon, 06 Nov 2023 12:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699302457; cv=none; d=google.com; s=arc-20160816; b=Sg2bFmcjQnqczoSWNPi8wPIVAIWpOL6U5P3CLJAsO3wMsO0ItpUPPtMP+5Sgo0rrpu GNaHdMyo3u/CqZLEQQ+rDjIR6amzqluupNnPp/6Ym+Aa7JDeFzOSLa2F6WaXDAEcxhyT 3Mtmk11+h/56CJsWwoSZQEixZ5s7rYn5X5Gx3dpnrysjzX9AxEiyTzz3ld++2hSPDEmd PdR1O/DlQYkDcjonAE47NQN/04vNHZh4bmq+dh1ETWuW8YzcvJfcfhNP0O8aplUjMbD6 ai5mkQzzUtsgS9zOxGplhXvBTYdwK/KB8Q6cnFjUbjtb4yv+E1TLo07enrfORo5imPLV 0Z0A== 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=Vz6uvwriR1+OIggsSXhmm2xKVmokQ0cn6jtfnTEqo3yuEqfmxq9PnGGmSZor5rUDAI qC31pMQd/gp0gAR7bDWxnWKt8oIHV6O22iCD0HzT8/UOrOA5JCrs2T4PSjpD70DFD3an PEBwUXasYqtApZwkKwx+e5bG4dgzJJwgLQ1JokyAwg2KB46uKDbo6roVuYyraQ50+eA/ VXv/Bu7zV9DwK3N8PIZpqYywTETV4kmK0EdBwBywoyb3iCowAsD8J341lNOeSFc/Mx2d OcA9PmRSvEWqvrFqAstgsqkbRvdwT8lUcTj4v/RvtQtSVWXz8LGA4CRONcBQ35evAdiE zXsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j49zgON+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id a20-20020a17090ad81400b00280203592dbsi8698673pjv.90.2023.11.06.12.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j49zgON+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 715A9801B929; Mon, 6 Nov 2023 12:27:35 -0800 (PST) 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 S232979AbjKFU1c (ORCPT + 34 others); Mon, 6 Nov 2023 15:27:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232955AbjKFU1a (ORCPT ); Mon, 6 Nov 2023 15:27:30 -0500 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D4AD71 for ; Mon, 6 Nov 2023 12:27:27 -0800 (PST) Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2ea7cca04so3176153b6e.2 for ; Mon, 06 Nov 2023 12:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699302446; x=1699907246; 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; b=j49zgON+ginlYUWH6XsufPn1jVyMvo600PjaME66lFJwZttshjNnmWiaBalYFNf7lJ oCUAtI+CT/k3fWB2HZpTGlxvXzM4OsJPgN8n1/i3rI1840uyeu4DS8ly1pOtEgwKQ1FP hgrnCnqEE67gt9q9F2D3nz7z+/PJJpAAVstOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302446; x=1699907246; 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; b=jvS5mvyXstBBy2yXm0QNpx8qS4LWJKXKE96/yUb2Adj+z4aUhi6eZXC0AkHll9YgOZ BiSnj3VKfT4b2uy9aLB0hGeNvsiu2jPoZIVnPfMbxuUbq3UP2pj3XyWX5ed8edWCMfnT CS9dM78qc+hhkUfQHXSXlgbi+H3VvBHll9TldQd71prJf2hbx+htt+ZF45L0oA5gQWZy cwNn1h0QqFFDpNB5jkeHlKaYtcguYGGQm1DaoKrxoAJKcst4QIeOb7DplmFL1ENNcfn2 R0s1EiCar3zmJDLGedoLfAttO7g16D1xCgMX+vmiv9CqEyHnNCMJx8LZdDfxxSIabA+j t84Q== X-Gm-Message-State: AOJu0YxNx5Zad9QxlTsp7STk754fSo3+1nwq3YOrf0Ea2z4jlBSodMlI 2eEBUXmW+C4Mezln5Aau+B2xpA== X-Received: by 2002:a05:6808:1b14:b0:3a7:2390:3583 with SMTP id bx20-20020a0568081b1400b003a723903583mr38346779oib.38.1699302446477; Mon, 06 Nov 2023 12:27:26 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:3374:ff6c:474e:a78]) by smtp.gmail.com with ESMTPSA id fj36-20020a056a003a2400b00689f5940061sm6144150pfb.17.2023.11.06.12.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:26 -0800 (PST) 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 v3 3/3] drm/panel-edp: Avoid adding multiple preferred modes Date: Mon, 6 Nov 2023 12:22:50 -0800 Message-ID: <20231106202718.2770821-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231106202718.2770821-1-hsinyi@chromium.org> References: <20231106202718.2770821-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 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 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]); Mon, 06 Nov 2023 12:27:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781847774435903168 X-GMAIL-MSGID: 1781847774435903168 If a non generic edp-panel is under aux-bus, the mode read from edid would still be selected as preferred and results in multiple preferred modes, which is ambiguous. If both hard-coded mode and edid exists, only add mode from hard-coded. Signed-off-by: Hsin-Yi Wang --- v2->v3: if hard-coded mode presents, don't add edid mode. --- drivers/gpu/drm/panel/panel-edp.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 0fb439b5efb1..54dbbdf62ec0 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -594,8 +594,20 @@ static int panel_edp_get_modes(struct drm_panel *panel, p->detected_panel != ERR_PTR(-EINVAL) && p->detected_panel->override_edid_mode; - /* probe EDID if a DDC bus is available */ - if (p->ddc) { + /* + * If both edid and hard-coded modes exists, only add hard-coded modes + * to avoid multiple preferred modes. + */ + if (p->desc->num_timings || p->desc->num_modes) { + /* + * Add hard-coded panel modes. Don't call this if there are no + * timings and no modes (the generic edp-panel case) because it + * will clobber the display_info that was already set by + * drm_add_edid_modes(). + */ + num += panel_edp_get_non_edid_modes(p, connector); + } else if (p->ddc) { + /* probe EDID if a DDC bus is available */ pm_runtime_get_sync(panel->dev); if (!p->edid) @@ -617,14 +629,7 @@ static int panel_edp_get_modes(struct drm_panel *panel, pm_runtime_put_autosuspend(panel->dev); } - /* - * Add hard-coded panel modes. Don't call this if there are no timings - * and no modes (the generic edp-panel case) because it will clobber - * the display_info that was already set by drm_add_edid_modes(). - */ - if (p->desc->num_timings || p->desc->num_modes) - num += panel_edp_get_non_edid_modes(p, connector); - else if (!num) + if (!num) dev_warn(p->base.dev, "No display modes\n"); /*