[media] tvp514x: Fix init seqeunce
authorLars-Peter Clausen <lars@metafoo.de>
Sun, 23 Jun 2013 13:01:35 +0000 (10:01 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 28 Jun 2013 18:08:43 +0000 (15:08 -0300)
client->driver->id_table will always point to the first entry in the device id
table. So all devices will use the same init sequence. Use the id table entry
that gets passed to the driver's probe() function to get the right init
sequence.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/i2c/tvp514x.c

index 864eb14ae9b10046043fde7d9272f01365638b87..03289e57a2171d5a47163680e46712f452d475aa 100644 (file)
@@ -123,6 +123,8 @@ struct tvp514x_decoder {
        /* mc related members */
        struct media_pad pad;
        struct v4l2_mbus_framefmt format;
+
+       struct tvp514x_reg *int_seq;
 };
 
 /* TVP514x default register values */
@@ -864,7 +866,6 @@ tvp514x_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *a)
 static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable)
 {
        int err = 0;
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
        struct tvp514x_decoder *decoder = to_decoder(sd);
 
        if (decoder->streaming == enable)
@@ -884,11 +885,8 @@ static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable)
        }
        case 1:
        {
-               struct tvp514x_reg *int_seq = (struct tvp514x_reg *)
-                               client->driver->id_table->driver_data;
-
                /* Power Up Sequence */
-               err = tvp514x_write_regs(sd, int_seq);
+               err = tvp514x_write_regs(sd, decoder->int_seq);
                if (err) {
                        v4l2_err(sd, "Unable to turn on decoder\n");
                        return err;
@@ -1128,6 +1126,8 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
        memcpy(decoder->tvp514x_regs, tvp514x_reg_list_default,
                        sizeof(tvp514x_reg_list_default));
 
+       decoder->int_seq = (struct tvp514x_reg *)id->driver_data;
+
        /* Copy board specific information here */
        decoder->pdata = pdata;