mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
[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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
f077aa7774
commit
47b4bafd2c
@ -53,6 +53,7 @@ struct vsp1_uds;
|
||||
|
||||
struct vsp1_device_info {
|
||||
u32 version;
|
||||
const char *model;
|
||||
unsigned int gen;
|
||||
unsigned int features;
|
||||
unsigned int rpf_count;
|
||||
@ -65,6 +66,7 @@ struct vsp1_device_info {
|
||||
struct vsp1_device {
|
||||
struct device *dev;
|
||||
const struct vsp1_device_info *info;
|
||||
u32 version;
|
||||
|
||||
void __iomem *mmio;
|
||||
struct rcar_fcp_device *fcp;
|
||||
|
@ -220,7 +220,8 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
|
||||
int ret;
|
||||
|
||||
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",
|
||||
dev_name(mdev->dev));
|
||||
media_device_init(mdev);
|
||||
@ -559,6 +560,7 @@ static const struct dev_pm_ops vsp1_pm_ops = {
|
||||
static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
{
|
||||
.version = VI6_IP_VERSION_MODEL_VSPS_H2,
|
||||
.model = "VSP1-S",
|
||||
.gen = 2,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
|
||||
| VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
|
||||
@ -569,6 +571,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPR_H2,
|
||||
.model = "VSP1-R",
|
||||
.gen = 2,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
|
||||
.rpf_count = 5,
|
||||
@ -578,6 +581,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPD_GEN2,
|
||||
.model = "VSP1-D",
|
||||
.gen = 2,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_LUT,
|
||||
.rpf_count = 4,
|
||||
@ -587,6 +591,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPS_M2,
|
||||
.model = "VSP1-S",
|
||||
.gen = 2,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
|
||||
| VSP1_HAS_SRU | VSP1_HAS_WPF_VFLIP,
|
||||
@ -597,6 +602,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPI_GEN3,
|
||||
.model = "VSP2-I",
|
||||
.gen = 3,
|
||||
.features = VSP1_HAS_CLU | VSP1_HAS_LUT | VSP1_HAS_SRU
|
||||
| VSP1_HAS_WPF_HFLIP | VSP1_HAS_WPF_VFLIP,
|
||||
@ -606,6 +612,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPBD_GEN3,
|
||||
.model = "VSP2-BD",
|
||||
.gen = 3,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_WPF_VFLIP,
|
||||
.rpf_count = 5,
|
||||
@ -614,6 +621,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPBC_GEN3,
|
||||
.model = "VSP2-BC",
|
||||
.gen = 3,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_CLU | VSP1_HAS_LUT
|
||||
| VSP1_HAS_WPF_VFLIP,
|
||||
@ -623,6 +631,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
|
||||
.uapi = true,
|
||||
}, {
|
||||
.version = VI6_IP_VERSION_MODEL_VSPD_GEN3,
|
||||
.model = "VSP2-D",
|
||||
.gen = 3,
|
||||
.features = VSP1_HAS_BRU | VSP1_HAS_LIF | VSP1_HAS_WPF_VFLIP,
|
||||
.rpf_count = 5,
|
||||
@ -638,7 +647,6 @@ static int vsp1_probe(struct platform_device *pdev)
|
||||
struct resource *irq;
|
||||
struct resource *io;
|
||||
unsigned int i;
|
||||
u32 version;
|
||||
int ret;
|
||||
|
||||
vsp1 = devm_kzalloc(&pdev->dev, sizeof(*vsp1), GFP_KERNEL);
|
||||
@ -689,11 +697,11 @@ static int vsp1_probe(struct platform_device *pdev)
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
|
||||
version = vsp1_read(vsp1, VI6_IP_VERSION);
|
||||
vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
|
||||
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->info = &vsp1_device_infos[i];
|
||||
break;
|
||||
@ -701,12 +709,13 @@ static int vsp1_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
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;
|
||||
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 */
|
||||
ret = vsp1_create_entities(vsp1);
|
||||
|
Loading…
Reference in New Issue
Block a user