|
@@ -21,7 +21,6 @@
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/of_device.h>
|
|
-#include <linux/platform_data/media/camera-rcar.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/pm_runtime.h>
|
|
#include <linux/pm_runtime.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
@@ -138,6 +137,11 @@
|
|
|
|
|
|
#define TIMEOUT_MS 100
|
|
#define TIMEOUT_MS 100
|
|
|
|
|
|
|
|
+#define RCAR_VIN_HSYNC_ACTIVE_LOW (1 << 0)
|
|
|
|
+#define RCAR_VIN_VSYNC_ACTIVE_LOW (1 << 1)
|
|
|
|
+#define RCAR_VIN_BT601 (1 << 2)
|
|
|
|
+#define RCAR_VIN_BT656 (1 << 3)
|
|
|
|
+
|
|
enum chip_id {
|
|
enum chip_id {
|
|
RCAR_GEN2,
|
|
RCAR_GEN2,
|
|
RCAR_H1,
|
|
RCAR_H1,
|
|
@@ -1853,63 +1857,43 @@ static const struct of_device_id rcar_vin_of_table[] = {
|
|
MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
|
|
MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-static struct platform_device_id rcar_vin_id_table[] = {
|
|
|
|
- { "r8a7779-vin", RCAR_H1 },
|
|
|
|
- { "r8a7778-vin", RCAR_M1 },
|
|
|
|
- { "uPD35004-vin", RCAR_E1 },
|
|
|
|
- {},
|
|
|
|
-};
|
|
|
|
-MODULE_DEVICE_TABLE(platform, rcar_vin_id_table);
|
|
|
|
-
|
|
|
|
static int rcar_vin_probe(struct platform_device *pdev)
|
|
static int rcar_vin_probe(struct platform_device *pdev)
|
|
{
|
|
{
|
|
const struct of_device_id *match = NULL;
|
|
const struct of_device_id *match = NULL;
|
|
struct rcar_vin_priv *priv;
|
|
struct rcar_vin_priv *priv;
|
|
|
|
+ struct v4l2_of_endpoint ep;
|
|
|
|
+ struct device_node *np;
|
|
struct resource *mem;
|
|
struct resource *mem;
|
|
- struct rcar_vin_platform_data *pdata;
|
|
|
|
unsigned int pdata_flags;
|
|
unsigned int pdata_flags;
|
|
int irq, ret;
|
|
int irq, ret;
|
|
|
|
|
|
- if (pdev->dev.of_node) {
|
|
|
|
- struct v4l2_of_endpoint ep;
|
|
|
|
- struct device_node *np;
|
|
|
|
|
|
+ match = of_match_device(of_match_ptr(rcar_vin_of_table), &pdev->dev);
|
|
|
|
|
|
- match = of_match_device(of_match_ptr(rcar_vin_of_table),
|
|
|
|
- &pdev->dev);
|
|
|
|
-
|
|
|
|
- np = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
|
|
|
|
- if (!np) {
|
|
|
|
- dev_err(&pdev->dev, "could not find endpoint\n");
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
|
|
+ np = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
|
|
|
|
+ if (!np) {
|
|
|
|
+ dev_err(&pdev->dev, "could not find endpoint\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
|
|
- ret = v4l2_of_parse_endpoint(np, &ep);
|
|
|
|
- if (ret) {
|
|
|
|
- dev_err(&pdev->dev, "could not parse endpoint\n");
|
|
|
|
- return ret;
|
|
|
|
- }
|
|
|
|
|
|
+ ret = v4l2_of_parse_endpoint(np, &ep);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "could not parse endpoint\n");
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
|
|
- if (ep.bus_type == V4L2_MBUS_BT656)
|
|
|
|
- pdata_flags = RCAR_VIN_BT656;
|
|
|
|
- else {
|
|
|
|
- pdata_flags = 0;
|
|
|
|
- if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
|
|
|
|
- pdata_flags |= RCAR_VIN_HSYNC_ACTIVE_LOW;
|
|
|
|
- if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
|
|
|
|
- pdata_flags |= RCAR_VIN_VSYNC_ACTIVE_LOW;
|
|
|
|
- }
|
|
|
|
|
|
+ if (ep.bus_type == V4L2_MBUS_BT656)
|
|
|
|
+ pdata_flags = RCAR_VIN_BT656;
|
|
|
|
+ else {
|
|
|
|
+ pdata_flags = 0;
|
|
|
|
+ if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
|
|
|
|
+ pdata_flags |= RCAR_VIN_HSYNC_ACTIVE_LOW;
|
|
|
|
+ if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
|
|
|
|
+ pdata_flags |= RCAR_VIN_VSYNC_ACTIVE_LOW;
|
|
|
|
+ }
|
|
|
|
|
|
- of_node_put(np);
|
|
|
|
|
|
+ of_node_put(np);
|
|
|
|
|
|
- dev_dbg(&pdev->dev, "pdata_flags = %08x\n", pdata_flags);
|
|
|
|
- } else {
|
|
|
|
- pdata = pdev->dev.platform_data;
|
|
|
|
- if (!pdata || !pdata->flags) {
|
|
|
|
- dev_err(&pdev->dev, "platform data not set\n");
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
- pdata_flags = pdata->flags;
|
|
|
|
- }
|
|
|
|
|
|
+ dev_dbg(&pdev->dev, "pdata_flags = %08x\n", pdata_flags);
|
|
|
|
|
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
if (mem == NULL)
|
|
if (mem == NULL)
|
|
@@ -1992,7 +1976,6 @@ static struct platform_driver rcar_vin_driver = {
|
|
.name = DRV_NAME,
|
|
.name = DRV_NAME,
|
|
.of_match_table = of_match_ptr(rcar_vin_of_table),
|
|
.of_match_table = of_match_ptr(rcar_vin_of_table),
|
|
},
|
|
},
|
|
- .id_table = rcar_vin_id_table,
|
|
|
|
};
|
|
};
|
|
|
|
|
|
module_platform_driver(rcar_vin_driver);
|
|
module_platform_driver(rcar_vin_driver);
|