From patchwork Tue Jun 13 07:04:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikandan Muralidharan X-Patchwork-Id: 107124 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp362272vqr; Tue, 13 Jun 2023 00:31:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4GVSk2finKsTV/QVbKpxFIGgKcBRN1wwk6tN0me8TyAYFHAxnyH3oQF7bu7/xEhxIDY+n/ X-Received: by 2002:a17:90a:b38c:b0:25c:1a9b:db97 with SMTP id e12-20020a17090ab38c00b0025c1a9bdb97mr314576pjr.10.1686641478446; Tue, 13 Jun 2023 00:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686641478; cv=none; d=google.com; s=arc-20160816; b=UFnypADnehO/sNREc8/fCEYYIKWzU3gVubtmx2o0R6jqzcoBlBtYEv3qO5qd7WKnCi 00x2pREuwdYPbe2pQeE2Ek+lhJIkRLSMc0Z8hzGUO6V/g7Vd3WrRjPROEEWOXt8Q4hHk UMURljF2LWRJJdm2ITfT7fKaRiq5EwTF536tcVcArbOEQqJ+kto6LNkzQ+byFMVB+2Y0 8bBnwWxeL7WFAYlVtEGEitexj6FZB9ec5xsbBLII7Hep4yXBslXl9fo2eSfYSfQQXJh8 hQaP2jVka6j3PbsdU+GNPIjr5tpnAbf3CapwqTstp6mx4cIAwl4SPjgDFkhCeBHQGGVt Lbww== 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=LUU9IQ6gjEYvbs5YNydrFaTb7VxTwnZUXtmPXk8jgkA=; b=l0PdnaA6Q3svuOt+qqU9AI+9KXIIXKpcCOvCczL1K2arlMJ0P+RCA7tTZf9SLZkKf8 rjfL9ojOvk62ly3qetqI4R50zeV9xluJYMnwKCAdGYz6p/7GmgjNc7o0+qnf7vnZ+Y4i qrx3OGNdy+fbgJIqxIQ+YZzFUoPA2E+bQHhf4k6gD41a87uV/lP4JKsO56IpSLixFMlL PKXh/45WHHPjBWiYQtehCh7udZoHj1VAZ6dx8DgAN5Rfsulq8R41uiokZ6VbwK2OhK7t 7YQ3m0tt/4kriS8hNBkdr8PXEkIXdMejiRGSvMSvaKwa8wKw+D7s8UdNF3P/QPLKeZzG TXTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=W56NGDFz; 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 pc13-20020a17090b3b8d00b00250a2c9a793si8688849pjb.152.2023.06.13.00.31.06; Tue, 13 Jun 2023 00:31:18 -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=W56NGDFz; 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 S235139AbjFMHHO (ORCPT + 99 others); Tue, 13 Jun 2023 03:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239925AbjFMHGw (ORCPT ); Tue, 13 Jun 2023 03:06:52 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B74E1FEF; Tue, 13 Jun 2023 00:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1686639974; x=1718175974; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T7Y/2YDTllTUUHSl2rDvQC/p9LxvbkgfdDNcPx1ZDwk=; b=W56NGDFzdQUEk2V7l+W7EBL6Z095Z1fzJXCzsojLZONmVpAAOkcrFsEv eDG0kelD+86BUgflzPxqDxAzG71tAULB35u2KrNn7Jz4YNWTPfVNCVT9d 61gwNYGRyD2yoSQxDVKJNUjlM2IjzwhFB8oBuHD6Z9vXkUlG3nmfBm34D 8yVLUnhOtyW/wPLLvIIFQQVvI2lHTaw+W4dIxFNAX3VuuriP8OvN8cvD+ sZHJaoOTOHdBE0dnBJ3efncdBzwTRpU6uESyB6mz05XazwtgcY84pTD4E UB7LTy4G6KrBnDnnVSQZGnHvP05oyYZBrz6f0ihZuMU0s0wpWnc6i/lts Q==; X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="217554081" 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/AES256-SHA256; 13 Jun 2023 00:06:11 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) 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, 13 Jun 2023 00:06:06 -0700 Received: from che-lt-i67131.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 13 Jun 2023 00:05:57 -0700 From: Manikandan Muralidharan To: , , , , , , , , , , , , , , CC: , , , , , , , Manikandan , Durai Manickam KR Subject: [PATCH 7/9] drm: atmel-hlcdc: add DPI mode support for XLCDC Date: Tue, 13 Jun 2023 12:34:24 +0530 Message-ID: <20230613070426.467389-8-manikandan.m@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613070426.467389-1-manikandan.m@microchip.com> References: <20230613070426.467389-1-manikandan.m@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768571774712126882?= X-GMAIL-MSGID: =?utf-8?q?1768571774712126882?= 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 7c9cf7c0c75d..abdece982507 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->is_xlcdc) + cfg |= state->dpi << 11; if (!crtc->dc->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->is_xlcdc ? ATMEL_XLCDC_MODE_MASK | + ATMEL_XLCDC_DPI : ATMEL_HLCDC_MODE_MASK), cfg); clk_disable_unprepare(crtc->dc->hlcdc->sys_clk); @@ -344,7 +350,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->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; } @@ -448,7 +462,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; @@ -459,6 +473,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->is_xlcdc) + state->dpi = cur->dpi; return &state->base; }