Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp208905lqd; Tue, 23 Apr 2024 22:36:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJt0WCieT3VQfTUavdVnCVL+KjoWUxk1zBanaRJj8oyApq0P3ArTw7vrkMol1y8f6RqvzwTyajD8YCN/ZpfjQQ5qHjZ/h+93w+dqXJ7Q== X-Google-Smtp-Source: AGHT+IHi6P6ouVHM/payZCWNMd8BhlV/vXI2n3ou9E09c4Rq4YlGZJpRR7D0nJraT6OZcEU8tq6F X-Received: by 2002:a05:690c:6d08:b0:618:79f5:8d32 with SMTP id iv8-20020a05690c6d0800b0061879f58d32mr1557809ywb.48.1713937009328; Tue, 23 Apr 2024 22:36:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713937009; cv=pass; d=google.com; s=arc-20160816; b=nibHz3cdRsoLvTmDdtApYLpYIAlP+1DG2RzGzEiOUfLkK7U8jkPrtu5F5ptERc+zi3 mNvuwbflzY8s8YNo9WW5+K7251phXZ1Y5g4/KancPZa1yzIrvdnnxkSChVTBXfRlT74O bm3vtHY6Et0ZSHGIcjkV6uyqbQpm3pGaPKLitGuTvMFM4GEuu+HH/eQD0l65asOfgFzK L/T4VUO9CAFOJEA9yuFbsEqdmc19XWSmA6y5xZhx5KauQNmR9AUzZH8DtOXieiwNKzWc /hu61x3plPlXOt7QZJwfUyh0Yg4Lq6RCblzYjSWK1oOch+EKi0J+k73jk/TcFD3dCAhM kHVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GpdqWoHxzs3aqUfyRA1t46xOrR9t44oSODF3zy8PzEk=; fh=7LlwrKsimiND7hPCZs/yKkmKi2XUc8gnfHs3RVyzKvk=; b=ayMB0CS6Q1cj4/cohZjTvTo+WXFepXhtXePDrKvvBPSP2zWmvxOq4owOjEIiTEEgC+ PE0B9tqwN8xPzLxSDf6wBvsNuzMos79DOvpYlDZF2k56RdYNbKRBvXE/XDpUb5ZsxmqD X24mz9IOoPqhaswnnOvoh8DoXvtjS4ObJIHj7zGpZXMF8tklYToIeeIxl9oWtVcm8WyP dsH9gJcovrHNZnxbAj6lKwXCNkQslfhdp06BXQqIjxScj0CleaKO8+As2hjJ/Zs9mHWM gv60BuqkGH7aGHmsvTH6b/k9E3wBESyUC3aUnms5xOFd7ARXiwc17n3Eyv3ImMdq/+v5 JrjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=bk9gXjp0; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-156318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fj24-20020a05622a551800b00439f565dbb6si2842658qtb.169.2024.04.23.22.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 22:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=bk9gXjp0; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-156318-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156318-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F0D9B1C2247C for ; Wed, 24 Apr 2024 05:36:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A47C156980; Wed, 24 Apr 2024 05:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="bk9gXjp0" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2640A156876 for ; Wed, 24 Apr 2024 05:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713936964; cv=none; b=P+0M/hkoxwvXWksh//UlbwwTa/oI9m5L9G+3h0b21rGAdfcFhJskQzdK8HYDK2FEvQ6cecTJqAA2S6ZkZRotnG4GqdOQxdHkhoLB5DTEbt7kCqGBv5xSEYwxyRGDrYZpJ/bsWJQOGPNwmHmkesayopyMY4ZhDFsBIY3uEtRogic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713936964; c=relaxed/simple; bh=yyPs4AwQF2sQjCTCDS+LBYKuRFhFcwhT0V8y0ED5pcE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LTmaj98LiTRj+FEEtQIxb8fCyTFeFubjJuMZRpa5xLh+aREl0+kczaEpIUOKCma5iw1OL77SwLYZvpSJYFg5es9iCEmhMG0p3yTlUEDDBjwZ6mnvf4jBKJTaAOIT18PfPpJ3ppm0maJWMtdl973GAGR2ZMiBPRgmpTBG4UoYCTo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=bk9gXjp0; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713936963; x=1745472963; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yyPs4AwQF2sQjCTCDS+LBYKuRFhFcwhT0V8y0ED5pcE=; b=bk9gXjp0qFYYsmvk/vxbOQ/mod3RKxx2KJ6XhPttSARgBSa0dZ0kLYK5 gzfCt/zYGNyfYr4wDSIcs7Z3ctuguPt17EOz66c/JgHxFGMHt88t7ks7/ Y+tipvX/lO/UAVAWdsJKnnPBKzTEKmb3CAYRT+C6YlTs84O9TsmPLIyC9 3G+xTSK3ehjhMoOBZxXsU4Y8epZV2kmj8C5ffKU+Be0Wf7Zxl1notuE10 pd7AqWdliNGysWhw+G6Es+xS6Hobncsno8nwJOAnl8+oZgvQ0t3JiuFY0 S+1CCXzoTSlMmZN5LPWn32DvnBKsMBfMlRk70Lfu9aBDb8qRWBya/SX7G w==; X-CSE-ConnectionGUID: IIomXHMkRVGwWaCsBommpQ== X-CSE-MsgGUID: 5ionKT28RNmLBWSn4A8l8g== X-IronPort-AV: E=Sophos;i="6.07,225,1708412400"; d="scan'208";a="24473826" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Apr 2024 22:36:02 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 23 Apr 2024 22:35:30 -0700 Received: from che-lt-i67131.microchip.com (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 23 Apr 2024 22:35:20 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , CC: , , , , , , , , "Manikandan Muralidharan" , Durai Manickam KR Subject: [PATCH RESEND v9 7/8] drm: atmel-hlcdc: add support for DSI output formats Date: Wed, 24 Apr 2024 11:03:50 +0530 Message-ID: <20240424053351.589830-8-manikandan.m@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240424053351.589830-1-manikandan.m@microchip.com> References: <20240424053351.589830-1-manikandan.m@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Add support for the following DPI mode if the encoder type is DSI as per the XLCDC IP datasheet: - 16BPPCFG1 - 16BPPCFG2 - 16BPPCFG3 - 18BPPCFG1 - 18BPPCFG2 - 24BPP Signed-off-by: Manikandan Muralidharan [durai.manickamkr@microchip.com: update output format using is_xlcdc flag] Signed-off-by: Durai Manickam KR Acked-by: Sam Ravnborg --- .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 70 +++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index fdd3a6bc0f79..0f7ffb3ced20 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -301,11 +301,60 @@ static void atmel_hlcdc_crtc_atomic_enable(struct drm_crtc *c, } -#define ATMEL_HLCDC_RGB444_OUTPUT BIT(0) -#define ATMEL_HLCDC_RGB565_OUTPUT BIT(1) -#define ATMEL_HLCDC_RGB666_OUTPUT BIT(2) -#define ATMEL_HLCDC_RGB888_OUTPUT BIT(3) -#define ATMEL_HLCDC_OUTPUT_MODE_MASK GENMASK(3, 0) +#define ATMEL_HLCDC_RGB444_OUTPUT BIT(0) +#define ATMEL_HLCDC_RGB565_OUTPUT BIT(1) +#define ATMEL_HLCDC_RGB666_OUTPUT BIT(2) +#define ATMEL_HLCDC_RGB888_OUTPUT BIT(3) +#define ATMEL_HLCDC_DPI_RGB565C1_OUTPUT BIT(4) +#define ATMEL_HLCDC_DPI_RGB565C2_OUTPUT BIT(5) +#define ATMEL_HLCDC_DPI_RGB565C3_OUTPUT BIT(6) +#define ATMEL_HLCDC_DPI_RGB666C1_OUTPUT BIT(7) +#define ATMEL_HLCDC_DPI_RGB666C2_OUTPUT BIT(8) +#define ATMEL_HLCDC_DPI_RGB888_OUTPUT BIT(9) +#define ATMEL_HLCDC_OUTPUT_MODE_MASK GENMASK(3, 0) +#define ATMEL_XLCDC_OUTPUT_MODE_MASK GENMASK(9, 0) + +static int atmel_xlcdc_connector_output_dsi(struct drm_encoder *encoder, + struct drm_display_info *info) +{ + int j; + unsigned int supported_fmts = 0; + + switch (atmel_hlcdc_encoder_get_bus_fmt(encoder)) { + case 0: + break; + case MEDIA_BUS_FMT_RGB565_1X16: + return ATMEL_HLCDC_DPI_RGB565C1_OUTPUT; + case MEDIA_BUS_FMT_RGB666_1X18: + return ATMEL_HLCDC_DPI_RGB666C1_OUTPUT; + case MEDIA_BUS_FMT_RGB666_1X24_CPADHI: + return ATMEL_HLCDC_DPI_RGB666C2_OUTPUT; + case MEDIA_BUS_FMT_RGB888_1X24: + return ATMEL_HLCDC_DPI_RGB888_OUTPUT; + default: + return -EINVAL; + } + + for (j = 0; j < info->num_bus_formats; j++) { + switch (info->bus_formats[j]) { + case MEDIA_BUS_FMT_RGB565_1X16: + supported_fmts |= ATMEL_HLCDC_DPI_RGB565C1_OUTPUT; + break; + case MEDIA_BUS_FMT_RGB666_1X18: + supported_fmts |= ATMEL_HLCDC_DPI_RGB666C1_OUTPUT; + break; + case MEDIA_BUS_FMT_RGB666_1X24_CPADHI: + supported_fmts |= ATMEL_HLCDC_DPI_RGB666C2_OUTPUT; + break; + case MEDIA_BUS_FMT_RGB888_1X24: + supported_fmts |= ATMEL_HLCDC_DPI_RGB888_OUTPUT; + break; + default: + break; + } + } + return supported_fmts; +} static int atmel_hlcdc_connector_output_mode(struct drm_connector_state *state) { @@ -318,6 +367,13 @@ static int atmel_hlcdc_connector_output_mode(struct drm_connector_state *state) encoder = state->best_encoder; if (!encoder) encoder = connector->encoder; + /* + * atmel-hlcdc to support DSI formats with DSI video pipeline + * when DRM_MODE_ENCODER_DSI type is set by + * connector driver component. + */ + if (encoder->encoder_type == DRM_MODE_ENCODER_DSI) + return atmel_xlcdc_connector_output_dsi(encoder, info); switch (atmel_hlcdc_encoder_get_bus_fmt(encoder)) { case 0: @@ -358,7 +414,7 @@ static int atmel_hlcdc_connector_output_mode(struct drm_connector_state *state) static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) { - unsigned int output_fmts = ATMEL_HLCDC_OUTPUT_MODE_MASK; + unsigned int output_fmts; struct atmel_hlcdc_crtc_state *hstate; struct drm_connector_state *cstate; struct drm_connector *connector; @@ -366,6 +422,8 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) int i; crtc = drm_crtc_to_atmel_hlcdc_crtc(state->crtc); + output_fmts = crtc->dc->desc->is_xlcdc ? ATMEL_XLCDC_OUTPUT_MODE_MASK : + ATMEL_HLCDC_OUTPUT_MODE_MASK; for_each_new_connector_in_state(state->state, connector, cstate, i) { unsigned int supported_fmts = 0; -- 2.25.1