Commit 47b4bafd authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Report device model and rev through media device information

Instead of hardcoding the media device model and hardware revision to
"VSP1" and 0 respectively, report the actual hardware device model and
IP version number.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent f077aa77
...@@ -53,6 +53,7 @@ struct vsp1_uds; ...@@ -53,6 +53,7 @@ struct vsp1_uds;
struct vsp1_device_info { struct vsp1_device_info {
u32 version; u32 version;
const char *model;
unsigned int gen; unsigned int gen;
unsigned int features; unsigned int features;
unsigned int rpf_count; unsigned int rpf_count;
...@@ -65,6 +66,7 @@ struct vsp1_device_info { ...@@ -65,6 +66,7 @@ struct vsp1_device_info {
struct vsp1_device { struct vsp1_device {
struct device *dev; struct device *dev;
const struct vsp1_device_info *info; const struct vsp1_device_info *info;
u32 version;
void __iomem *mmio; void __iomem *mmio;
struct rcar_fcp_device *fcp; struct rcar_fcp_device *fcp;
......
...@@ -220,7 +220,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) ...@@ -220,7 +220,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
int ret; int ret;
mdev->dev = vsp1->dev; mdev->dev = vsp1->dev;
strlcpy(mdev->model, "VSP1", sizeof(mdev->model)); mdev->hw_revision = vsp1->version;
strlcpy(mdev->model, vsp1->info->model, sizeof(mdev->model));
snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s",
dev_name(mdev->dev)); dev_name(mdev->dev));
media_device_init(mdev); media_device_init(mdev);
...@@ -559,6 +560,7 @@ static const struct dev_pm_ops vsp1_pm_ops = { ...@@ -559,6 +560,7 @@ static const struct dev_pm_ops vsp1_pm_ops = {
static const struct vsp1_device_info vsp1_device_infos[] = { static const struct vsp1_device_info vsp1_device_infos[] = {
{ {
.version = VI6_IP_VERSION_MODEL_VSPS_H2, .version = VI6_IP_VERSION_MODEL_VSPS_H2,
.model = "VSP1-S",
.gen = 2, .gen = 2,
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
| VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
...@@ -569,6 +571,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -569,6 +571,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPR_H2, .version = VI6_IP_VERSION_MODEL_VSPR_H2,
.model = "VSP1-R",
.gen = 2, .gen = 2,
.features = VSP1_HAS_BRU | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, .features = VSP1_HAS_BRU | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
.rpf_count = 5, .rpf_count = 5,
...@@ -578,6 +581,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -578,6 +581,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPD_GEN2, .version = VI6_IP_VERSION_MODEL_VSPD_GEN2,
.model = "VSP1-D",
.gen = 2, .gen = 2,
.features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT, .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT,
.rpf_count = 4, .rpf_count = 4,
...@@ -587,6 +591,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -587,6 +591,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPS_M2, .version = VI6_IP_VERSION_MODEL_VSPS_M2,
.model = "VSP1-S",
.gen = 2, .gen = 2,
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
| VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP, | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
...@@ -597,6 +602,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -597,6 +602,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPI_GEN3, .version = VI6_IP_VERSION_MODEL_VSPI_GEN3,
.model = "VSP2-I",
.gen = 3, .gen = 3,
.features = VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU .features = VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU
| VSP1_HAS_WPF_HFLIP | VSP1_HAS_WPF_VFLIP, | VSP1_HAS_WPF_HFLIP | VSP1_HAS_WPF_VFLIP,
...@@ -606,6 +612,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -606,6 +612,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPBD_GEN3, .version = VI6_IP_VERSION_MODEL_VSPBD_GEN3,
.model = "VSP2-BD",
.gen = 3, .gen = 3,
.features = VSP1_HAS_BRU | VSP1_HAS_WPF_VFLIP, .features = VSP1_HAS_BRU | VSP1_HAS_WPF_VFLIP,
.rpf_count = 5, .rpf_count = 5,
...@@ -614,6 +621,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -614,6 +621,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPBC_GEN3, .version = VI6_IP_VERSION_MODEL_VSPBC_GEN3,
.model = "VSP2-BC",
.gen = 3, .gen = 3,
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT .features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
| VSP1_HAS_WPF_VFLIP, | VSP1_HAS_WPF_VFLIP,
...@@ -623,6 +631,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { ...@@ -623,6 +631,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
.uapi = true, .uapi = true,
}, { }, {
.version = VI6_IP_VERSION_MODEL_VSPD_GEN3, .version = VI6_IP_VERSION_MODEL_VSPD_GEN3,
.model = "VSP2-D",
.gen = 3, .gen = 3,
.features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP, .features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP,
.rpf_count = 5, .rpf_count = 5,
...@@ -638,7 +647,6 @@ static int vsp1_probe(struct platform_device *pdev) ...@@ -638,7 +647,6 @@ static int vsp1_probe(struct platform_device *pdev)
struct resource *irq; struct resource *irq;
struct resource *io; struct resource *io;
unsigned int i; unsigned int i;
u32 version;
int ret; int ret;
vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL); vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL);
...@@ -689,11 +697,11 @@ static int vsp1_probe(struct platform_device *pdev) ...@@ -689,11 +697,11 @@ static int vsp1_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto done; goto done;
version = vsp1_read(vsp1, VI6_IP_VERSION); vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
if ((version & VI6_IP_VERSION_MODEL_MASK) == if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) ==
vsp1_device_infos[i].version) { vsp1_device_infos[i].version) {
vsp1->info = &vsp1_device_infos[i]; vsp1->info = &vsp1_device_infos[i];
break; break;
...@@ -701,12 +709,13 @@ static int vsp1_probe(struct platform_device *pdev) ...@@ -701,12 +709,13 @@ static int vsp1_probe(struct platform_device *pdev)
} }
if (!vsp1->info) { if (!vsp1->info) {
dev_err(&pdev->dev, "unsupported IP version 0x%08x\n", version); dev_err(&pdev->dev, "unsupported IP version 0x%08x\n",
vsp1->version);
ret = -ENXIO; ret = -ENXIO;
goto done; goto done;
} }
dev_dbg(&pdev->dev, "IP version 0x%08x\n", version); dev_dbg(&pdev->dev, "IP version 0x%08x\n", vsp1->version);
/* Instanciate entities */ /* Instanciate entities */
ret = vsp1_create_entities(vsp1); ret = vsp1_create_entities(vsp1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment