From patchwork Wed Sep 1 20:19:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12470177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9DB2C19F3A for ; Wed, 1 Sep 2021 20:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B49636109E for ; Wed, 1 Sep 2021 20:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245426AbhIAUVd (ORCPT ); Wed, 1 Sep 2021 16:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245154AbhIAUVc (ORCPT ); Wed, 1 Sep 2021 16:21:32 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 639BAC0617AE for ; Wed, 1 Sep 2021 13:20:28 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id w7so620420pgk.13 for ; Wed, 01 Sep 2021 13:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MFz/J7aAijkpNMg5cMsZk7y0NR1FdTOY1jwRJZxc2nE=; b=f5Rs2FjUW6nkR+AHabo7d9WoP1/vWzHJZv9+bW4me5pWqFLdEYjIS+1PUPQ+PFZ2+F uZ4RJoMTRSOrTb4aB9brFgTboAtAPRO4wfnaMb86fjyTkkJcnxUE47msuUGg7A3aj9H4 qevn5ZG395T+ZN4kb2Qr3SSsuEgZRbY290rn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MFz/J7aAijkpNMg5cMsZk7y0NR1FdTOY1jwRJZxc2nE=; b=X22CYSLZFbMRhi1Bw3xLz0wKLganF0q97AY1ucYGcqybWunL6FGZFTJqn9y6nyHTyE 8UGUooHhxNuIpx0UvGY2T9Bwo6NZjbnIhvAoShdChC+v7GuO6xUw4CLVidI5xGF7Jjjy CZiHSZL7pY9MP+GOUnj7XbqIXyb2WVv8rNvZNN1q/uKNrurpfoU4TSDpv5PTMZRsOyk3 HVdyuZlvCXD8iYyvLHwFIqIgQkpniISnogurQjV1Ln+9QEvlsnVRKMU52X3yGGDnoZHd 0JqKiInYkm26G6xKPs61h8eZqmUeiMZdZwU9CfKWMKcoaDOiHHCsJ4IopMI6ic66x1ay AslA== X-Gm-Message-State: AOAM531LN/Hbjc+olCZd80R8/Y/rsNf5jB/5GLRHKljRjw+qMVmYtkHo R+fC8roS4gEQ5V9zGImi+hm2fQ== X-Google-Smtp-Source: ABdhPJzG561MW4j1aGa/s8L4HHSGGsl+PzC3APu3L1sVM4dFh/eFb6YO0xt2ZtmTRVxRFQ3ueRbOrg== X-Received: by 2002:a63:4b53:: with SMTP id k19mr783896pgl.3.1630527627758; Wed, 01 Sep 2021 13:20:27 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:958b:b561:a735:e774]) by smtp.gmail.com with ESMTPSA id x15sm321178pfq.31.2021.09.01.13.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 13:20:27 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, Douglas Anderson , Rob Herring , linux-kernel@vger.kernel.org Subject: [PATCH v3 01/16] dt-bindings: drm/panel-simple-edp: Introduce generic eDP panels Date: Wed, 1 Sep 2021 13:19:19 -0700 Message-Id: <20210901131531.v3.1.I1116e79d34035338a45c1fc7cdd14a097909c8e0@changeid> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210901201934.1084250-1-dianders@chromium.org> References: <20210901201934.1084250-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org eDP panels generally contain almost everything needed to control them in their EDID. This comes from their DP heritage were a computer needs to be able to properly control pretty much any DP display that's plugged into it. The one big issue with eDP panels and the reason that we need a panel driver for them is that the power sequencing can be different per panel. While it is true that eDP panel sequencing can be arbitrarily complex, in practice it turns out that many eDP panels are compatible with just some slightly different delays. See the contents of the bindings file introduced in this patch for some details. The fact that eDP panels are 99% probable and that the power sequencing (especially power up) can be compatible between many panels means that there's a constant desire to plug multiple different panels into the same board. This could be for second sourcing purposes or to support multiple SKUs (maybe a 11" and a 13", for instance). As discussed [1], it should be OK to support this by adding two properties to the device tree to specify the delays needed for powering up the panel the first time. We'll create a new "edp-panel" bindings file and define the two delays that might need to be specified. NOTE: in the vast majority of the cases (HPD is hooked up and isn't glitchy or is debounced) even these delays aren't needed. [1] https://lore.kernel.org/r/CAD=FV=VZYOMPwQZzWdhJGh5cjJWw_EcM-wQVEivZ-bdGXjPrEQ@mail.gmail.com Signed-off-by: Douglas Anderson Reviewed-by: Rob Herring --- (no changes since v2) Changes in v2: - No longer allow fallback to panel-simple. - Add "-ms" suffix to delays. .../bindings/display/panel/panel-edp.yaml | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/panel-edp.yaml diff --git a/Documentation/devicetree/bindings/display/panel/panel-edp.yaml b/Documentation/devicetree/bindings/display/panel/panel-edp.yaml new file mode 100644 index 000000000000..6a621376ff86 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/panel-edp.yaml @@ -0,0 +1,188 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/panel-edp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Probable (via DP AUX / EDID) eDP Panels with simple poweron sequences + +maintainers: + - Douglas Anderson + +description: | + This binding file can be used to indicate that an eDP panel is connected + to a Embedded DisplayPort AUX bus (see display/dp-aux-bus.yaml) without + actually specifying exactly what panel is connected. This is useful for + the case that more than one different panel could be connected to the + board, either for second-sourcing purposes or to support multiple SKUs + with different LCDs that hook up to a common board. + + As per above, a requirement for using this binding is that the panel is + represented under the DP AUX bus. This means that we can use any + information provided by the DP AUX bus (including the EDID) to identify + the panel. We can use this to identify display size, resolution, and + timings among other things. + + One piece of information about eDP panels that is typically _not_ + provided anywhere on the DP AUX bus is the power sequencing timings. + This is the reason why, historically, we've always had to explicitly + list eDP panels. We solve that here with two tricks. The "worst case" + power on timings for any panels expected to be connected to a board are + specified in these bindings. Once we've powered on, it's expected that + the operating system will lookup the panel in a table (based on EDID + information) to figure out other power sequencing timings. + + eDP panels in general can have somewhat arbitrary power sequencing + requirements. However, even though it's arbitrary in general, the + vast majority of panel datasheets have a power sequence diagram that + looks the exactly the same as every other panel. Each panel datasheet + cares about different timings in this diagram but the fact that the + diagram is so similar means we can come up with a single driver to + handle it. + + These diagrams all look roughly like this, sometimes labeled with + slightly different numbers / lines but all pretty much the same + sequence. This is because much of this diagram comes straight from + the eDP Standard. + + __________________________________________________ + Vdd ___/: :\____ / + _/ : : \_____/ + ::: :<--T10-->::: + : +-----------------------+---------+---------+ + eDP -----------+ Black video | Src vid | Blk vid + + Display : +-----------------------+---------+---------+ + : _______________________:_________:_________: + HPD :| : : | + ___________| : : |_____________ + : : : : + Sink +-----------------------:---------:---------+ + AUX CH -----------+ AUX Ch operational : : +------------- + +-----------------------:---------:---------+ + : : : : + :: :: : : + Src main +------+------+--------------+---------+ + lnk data----------------+LnkTrn| Idle |Valid vid data| Idle/off+------------- + +------+------+--------------+---------+ + : :<-T6->:<-T8->: : + :__:: + LED_EN | | + _____________________________________| |____________________________ + : : + __________:__:_ + PWM | : : | + __________________________| : : |__________________________ + : : : : + _____________:__________:__:_:______ + Bklight ____/: : : : : :\____ + power _______/ :<---T13---->: : : :: \______________ + (Vbl) ::<---------T14--------->: :<-T15->:: + + The above looks fairly complex but, as per above, each panel only cares + about a subset of those timings. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + const: edp-panel + + hpd-reliable-delay-ms: + description: + A fixed amount of time that must be waited after powering on the + panel's power-supply before the HPD signal is a reliable way to know + when the AUX channel is ready. This is useful for panels that glitch + the HPD at the start of power-on. This value is not needed if HPD is + always reliable for all panels that might be connected. + + hpd-absent-delay-ms: + description: + The panel specifies that HPD will be asserted this many milliseconds + from power on (timing T3 in the diagram above). If we have no way to + measure HPD then a fixed delay of this many milliseconds can be used. + This can also be used as a timeout when waiting for HPD. Does not + include the hpd-reliable-delay, so if hpd-reliable-delay was 80 ms + and hpd-absent-delay was 200 ms then we'd do a fixed 80 ms delay and + then we know HPD would assert in the next 120 ms. This value is not + needed if HPD hooked up, either through a GPIO in the panel node or + hooked up directly to the eDP controller. + + backlight: true + enable-gpios: true + port: true + power-supply: true + no-hpd: true + hpd-gpios: true + +additionalProperties: false + +required: + - compatible + - power-supply + +examples: + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bridge@2d { + compatible = "ti,sn65dsi86"; + reg = <0x2d>; + + interrupt-parent = <&tlmm>; + interrupts = <10 IRQ_TYPE_LEVEL_HIGH>; + + enable-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>; + + vpll-supply = <&src_pp1800_s4a>; + vccio-supply = <&src_pp1800_s4a>; + vcca-supply = <&src_pp1200_l2a>; + vcc-supply = <&src_pp1200_l2a>; + + clocks = <&rpmhcc RPMH_LN_BB_CLK2>; + clock-names = "refclk"; + + no-hpd; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + endpoint { + remote-endpoint = <&dsi0_out>; + }; + }; + + port@1 { + reg = <1>; + sn65dsi86_out: endpoint { + remote-endpoint = <&panel_in_edp>; + }; + }; + }; + + aux-bus { + panel { + compatible = "edp-panel"; + power-supply = <&pp3300_dx_edp>; + backlight = <&backlight>; + hpd-gpios = <&sn65dsi86_bridge 2 GPIO_ACTIVE_HIGH>; + hpd-reliable-delay-ms = <15>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&sn65dsi86_out>; + }; + }; + }; + }; + }; + }; From patchwork Wed Sep 1 20:19:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12470195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D068EC25AEE for ; Wed, 1 Sep 2021 20:20:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B373B610D2 for ; Wed, 1 Sep 2021 20:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344160AbhIAUVz (ORCPT ); Wed, 1 Sep 2021 16:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245226AbhIAUVc (ORCPT ); Wed, 1 Sep 2021 16:21:32 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4CBDC0613A4 for ; Wed, 1 Sep 2021 13:20:29 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id q3so381263plx.4 for ; Wed, 01 Sep 2021 13:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CdvWH3y4JK/aU5g4UL9vX4Drgc5KR+WNcLLfmz6Dht0=; b=UDVkD/BN+MtASvoU5ESBO17dNBs/+/ptk17k5LqiGLVMA0vqAho4MYhGID93hNcoD3 f45U5FRmuSltdaFdIV26coiOGHBk2k10CXvbbHqYDUddB9T63kSZqoNfgmPSdcWRfIkb fY9iLXDDMHFpwqjzuLagqrAuEAR1sTIWClOYw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CdvWH3y4JK/aU5g4UL9vX4Drgc5KR+WNcLLfmz6Dht0=; b=oJ+Wr7l1Is3QhPZnv3VPYsEBSDvYJrnPVUte2ZlMJpPNEnkIidUUL4LKXRewkpaigN 98QW9fxHQz25GuhLYMVPOYWemeooL8WpZ/0YDC0WDyLDG6Xvjl8fgck00KGHP4NkayHx 5noRxKM5WIfuWCzO8oAGLxS3OLySft6h2oh7y5b/q6ZGsYHvgGyM76NwFS1AolYP5Dak 9QEu4A6AfV8QOOEatO/LnSzhKccZ/fUAbJtWEyZgPRb8Xr69iG23im+nsF/+j3Y2c6Gm /c5VfYz71ij+z2UKPGDbwoyKhQh2Iqg0tGbEMAJeg9ew9+jf5r5hvjbWwg4IiSE6A9ky wrFQ== X-Gm-Message-State: AOAM532zwyqJ5Uti/L0/8fungUJDHlcK+tjdKTQwOD+n5SN8CNRe6OkM KMSAF7xZywmoy8SklOxF3KwbAA== X-Google-Smtp-Source: ABdhPJzybWYw8OfKvEN0fimtrj6mwClpjSIup0tHDbRx+ZxBYyA+CaNWH/QnH38x8HXOsGvYpod3JQ== X-Received: by 2002:a17:90a:520c:: with SMTP id v12mr1150359pjh.105.1630527629353; Wed, 01 Sep 2021 13:20:29 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:958b:b561:a735:e774]) by smtp.gmail.com with ESMTPSA id x15sm321178pfq.31.2021.09.01.13.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 13:20:28 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3 02/16] drm/edid: Break out reading block 0 of the EDID Date: Wed, 1 Sep 2021 13:19:20 -0700 Message-Id: <20210901131531.v3.2.I62e76a034ac78c994d40a23cd4ec5aeee56fa77c@changeid> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210901201934.1084250-1-dianders@chromium.org> References: <20210901201934.1084250-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A future change wants to be able to read just block 0 of the EDID, so break it out of drm_do_get_edid() into a sub-function. This is intended to be a no-op change--just code movement. Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/drm_edid.c | 62 +++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 6325877c5fd6..a22c38482a90 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1905,6 +1905,43 @@ int drm_add_override_edid_modes(struct drm_connector *connector) } EXPORT_SYMBOL(drm_add_override_edid_modes); +static struct edid *drm_do_get_edid_blk0( + int (*get_edid_block)(void *data, u8 *buf, unsigned int block, + size_t len), + void *data, bool *edid_corrupt, int *null_edid_counter) +{ + int i; + u8 *edid; + + if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) + return NULL; + + /* base block fetch */ + for (i = 0; i < 4; i++) { + if (get_edid_block(data, edid, 0, EDID_LENGTH)) + goto out; + if (drm_edid_block_valid(edid, 0, false, edid_corrupt)) + break; + if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) { + if (null_edid_counter) + (*null_edid_counter)++; + goto carp; + } + } + if (i == 4) + goto carp; + + return (struct edid *)edid; + +carp: + kfree(edid); + return ERR_PTR(-EINVAL); + +out: + kfree(edid); + return NULL; +} + /** * drm_do_get_edid - get EDID data using a custom EDID block read function * @connector: connector we're probing @@ -1938,25 +1975,16 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, if (override) return override; - if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL) + edid = (u8 *)drm_do_get_edid_blk0(get_edid_block, data, + &connector->edid_corrupt, + &connector->null_edid_counter); + if (IS_ERR_OR_NULL(edid)) { + if (IS_ERR(edid)) + connector_bad_edid(connector, edid, 1); return NULL; - - /* base block fetch */ - for (i = 0; i < 4; i++) { - if (get_edid_block(data, edid, 0, EDID_LENGTH)) - goto out; - if (drm_edid_block_valid(edid, 0, false, - &connector->edid_corrupt)) - break; - if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) { - connector->null_edid_counter++; - goto carp; - } } - if (i == 4) - goto carp; - /* if there's no extensions, we're done */ + /* if there's no extensions or no connector, we're done */ valid_extensions = edid[0x7e]; if (valid_extensions == 0) return (struct edid *)edid; @@ -2010,8 +2038,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, return (struct edid *)edid; -carp: - connector_bad_edid(connector, edid, 1); out: kfree(edid); return NULL; From patchwork Wed Sep 1 20:19:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12470183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EA4AC25AEE for ; Wed, 1 Sep 2021 20:20:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E4E26109E for ; Wed, 1 Sep 2021 20:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343628AbhIAUVm (ORCPT ); Wed, 1 Sep 2021 16:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245294AbhIAUVd (ORCPT ); Wed, 1 Sep 2021 16:21:33 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED164C061764 for ; Wed, 1 Sep 2021 13:20:31 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id u11-20020a17090adb4b00b00181668a56d6so574801pjx.5 for ; Wed, 01 Sep 2021 13:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NFnoIbGurLHygQYzR/1vkknC/vUF1WONmleiQRHkl10=; b=d5lm75+RLct6X/Jl04wCP559lXGWD7QrbiXaXZsBpu0T/HPKljNQr18x6eRHAPB/Uv A6MK+U8iAPjyDVn9LejUQEv7cJDRahTvyejMAVtMF5Rf1AiBO8Rih3QARced7J00qOhd gvUqgtvGrIcE//kMcXNfoL+wYIvMqL3MBTWUw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NFnoIbGurLHygQYzR/1vkknC/vUF1WONmleiQRHkl10=; b=qmN2/b+LU6eOJLapFmDeshf0gXQYjxX1KyxkBkv4512WI20F0aLubf/D478y75yzbK 4fwgoenn0k+QnDzhIpmYGtTWJ9FQsc9B8+Nz3QpT9I7CiPW9b0TGXu+BTQexxRpQyboX z64404YVASnhnOtZAYw1rgqSPXCvdF7LhApsuxl8Taljm2l5rzjf7W40sKJL3nIY988f WmlPtd8LyIP2D8ZNNUdzoPE8K5suhJluqG/4AshBMidA7+B3p1z0nHc7wKO62gqSsyP1 ivS+CEQ6TgfkTC4u1iP2vZEhJH4CpmO0ivwAb6t0Gt1c3+1pbd8sWANNuO90TwwxmNz2 eQ5w== X-Gm-Message-State: AOAM533k+KF27WILckWuPAXJS3DQaY0foUhrf7YcWDROsGjVY7adET0O XBLjUvJySKSdi2CrbHouhwMEsA== X-Google-Smtp-Source: ABdhPJz9dXAu9z9CahmGdhaS7l63HuYWmgsF9bVQKFGNROPgTEDy5l0aF6odYgaVO9CJl819YB0BNQ== X-Received: by 2002:a17:90b:128a:: with SMTP id fw10mr1225651pjb.212.1630527631467; Wed, 01 Sep 2021 13:20:31 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:958b:b561:a735:e774]) by smtp.gmail.com with ESMTPSA id x15sm321178pfq.31.2021.09.01.13.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 13:20:31 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3 03/16] drm/edid: Allow the querying/working with the panel ID from the EDID Date: Wed, 1 Sep 2021 13:19:21 -0700 Message-Id: <20210901131531.v3.3.I4a672175ba1894294d91d3dbd51da11a8239cf4a@changeid> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210901201934.1084250-1-dianders@chromium.org> References: <20210901201934.1084250-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org EDIDs have 32-bits worth of data which is intended to be used to uniquely identify the make/model of a panel. This has historically been used only internally in the EDID processing code to identify quirks with panels. We'd like to use this panel ID in panel-simple to identify which panel is hooked up and from that information figure out power sequence timings. Let's expose this information from the EDID code and also allow it to be accessed early, before a connector has been created. To make matching in the panel-simple code easier, we'll return the panel ID as a 32-bit value. We'll provide some functions for converting this value back and forth to something more human readable. Signed-off-by: Douglas Anderson --- Changes in v3: - Decode hex product ID w/ same endianness as everyone else. drivers/gpu/drm/drm_edid.c | 59 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_edid.h | 47 ++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index a22c38482a90..ac128bc3478a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2086,6 +2086,65 @@ struct edid *drm_get_edid(struct drm_connector *connector, } EXPORT_SYMBOL(drm_get_edid); +/** + * drm_get_panel_id - Get a panel's ID through DDC + * @adapter: I2C adapter to use for DDC + * + * This function reads the first block of the EDID of a panel and (assuming + * that the EDID is valid) extracts the ID out of it. The ID is a 32-bit value + * (16 bits of manufacturer ID and 16 bits of per-manufacturer ID) that's + * supposed to be different for each different modem of panel. + * + * This function is intended to be used during early probing on devices where + * more than one panel might be present. Because of its intended use it must + * assume that the EDID of the panel is correct, at least as far as the ID + * is concerned (in other words, we don't process any overrides here). + * + * NOTE: it's expected that this function and drm_do_get_edid() will both + * be read the EDID, but there is no caching between them. Since we're only + * reading the first block, hopefully this extra overhead won't be too big. + * + * Return: A 32-bit ID that should be different for each make/model of panel. + * See the functions encode_edid_id() and decode_edid_id() for some + * details on the structure of this ID. + */ +u32 drm_get_panel_id(struct i2c_adapter *adapter) +{ + struct edid *edid; + u32 val; + + edid = drm_do_get_edid_blk0(drm_do_probe_ddc_edid, adapter, NULL, NULL); + + /* + * There are no manufacturer IDs of 0, so if there is a problem reading + * the EDID then we'll just return 0. + */ + if (IS_ERR_OR_NULL(edid)) + return 0; + + /* + * In theory we could try to de-obfuscate this like edid_get_quirks() + * does, but it's easier to just deal with a 32-bit number. + * + * NOTE that we deal with endianness differently for the top half + * of this ID than for the bottom half. The bottom half (the product + * id) gets decoded as little endian by the EDID_PRODUCT_ID because + * that's how everyone seems to interpret it. The top half (the mfg_id) + * gets stored as big endian because that makes encode_edid_id() and + * decode_edid_id() easier to write (it's easier to extract the ASCII). + * It doesn't really matter, though, as long as the number here is + * unique. + */ + val = (u32)edid->mfg_id[0] << 24 | + (u32)edid->mfg_id[1] << 16 | + (u32)EDID_PRODUCT_ID(edid); + + kfree(edid); + + return val; +} +EXPORT_SYMBOL(drm_get_panel_id); + /** * drm_get_edid_switcheroo - get EDID data for a vga_switcheroo output * @connector: connector we're probing diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index deccfd39e6db..73da40d0b5d1 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -508,6 +508,52 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld) return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK; } +/** + * encode_edid_id - Encode an ID for matching against drm_get_panel_id() + * @vend_chr_0: First character of the vendor string. + * @vend_chr_2: Second character of the vendor string. + * @vend_chr_3: Third character of the vendor string. + * @product_id: The 16-bit product ID. + * + * This is a macro so that it can be calculated at compile time and used + * as an initializer. + * + * For instance: + * encode_edid_id('B', 'O', 'E', 0x2d08) => 0x09e52d08 + * + * Return: a 32-bit ID per panel. + */ +#define encode_edid_id(vend_chr_0, vend_chr_1, vend_chr_2, product_id) \ + ((((u32)(vend_chr_0) - '@') & 0x1f) << 26 | \ + (((u32)(vend_chr_1) - '@') & 0x1f) << 21 | \ + (((u32)(vend_chr_2) - '@') & 0x1f) << 16 | \ + ((product_id) & 0xffff)) + +/** + * decode_edid_id - Decode a panel ID from encode_edid_id() + * @panel_id: The panel ID to decode. + * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0' + * termination + * @product_id: The product ID will be returned here. + * + * For instance, after: + * decode_edid_id(0x09e52d08, vend, &product_id) + * These will be true: + * vend[0] = 'B' + * vend[1] = 'O' + * vend[2] = 'E' + * vend[3] = '\0' + * product_id = 0x2d08 + */ +static inline void decode_edid_id(u32 panel_id, char vend[4], u16 *product_id) +{ + *product_id = (u16)(panel_id & 0xffff); + vend[0] = '@' + ((panel_id >> 26) & 0x1f); + vend[1] = '@' + ((panel_id >> 21) & 0x1f); + vend[2] = '@' + ((panel_id >> 16) & 0x1f); + vend[3] = '\0'; +} + bool drm_probe_ddc(struct i2c_adapter *adapter); struct edid *drm_do_get_edid(struct drm_connector *connector, int (*get_edid_block)(void *data, u8 *buf, unsigned int block, @@ -515,6 +561,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, void *data); struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); +u32 drm_get_panel_id(struct i2c_adapter *adapter); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); From patchwork Wed Sep 1 20:19:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12470179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6FADC25AEB for ; Wed, 1 Sep 2021 20:20:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B181C610CC for ; Wed, 1 Sep 2021 20:20:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245531AbhIAUVf (ORCPT ); Wed, 1 Sep 2021 16:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245289AbhIAUVd (ORCPT ); Wed, 1 Sep 2021 16:21:33 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767CEC06129D for ; Wed, 1 Sep 2021 13:20:33 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id t1so666853pgv.3 for ; Wed, 01 Sep 2021 13:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mYEjr3BHJmNyg4msjLT0qnp85uO+qqwgC2AGDj+zncU=; b=P60U51/qwPpUhHQsv0zUtH/PcrqGxO2R/9X18RBIKx5Mtz5wO2Ft8u+F35d4wIrgmR ejO8A10syiidLpMv4yTRfNq3nniUL7WdMvcHzJVJWdx8BANawPxj+M/umDj+LKlGMZ56 9+ikXKepWNHpoUvQ0Su8q+D1yBWvBmQKGMhbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mYEjr3BHJmNyg4msjLT0qnp85uO+qqwgC2AGDj+zncU=; b=ZK/3DCzh4zhmbp/Km7okyHt09ke7mmLFsmqqBCn191vn1mbklIYT5gE4GFxS8HdKG1 faL3NgmILZkwhmN4Xr9YXkCDYAzt5mgOaUH2/A6QLJ2N7EFnDRdnOV47MX50Z+EnlsWt YmwoQRFrbPZeCMMrP6bK7eIx8G1hoAIDS0nhmvssx2SBM4j+gWGbjzNSoANRam8ZpQod LFd7fZSaFEJz8EdUJjqngXNfKB4xDfTMnEOFUJrrs+OpuUNuQ1KlBz3t7X8f0aMSpCk6 vEVIKEwNW6J9B7eSTJ7y7rYb08REEaHflvE+dFSfCpZVYitvJfFjSBljNf062PmaIUn5 K/xw== X-Gm-Message-State: AOAM533I5m9zoXbMjR4jPkI1XJ0ybKt7dQLFhTLRdF58GypKgpQAg4BT tqtDjl9TiC2O+Ecm/IfPAp1oDw== X-Google-Smtp-Source: ABdhPJxJiYLYOc7eJ+XctS407tdB4smvFn42i+/F5T3WjgMJknBb9J0mJz722Ej4uS/thX6D85z3+w== X-Received: by 2002:a63:c10b:: with SMTP id w11mr811439pgf.228.1630527633041; Wed, 01 Sep 2021 13:20:33 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:958b:b561:a735:e774]) by smtp.gmail.com with ESMTPSA id x15sm321178pfq.31.2021.09.01.13.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 13:20:32 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3 04/16] drm/panel-simple: Reorder logicpd_type_28 / mitsubishi_aa070mc01 Date: Wed, 1 Sep 2021 13:19:22 -0700 Message-Id: <20210901131531.v3.4.Ib2bdeceb8ce45d36c09f5d1ae62a2263276a0605@changeid> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210901201934.1084250-1-dianders@chromium.org> References: <20210901201934.1084250-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The "logicpd_type_28" panel data was splitting up the mitsubishi_aa070mc01 panel data. Reorganize it so that the panel descs and modes are kept together. This is a no-op code-cleanup change, found by code inspection. Signed-off-by: Douglas Anderson --- Changes in v3: - ("Reorder logicpd_type_28...") patch new for v3. drivers/gpu/drm/panel/panel-simple.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 0e4f3cac0fef..4ec310a650cd 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -3158,19 +3158,6 @@ static const struct panel_desc logictechno_lttd800480070_l6wh_rt = { .connector_type = DRM_MODE_CONNECTOR_DPI, }; -static const struct drm_display_mode mitsubishi_aa070mc01_mode = { - .clock = 30400, - .hdisplay = 800, - .hsync_start = 800 + 0, - .hsync_end = 800 + 1, - .htotal = 800 + 0 + 1 + 160, - .vdisplay = 480, - .vsync_start = 480 + 0, - .vsync_end = 480 + 48 + 1, - .vtotal = 480 + 48 + 1 + 0, - .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, -}; - static const struct drm_display_mode logicpd_type_28_mode = { .clock = 9107, .hdisplay = 480, @@ -3205,6 +3192,19 @@ static const struct panel_desc logicpd_type_28 = { .connector_type = DRM_MODE_CONNECTOR_DPI, }; +static const struct drm_display_mode mitsubishi_aa070mc01_mode = { + .clock = 30400, + .hdisplay = 800, + .hsync_start = 800 + 0, + .hsync_end = 800 + 1, + .htotal = 800 + 0 + 1 + 160, + .vdisplay = 480, + .vsync_start = 480 + 0, + .vsync_end = 480 + 48 + 1, + .vtotal = 480 + 48 + 1 + 0, + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, +}; + static const struct panel_desc mitsubishi_aa070mc01 = { .modes = &mitsubishi_aa070mc01_mode, .num_modes = 1, From patchwork Wed Sep 1 20:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 12470181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94E09C43214 for ; Wed, 1 Sep 2021 20:20:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 687F9610CA for ; Wed, 1 Sep 2021 20:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245209AbhIAUVg (ORCPT ); Wed, 1 Sep 2021 16:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245345AbhIAUVd (ORCPT ); Wed, 1 Sep 2021 16:21:33 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83562C0613C1 for ; Wed, 1 Sep 2021 13:20:35 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id y17so711964pfl.13 for ; Wed, 01 Sep 2021 13:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mz9HeGJ+K7sval94JDg800KjqgtCuquTPW7QtWQlZWM=; b=jzTj/pD5dkkQYgZIwhNNMzeq/pE4Xb6qyV9tG+wlV200QFulkiGCrLE2/ks/Oin4ki vV2AH4GTsmOhS/K6/mRqlC9T57ARHF/I0GeFIN7CwUdMWbgtxN3MLd45pO1gnwd79dab 11tmOHElLexVfJ2YrHXx/ZLy3hEYckYwe6dQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mz9HeGJ+K7sval94JDg800KjqgtCuquTPW7QtWQlZWM=; b=QXfAjP21kxVnGorpqoRW3pVupVRx2oAQhTzWnN1WJTdgnMjv39VHujBdgrSjm+csIX 7jlhM+VeaqXOOqWVD1ZsEgulofXXcrfr/ZUEW/k+RKlVMZVBShWevLx666B7t1cpKEFi Vx26+OXf/uNcmocjJ4hQtDKqXBHiFP7i4AXDk5wFKwWLKbd72zXPi4ha2a4xHmBlYdKg zRjTQ3mIAHMTwWCCMs8ftSvwsruZj3Jff91lFRnfzTSUV+5re4Hz1T+BntAstKkOR1qs D5jT7dlcW6H0Y6hYhpaxvPAHXyBsIqINVcErjn9Vj+oAY5CSW919J6Of+o8RkIPHxRef 2TZQ== X-Gm-Message-State: AOAM531/CFjVkYVYgiQTiRBvcQcSdmMjD9GNNnziQUmRFlVcGdan1ngJ jXxPdvOwGTgQdyCqF/MpFOb8xg== X-Google-Smtp-Source: ABdhPJxVRZs2jI+b171j3PMFJmKPyxpXLuhuYzjmV3/PejX4NWlFwEV49rY4x+1i8NaXhx7JCu2hjA== X-Received: by 2002:a63:ff51:: with SMTP id s17mr762145pgk.415.1630527634673; Wed, 01 Sep 2021 13:20:34 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:958b:b561:a735:e774]) by smtp.gmail.com with ESMTPSA id x15sm321178pfq.31.2021.09.01.13.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 13:20:34 -0700 (PDT) From: Douglas Anderson To: Thierry Reding , Rob Herring , Sam Ravnborg Cc: Maarten Lankhorst , linux-arm-msm@vger.kernel.org, Bjorn Andersson , Linus W , Daniel Vetter , devicetree@vger.kernel.org, Steev Klimaszewski , Thomas Zimmermann , Maxime Ripard , David Airlie , dri-devel@lists.freedesktop.org, Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3 05/16] drm/panel-simple-edp: Split eDP panels out of panel-simple Date: Wed, 1 Sep 2021 13:19:23 -0700 Message-Id: <20210901131531.v3.5.I0a2f75bb822d17ce06f5b147734764eeb0c3e3df@changeid> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210901201934.1084250-1-dianders@chromium.org> References: <20210901201934.1084250-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The panel-simple driver handles way too much. Let's start trying to get a handle on it by splitting out the eDP panels. This patch does this: 1. Start by copying simple-panel verbatim over to a new driver, simple-panel-edp. 2. Rename "panel_simple" to "panel_edp" in the new driver. 3. Keep only panels marked with `DRM_MODE_CONNECTOR_eDP` in the new driver. Remove those panels from the old driver. 4. Remove all recent "DP AUX bus" stuff from the old driver. The DP AUX bus is only possible on DP panels. 5. Remove all DSI / MIPI related functions from the new driver. 6. Remove bus_format / bus_flags from eDP driver. These things don't seem to make any sense for eDP panels so let's stop filling in made up stuff. In the end we end up with a bunch of duplicated code for now. Future patches will try to address _some_ of this duplicated code though some of it will be unavoidable. NOTE: This may not actually move all eDP panels over to the new driver since not all panels were properly marked with `DRM_MODE_CONNECTOR_eDP`. A future patch will attempt to move wayward panels I could identify but even so there may be some missed. Suggested-by: Sam Ravnborg Signed-off-by: Douglas Anderson --- I believe this is what Sam was looking for when he requested that the eDP panels split out [1]. Please yell if not. [1] https://lore.kernel.org/dri-devel/YRTsFNTn%2FT8fLxyB@ravnborg.org/ Changes in v3: - Split eDP panels patch new for v3. drivers/gpu/drm/panel/Kconfig | 16 +- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-simple-edp.c | 1298 ++++++++++++++++++++++ drivers/gpu/drm/panel/panel-simple.c | 575 +--------- 4 files changed, 1323 insertions(+), 567 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-simple-edp.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 0b3784941312..4b7ff4ebdc34 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -77,14 +77,26 @@ config DRM_PANEL_LVDS backlight handling if the panel is attached to a backlight controller. config DRM_PANEL_SIMPLE - tristate "support for simple panels" + tristate "support for simple panels (other than eDP ones)" + depends on OF + depends on BACKLIGHT_CLASS_DEVICE + depends on PM + select VIDEOMODE_HELPERS + help + DRM panel driver for dumb non-eDP panels that need at most a regulator + and a GPIO to be powered up. Optionally a backlight can be attached so + that it can be automatically turned off when the panel goes into a + low power state. + +config DRM_PANEL_SIMPLE_EDP + tristate "support for simple Embedded DisplayPort panels" depends on OF depends on BACKLIGHT_CLASS_DEVICE depends on PM select VIDEOMODE_HELPERS select DRM_DP_AUX_BUS help - DRM panel driver for dumb panels that need at most a regulator and + DRM panel driver for dumb eDP panels that need at most a regulator and a GPIO to be powered up. Optionally a backlight can be attached so that it can be automatically turned off when the panel goes into a low power state. diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 60c0149fc54a..640234d4d693 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o +obj-$(CONFIG_DRM_PANEL_SIMPLE_EDP) += panel-simple-edp.o obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o diff --git a/drivers/gpu/drm/panel/panel-simple-edp.c b/drivers/gpu/drm/panel/panel-simple-edp.c new file mode 100644 index 000000000000..5b47ee4bc338 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-simple-edp.c @@ -0,0 +1,1298 @@ +/* + * Copyright (C) 2013, NVIDIA Corporation. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include