From patchwork Fri Mar 1 05:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikandan Muralidharan X-Patchwork-Id: 208647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp872981dyb; Thu, 29 Feb 2024 21:27:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVK+YqS4FkNAav3oWQntGrXDPMssuubpFENz+of4Cg7tTFR783U40Hrpq3aoGxUhMeWah3u96aY+sEZ+yxPbUR30aNCuw== X-Google-Smtp-Source: AGHT+IElLaDkJ1Vdlsp4SpnZCF/zvOYyKGLof68MsbQWDViZtADqYZXr3LDgaeBtuU8/u5CVfny3 X-Received: by 2002:a17:902:db02:b0:1dc:df18:c5c0 with SMTP id m2-20020a170902db0200b001dcdf18c5c0mr911561plx.0.1709270844563; Thu, 29 Feb 2024 21:27:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709270844; cv=pass; d=google.com; s=arc-20160816; b=wFv2o0mWPjZa8ls1azt8O9bxZNKhLCFlUOOJDrx1VTTExFy4cShJ3C/aMSDzkSXZOm zmVeJWzn7uWrsuD2HfzXTplDWWfcXFfVjWpzh8FTdJmO7GtIXI3lE0vZBkx2OqG2mcK0 PO53RSmz/C/zvBhZtA/6dLys8Y9dK1WRZ5Qs9UchH4oaai6/tIgEnsRM3eQ93/wMtduU pc9yDiV7VapHmyEeXHfxyq/5hBGEslQj8u2M6EJ1NXTc+NPg0rVLK31EMrWFuanI4NHC cTqovL2nDH/zMy+ObzjAIPZqcsRcyPmfLzwEavOV+WD9bOtIba3APrubFM2asqYaunip 8PMg== 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=7xDrTPtxQps5HuSmCDVQr7PQdVAlZ4Y45ujnCRsPeMM=; fh=7LlwrKsimiND7hPCZs/yKkmKi2XUc8gnfHs3RVyzKvk=; b=Wm8izmjq+KWmD0/OlZnXkFq4qPJqwePZArTURYFUmpJEeVhZYpUqYXf8pGD3TSjvHX vYJAOrR3J2T8Og5zoqF5c4CNp7Le44qVp9tnXdvOENTCmOrjZmrTsa1Vl4tBpvT7RfE/ NWa4WshadA+3rGb/die186u+uk/RR3wFXJ1ylK+IMMlTmuptZ8mHLug32bjWBWZAcleU pMoQ5Upvrdmm4yEtAhTH1bGtaAdLdviURD+P3IvDwtBmdVreVD+FQabXeu1GIsY1eFj0 uAAwfZuxdQyVJ1IeUL/Bw/nTCYqaRaDIAq3vzCZsJuhRBLYBEo3O42twwEVm7qGAUrAo 1GDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Z76FPPSK; 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-87919-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87919-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 q12-20020a17090311cc00b001dcb654d197si2753275plh.303.2024.02.29.21.27.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 21:27:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87919-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=Z76FPPSK; 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-87919-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87919-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 60CD0282F55 for ; Fri, 1 Mar 2024 05:27:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 433A6537F1; Fri, 1 Mar 2024 05:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Z76FPPSK" 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 92EDE52F8A for ; Fri, 1 Mar 2024 05:26:41 +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=1709270803; cv=none; b=L5T+tN9GSztiRRezLkiGp+ajJ3l2+sUtjk7DN50lc5y6kq/zHTLQKVTa92b35x63It+9EwmpUK1rNnI28hGtnM+2h24gy3Zia2XOQS1SvWEl7BuB3Yc18aQW5jM2OjKer/S8ktg/OOUIC8Pumu+DwSb9n5yGFu4PnDCFTTQzmAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709270803; c=relaxed/simple; bh=cf1ERUI8W0KgkYZjZBGlnJlrKnBS1Q66fpRRN2HpQMY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=emj8eZfZbMEt6/4/OSOpsmcfeK2H5K7sPvnyTboCmn2Zz1Edeaw83gI9XwksgNh+8X9SXVNnxOMpznZfBtfUJAjhWJpg7lp1p63s3YRzOOd+YwNS/IH70g2IVYCgMKDrw8dZ9ALKdRpcmOUAZtC1Jzkl4z0eUEHGsA0xp1aCyJE= 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=Z76FPPSK; arc=none smtp.client-ip=68.232.153.233 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=1709270801; x=1740806801; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cf1ERUI8W0KgkYZjZBGlnJlrKnBS1Q66fpRRN2HpQMY=; b=Z76FPPSK8OIEuFALIiY1yGogGy8We2Cn4fB3jV/AqqZsvINHTSreyynJ dYQABek295sv1rO9U/D8XBjKJ1ERn8jLMpprANCOqfDwYbadRP89bEktP 3Yv2KC6pn1CXKqJ9c+2sYmyjuswDMX/+hceVK6ii+syRAsGKGgon5R0bC +3vI0ZyP69G4l8hBcW3b0ymwY73z5IiNKloulLS4+nIazuVFm1c4ZIsuG B5NoUuU8FKyxKQOVb3J41lPiUsdSqIcgHbXfSySCemVbPE0hY/EtT3fSn QIR/B17RAhDYrFWg1+eUyUtCKB5A92wu1qaZ6BZ9uPHIFj1PiYj+bC0jA g==; X-CSE-ConnectionGUID: NiYMRsuYQMSobLMasNu+DA== X-CSE-MsgGUID: suMdi/RQTVKuzaHjFPpCjg== X-IronPort-AV: E=Sophos;i="6.06,195,1705388400"; d="scan'208";a="17055836" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Feb 2024 22:26:40 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 29 Feb 2024 22:26:37 -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; Thu, 29 Feb 2024 22:26:29 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , CC: , , , , , , , , "Manikandan Muralidharan" , Durai Manickam KR Subject: [PATCH v9 5/8] drm: atmel-hlcdc: add DPI mode support for XLCDC Date: Fri, 1 Mar 2024 10:55:31 +0530 Message-ID: <20240301052534.38651-6-manikandan.m@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301052534.38651-1-manikandan.m@microchip.com> References: <20240301052534.38651-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: 1792300384992066863 X-GMAIL-MSGID: 1792300384992066863 Add support for Display Pixel Interface (DPI) Compatible Mode support in atmel-hlcdc driver for XLCDC IP along with legacy pixel mapping. DPI mode BIT is configured in LCDC_CFG5 register. Signed-off-by: Manikandan Muralidharan [durai.manickamkr@microchip.com: update DPI mode bit using is_xlcdc flag] Signed-off-by: Durai Manickam KR --- .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 98a98b5fca85..fdd3a6bc0f79 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -30,10 +30,12 @@ * * @base: base CRTC state * @output_mode: RGBXXX output mode + * @dpi: output DPI mode */ struct atmel_hlcdc_crtc_state { struct drm_crtc_state base; unsigned int output_mode; + u8 dpi; }; static inline struct atmel_hlcdc_crtc_state * @@ -170,6 +172,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) if (adj->flags & DRM_MODE_FLAG_NHSYNC) cfg |= ATMEL_HLCDC_HSPOL; + } else { + cfg |= state->dpi << 11; } regmap_update_bits(regmap, ATMEL_HLCDC_CFG(5), @@ -177,7 +181,9 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) ATMEL_HLCDC_VSPDLYS | ATMEL_HLCDC_VSPDLYE | ATMEL_HLCDC_DISPPOL | ATMEL_HLCDC_DISPDLY | ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO | - ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK, + ATMEL_HLCDC_GUARDTIME_MASK | + (crtc->dc->desc->is_xlcdc ? ATMEL_XLCDC_MODE_MASK | + ATMEL_XLCDC_DPI : ATMEL_HLCDC_MODE_MASK), cfg); clk_disable_unprepare(crtc->dc->hlcdc->sys_clk); @@ -380,7 +386,15 @@ static int atmel_hlcdc_crtc_select_output_mode(struct drm_crtc_state *state) hstate = drm_crtc_state_to_atmel_hlcdc_crtc_state(state); hstate->output_mode = fls(output_fmts) - 1; - + if (crtc->dc->desc->is_xlcdc) { + /* check if MIPI DPI bit needs to be set */ + if (fls(output_fmts) > 3) { + hstate->output_mode -= 4; + hstate->dpi = 1; + } else { + hstate->dpi = 0; + } + } return 0; } @@ -484,6 +498,7 @@ static struct drm_crtc_state * atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc) { struct atmel_hlcdc_crtc_state *state, *cur; + struct atmel_hlcdc_crtc *c = drm_crtc_to_atmel_hlcdc_crtc(crtc); if (WARN_ON(!crtc->state)) return NULL; @@ -495,6 +510,8 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc) cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); state->output_mode = cur->output_mode; + if (c->dc->desc->is_xlcdc) + state->dpi = cur->dpi; return &state->base; }