From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79F14C433ED for ; Thu, 20 May 2021 15:06:23 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0314360FE8 for ; Thu, 20 May 2021 15:06:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0314360FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3PfAPrW0wwPaEUI4F7o1B8+Q/zKQLKBU7Vau4cocP40=; b=eeMNgHlIpk51AP0rfdPNiDSrJr QMFBNiQkzLQns09OnJ8H0agyR70FAh+BjFcSji0hYhsgKqUrSg2a34o+IdK++Hr2pPTUxIHYz+pnO drIoobo50HDEaVl4TBKqhz3XooWHVP5go+BO+hj5CY3KrTqp2lzHY0cu9mYE2QY3RtXN6vb0TuuAX oSfdPuh/JlFHJ/3drHl6Qmu1iZEjZeZWTXahwX6WXUwPkV8egh/b+p/YhlDr0iqgNxieMOlc57heJ OfiE1kEHtLz9XPHqgniRU3h6lfMIv99s3QTk8mLgvdyxRqADZUXlGICyxcANEg8p2OMIs7k8yQGIj 7BBGNlwA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljkE7-001Zqr-4D; Thu, 20 May 2021 15:04:43 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljkDa-001Zd3-OE; Thu, 20 May 2021 15:04:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Zpxq5v0tG5hhwjgR/68xsWJDvi1qsDN0rRHvdVKecSI=; b=WeCasCHf3ZYIO05bmiv5XmO6Nf Sjn3xAjxMV9BC8K4Ane4To0w061PvoTl6LzUNxQ9Dn54L8OAJkC/3Yu2Iprv2qt0SYeqHP6lrC9v7 5vh0CrqLCDfeBccKHAGIsgRYH4eM6k17n8bqOsHyLmz0lvmm3hI3Y/2KOrfLimo/3GipIS2dY2tT1 L/W2xfvZFv3s7l5/mdOBlWaiOMC5p89APl4HqnTM+OC+tQBQDMQXXJOLFTy9mQ4p0HEU9Xtxw6iQA REjfyTvRg2Wk6Mx2GR9rViQf8mNoiLF37gCIYscpQ5KbqF5oIBSy3jeVKeturDQMQ801MQK+Yqe0c I7ujupQw==; Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljkDY-00GRhD-6O; Thu, 20 May 2021 15:04:09 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 84D72166B; Thu, 20 May 2021 11:04:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 20 May 2021 11:04:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=Zpxq5v0tG5hhw jgR/68xsWJDvi1qsDN0rRHvdVKecSI=; b=cOE0gGWm+YXq7PJ24EQ5s0nbWAw3K /wPun/Q6aKKiQEvhpobORLkJGW3BbRAzw6ZKQ5a/XHcNN9hlKNYdFLrEvxYbxLuu +lRw1pfQK1n3J6YYLfrF6alKW9Y9xY2z28uqXGAMxhgIXj+JurmTg4cN6fdIAFD+ X9mRjRgIHgyhNGen61EdXSDXRxNjpIg69bFdO63dHoMeYR7f+52lFM0UbSyR5VNp U6f1znSwk10eWQtj+0aZH0X+wZmK/wWzO3LoFue4eWXCUzgjY15c7FXA0u03RreC VKGSCXT6FADi7T1inzGSDGgV2QeQS4Au0xskBybD7lA3xwUYZ+sGNkqOQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=Zpxq5v0tG5hhwjgR/68xsWJDvi1qsDN0rRHvdVKecSI=; b=Hd/wCaiq MLec/uU5imBmeM76062oHI1KiWc4yTR2cb/Arx3xFYwSs4ERr7OdRoVzpFCfDcV9 5YHI2BrqdaibvsLrVpHOOJ2LCaTaV6kt5NH8+bTPA1/9L5oUd7bBKG6P/15nScsK uHiqE79r/dbMKMd91M/iOjh1NatMfbECqolORVyfaEXS2BKOq0yqVmbREmAdzOgE k+Tfpf15hIfdANyC79vj5dcKPsV2U0Y1TMTkFRZ6Bejanqrlr322ga2IAfnJppNP vfxhkgdmsVaqDy+n1zGFu0wiZWmBSX2YY2rSyH4AIFbJH648kWCyL6i+Sw11vjTM i2A0NuI3zm3D2A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejuddgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 20 May 2021 11:04:03 -0400 (EDT) From: Maxime Ripard To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: Florian Fainelli , Maxime Ripard , Eric Anholt , bcm-kernel-feedback-list@broadcom.com, Ray Jui , devicetree@vger.kernel.org, Scott Branden , linux-kernel@vger.kernel.org, Daniel Vetter , Rob Herring , linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , linux-arm-kernel@lists.infradead.org, Mateusz Kwiatkowski Subject: [PATCH 3/4] drm/vc4: Separate VEC compatible variants Date: Thu, 20 May 2021 17:03:43 +0200 Message-Id: <20210520150344.273900-4-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520150344.273900-1-maxime@cerno.tech> References: <20210520150344.273900-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_080408_283184_BF33E61D X-CRM114-Status: GOOD ( 15.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mateusz Kwiatkowski The VEC's DAC on BCM2711 is slightly different compared to the one on BCM283x and needs different configuration. In particular, bit 3 (mask 0x8) switches the BCM2711 DAC input to "self-test input data", which makes the output unusable. Separating two compatible variants in devicetrees and the DRM driver was therefore necessary. The configurations used for both variants have been borrowed from Raspberry Pi (model 3B for BCM283x, 4B for BCM2711) firmware defaults. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_vec.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index bd5b8eb58b18..a467ceba75e4 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -154,9 +154,14 @@ #define VEC_DAC_MISC_DAC_RST_N BIT(0) +struct vc4_vec_variant { + u32 dac_config; +}; + /* General VEC hardware state. */ struct vc4_vec { struct platform_device *pdev; + const struct vc4_vec_variant *variant; struct drm_encoder *encoder; struct drm_connector *connector; @@ -451,10 +456,7 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder) VEC_WRITE(VEC_CONFIG2, VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS); VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD); - VEC_WRITE(VEC_DAC_CONFIG, - VEC_DAC_CONFIG_DAC_CTRL(0xc) | - VEC_DAC_CONFIG_DRIVER_CTRL(0xc) | - VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x46)); + VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config); /* Mask all interrupts. */ VEC_WRITE(VEC_MASK0, 0); @@ -507,8 +509,21 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, }; +static const struct vc4_vec_variant bcm2835_vec_variant = { + .dac_config = VEC_DAC_CONFIG_DAC_CTRL(0xc) | + VEC_DAC_CONFIG_DRIVER_CTRL(0xc) | + VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x46) +}; + +static const struct vc4_vec_variant bcm2711_vec_variant = { + .dac_config = VEC_DAC_CONFIG_DAC_CTRL(0x0) | + VEC_DAC_CONFIG_DRIVER_CTRL(0x80) | + VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x61) +}; + static const struct of_device_id vc4_vec_dt_match[] = { - { .compatible = "brcm,bcm2835-vec", .data = NULL }, + { .compatible = "brcm,bcm2835-vec", .data = &bcm2835_vec_variant }, + { .compatible = "brcm,bcm2711-vec", .data = &bcm2711_vec_variant }, { /* sentinel */ }, }; @@ -546,6 +561,8 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) vec->encoder = &vc4_vec_encoder->base.base; vec->pdev = pdev; + vec->variant = (const struct vc4_vec_variant *) + of_device_get_match_data(dev); vec->regs = vc4_ioremap_regs(pdev, 0); if (IS_ERR(vec->regs)) return PTR_ERR(vec->regs); -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel