Commit 443f483a authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] V4L: mt9m001, mt9v022: use internally cached pixel code

Using the internally cached pixel code, instead of the one, provided by
the soc-camera, removes one more use of struct soc_camera_device in these
drivers. Also remove the no longer needed soc_camera_from_i2c() inline
function.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 14178aa5
...@@ -601,15 +601,9 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, ...@@ -601,15 +601,9 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd,
const struct v4l2_mbus_config *cfg) const struct v4l2_mbus_config *cfg)
{ {
const struct i2c_client *client = v4l2_get_subdevdata(sd); const struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = soc_camera_from_i2c(client);
struct soc_camera_link *icl = soc_camera_i2c_to_link(client); struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
/* struct mt9m001 *mt9m001 = to_mt9m001(client);
* Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that unsigned int bps = soc_mbus_get_fmtdesc(mt9m001->fmt->code)->bits_per_sample;
* is the number of bits, that the host has to sample, not the number of
* bits, that we have to send. See mx3_camera.c for an example of 10-bit
* formats being truncated to 8 bits by the host.
*/
unsigned int bps = soc_mbus_get_fmtdesc(icd->current_fmt->code)->bits_per_sample;
if (icl->set_bus_param) if (icl->set_bus_param)
return icl->set_bus_param(icl, 1 << (bps - 1)); return icl->set_bus_param(icl, 1 << (bps - 1));
......
...@@ -700,23 +700,13 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd, ...@@ -700,23 +700,13 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd,
const struct v4l2_mbus_config *cfg) const struct v4l2_mbus_config *cfg)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = client->dev.platform_data; struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
struct soc_camera_link *icl = to_soc_camera_link(icd);
struct mt9v022 *mt9v022 = to_mt9v022(client); struct mt9v022 *mt9v022 = to_mt9v022(client);
unsigned long flags = soc_camera_apply_board_flags(icl, cfg); unsigned long flags = soc_camera_apply_board_flags(icl, cfg);
/* unsigned int bps = soc_mbus_get_fmtdesc(mt9v022->fmt->code)->bits_per_sample;
* Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that
* is the number of bits, that the host has to sample, not the number of
* bits, that we have to send. See mx3_camera.c for an example of 10-bit
* formats being truncated to 8 bits by the host.
*/
unsigned int bps = soc_mbus_get_fmtdesc(icd->current_fmt->code)->bits_per_sample;
int ret; int ret;
u16 pixclk = 0; u16 pixclk = 0;
dev_dbg(icd->pdev, "set %d: %s, %dbps\n", icd->current_fmt->code,
icd->current_fmt->host_fmt->name, bps);
if (icl->set_bus_param) { if (icl->set_bus_param) {
ret = icl->set_bus_param(icl, 1 << (bps - 1)); ret = icl->set_bus_param(icl, 1 << (bps - 1));
if (ret) if (ret)
......
...@@ -269,11 +269,6 @@ static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_d ...@@ -269,11 +269,6 @@ static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_d
return soc_camera_to_subdev(icd); return soc_camera_to_subdev(icd);
} }
static inline struct soc_camera_device *soc_camera_from_i2c(const struct i2c_client *client)
{
return client->dev.platform_data;
}
static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq) static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq)
{ {
return container_of(vq, struct soc_camera_device, vb2_vidq); return container_of(vq, struct soc_camera_device, vb2_vidq);
......
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