From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: laurent.pinchart@ideasonboard.com, linux-renesas-soc@vger.kernel.org
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
VenkataRajesh.Kalakodima@in.bosch.com,
Harsha.ManjulaMallikarjun@in.bosch.com,
Jacopo Mondi <jacopo@jmondi.org>
Subject: [RFC 3/9] [TODO] drm: rcar-du: Add basic support for CMM
Date: Wed, 8 May 2019 19:34:22 +0200 [thread overview]
Message-ID: <20190508173428.22054-4-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <20190508173428.22054-1-jacopo+renesas@jmondi.org>
Add a driver skeleton for the R-Car Display Unit Color Correction
Module.
Each DU output channel is provided with a CMM unit to perform image
enhancement and color correction.
Add support for CMM through a skeleton driver to be later expanded to
support setting color correction tables through the DRM/KMS properties
framework.
As of now, the driver is only useful to demonstrate the integration with
the DU driver.
Not-Yet-Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/gpu/drm/rcar-du/Kconfig | 7 +++
drivers/gpu/drm/rcar-du/Makefile | 1 +
drivers/gpu/drm/rcar-du/rcar_du_cmm.c | 78 +++++++++++++++++++++++++++
drivers/gpu/drm/rcar-du/rcar_du_cmm.h | 23 ++++++++
4 files changed, 109 insertions(+)
create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_cmm.c
create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_cmm.h
diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 1529849e217e..820f2b85a073 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -13,6 +13,13 @@ config DRM_RCAR_DU
Choose this option if you have an R-Car chipset.
If M is selected the module will be called rcar-du-drm.
+config DRM_RCAR_CMM
+ bool "R-Car DU Color Correction Module Support"
+ depends on DRM && OF
+ depends on DRM_RCAR_DU && ARCH_RCAR_GEN3
+ help
+ Enable support for R-Car Gen3 Color Correction Module (CMM).
+
config DRM_RCAR_DW_HDMI
tristate "R-Car DU Gen3 HDMI Encoder Support"
depends on DRM && OF
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 6c2ed9c46467..ae26d465d421 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -15,6 +15,7 @@ rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS) += rcar_du_of.o \
rcar-du-drm-$(CONFIG_DRM_RCAR_VSP) += rcar_du_vsp.o
rcar-du-drm-$(CONFIG_DRM_RCAR_WRITEBACK) += rcar_du_writeback.o
+obj-$(CONFIG_DRM_RCAR_CMM) += rcar_du_cmm.o
obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o
obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o
obj-$(CONFIG_DRM_RCAR_LVDS) += rcar_lvds.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_cmm.c b/drivers/gpu/drm/rcar-du/rcar_du_cmm.c
new file mode 100644
index 000000000000..63f545830bb9
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_cmm.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * rcar_du_cmm.c -- R-Car Display Unit Color Management Module
+ *
+ * Copyright (C) 2019 Jacopo Mondi <jacopo+renesas@jmondi.org>
+ */
+
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include "rcar_du_cmm.h"
+#include "rcar_du_crtc.h"
+
+struct rcar_cmm {
+ struct clk *clk;
+ void __iomem *base;
+};
+
+int rcar_du_cmm_setup(struct platform_device *pdev, struct rcar_du_crtc *rcrtc)
+{
+ struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = clk_prepare_enable(rcmm->clk);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static int rcar_cmm_probe(struct platform_device *pdev)
+{
+ struct rcar_cmm *rcmm;
+ struct resource *res;
+
+ rcmm = devm_kzalloc(&pdev->dev, sizeof(*rcmm), GFP_KERNEL);
+ if (!rcmm)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, rcmm);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ rcmm->base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(rcmm->base))
+ return PTR_ERR(rcmm->base);
+
+ rcmm->clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(rcmm->clk)) {
+ dev_err(&pdev->dev, "Failed to get CMM clock");
+ return PTR_ERR(rcmm->clk);
+ }
+
+ return 0;
+}
+
+static const struct of_device_id rcar_cmm_of_table[] = {
+ { .compatible = "renesas,cmm" },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, rcar_cmm_of_table);
+
+static struct platform_driver rcar_cmm_platform_driver = {
+ .probe = rcar_cmm_probe,
+ .driver = {
+ .name = "rcar-cmm",
+ .of_match_table = rcar_cmm_of_table,
+ },
+};
+
+module_platform_driver(rcar_cmm_platform_driver);
+
+MODULE_AUTHOR("Jacopo Mondi <jacopo+renesas@jmondi.org");
+MODULE_DESCRIPTION("Renesas R-Car CMM Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_cmm.h b/drivers/gpu/drm/rcar-du/rcar_du_cmm.h
new file mode 100644
index 000000000000..be9ac1a091b0
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_cmm.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * rcar_du_cmm.c -- R-Car Display Unit Color Management Module
+ *
+ * Copyright (C) 2019 Jacopo Mondi <jacopo+renesas@jmondi.org>
+ */
+
+#ifndef __RCAR_DU_CMM_H_
+#define __RCAR_DU_CMM_H_
+
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+struct rcar_du_crtc;
+
+struct rcar_du_cmm {
+ struct device_node *np;
+ unsigned int crtc;
+};
+
+int rcar_du_cmm_setup(struct platform_device *, struct rcar_du_crtc *);
+
+#endif /* __RCAR_DU_CMM_H_ */
--
2.21.0
next prev parent reply other threads:[~2019-05-08 17:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 17:34 [RFC 0/9] drm: rcar-du: Add CMM support to M3-W (plumbing only) Jacopo Mondi
2019-05-08 17:34 ` [RFC 1/9] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation Jacopo Mondi
2019-05-11 18:16 ` Laurent Pinchart
2019-05-28 12:37 ` Jacopo Mondi
2019-05-28 14:25 ` Laurent Pinchart
2019-05-28 14:50 ` Geert Uytterhoeven
2019-05-08 17:34 ` [RFC 2/9] dt-bindings: display, renesas,du: Document cmms property Jacopo Mondi
2019-05-11 18:23 ` Laurent Pinchart
2019-05-15 14:12 ` Jacopo Mondi
2019-05-16 10:40 ` Laurent Pinchart
2019-05-08 17:34 ` Jacopo Mondi [this message]
2019-05-11 18:45 ` [RFC 3/9] [TODO] drm: rcar-du: Add basic support for CMM Laurent Pinchart
2019-05-08 17:34 ` [RFC 4/9] drm: rcar-du: kms: Create CMM instances Jacopo Mondi
2019-05-11 18:56 ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 5/9] drm: rcar-du: Add CMM support for M3-W Jacopo Mondi
2019-05-11 18:47 ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 6/9] drm: rcar-du: crtc: Setup the CMM Jacopo Mondi
2019-05-11 18:59 ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 7/9] drm: rcar-du: group: Enable CMM unit Jacopo Mondi
2019-05-11 19:02 ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 8/9] clk: renesas: r8a7796: Add CMM clocks Jacopo Mondi
2019-05-09 9:12 ` Geert Uytterhoeven
2019-05-11 18:21 ` Laurent Pinchart
2019-05-21 8:47 ` Geert Uytterhoeven
2019-05-08 17:34 ` [RFC 9/9] arm64: dts: renesas: r8a7796: Add CMM units Jacopo Mondi
2019-05-11 18:25 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190508173428.22054-4-jacopo+renesas@jmondi.org \
--to=jacopo+renesas@jmondi.org \
--cc=Harsha.ManjulaMallikarjun@in.bosch.com \
--cc=VenkataRajesh.Kalakodima@in.bosch.com \
--cc=jacopo@jmondi.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).