From patchwork Wed Jul 12 02:40:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikandan Muralidharan X-Patchwork-Id: 118781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp876072vqm; Tue, 11 Jul 2023 19:59:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWesNGggTFvD9403H30jfcOwrsstW3nYhFJuMoo4UtHBKzkvLjW6kbqvRnwdWak96OX6Ur X-Received: by 2002:a05:6358:6f0c:b0:134:eed0:3bc5 with SMTP id r12-20020a0563586f0c00b00134eed03bc5mr12029645rwn.9.1689130787984; Tue, 11 Jul 2023 19:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689130787; cv=none; d=google.com; s=arc-20160816; b=Z4eBOTS1uhOYFOkCJrLPAOfV1iaCnX1s8qjWTXNv4Vtrw4Lc//ww3eMxGR8+ONDCwX DLAvdlSeRYD3Uil4eyg30fKJZ11rT0F8INIze+D4Fu3LRKWBKe55kfk7y0D4+FXuYkLF I7CdVMd+/XWEMz3WmPs6DEkPyLR6Yh0z+NY9Lp/dbvJ7SzlhPpZEuEldql2ZrllFUtxi WoVqgCU52i/pkOpLFmZKOwlXAYuqHnTpbZbl0mR+tmEyT7gkenE0eVT5ZhbPgReNBUyi U5Pl2vnokPFem/A4liJb+rDer3Z3vUm07Y5LOJ/BuTu70eRmN+OODfO07AavPMMfnT4V Ri5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rpT97xrjrHHJiM5wdiXHoON8bI1y3QhL4RX6AiBkJLs=; fh=gVhGnNAtguQjYzDrdP+BJBbFuDBYmhtL0OCl9BxKXVM=; b=DRSphPPUwvwyxtnaTBhc1GNbtxKrUEEWbnnmueuSotDrxPytoh3bKA9XiGY5B0FFTp W9/aF+N73Q4ywCHYtaHwWgvMnFQKdU21kzBIDZjag8Phq0fCaaQFu+YV7RFMwuFiwVsJ W3BL1ylLgGDRJlxz1Wdw43gis5UBHSiC7en77W9RcByk6qgwTNlPeu3LrHWFVGmzfmB0 aZ7QSjkzsRra+wtwtDHwG/8XUIpl4CsZls4byJSAClZrGsTJ2wvcMcw3dz3GbFKEvSNv emUls8QTNvaL3srL2bEj8YvahSvpBRf3LuInDAri2PuAtovG28ftUuc6bGjHH80L1q2Z GaSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=cMPCnMlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k24-20020a634b58000000b00542ad648fbasi2226866pgl.188.2023.07.11.19.59.34; Tue, 11 Jul 2023 19:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=cMPCnMlY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231822AbjGLCmZ (ORCPT + 99 others); Tue, 11 Jul 2023 22:42:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjGLCmY (ORCPT ); Tue, 11 Jul 2023 22:42:24 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64CFB1991; Tue, 11 Jul 2023 19:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1689129720; x=1720665720; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pHxkiGzF9VPXSQvgp2n2DJMy1QJNtdMeN99YBfrrG0w=; b=cMPCnMlYNgQs+rG5P5kFuBJr2A34u2MlYsQtDQMEim8PgePldiT05Bwb aGu/YJbnzbUBw/v0dCQQHhLQn03px1l96e73xExtRuj5KnOjdjriN9fND fvdGjbK7xPCHbYyBYxgSrzmEtMlqi6UB3qKw24LooHnBygiV11hRFgpJW 2KlBe5ldbGV+QME7K79QXjsslZGQxE5owgoSsgO/ppC2nnSRpv/OfJY+H i+PciPvnNGyUrTyLOj/UB6WD7W3rwypFEjfKlZGGhwNsKXlqprd852Iql G5qWQhAJHKSHkaIEVQv8YOD5QFPVmVa/vnnWAR14yJs8tvFrFLeln0u2W w==; X-IronPort-AV: E=Sophos;i="6.01,198,1684825200"; d="scan'208";a="219936201" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jul 2023 19:41:53 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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.21; Tue, 11 Jul 2023 19:41:45 -0700 Received: from che-lt-i67131.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 11 Jul 2023 19:41:36 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , , CC: , , , , , , , Manikandan Muralidharan , Durai Manickam KR Subject: [PATCH v2 7/9] drm: atmel-hlcdc: add DPI mode support for XLCDC Date: Wed, 12 Jul 2023 08:10:15 +0530 Message-ID: <20230712024017.218921-8-manikandan.m@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230712024017.218921-1-manikandan.m@microchip.com> References: <20230712024017.218921-1-manikandan.m@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771182005280576914 X-GMAIL-MSGID: 1771182005280576914 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 | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 27f86cea8bff..c0a1d2d31ed2 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; + bool dpi; }; static inline struct atmel_hlcdc_crtc_state * @@ -138,6 +140,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) state = drm_crtc_state_to_atmel_hlcdc_crtc_state(c->state); cfg = state->output_mode << 8; + if (crtc->dc->desc->is_xlcdc) + cfg |= state->dpi << 11; if (!crtc->dc->desc->is_xlcdc && (adj->flags & DRM_MODE_FLAG_NVSYNC)) cfg |= ATMEL_HLCDC_VSPOL; @@ -150,7 +154,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); @@ -348,7 +354,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 = true; + } else { + hstate->dpi = false; + } + } return 0; } @@ -452,7 +466,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; @@ -463,6 +477,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; }