Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp208711lqd; Tue, 23 Apr 2024 22:36:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVl3vPmzWlogEeuxdnQZyZPxAeh1hcsSq7mz499Gc/blbAqXSX6RmJcWjRjqKhAzhZiTvp2NSN7bS4C3xjW4FAtKd/ZS+8za5e/tTuFGQ== X-Google-Smtp-Source: AGHT+IGtrssWgpHVjNmF0h5e4gjdtjcsntyGp/h7ZQYA1AOAlNW1KN/9i8Ikx6ocO5Uk0xX1mOtu X-Received: by 2002:ac8:59d6:0:b0:439:de62:b6cc with SMTP id f22-20020ac859d6000000b00439de62b6ccmr1455272qtf.39.1713936967704; Tue, 23 Apr 2024 22:36:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713936967; cv=pass; d=google.com; s=arc-20160816; b=OYWSTXhLxOe9S8C9jok46GMqgdt6Xa7X++17hHkW/XSk5UkCiuyXqzL5NMndWDnB8p mU3m/lkbTZNV1W1fcw4SpT6BITJ+HEOuQEGFwjeRW51Ez/s9yXb8cI6MO1KtTEe3JYZN WjwUk0V5SVlFKiG4QIA3AyghKh55F760vCnaQdgRth/32kPNg8RBQ3KngvwHx0+MQgK3 6eNGHDmNE27/lpN1gqqRdW97UaJb//TV/n3rbZSizoXzDz53qprkiJ9hrnydT0wgb7wp O1HhrKmA04JuUjjI1TYqrQLRZ4wQ4kF4xGRcpQBFSYaxRrtDdGhffmlk4kODVSfwfVFa YWRg== 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=D9UFHD5kDN4EPeGLcbuCbffam7A3N6b9sNSCPQr0rOg=; fh=7LlwrKsimiND7hPCZs/yKkmKi2XUc8gnfHs3RVyzKvk=; b=Jos+ages+BcO/hGVANX46vvULpB+Aev3AyGsZ2PWcklD90Xt8VUOE8Yi5hPIsmdtzE 2dQ77c1SQIvmNV1cQsoGu/JtLA/m8s0sFByrRLAQXd2Vr5q2KW20DneXZX4jOCEoJoUz QrkO+ahfvXoA2xOwPgrlfFcF3J3xioSHOTxqidsMZX3jQpYd+xn4cEr0+vq92uOYilE0 S/V9Q8stPMKlY5sqBb1db7n6Wa3p2y0hb45vO/OiqMXh7Wx8ZUCFTRycrdrMJZUxEpf/ Q/WM0H9r2AW2YUP4E2l+8UF98ts8RDxCl3tERZTzctvje3gUo7ZcOEuqcoQ6B0BXpBCn 92fw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=B8QZs9Py; 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-156315-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156315-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 g21-20020ac87f55000000b00434df844b51si14193605qtk.466.2024.04.23.22.36.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 22:36:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156315-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=B8QZs9Py; 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-156315-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156315-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 2C5A71C226EC for ; Wed, 24 Apr 2024 05:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA815156867; Wed, 24 Apr 2024 05:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="B8QZs9Py" 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 A9E951553A9 for ; Wed, 24 Apr 2024 05:35:33 +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=1713936935; cv=none; b=VKAhOYDXT5VxxxiScAJp6AHyyh2tOmj1x4v5fPgvROFIL/GHwDV/YP6e7C2FtG7YzrA1EoUn80S4xDCR7SXOZJubUSxzGzS7wFddMEbLmrn1D/1uqYkwI9r6amdeMgWDzqsRmn20vuaQ3ebp7t+nJohI12ENhMj8rkiKQ6j+Flo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713936935; c=relaxed/simple; bh=6nlV4wKxfrlEmIzRqvvA320tp0LjMhonuKXAFTpzlsA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LHiejfD49hfSHzPESTfRqeWuryR8rwIU6Fqrg0QhlnBPuMxM5huK0+sm65egwiVcI5S+BVtvIV/hQYnbJwWscYtHdZWRYqiB7I6MmZO2MWdjKh0lJCTU1Aq3t1FWcDiHpBOl3VCeI+3ylrLAaCaLD3I12BVVuQNT1n3FKfSEtVY= 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=B8QZs9Py; 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=1713936933; x=1745472933; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6nlV4wKxfrlEmIzRqvvA320tp0LjMhonuKXAFTpzlsA=; b=B8QZs9PykSewgBmKHKE76A6es41SUQKv86fq9TZU6TjGAXHntPefa1WA aSvpzi7WaNcd4jNgGMcvDGkwnYrzXPS2U56sJGFeKwXf6ZbiDkcoCzmZ0 OlPXEi7531Jgw1CKyS9ut7rrjTFveyUIDVkofz5M9EKZSKvu1MrJQQLlf 80Px8McFqcY0UeSm0Jsu5IM7/t/p0IeqyA228ihIXd/9MdON1XWYXjsRc r2SOpRB7cfJgcSORiC3O2BzNLYJm/eMxquKZ1eXS0opHd3fWhJNQv/jEJ AycU1o2Sy/1EcnUBAqfwjWRdOJQF4l5ruNZgPeIv+ateLcCOwMgnKH85B Q==; X-CSE-ConnectionGUID: 66HgaiTNS5a1XaeqM3EXdg== X-CSE-MsgGUID: LkjvCPGyTs2RY/zYBD1ODg== X-IronPort-AV: E=Sophos;i="6.07,225,1708412400"; d="scan'208";a="22410968" 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; 23 Apr 2024 22:35:32 -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; Tue, 23 Apr 2024 22:35:10 -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:00 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , CC: , , , , , , , , "Manikandan Muralidharan" , Durai Manickam KR Subject: [PATCH RESEND v9 5/8] drm: atmel-hlcdc: add DPI mode support for XLCDC Date: Wed, 24 Apr 2024 11:03:48 +0530 Message-ID: <20240424053351.589830-6-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 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 Acked-by: Sam Ravnborg --- .../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; } -- 2.25.1