Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2798007pxb; Thu, 10 Feb 2022 05:56:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwekIl5jNQDxB8V/ta9Tc92jyj/bjKoavKNx2v4q0XD79yn/KIE4vOflMK5CX6MNAp4gAUB X-Received: by 2002:a17:907:1b16:: with SMTP id mp22mr6714080ejc.537.1644501368734; Thu, 10 Feb 2022 05:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644501368; cv=none; d=google.com; s=arc-20160816; b=W7qkzMvPYqhfo18/LZ0MFp+SDH70RDpdibmmavB44NEYnYkgT8btPJBmuGMPtp34Fa 66tGulWDjyoeVchmpKyXw6pW+9+8EfnLfonRCE7dmpxrMA/nhrMaMNy+bPUNCitB/bGb C50aT0h4D8X1weMKnJar/8IuLvppNuM78QmRTSYVg00DaWPDkhWdaKbobiWl2SUEww3/ DS38u07F2XejXEcgN/9+/JQzhbb2+d3RTNVd8N7+eZ+wqsRhDW4qgEc9vUDztVlU/PCC 9dpxaI0v10AM3X/w9LVkRM5Z/c+ZzyLz+nKRO+t9ekhg9W4SPJfn+CCe+cyHcKHn+CIL SdCg== 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=g9s618WwhV5e9L0QpSH7dNGXuiPtOXOkUOKFsHZbly8=; b=FpRH5wwLJ4RD6l3vKzVq6s+7UrZL6mYVBAXgxB5U7/kRcj71bvZk7oCNou8kQqbid4 k72ESmNWsV+WhWow8+UHZNIceD98qiD27bFUodv/H3+gJvp4fXSlRzqlzhl1RgbkH0HX iupWngNjprVrJ3LjegunGwNUIH+BkiRXsAsf1/c4kgCX7kiwIxibuTwYJm6Adw4psScw THvBOPfi1nWz9KBK2wCIzKtIWLgurQwW3xy2fBthcyzqlDNRbecLiI5MqcwKiUkJVf4Y 2al3CvER1Hcn2fyIMb4tVE2Ax0LgdbtIei+UY5L2QsWEL+zh0SbeXbnXXArh8pPEd6qa omdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UlIkNUgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7si11868003eju.711.2022.02.10.05.55.43; Thu, 10 Feb 2022 05:56:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UlIkNUgl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240018AbiBJKfr (ORCPT + 99 others); Thu, 10 Feb 2022 05:35:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239922AbiBJKfZ (ORCPT ); Thu, 10 Feb 2022 05:35:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDA8A1014; Thu, 10 Feb 2022 02:35:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 80452B8243C; Thu, 10 Feb 2022 10:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9266C340EE; Thu, 10 Feb 2022 10:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644489323; bh=UH/u6GhSQACw/+HadR9tGs6IYfw5jFInNEMRgRNnKqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlIkNUglJpWXpBQcQrhEcXCNFMAJbhc97eWMAixhRHxje7cqWUAc2B5joHrsQ8kR9 ZtkgF7lJALX7R7pFapFwpgFDrTg9u5KMxRuiKqu0n+Q+gs7KdgaWjT8Dc9UkHg6nXo 0QycuJlq3zjRiW4E9EsChtIsl89JKem1MkPauJ5gdxgCub4bmkl/komKUwaZgJ+TEM RKNZvZ26iOLWwEuQX34uSfoBt6tgPwfcM4WI/X6g4Z+volqeo9ZFX6zWvNsHn/Ws80 8xjVMXau3XjfyTN+14iQVM18OnC1iE9QDoqaEdvwZaQtEuLI/S+vgonYQpO17zc6VS EC3BnbTG5Zp6A== From: Vinod Koul To: Rob Clark Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Vinod Koul , David Airlie , Daniel Vetter , Jonathan Marek , Dmitry Baryshkov , Abhinav Kumar , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [REPOST PATCH v4 12/13] drm/msm/dsi: add mode valid callback for dsi_mgr Date: Thu, 10 Feb 2022 16:04:22 +0530 Message-Id: <20220210103423.271016-13-vkoul@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220210103423.271016-1-vkoul@kernel.org> References: <20220210103423.271016-1-vkoul@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Add a mode valid callback for dsi_mgr for checking mode being valid in case of DSC. For DSC the height and width needs to be multiple of slice, so we check that here Reviewed-by: Dmitry Baryshkov Signed-off-by: Vinod Koul --- drivers/gpu/drm/msm/dsi/dsi.h | 2 ++ drivers/gpu/drm/msm/dsi/dsi_host.c | 26 ++++++++++++++++++++++++++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 12 ++++++++++++ 3 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 16cd9b2fce86..580a1e6358bf 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -114,6 +114,8 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host, int msm_dsi_host_power_off(struct mipi_dsi_host *host); int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, const struct drm_display_mode *mode); +enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, + const struct drm_display_mode *mode); struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host); unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host); struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 7e9913eff724..438c80750682 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2552,6 +2552,32 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, return 0; } +enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, + const struct drm_display_mode *mode) +{ + struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + struct msm_display_dsc_config *dsc = msm_host->dsc; + int pic_width = mode->hdisplay; + int pic_height = mode->vdisplay; + + if (!msm_host->dsc) + return MODE_OK; + + if (pic_width % dsc->drm->slice_width) { + pr_err("DSI: pic_width %d has to be multiple of slice %d\n", + pic_width, dsc->drm->slice_width); + return MODE_H_ILLEGAL; + } + + if (pic_height % dsc->drm->slice_height) { + pr_err("DSI: pic_height %d has to be multiple of slice %d\n", + pic_height, dsc->drm->slice_height); + return MODE_V_ILLEGAL; + } + + return MODE_OK; +} + struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host) { return of_drm_find_panel(to_msm_dsi_host(host)->device_node); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index f19bae475c96..e7f6cc88f7a4 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -575,6 +575,17 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); } +static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct mipi_dsi_host *host = msm_dsi->host; + + return msm_dsi_host_check_dsc(host, mode); +} + static const struct drm_connector_funcs dsi_mgr_connector_funcs = { .detect = dsi_mgr_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, @@ -596,6 +607,7 @@ static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { .disable = dsi_mgr_bridge_disable, .post_disable = dsi_mgr_bridge_post_disable, .mode_set = dsi_mgr_bridge_mode_set, + .mode_valid = dsi_mgr_bridge_mode_valid, }; /* initialize connector when we're connected to a drm_panel */ -- 2.31.1