From patchwork Wed Feb 21 05:35:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikandan Muralidharan X-Patchwork-Id: 203929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp847793dyc; Tue, 20 Feb 2024 21:37:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURfGR3F5wqGNqofXdKYv2pQz15eiJFtupBwwCczOl07FVt+iIMLEa8yCRVwgoW5sAZsqZ7OP3T4gE1OA4uU7fOdYmzGw== X-Google-Smtp-Source: AGHT+IGuWWsp94s88Ldscz8kq4FiISwINWFfEfRpY/TRwUw2AqFVWl6l9v9htSqOxdHwZ4qtVVsS X-Received: by 2002:a05:6359:459d:b0:17b:59f9:b691 with SMTP id no29-20020a056359459d00b0017b59f9b691mr1173718rwb.1.1708493865168; Tue, 20 Feb 2024 21:37:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708493865; cv=pass; d=google.com; s=arc-20160816; b=wfALflaT7T3E49AFSJUJCF9TooCYdSynocI2msx+gC39db1ebQGtaGuielgzz557RU 7re93PRjqkppvTLTnxl4wVsX94gqJLxfiGoMlMg2EadauN5epaBoFjQJzK3PeKDSM2X1 0UPvlJGeItPGvkmd40U3xrzBy80EXm0ryDkGu+mt6RbJLQpAf0fNovY3rs3zvKBQgq3B U0vpcNQCpSPsLrRr4BezYdhGvennAnsxK5xU5iaWUjSBXI3fMn8m9Z1SPA4TAoOepD/a aknAWEvtR8tb0AdZ5wbiI10fQ+aT/J3aBGrR7bGcbDQDNu1nvB/fmBwzLEDVF7YXx5DX cUag== 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=1PtUxTc3ibjUCbpx4d97yTSbPTq7RWhF+GOiWNNvOgs=; fh=UhijDlGz4WYNx2y13BRHEKP9mVAyr2sRDgQuYnzbmVc=; b=JaHwIIy6YerldEZLJwSvbVuLAGvihb46UNSEDCr+ePpjztBZYbQIGkdI/P/tIfULm/ 44BT3JoM788gB+LrhdzGF/AnjfX9oB3MqeXMAHhZV4n17HXO4A3OxphAduU1wyJiDprW hmA85ISGOtAdD2y2Say4XgDt1eQRJDhhQFuhr+xTR9rVIY498G1FbP2eBWKZHrOKvyIV kDM/IY7YAKfJ9NEtqOUUKheDaJPjVu8Ng7P08Xv1FbK1+OGKuH/xGzV9IgryzemP6xO0 53XnnYN9e0696fEZdX+ns6YyOcJ6L6lNdZ9P6hQymlAMnxOLHAJEcTkQ/DRb7qECcsMi 5iuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=dU2Wo6mV; 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-74087-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74087-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m3-20020a62f203000000b006e3eda25102si5816306pfh.319.2024.02.20.21.37.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 21:37:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74087-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=dU2Wo6mV; 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-74087-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74087-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E8D4B282A99 for ; Wed, 21 Feb 2024 05:37:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 606FA3AC10; Wed, 21 Feb 2024 05:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="dU2Wo6mV" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 9D6C9383BF for ; Wed, 21 Feb 2024 05:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708493811; cv=none; b=DstTt+GvSBtDtVyDBv9jNf+YzzD4UsU9mAbY8xqtuLyro+KdKplSIePiTsL88MD0+8KdHaboflaD7H9bHKX2BsQGcT7Ldqqa/zdwKei5oFJIOb4eMLJ6TfLHtgBJcLlU4sHuLXeZqeXeLfyHFMs0NUCfaVV0g0pI5E6ICCKbaBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708493811; c=relaxed/simple; bh=U7jH/pJDoVpWs61f/GCs67K6hYCY5UGUIVemfwvO3Aw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WNzEA6jj6Ki9tYKk49mclgr4qxYTvptrmvuoU1PGtTY7cg0sx8UVxYsZM3va65NHyRhyFct5+36O04QRo2c9PS5r7tnaDfdsZICUGjnszxJpWCrsREUf7derDEgtGMxXGQOI+1J4sqT9+AR+mfQW3pS8vGzBWaY/UXB2meiNb90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=dU2Wo6mV; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=1708493809; x=1740029809; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U7jH/pJDoVpWs61f/GCs67K6hYCY5UGUIVemfwvO3Aw=; b=dU2Wo6mVO5DjcvtUiq2CuzP0zCyTcN7pT5eLxBK4B8S7BZ5LeHkOiCXd THvYUWPGCycFCWFHcFwdXE5iq/GTZU0YGvmgU8JA+8+MtWmAlGYr3wC6E F7/fr1Ff+Y8EFM0+KS0oZZtGGvraY61cT6s5MQ31reREZDwfObRBtXJoj dgk/XL0JljMwsKyw7O25oZFSnjAYUI3j6y4S8oo7iiOB8IN5civX/PI5Q VIwafPv3rIwznakvN7qSJKjiiPKQHPv90fY9ElnCzjAJ+k491KOE5FOT4 21FJ/4A+VDf7LPjXhLA/9YpQbHVumk14zjeCsvE5NY6F0WH4nzm37rU1/ g==; X-CSE-ConnectionGUID: uvmqqrvDTHSClXFWxIq5Hw== X-CSE-MsgGUID: LEPWwVfRQ8eIngdgoc/F2Q== X-IronPort-AV: E=Sophos;i="6.06,174,1705388400"; d="scan'208";a="183844465" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Feb 2024 22:36:46 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 22:36:35 -0700 Received: from che-lt-i67131.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Tue, 20 Feb 2024 22:36:27 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , CC: , , , , , , , , , Durai Manickam KR Subject: [PATCH v8 6/7] drm: atmel-hlcdc: add support for DSI output formats Date: Wed, 21 Feb 2024 11:05:30 +0530 Message-ID: <20240221053531.12701-7-manikandan.m@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240221053531.12701-1-manikandan.m@microchip.com> References: <20240221053531.12701-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791485663251111621 X-GMAIL-MSGID: 1791485663251111621 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 --- .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 74 +++++++++++++++++-- 1 file changed, 68 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..0dbe85686fc2 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -301,11 +301,64 @@ 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_hlcdc_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 +371,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_hlcdc_connector_output_dsi(encoder, info); switch (atmel_hlcdc_encoder_get_bus_fmt(encoder)) { case 0: @@ -358,7 +418,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 +426,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;