2013-05-25 17:40:02

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v2 0/4] media: i2c: ths7303 cleanup

From: Lad, Prabhakar <[email protected]>

Trivial cleanup of the driver.

Changes for v2:
1: Dropped the asynchronous probing and, OF
support patches will be handling them independently because of dependencies.
2: Arranged the patches logically so that git bisect
succeeds.

Lad, Prabhakar (4):
ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
media: i2c: ths7303: remove init_enable option from pdata
media: i2c: ths7303: remove unnecessary function ths7303_setup()
media: i2c: ths7303: make the pdata as a constant pointer

arch/arm/mach-davinci/board-dm365-evm.c | 1 -
drivers/media/i2c/ths7303.c | 48 ++++++++-----------------------
include/media/ths7303.h | 2 -
3 files changed, 12 insertions(+), 39 deletions(-)


2013-05-25 17:40:15

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

From: Lad, Prabhakar <[email protected]>

remove init_enable from ths7303 pdata as it is being dropped
from ths7303_platform_data.

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Sekhar Nori <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-davinci/board-dm365-evm.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index fd38c8d..afbc439 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -509,7 +509,6 @@ struct ths7303_platform_data ths7303_pdata = {
.ch_1 = 3,
.ch_2 = 3,
.ch_3 = 3,
- .init_enable = 1,
};

static struct amp_config_info vpbe_amp = {
--
1.7.0.4

2013-05-25 17:40:23

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v2 2/4] media: i2c: ths7303: remove init_enable option from pdata

From: Lad, Prabhakar <[email protected]>

This patch removes init_enable option from pdata, the init_enable
was intended that the device should start streaming video immediately
but ideally the bridge drivers should call s_stream explicitly for such
devices to start video.

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/media/i2c/ths7303.c | 4 +---
include/media/ths7303.h | 2 --
2 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index 65853ee..8cddcd0 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -356,9 +356,7 @@ static int ths7303_setup(struct v4l2_subdev *sd)
int ret;
u8 mask;

- state->stream_on = pdata->init_enable;
-
- mask = state->stream_on ? 0xff : 0xf8;
+ mask = 0xf8;

ret = ths7303_write(sd, THS7303_CHANNEL_1, pdata->ch_1 & mask);
if (ret)
diff --git a/include/media/ths7303.h b/include/media/ths7303.h
index 980ec51..a7b4929 100644
--- a/include/media/ths7303.h
+++ b/include/media/ths7303.h
@@ -30,13 +30,11 @@
* @ch_1: Bias value for channel one.
* @ch_2: Bias value for channel two.
* @ch_3: Bias value for channel three.
- * @init_enable: initalize on init.
*/
struct ths7303_platform_data {
u8 ch_1;
u8 ch_2;
u8 ch_3;
- u8 init_enable;
};

#endif
--
1.7.0.4

2013-05-25 17:40:31

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v2 3/4] media: i2c: ths7303: remove unnecessary function ths7303_setup()

From: Lad, Prabhakar <[email protected]>

the ths7303_setup() was doing the same thing as ths7303_setval()
except that ths7303_setval() sets it to some particular mode.
This patch removes ths7303_setup() function and calls ths7303_setval()
in the probe setting the device to 480I_576I filter mode in the probe.

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/media/i2c/ths7303.c | 31 ++++---------------------------
1 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index 8cddcd0..af06187 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -349,30 +349,6 @@ static const struct v4l2_subdev_ops ths7303_ops = {
.video = &ths7303_video_ops,
};

