diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-01-30 06:04:47 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-13 14:25:56 -0500 |
commit | ec34e1d579819789ecde888c1d54310824957893 (patch) | |
tree | bd473b4483e7f9805db592d254ae1bf6ba54d33f /drivers/media/i2c | |
parent | d6646b8075f8110ac167f335d660b8a544dd324e (diff) |
[media] mt9t112: mt9t111 format set up differs from mt9t112
The original commit, adding the mt9t112 driver said, that mt9t111 and
mt9t112 had identical register layouts. This however doesn't seem to be
the case. At least pixel format selection in the mt9t111 datasheet is
different from the driver implementation. So far only the default YUYV
format has been verified to work with mt9t111. Limit the driver to only
report one supported format with mt9t111 until more formats are
implemented.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/soc_camera/mt9t112.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c index c75d83168700..188e29b03273 100644 --- a/drivers/media/i2c/soc_camera/mt9t112.c +++ b/drivers/media/i2c/soc_camera/mt9t112.c | |||
@@ -92,6 +92,7 @@ struct mt9t112_priv { | |||
92 | struct v4l2_rect frame; | 92 | struct v4l2_rect frame; |
93 | const struct mt9t112_format *format; | 93 | const struct mt9t112_format *format; |
94 | int model; | 94 | int model; |
95 | int num_formats; | ||
95 | u32 flags; | 96 | u32 flags; |
96 | /* for flags */ | 97 | /* for flags */ |
97 | #define INIT_DONE (1 << 0) | 98 | #define INIT_DONE (1 << 0) |
@@ -859,11 +860,11 @@ static int mt9t112_set_params(struct mt9t112_priv *priv, | |||
859 | /* | 860 | /* |
860 | * get color format | 861 | * get color format |
861 | */ | 862 | */ |
862 | for (i = 0; i < ARRAY_SIZE(mt9t112_cfmts); i++) | 863 | for (i = 0; i < priv->num_formats; i++) |
863 | if (mt9t112_cfmts[i].code == code) | 864 | if (mt9t112_cfmts[i].code == code) |
864 | break; | 865 | break; |
865 | 866 | ||
866 | if (i == ARRAY_SIZE(mt9t112_cfmts)) | 867 | if (i == priv->num_formats) |
867 | return -EINVAL; | 868 | return -EINVAL; |
868 | 869 | ||
869 | priv->frame = *rect; | 870 | priv->frame = *rect; |
@@ -955,14 +956,16 @@ static int mt9t112_s_fmt(struct v4l2_subdev *sd, | |||
955 | static int mt9t112_try_fmt(struct v4l2_subdev *sd, | 956 | static int mt9t112_try_fmt(struct v4l2_subdev *sd, |
956 | struct v4l2_mbus_framefmt *mf) | 957 | struct v4l2_mbus_framefmt *mf) |
957 | { | 958 | { |
959 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
960 | struct mt9t112_priv *priv = to_mt9t112(client); | ||
958 | unsigned int top, left; | 961 | unsigned int top, left; |
959 | int i; | 962 | int i; |
960 | 963 | ||
961 | for (i = 0; i < ARRAY_SIZE(mt9t112_cfmts); i++) | 964 | for (i = 0; i < priv->num_formats; i++) |
962 | if (mt9t112_cfmts[i].code == mf->code) | 965 | if (mt9t112_cfmts[i].code == mf->code) |
963 | break; | 966 | break; |
964 | 967 | ||
965 | if (i == ARRAY_SIZE(mt9t112_cfmts)) { | 968 | if (i == priv->num_formats) { |
966 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; | 969 | mf->code = V4L2_MBUS_FMT_UYVY8_2X8; |
967 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 970 | mf->colorspace = V4L2_COLORSPACE_JPEG; |
968 | } else { | 971 | } else { |
@@ -979,7 +982,10 @@ static int mt9t112_try_fmt(struct v4l2_subdev *sd, | |||
979 | static int mt9t112_enum_fmt(struct v4l2_subdev *sd, unsigned int index, | 982 | static int mt9t112_enum_fmt(struct v4l2_subdev *sd, unsigned int index, |
980 | enum v4l2_mbus_pixelcode *code) | 983 | enum v4l2_mbus_pixelcode *code) |
981 | { | 984 | { |
982 | if (index >= ARRAY_SIZE(mt9t112_cfmts)) | 985 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
986 | struct mt9t112_priv *priv = to_mt9t112(client); | ||
987 | |||
988 | if (index >= priv->num_formats) | ||
983 | return -EINVAL; | 989 | return -EINVAL; |
984 | 990 | ||
985 | *code = mt9t112_cfmts[index].code; | 991 | *code = mt9t112_cfmts[index].code; |
@@ -1056,10 +1062,12 @@ static int mt9t112_camera_probe(struct i2c_client *client) | |||
1056 | case 0x2680: | 1062 | case 0x2680: |
1057 | devname = "mt9t111"; | 1063 | devname = "mt9t111"; |
1058 | priv->model = V4L2_IDENT_MT9T111; | 1064 | priv->model = V4L2_IDENT_MT9T111; |
1065 | priv->num_formats = 1; | ||
1059 | break; | 1066 | break; |
1060 | case 0x2682: | 1067 | case 0x2682: |
1061 | devname = "mt9t112"; | 1068 | devname = "mt9t112"; |
1062 | priv->model = V4L2_IDENT_MT9T112; | 1069 | priv->model = V4L2_IDENT_MT9T112; |
1070 | priv->num_formats = ARRAY_SIZE(mt9t112_cfmts); | ||
1063 | break; | 1071 | break; |
1064 | default: | 1072 | default: |
1065 | dev_err(&client->dev, "Product ID error %04x\n", chipid); | 1073 | dev_err(&client->dev, "Product ID error %04x\n", chipid); |