mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
media: marvell-ccic/mmp: add devicetree support
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> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
4d5da53d32
commit
83c40e6611
@ -17,6 +17,8 @@
|
|||||||
#include <media/v4l2-device.h>
|
#include <media/v4l2-device.h>
|
||||||
#include <linux/platform_data/media/mmp-camera.h>
|
#include <linux/platform_data/media/mmp-camera.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_platform.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
@ -194,6 +196,9 @@ static void mmpcam_calc_dphy(struct mcam_camera *mcam)
|
|||||||
struct device *dev = &cam->pdev->dev;
|
struct device *dev = &cam->pdev->dev;
|
||||||
unsigned long tx_clk_esc;
|
unsigned long tx_clk_esc;
|
||||||
|
|
||||||
|
if (!pdata)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If CSI2_DPHY3 is calculated dynamically,
|
* If CSI2_DPHY3 is calculated dynamically,
|
||||||
* pdata->lane_clk should be already set
|
* pdata->lane_clk should be already set
|
||||||
@ -312,10 +317,6 @@ static int mmpcam_probe(struct platform_device *pdev)
|
|||||||
struct mmp_camera_platform_data *pdata;
|
struct mmp_camera_platform_data *pdata;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pdata = pdev->dev.platform_data;
|
|
||||||
if (!pdata)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
cam = devm_kzalloc(&pdev->dev, sizeof(*cam), GFP_KERNEL);
|
cam = devm_kzalloc(&pdev->dev, sizeof(*cam), GFP_KERNEL);
|
||||||
if (cam == NULL)
|
if (cam == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -328,17 +329,29 @@ static int mmpcam_probe(struct platform_device *pdev)
|
|||||||
mcam->calc_dphy = mmpcam_calc_dphy;
|
mcam->calc_dphy = mmpcam_calc_dphy;
|
||||||
mcam->dev = &pdev->dev;
|
mcam->dev = &pdev->dev;
|
||||||
mcam->use_smbus = 0;
|
mcam->use_smbus = 0;
|
||||||
|
pdata = pdev->dev.platform_data;
|
||||||
|
if (pdata) {
|
||||||
mcam->mclk_src = pdata->mclk_src;
|
mcam->mclk_src = pdata->mclk_src;
|
||||||
mcam->mclk_div = pdata->mclk_div;
|
mcam->mclk_div = pdata->mclk_div;
|
||||||
mcam->bus_type = pdata->bus_type;
|
mcam->bus_type = pdata->bus_type;
|
||||||
mcam->dphy = pdata->dphy;
|
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) {
|
if (mcam->bus_type == V4L2_MBUS_CSI2_DPHY) {
|
||||||
cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
|
cam->mipi_clk = devm_clk_get(mcam->dev, "mipi");
|
||||||
if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
|
if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0))
|
||||||
return PTR_ERR(cam->mipi_clk);
|
return PTR_ERR(cam->mipi_clk);
|
||||||
}
|
}
|
||||||
mcam->mipi_enabled = false;
|
mcam->mipi_enabled = false;
|
||||||
mcam->lane = pdata->lane;
|
|
||||||
mcam->chip_id = MCAM_ARMADA610;
|
mcam->chip_id = MCAM_ARMADA610;
|
||||||
mcam->buffer_mode = B_DMA_sg;
|
mcam->buffer_mode = B_DMA_sg;
|
||||||
strscpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info));
|
strscpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info));
|
||||||
@ -473,6 +486,10 @@ static int mmpcam_resume(struct platform_device *pdev)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const struct of_device_id mmpcam_of_match[] = {
|
||||||
|
{ .compatible = "marvell,mmp2-ccic", },
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
static struct platform_driver mmpcam_driver = {
|
static struct platform_driver mmpcam_driver = {
|
||||||
.probe = mmpcam_probe,
|
.probe = mmpcam_probe,
|
||||||
@ -483,6 +500,7 @@ static struct platform_driver mmpcam_driver = {
|
|||||||
#endif
|
#endif
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "mmp-camera",
|
.name = "mmp-camera",
|
||||||
|
.of_match_table = of_match_ptr(mmpcam_of_match),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user