-static int ths7303_setup(struct v4l2_subdev *sd)
-{
- struct ths7303_state *state = to_state(sd);
- struct ths7303_platform_data *pdata = &state->pdata;
- int ret;
- u8 mask;
-
- mask = 0xf8;
-
- ret = ths7303_write(sd, THS7303_CHANNEL_1, pdata->ch_1 & mask);
- if (ret)
- return ret;
-
- ret = ths7303_write(sd, THS7303_CHANNEL_2, pdata->ch_2 & mask);
- if (ret)
- return ret;
-
- ret = ths7303_write(sd, THS7303_CHANNEL_3, pdata->ch_3 & mask);
- if (ret)
- return ret;
-
- return 0;
-}
-
static int ths7303_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -402,9 +378,10 @@ static int ths7303_probe(struct i2c_client *client,
/* store the driver data to differntiate the chip */
state->driver_data = (int)id->driver_data;

- if (ths7303_setup(sd) < 0) {
- v4l_err(client, "init failed\n");
- return -EIO;
+ /* set to default 480I_576I filter mode */
+ if (ths7303_setval(sd, THS7303_FILTER_MODE_480I_576I) < 0) {
+ v4l_err(client, "Setting to 480I_576I filter mode failed!\n");
+ return -EINVAL;
}

return 0;
--
1.7.0.4

2013-05-25 17:40:45

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH v2 4/4] media: i2c: ths7303: make the pdata as a constant pointer

From: Lad, Prabhakar <[email protected]>

generally the pdata needs to be a constant pointer in the device
state structure. This patch makes the pdata as a constant pointer
and alongside returns -EINVAL when pdata is NULL.

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/media/i2c/ths7303.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index af06187..b954195 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -35,7 +35,7 @@

struct ths7303_state {
struct v4l2_subdev sd;
- struct ths7303_platform_data pdata;
+ const struct ths7303_platform_data *pdata;
struct v4l2_bt_timings bt;
int std_id;
int stream_on;
@@ -89,7 +89,7 @@ int ths7303_setval(struct v4l2_subdev *sd, enum ths7303_filter_mode mode)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ths7303_state *state = to_state(sd);
- struct ths7303_platform_data *pdata = &state->pdata;
+ const struct ths7303_platform_data *pdata = state->pdata;
u8 val, sel = 0;
int err, disable = 0;

@@ -356,6 +356,11 @@ static int ths7303_probe(struct i2c_client *client,
struct ths7303_state *state;
struct v4l2_subdev *sd;

+ if (pdata == NULL) {
+ dev_err(&client->dev, "No platform data\n");
+ return -EINVAL;
+ }
+
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV;

@@ -367,11 +372,7 @@ static int ths7303_probe(struct i2c_client *client,
if (!state)
return -ENOMEM;

- if (!pdata)
- v4l_warn(client, "No platform data, using default data!\n");
- else
- state->pdata = *pdata;
-
+ state->pdata = pdata;
sd = &state->sd;
v4l2_i2c_subdev_init(sd, client, &ths7303_ops);

--
1.7.0.4

2013-05-25 17:43:52

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

Hi Sekhar,

On Sat, May 25, 2013 at 11:09 PM, Prabhakar Lad
<[email protected]> wrote:
> From: Lad, Prabhakar <[email protected]>
>
> remove init_enable from ths7303 pdata as it is being dropped
> from ths7303_platform_data.
>
Can you please ack this patch as I intend to take this patch via media
tree.

Regards,
--Prabhakar Lad

2013-05-26 01:20:49

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] media: i2c: ths7303 cleanup

On Saturday 25 May 2013 23:09:32 Prabhakar Lad wrote:
> From: Lad, Prabhakar <[email protected]>
>
> Trivial cleanup of the driver.
>
> Changes for v2:
> 1: Dropped the asynchronous probing and, OF
> support patches will be handling them independently because of
> dependencies. 2: Arranged the patches logically so that git bisect
> succeeds.
>
> Lad, Prabhakar (4):
> ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
> media: i2c: ths7303: remove init_enable option from pdata
> media: i2c: ths7303: remove unnecessary function ths7303_setup()
> media: i2c: ths7303: make the pdata as a constant pointer
>
> arch/arm/mach-davinci/board-dm365-evm.c | 1 -
> drivers/media/i2c/ths7303.c | 48 ++++++++--------------------
> include/media/ths7303.h | 2 -
> 3 files changed, 12 insertions(+), 39 deletions(-)

For the whole series,

Acked-by: Laurent Pinchart <[email protected]>

--
Regards,

Laurent Pinchart

2013-05-31 08:43:25

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

Hi Sekhar,

On Sat, May 25, 2013 at 11:13 PM, Prabhakar Lad
<[email protected]> wrote:
> Hi Sekhar,
>
> On Sat, May 25, 2013 at 11:09 PM, Prabhakar Lad
> <[email protected]> wrote:
>> From: Lad, Prabhakar <[email protected]>
>>
>> remove init_enable from ths7303 pdata as it is being dropped
>> from ths7303_platform_data.
>>
> Can you please ack this patch as I intend to take this patch via media
> tree.
gentle ping.

Regards,
--Prabhakar

2013-06-06 04:36:40

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

On 5/25/2013 11:09 PM, Prabhakar Lad wrote:
> From: Lad, Prabhakar <[email protected]>
>
> remove init_enable from ths7303 pdata as it is being dropped
> from ths7303_platform_data.
>
> Signed-off-by: Lad, Prabhakar <[email protected]>
> Cc: Sekhar Nori <[email protected]>
> Cc: Hans Verkuil <[email protected]>
> Cc: Laurent Pinchart <[email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

Acked-by: Sekhar Nori <[email protected]>

I would prefer this be squashed into 2/4 but I leave it to you.

Thanks,
Sekhar

2013-06-06 10:03:11

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

Hi Sekhar,

On Thu, Jun 6, 2013 at 10:06 AM, Sekhar Nori <[email protected]> wrote:
> On 5/25/2013 11:09 PM, Prabhakar Lad wrote:
>> From: Lad, Prabhakar <[email protected]>
>>
>> remove init_enable from ths7303 pdata as it is being dropped
>> from ths7303_platform_data.
>>
>> Signed-off-by: Lad, Prabhakar <[email protected]>
>> Cc: Sekhar Nori <[email protected]>
>> Cc: Hans Verkuil <[email protected]>
>> Cc: Laurent Pinchart <[email protected]>
>> Cc: Mauro Carvalho Chehab <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>
> Acked-by: Sekhar Nori <[email protected]>
>
Thanks for the ack.

> I would prefer this be squashed into 2/4 but I leave it to you.
>
I would like to go as is :)

Regards,
--Prabhakar Lad

2013-06-06 10:06:02

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] media: i2c: ths7303 cleanup

Hi Hans,

On Sun, May 26, 2013 at 6:50 AM, Laurent Pinchart
<[email protected]> wrote:
> On Saturday 25 May 2013 23:09:32 Prabhakar Lad wrote:
>> From: Lad, Prabhakar <[email protected]>
>>
>> Trivial cleanup of the driver.
>>
>> Changes for v2:
>> 1: Dropped the asynchronous probing and, OF
>> support patches will be handling them independently because of
>> dependencies. 2: Arranged the patches logically so that git bisect
>> succeeds.
>>
>> Lad, Prabhakar (4):
>> ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
>> media: i2c: ths7303: remove init_enable option from pdata
>> media: i2c: ths7303: remove unnecessary function ths7303_setup()
>> media: i2c: ths7303: make the pdata as a constant pointer
>>
Can you pick up this series or do you want me to issue a pull for it ?

Regards,
--Prabhakar Lad

2013-06-06 10:07:41

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

On 6/6/2013 3:32 PM, Prabhakar Lad wrote:
> Hi Sekhar,
>
> On Thu, Jun 6, 2013 at 10:06 AM, Sekhar Nori <[email protected]> wrote:
>> On 5/25/2013 11:09 PM, Prabhakar Lad wrote:
>>> From: Lad, Prabhakar <[email protected]>
>>>
>>> remove init_enable from ths7303 pdata as it is being dropped
>>> from ths7303_platform_data.
>>>
>>> Signed-off-by: Lad, Prabhakar <[email protected]>
>>> Cc: Sekhar Nori <[email protected]>
>>> Cc: Hans Verkuil <[email protected]>
>>> Cc: Laurent Pinchart <[email protected]>
>>> Cc: Mauro Carvalho Chehab <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>
>> Acked-by: Sekhar Nori <[email protected]>
>>
> Thanks for the ack.
>
>> I would prefer this be squashed into 2/4 but I leave it to you.
>>
> I would like to go as is :)

If you go this path, then may be repeat some of the explanation of why
init_enable is not needed from 2/4 here as well. Without that the
description above makes little sense.

Thanks,
Sekhar

2013-06-07 08:41:10

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] media: i2c: ths7303 cleanup

