Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3215460imu; Sat, 24 Nov 2018 00:17:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/WxCpiM0hJX8S/IRM/C4/00qQ7yeX9hxZXqH9pHiozddI9jCK7oJkEtSJ3LJj3SHFX+8Kxp X-Received: by 2002:a17:902:6113:: with SMTP id t19mr18517541plj.248.1543047470213; Sat, 24 Nov 2018 00:17:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047470; cv=none; d=google.com; s=arc-20160816; b=eic2ZAoAjFObqTu6j4Ofa1SlMytacopSPDWZWeQ+BeGKr/rNF4eVBOF1yfbdAXxZze JSxwP1CSSPDN3xuvnApG1GjkYAjrTJ4FwVLB97/F2waO0/22Dkn4BoFhtPDwgCYnENaz 3VGci+JEPj+tv7wnFZoN2330Y5wB/UtNwDCG7FoXoJVFPYrrEsTeak4x4FHYLrm7kpkI c45n8cVm7uhbhL8n04Fzii8lEvh8s1O8aZaEc0Meg6NSB0bp7c8ICm787uap7uuAJdf5 e5eFb7t04ZCIT1jV2Ssm+kJlytm6+vsRtwZtbX11lyQrZCPbiihQz+Q0OHNAt7622iA+ TaoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4i/gytRJFbsnlFE93MhNb77TzuSFUOjTwQ70jTjtPd0=; b=IkUVTAy6P18tciyb0w/ja0VuvyWu8twywP0gdfFhL8O5YoM3THiSav647cziGueUE8 gJ5BewYPrzTTs4r4MfP5JaOJ6Pc1WNAWpsIlMRp6O83Q/BIciPLo8SZBDom52UpbxS5a WSyScEDTFdWaEhU9gPJuK2kovu6PFtawcry/fkkqmtuxeTbYRz2Kr2cqbkLGspWh0FvH OGsL6MRI9kYmlmj5IbODZeM46wsZ9JStIrerCmRSjXJrDxGQ8sNOGm75vhjjgT8B+HoS d7dmafFTvCDJ+euV+0hEdfMNPLbH9fZXjb6t3NfCm+kv3t89eiI+EP67gcTaDrfK3L4w tOuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si43648637pgb.245.2018.11.24.00.17.36; Sat, 24 Nov 2018 00:17:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502830AbeKWULD (ORCPT + 99 others); Fri, 23 Nov 2018 15:11:03 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49477 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409028AbeKWUKg (ORCPT ); Fri, 23 Nov 2018 15:10:36 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 3B30320F6A; Fri, 23 Nov 2018 10:27:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost.localdomain (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id BABA520F75; Fri, 23 Nov 2018 10:26:37 +0100 (CET) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter Subject: [PATCH v2 39/43] drm/sun4i: frontend: Add a quirk structure Date: Fri, 23 Nov 2018 10:25:11 +0100 Message-Id: <20181123092515.2511-40-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard The ACCESS_CTRL bit is not found on all the variants of the frontend, so let's introduce a structure that will hold whether or not we need to set it, and associate it with the compatible. This will be extended for further similar quirks later on. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 21 +++++++++++++++++---- drivers/gpu/drm/sun4i/sun4i_frontend.h | 6 ++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 2c9dcb4ffde0..368391a9e5fd 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -74,9 +75,10 @@ static void sun4i_frontend_scaler_init(struct sun4i_frontend *frontend) { int i; - regmap_write_bits(frontend->regs, SUN4I_FRONTEND_FRM_CTRL_REG, - SUN4I_FRONTEND_FRM_CTRL_COEF_ACCESS_CTRL, - SUN4I_FRONTEND_FRM_CTRL_COEF_ACCESS_CTRL); + if (frontend->data->has_coef_access_ctrl) + regmap_write_bits(frontend->regs, SUN4I_FRONTEND_FRM_CTRL_REG, + SUN4I_FRONTEND_FRM_CTRL_COEF_ACCESS_CTRL, + SUN4I_FRONTEND_FRM_CTRL_COEF_ACCESS_CTRL); for (i = 0; i < 32; i++) { regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_HORZCOEF0_REG(i), @@ -547,6 +549,10 @@ static int sun4i_frontend_bind(struct device *dev, struct device *master, frontend->dev = dev; frontend->node = dev->of_node; + frontend->data = of_device_get_match_data(dev); + if (!frontend->data) + return -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(dev, res); if (IS_ERR(regs)) @@ -659,8 +665,15 @@ static const struct dev_pm_ops sun4i_frontend_pm_ops = { .runtime_suspend = sun4i_frontend_runtime_suspend, }; +static const struct sun4i_frontend_data sun8i_a33_frontend = { + .has_coef_access_ctrl = true, +}; + const struct of_device_id sun4i_frontend_of_table[] = { - { .compatible = "allwinner,sun8i-a33-display-frontend" }, + { + .compatible = "allwinner,sun8i-a33-display-frontend", + .data = &sun8i_a33_frontend + }, { } }; EXPORT_SYMBOL(sun4i_frontend_of_table); diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h index 822d39ca4b8e..daf3fa5d01ba 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.h +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h @@ -100,6 +100,10 @@ struct drm_plane; struct regmap; struct reset_control; +struct sun4i_frontend_data { + bool has_coef_access_ctrl; +}; + struct sun4i_frontend { struct list_head list; struct device *dev; @@ -110,6 +114,8 @@ struct sun4i_frontend { struct clk *ram_clk; struct regmap *regs; struct reset_control *reset; + + const struct sun4i_frontend_data *data; }; extern const struct of_device_id sun4i_frontend_of_table[]; -- 2.19.1