From patchwork Thu Nov 2 13:42:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Jonker X-Patchwork-Id: 160882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp362398vqu; Thu, 2 Nov 2023 06:42:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGt5b94Hh0OqkS38YhB2wtgUgkqgQKzzewgRZ1GyBlPqcg2UgElRQ+5Y4lNClN6uMijFeEU X-Received: by 2002:a05:6a00:1356:b0:6bd:705b:56fb with SMTP id k22-20020a056a00135600b006bd705b56fbmr17719344pfu.6.1698932575810; Thu, 02 Nov 2023 06:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698932575; cv=none; d=google.com; s=arc-20160816; b=fjn/fXN+VTHU0dYrUFY5I8tQRzgfmyR3XLveRkdv36R576drpXnAZ4A/BSUMS5zDzZ EZdt+Rhwhl1YNbvo97ojLAG85Hoy2hsy0kYOzGeta2IN6sNYCKB3OyO9Mxte0glJfg8t H3g/XurIvOI9DQzcqgwz1cs6FgG5xsGSjDa8cOnJiMvpZEXhc4s0qrF/UM2a+wHpRILj pE4gXFqJBecqUNOFA60ujcUjBCmgicx/juZCZWyGXZQxa72UlZM6aLZEm4dpDonP1gke FhAFk+Fp+2soxjWuQ7M15oi7sPgzb4cASaMLMV5ESeEYgqfIyqBoGx2Zj8qYq1Gb0AGp AT1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=lK/vWnmM0KVaM6vCg3VvvClqSJH14OWzepShm2ndJ8I=; fh=v9EK/ZpF7mC7HytCEN1dwHNmJmndcYWW0//5MYgVSx0=; b=Zeu6BudBh8K4Zu/RCgHrBuStSzSkxFjhDzL2WEZPHrIfdL8NPm6GECQTch1td7+C3J s+M070sMjYSdzcFkdPOw3NxVZYRjvlkCBK+PyaDOjAA+xi1zLFAdUlTLsd4x6pEVBPW+ nTtYwe9jRdEchoSDvAvPxL++4PrRuR77c+HxWxxxhjVxfRlOYcQPvR1PoXmxo6G8W1Bw j83x29qN4SkjR+qIeMEXtSpK8iyYxsvumX/V36+sWQgj1RCuhnj6WfRfW8Yajjtd7Huh WRzm0CkDBeubwnaevT3Hpzfbr0z1qrygyU0kvZH685w2sdnYq2CFAqOZBi/kATTS4c4P YHew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=A6mE6ntv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id b1-20020a056a00114100b0069100706960si3627963pfm.116.2023.11.02.06.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 06:42:55 -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=@gmail.com header.s=20230601 header.b=A6mE6ntv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 28B91807649F; Thu, 2 Nov 2023 06:42:53 -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 S1376641AbjKBNmQ (ORCPT + 36 others); Thu, 2 Nov 2023 09:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376635AbjKBNmO (ORCPT ); Thu, 2 Nov 2023 09:42:14 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0F70188 for ; Thu, 2 Nov 2023 06:42:07 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5230a22cfd1so1580958a12.1 for ; Thu, 02 Nov 2023 06:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698932526; x=1699537326; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=lK/vWnmM0KVaM6vCg3VvvClqSJH14OWzepShm2ndJ8I=; b=A6mE6ntvC9vlzZR47HhVci31Isma4vrFimhXY7SYGw2wBqrmN8y54wQ2U4J3L9jtFU uCPbXvUmYMhV8tAYPtv41H5MzvXnBv1t2c0f43P0Ekg9wP6iHNkiMhjnBlTShoW5J+2t zejFycYglfYZYJpoeSVMxs5WKlANe5Ui6mqUJKwY5+O/4W6G2osA0uoxFX8mQ4q0S6sG f3mtqHroQqhQ/cH4UXgW0NQbijJi/pCGvs/ciOoZTFN4TWgFHytjBPpGX5fBuuz/HrDw rk/tCi4g+qYS0/FXBzq5wzC5T3SFzv1olvIds9Beq6z1/Z5jO5a0SkFrHf3r06r89rUW Ilow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698932526; x=1699537326; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lK/vWnmM0KVaM6vCg3VvvClqSJH14OWzepShm2ndJ8I=; b=FL0wx2oy+NxImGbiHkHaaumLb754dn/Ffdjd7kEDeYSdsgVZdGEnZuGpDy7HEHfWQn A5EBcKISkmwqNMzqK4zF5IMETS+TKBLsKj7dokdv6dQ4RCYJyp4J5w76hfURNo7byLZO 0VppvMi7VOvKCCndYmbHF2Ux+gi1+wP/rlKwcJ52LZ0qucI0CosYnCqNJDMxEGOVebr0 PUvtXBoLiyCRqGHTuij/8ZUyz37cLLqpqKZvDBcuUxEKxsIcEBzV86ILfiJoYlkVBvPz OiB861sMpkLrcAkKzW0j4ZH9slgxtubTIKL37CObNF5sSqkj8UNlp4Xpb1wz4LgvBRnG sSpw== X-Gm-Message-State: AOJu0YxmBH0nBlfu+Ldvqtw0ho6zhK2C9Oud6UQWZS6veD/Iy0bJ3BES ejBkt0y3mKEfVIB+Q4REzqg= X-Received: by 2002:a50:9544:0:b0:543:595a:8280 with SMTP id v4-20020a509544000000b00543595a8280mr7749934eda.37.1698932526017; Thu, 02 Nov 2023 06:42:06 -0700 (PDT) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id q32-20020a05640224a000b0054130b1bc77sm2347915eda.51.2023.11.02.06.42.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Nov 2023 06:42:05 -0700 (PDT) Message-ID: <034c3446-d619-f4c3-3aaa-ab51dc19d07f@gmail.com> Date: Thu, 2 Nov 2023 14:42:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 From: Johan Jonker Subject: [PATCH v1 2/4] drm/rockchip: rk3066_hdmi: Switch encoder hooks to atomic To: hjc@rock-chips.com, heiko@sntech.de Cc: airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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]); Thu, 02 Nov 2023 06:42:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781459925057399218 X-GMAIL-MSGID: 1781459925057399218 The rk3066_hdmi encoder still uses the non atomic variants of enable and disable. Convert to their atomic equivalents. In atomic mode there is no need to save the adjusted mode, so remove the mode_set function. Signed-off-by: Johan Jonker --- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 35 +++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) -- 2.39.2 diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c index 5c269081c691..0e7aae341960 100644 --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c @@ -55,7 +55,6 @@ struct rk3066_hdmi { unsigned int tmdsclk; struct hdmi_data_info hdmi_data; - struct drm_display_mode previous_mode; }; static struct rk3066_hdmi *encoder_to_rk3066_hdmi(struct drm_encoder *encoder) @@ -387,21 +386,21 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, return 0; } -static void -rk3066_hdmi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adj_mode) +static void rk3066_hdmi_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct rk3066_hdmi *hdmi = encoder_to_rk3066_hdmi(encoder); + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + int mux, val; - /* Store the display mode for plugin/DPMS poweron events. */ - drm_mode_copy(&hdmi->previous_mode, adj_mode); -} + conn_state = drm_atomic_get_new_connector_state(state, &hdmi->connector); + if (WARN_ON(!conn_state)) + return; -static void rk3066_hdmi_encoder_enable(struct drm_encoder *encoder) -{ - struct rk3066_hdmi *hdmi = encoder_to_rk3066_hdmi(encoder); - int mux, val; + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + if (WARN_ON(!crtc_state)) + return; mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); if (mux) @@ -414,10 +413,11 @@ static void rk3066_hdmi_encoder_enable(struct drm_encoder *encoder) DRM_DEV_DEBUG(hdmi->dev, "hdmi encoder enable select: vop%s\n", (mux) ? "1" : "0"); - rk3066_hdmi_setup(hdmi, &hdmi->previous_mode); + rk3066_hdmi_setup(hdmi, &crtc_state->adjusted_mode); } -static void rk3066_hdmi_encoder_disable(struct drm_encoder *encoder) +static void rk3066_hdmi_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct rk3066_hdmi *hdmi = encoder_to_rk3066_hdmi(encoder); @@ -449,10 +449,9 @@ rk3066_hdmi_encoder_atomic_check(struct drm_encoder *encoder, static const struct drm_encoder_helper_funcs rk3066_hdmi_encoder_helper_funcs = { - .enable = rk3066_hdmi_encoder_enable, - .disable = rk3066_hdmi_encoder_disable, - .mode_set = rk3066_hdmi_encoder_mode_set, - .atomic_check = rk3066_hdmi_encoder_atomic_check, + .atomic_check = rk3066_hdmi_encoder_atomic_check, + .atomic_enable = rk3066_hdmi_encoder_enable, + .atomic_disable = rk3066_hdmi_encoder_disable, }; static enum drm_connector_status