On Thu June 6 2013 12:05:38 Prabhakar Lad wrote:
> Hi Hans,
>
> On Sun, May 26, 2013 at 6:50 AM, Laurent Pinchart
> <[email protected]> wrote:
> > On Saturday 25 May 2013 23:09:32 Prabhakar Lad wrote:
> >> From: Lad, Prabhakar <[email protected]>
> >>
> >> Trivial cleanup of the driver.
> >>
> >> Changes for v2:
> >> 1: Dropped the asynchronous probing and, OF
> >> support patches will be handling them independently because of
> >> dependencies. 2: Arranged the patches logically so that git bisect
> >> succeeds.
> >>
> >> Lad, Prabhakar (4):
> >> ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
> >> media: i2c: ths7303: remove init_enable option from pdata
> >> media: i2c: ths7303: remove unnecessary function ths7303_setup()
> >> media: i2c: ths7303: make the pdata as a constant pointer
> >>
> Can you pick up this series or do you want me to issue a pull for it ?

I've picked it up. I kept the dm365 patch separate, but I did improve the
commit log a bit.

Regards,

Hans

2013-06-08 08:04:34

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] media: i2c: ths7303 cleanup

Hi Hans,

On Fri, Jun 7, 2013 at 2:10 PM, Hans Verkuil <[email protected]> wrote:
> On Thu June 6 2013 12:05:38 Prabhakar Lad wrote:
>> Hi Hans,
>>
>> On Sun, May 26, 2013 at 6:50 AM, Laurent Pinchart
>> <[email protected]> wrote:
>> > On Saturday 25 May 2013 23:09:32 Prabhakar Lad wrote:
>> >> From: Lad, Prabhakar <[email protected]>
>> >>
>> >> Trivial cleanup of the driver.
>> >>
>> >> Changes for v2:
>> >> 1: Dropped the asynchronous probing and, OF
>> >> support patches will be handling them independently because of
>> >> dependencies. 2: Arranged the patches logically so that git bisect
>> >> succeeds.
>> >>
>> >> Lad, Prabhakar (4):
>> >> ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
>> >> media: i2c: ths7303: remove init_enable option from pdata
>> >> media: i2c: ths7303: remove unnecessary function ths7303_setup()
>> >> media: i2c: ths7303: make the pdata as a constant pointer
>> >>
>> Can you pick up this series or do you want me to issue a pull for it ?
>
> I've picked it up. I kept the dm365 patch separate, but I did improve the
> commit log a bit.
>
Thanks for fixing it.

Regards,
--Prabhakar Lad