From: Lubomir Rintel <lkundrak@v3.sk>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Lubomir Rintel <lkundrak@v3.sk>,
Pavel Machek <pavel@ucw.cz>
Subject: [PATCH v6 5/7] [media] marvell-ccic/mmp: add devicetree support
Date: Tue, 28 May 2019 11:07:29 +0200 [thread overview]
Message-ID: <20190528090731.10341-6-lkundrak@v3.sk> (raw)
In-Reply-To: <20190528090731.10341-1-lkundrak@v3.sk>
The platform data is actually not used anywhere (along with the CSI
support) and should be safe to remove.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
Changes since v1:
- s/This are/These are/ in a comment
.../media/platform/marvell-ccic/mmp-driver.c | 36 ++++++++++++++-----
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c
index 8f1d2a972bc9..54c2dd8c29d8 100644
--- a/drivers/media/platform/marvell-ccic/mmp-driver.c
+++ b/drivers/media/platform/marvell-ccic/mmp-driver.c
@@ -19,6 +19,8 @@
#include <media/v4l2-device.h>
#include <linux/platform_data/media/mmp-camera.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/io.h>
@@ -196,6 +198,9 @@ static void mmpcam_calc_dphy(struct mcam_camera *mcam)
struct device *dev = &cam->pdev->dev;
unsigned long tx_clk_esc;
+ if (!pdata)
+ return;
+
/*
* If CSI2_DPHY3 is calculated dynamically,
* pdata->lane_clk should be already set
@@ -314,10 +319,6 @@ static int mmpcam_probe(struct platform_device *pdev)
struct mmp_camera_platform_data *pdata;
int ret;
- pdata = pdev->dev.platform_data;
- if (!pdata)
- return -ENODEV;
-
cam = devm_kzalloc(&pdev->dev, sizeof(*cam), GFP_KERNEL);
if (cam == NULL)
return -ENOMEM;
@@ -330,17 +331,29 @@ static int mmpcam_probe(struct platform_device *pdev)
mcam->calc_dphy = mmpcam_calc_dphy;
mcam->dev = &pdev->dev;
mcam->use_smbus = 0;
- mcam->mclk_src = pdata->mclk_src;
- mcam->mclk_div = pdata->mclk_div;
- mcam->bus_type = pdata->bus_type;
- mcam->dphy = pdata->dphy;
+ pdata = pdev->dev.platform_data;
+ if (pdata) {
+ mcam->mclk_src = pdata->mclk_src;
+ mcam->mclk_div = pdata->mclk_div;
+ mcam->bus_type = pdata->bus_type;
+ mcam->dphy = pdata->dphy;
+ mcam->lane = pdata->lane;
+ } else {
+ /*
+ * These are values that used to be hardcoded in mcam-core and
+ * work well on a OLPC XO 1.75 with a parallel bus sensor.
+ * If it turns out other setups make sense, the values should
+ * be obtained from the device tree.
+ */
+ mcam->mclk_src = 3;
+ mcam->mclk_div = 2;
+ }
if (mcam->bus_type == V4L2_MBUS_CSI2_DPHY) {
cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
return PTR_ERR(cam->mipi_clk);
}
mcam->mipi_enabled = false;
- mcam->lane = pdata->lane;
mcam->chip_id = MCAM_ARMADA610;
mcam->buffer_mode = B_DMA_sg;
strscpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info));
@@ -475,6 +488,10 @@ static int mmpcam_resume(struct platform_device *pdev)
#endif
+static const struct of_device_id mmpcam_of_match[] = {
+ { .compatible = "marvell,mmp2-ccic", },
+ {},
+};
static struct platform_driver mmpcam_driver = {
.probe = mmpcam_probe,
@@ -485,6 +502,7 @@ static struct platform_driver mmpcam_driver = {
#endif
.driver = {
.name = "mmp-camera",
+ .of_match_table = of_match_ptr(mmpcam_of_match),
}
};
--
2.21.0
next prev parent reply other threads:[~2019-05-28 9:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 9:07 [PATCH v6 0/7] media: make Marvell camera work on DT-based OLPC XO-1.75 Lubomir Rintel
2019-05-28 9:07 ` [PATCH v6 1/7] Revert "[media] marvell-ccic: reset ccic phy when stop streaming for stability" Lubomir Rintel
2019-05-28 9:07 ` [PATCH v6 2/7] [media] marvell-ccic: drop unused stuff Lubomir Rintel
2019-05-28 9:07 ` [PATCH v6 3/7] [media] marvell-ccic/mmp: enable clock before accessing registers Lubomir Rintel
2019-05-28 9:07 ` [PATCH v6 4/7] [media] marvell-ccic: rename the clocks Lubomir Rintel
2019-05-28 9:07 ` Lubomir Rintel [this message]
2019-06-14 10:39 ` [PATCH v6 5/7] [media] marvell-ccic/mmp: add devicetree support Jacopo Mondi
2019-06-20 11:35 ` Sakari Ailus
2019-06-20 11:37 ` Lubomir Rintel
2019-06-20 11:39 ` Sakari Ailus
2019-06-20 11:43 ` Jacopo Mondi
2019-05-28 9:07 ` [PATCH v6 6/7] [media] marvell-ccic: use async notifier to get the sensor Lubomir Rintel
2019-05-28 9:07 ` [PATCH v6 7/7] [media] marvell-ccic: provide a clock for " Lubomir Rintel
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=20190528090731.10341-6-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pavel@ucw.cz \
/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).