Skip to content

Commit 443f483

Browse files
lyakhMauro Carvalho Chehab
authored andcommitted
[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: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent 14178aa commit 443f483

3 files changed

Lines changed: 4 additions & 25 deletions

File tree

‎drivers/media/video/mt9m001.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -601,15 +601,9 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd,
601601
const struct v4l2_mbus_config *cfg)
602602
{
603603
const struct i2c_client *client = v4l2_get_subdevdata(sd);
604-
struct soc_camera_device *icd = soc_camera_from_i2c(client);
605604
struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
606-
/*
607-
* Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that
608-
* is the number of bits, that the host has to sample, not the number of
609-
* bits, that we have to send. See mx3_camera.c for an example of 10-bit
610-
* formats being truncated to 8 bits by the host.
611-
*/
612-
unsigned int bps = soc_mbus_get_fmtdesc(icd->current_fmt->code)->bits_per_sample;
605+
struct mt9m001 *mt9m001 = to_mt9m001(client);
606+
unsigned int bps = soc_mbus_get_fmtdesc(mt9m001->fmt->code)->bits_per_sample;
613607

614608
if (icl->set_bus_param)
615609
return icl->set_bus_param(icl, 1 << (bps - 1));

‎drivers/media/video/mt9v022.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -700,23 +700,13 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd,
700700
const struct v4l2_mbus_config *cfg)
701701
{
702702
struct i2c_client *client = v4l2_get_subdevdata(sd);
703-
struct soc_camera_device *icd = client->dev.platform_data;
704-
struct soc_camera_link *icl = to_soc_camera_link(icd);
703+
struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
705704
struct mt9v022 *mt9v022 = to_mt9v022(client);
706705
unsigned long flags = soc_camera_apply_board_flags(icl, cfg);
707-
/*
708-
* Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that
709-
* is the number of bits, that the host has to sample, not the number of
710-
* bits, that we have to send. See mx3_camera.c for an example of 10-bit
711-
* formats being truncated to 8 bits by the host.
712-
*/
713-
unsigned int bps = soc_mbus_get_fmtdesc(icd->current_fmt->code)->bits_per_sample;
706+
unsigned int bps = soc_mbus_get_fmtdesc(mt9v022->fmt->code)->bits_per_sample;
714707
int ret;
715708
u16 pixclk = 0;
716709

717-
dev_dbg(icd->pdev, "set %d: %s, %dbps\n", icd->current_fmt->code,
718-
icd->current_fmt->host_fmt->name, bps);
719-
720710
if (icl->set_bus_param) {
721711
ret = icl->set_bus_param(icl, 1 << (bps - 1));
722712
if (ret)

‎include/media/soc_camera.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,6 @@ static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_d
269269
return soc_camera_to_subdev(icd);
270270
}
271271

272-
static inline struct soc_camera_device *soc_camera_from_i2c(const struct i2c_client *client)
273-
{
274-
return client->dev.platform_data;
275-
}
276-
277272
static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq)
278273
{
279274
return container_of(vq, struct soc_camera_device, vb2_vidq);

0 commit comments

Comments
 (0)