aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan O'Donoghue <[email protected]>2022-10-14 19:04:16 +0100
committerMauro Carvalho Chehab <[email protected]>2022-11-25 06:45:35 +0000
commit63575dd3d973bf82d034bb571423ccfdc9b6893e (patch)
treebba6f3f7c38810dd49e67254c5e9badb6fe36498
parentfd1c9499bdff5694ef4c36053675f416fad8ca2a (diff)
media: i2c: imx412: Assign v4l2 device subname based on compat string
imx412 and imx577 return the same chip-id when interrogated via i2c. I've confirmed this myself by Sakari suggested we should add a new compat which should be reflected in the name of the media entity https://patchwork.kernel.org/project/linux-media/patch/[email protected]/#24894500 Set up the .data parameter of of_device_id to pass a string which we use to set the media entity name. Once done we can add in imx577 as a compatible chips with the media names reflecting the directed compat string. Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: "Paul J. Murphy" <[email protected]> Cc: Daniele Alessandrelli <[email protected]> Cc: Rob Herring <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r--drivers/media/i2c/imx412.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c
index 7f6d29e0e7c4..353304312e1c 100644
--- a/drivers/media/i2c/imx412.c
+++ b/drivers/media/i2c/imx412.c
@@ -1172,6 +1172,7 @@ static int imx412_init_controls(struct imx412 *imx412)
static int imx412_probe(struct i2c_client *client)
{
struct imx412 *imx412;
+ const char *name;
int ret;
imx412 = devm_kzalloc(&client->dev, sizeof(*imx412), GFP_KERNEL);
@@ -1179,6 +1180,9 @@ static int imx412_probe(struct i2c_client *client)
return -ENOMEM;
imx412->dev = &client->dev;
+ name = device_get_match_data(&client->dev);
+ if (!name)
+ return -ENODEV;
/* Initialize subdev */
v4l2_i2c_subdev_init(&imx412->sd, client, &imx412_subdev_ops);
@@ -1218,6 +1222,8 @@ static int imx412_probe(struct i2c_client *client)
imx412->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
imx412->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
+ v4l2_i2c_subdev_set_name(&imx412->sd, client, name, NULL);
+
/* Initialize source pad */
imx412->pad.flags = MEDIA_PAD_FL_SOURCE;
ret = media_entity_pads_init(&imx412->sd.entity, 1, &imx412->pad);
@@ -1279,7 +1285,7 @@ static const struct dev_pm_ops imx412_pm_ops = {
};
static const struct of_device_id imx412_of_match[] = {
- { .compatible = "sony,imx412" },
+ { .compatible = "sony,imx412", .data = "imx412" },
{ }
};