From patchwork Thu Feb 10 10:34:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 541427 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp2113635imo; Thu, 10 Feb 2022 02:35:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyeRTYsAAU53hT/qf/E/F+KTVEB7EDK5+gkz8Io3+MsqaeEbG+XswJtqmHnWwSPbqHUCYQ X-Received: by 2002:a63:2bc5:: with SMTP id r188mr5670544pgr.363.1644489330341; Thu, 10 Feb 2022 02:35:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644489330; cv=none; d=google.com; s=arc-20160816; b=eSVkDa2Gc4V49pCFRmrkfoyJVlv4kfCsyzB31m6O/j5Ip5WmrRihOaIY+aaBzVuM+L ihqaFEGD49kAsbGb8374wPjs5jgEHv4oUPsrUEKzbBj8MZyWC8tiz79ocZtpkpeQqx6E E2RkaM+UUpWULG1YZq0XnIW4waEB8tOuuqBAfEAd6B2XAqgqI7vjE459XJdXprQMsBh0 EZ6EhOMeyrEF5E1mRPuVaTnn85lb7yFkTnompGMN0p571TeK81a9u3zOmLDeNRj24Hdf iP0ivvQaXnSdiTPHpeMUjMJTMa51mg7cYgjE3aCQbBjrzJY1v7kAjIY1ogc3Ta/1UcxN OPxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=g9s618WwhV5e9L0QpSH7dNGXuiPtOXOkUOKFsHZbly8=; b=BQ0maIqydPeFNSQYCC2eivp386Uf0UiDT4j3IaYG1pyYX23UOZT/zWPHC0ODfp+/FN FUmoch6uiDc2TMjgQtYhV6tEw/59V2RJE8vUejI1IIJ0HaZuoonK27GJ4mKtlZH2HcRb ctPTRQpEjfL2WTlBVRRItpW3/Qa2zshm4cu+qAldmjqh5R8PokZ5W0NVeMOkB/I4oQeD EpLsXmDzxEkyz/RRWLSc3rl1O/qZtWt3ft8ZpEUopQfxrg2hb4sC/uPuDplaaTcdG6nK n2uUjRvsLRCT9QmvGf+rGX9xpMeLhqP66X0BS+2t5IH62S5u+Zde4GF0YHOyXVcYyCt6 g1xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=UlIkNUgl; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id l63si18582913pgd.579.2022.02.10.02.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 02:35:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=UlIkNUgl; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E17CC10E7EA; Thu, 10 Feb 2022 10:35:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id C379B10E7E3; Thu, 10 Feb 2022 10:35:25 +0000 (UTC) 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 647C9B80EC0; 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jonathan Marek , David Airlie , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Abhinav Kumar , Bjorn Andersson , Vinod Koul , dri-devel@lists.freedesktop.org, Dmitry Baryshkov , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Abhinav Kumar --- 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 */