media: i2c: ths7303 feature enhancement and cleanup
Subsystems (5)
PATCH 2/6 ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
In reply to Lad PrabhakarFrom: Lad, Prabhakar <[email protected]>
remove init_enable from ths7303 pdata as it is no longer exists.
--- arch/arm/mach-davinci/board-dm365-evm.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-dm365-evm.c +0 -1
@@ -510,7 +510,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 = {
Signature · 1 line
1.7.4.1
PATCH 6/6 media: i2c: ths7303: add OF support
In reply to Lad PrabhakarFrom: Lad, Prabhakar <[email protected]>
add OF support for the ths7303 driver.
--- .../devicetree/bindings/media/i2c/ths73x3.txt | 50 ++++++++++++++++++++ drivers/media/i2c/ths7303.c | 37 ++++++++++++++- 2 files changed, 86 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/ths73x3.txt
Documentation/devicetree/bindings/media/i2c/ths73x3.txt new file +50 -0
@@ -0,0 +1,50 @@ +* Texas Instruments THS7303/THS7353 video amplifier + +The THS7303/THS7353 device is a low power 3-channel integrated video buffer +which can be configured individually via i2c for all the functions which makes +it flexible for any application. It incorporates a selectable fifth-order +Butterworth filter to eliminate data converter images. + +Required Properties : +- compatible : value should be either one among the following + (a) "ti,ths7303" for ths7303 video amplifier. + (b) "ti,ths7353" for ths7353 video amplifier. + +- ti,ths73x3-ch1-bias: Bias value for channel 1. + +- ti,ths73x3-ch2-bias: Bias value for channel 2. + +- ti,ths73x3-ch3-bias: Bias value for channel 3. + +Bias values for channel-1/2/3 can be following (values default to zero):- + - 0: Disable Channel - Conserves Power + - 1: Channel On - Mute Function - No Output + - 2: Channel On - DC Bias Select + - 3: Channel On - DC Bias + 250 mV Offset Select + - 4: Channel On - AC Bias Select + - 5: Channel On - Sync Tip Clam with low bias + - 6: Channel On - Sync Tip Clam with mid bias + - 7: Channel On - Sync Tip Clam with high bias + +For further reading of port node refer Documentation/devicetree/bindings/media/ +video-interfaces.txt. + +Example: + + i2c0@1c22000 { + ... + ... + ths7303@2c { + compatible = "ti,ths7303"; + reg = <0x2c>; + + port { + ths7303_1: endpoint { + ti,ths73x3-ch1-bias = <3>; + ti,ths73x3-ch2-bias = <3>; + ti,ths73x3-ch3-bias = <3>; + }; + }; + }; + ... + };
drivers/media/i2c/ths7303.c +36 -1
@@ -29,6 +29,7 @@#include <media/v4l2-async.h> #include <media/v4l2-chip-ident.h> #include <media/v4l2-device.h> +#include <media/v4l2-of.h> #define THS7303_CHANNEL_1 1#define THS7303_CHANNEL_2 2
@@ -350,10 +351,34 @@ static const struct v4l2_subdev_ops ths7303_ops = { .video = &ths7303_video_ops, }; +static struct ths7303_platform_data * +ths7303_get_pdata (struct i2c_client *client) +{ +struct ths7303_platform_data *pdata; +struct device_node *endpoint; + +if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node) +return client->dev.platform_data; + + endpoint =v4l2_of_get_next_endpoint (client->dev.of_node,NULL ); +if (!endpoint) +return NULL ; + + pdata =devm_kzalloc (&client->dev,sizeof (*pdata),GFP_KERNEL ); +if (!pdata) +return NULL ; + +of_property_read_u8 (endpoint,"ti,ths73x3-ch1-bias" , &pdata->ch_1); +of_property_read_u8 (endpoint,"ti,ths73x3-ch2-bias" , &pdata->ch_2); +of_property_read_u8 (endpoint,"ti,ths73x3-ch3-bias" , &pdata->ch_3); + +return pdata; +} +static int ths7303_probe (struct i2c_client *client,const struct i2c_device_id *id) { -struct ths7303_platform_data *pdata = client->dev.platform_data; +struct ths7303_platform_data *pdata =ths7303_get_pdata (client);struct ths7303_state *state;struct v4l2_subdev *sd;int ret;
@@ -414,8 +439,18 @@ static const struct i2c_device_id ths7303_id[] = {MODULE_DEVICE_TABLE (i2c, ths7303_id); +#if IS_ENABLED (CONFIG_OF ) +static const struct of_device_id ths73x3_of_match[] = { + { .compatible ="ti,ths7303" , }, + { .compatible ="ti,ths7353" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, ths73x3_of_match); +#endif +static struct i2c_driver ths7303_driver = { .driver = { + .of_match_table =of_match_ptr (ths73x3_of_match), .owner =THIS_MODULE , .name ="ths73x3" , },
Signature · 1 line
1.7.4.1
cover media: i2c: ths7303 feature enhancement and cleanup
From: Lad, Prabhakar <[email protected]>
This patch series enables the ths7303 driver for asynchronous probing, OF support with some cleanup patches.
Lad, Prabhakar (6):
media: i2c: ths7303: remove init_enable option from pdata
ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
media: i2c: ths7303: remove unnecessary function ths7303_setup()
media: i2c: ths7303: make the pdata as a constant pointer
media: i2c: ths7303: add support for asynchronous probing
media: i2c: ths7303: add OF support
.../devicetree/bindings/media/i2c/ths73x3.txt | 50 +++++++++++++ arch/arm/mach-davinci/board-dm365-evm.c | 1 - drivers/media/i2c/ths7303.c | 78 ++++++++++++------- include/media/ths7303.h | 2 - 4 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/ths73x3.txt
Signature · 1 line
1.7.4.1
PATCH 1/6 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.
--- drivers/media/i2c/ths7303.c | 4 +--- include/media/ths7303.h | 2 -- 2 files changed, 1 insertions(+), 5 deletions(-)
drivers/media/i2c/ths7303.c +1 -3
@@ -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)
include/media/ths7303.h +0 -2
@@ -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
Signature · 1 line
1.7.4.1
PATCH 3/6 media: i2c: ths7303: remove unnecessary function ths7303_setup()
In reply to Lad PrabhakarFrom: 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.
--- drivers/media/i2c/ths7303.c | 31 ++++--------------------------- 1 files changed, 4 insertions(+), 27 deletions(-)
drivers/media/i2c/ths7303.c +4 -27
@@ -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 ;
Signature · 1 line
1.7.4.1
PATCH 4/6 media: i2c: ths7303: make the pdata as a constant pointer
In reply to Lad PrabhakarFrom: 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.
--- drivers/media/i2c/ths7303.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/media/i2c/ths7303.c +8 -7
@@ -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);
Signature · 1 line
1.7.4.1
PATCH 5/6 media: i2c: ths7303: add support for asynchronous probing
In reply to Lad PrabhakarFrom: Lad, Prabhakar <[email protected]>
Both synchronous and asynchronous ths7303 subdevice probing is supported by this patch.
--- drivers/media/i2c/ths7303.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/media/i2c/ths7303.c +9 -0
@@ -26,6 +26,7 @@#include <linux/slab.h> #include <media/ths7303.h> +#include <media/v4l2-async.h> #include <media/v4l2-chip-ident.h> #include <media/v4l2-device.h>
@@ -355,6 +356,7 @@ static int ths7303_probe(struct i2c_client *client,struct ths7303_platform_data *pdata = client->dev.platform_data;struct ths7303_state *state;struct v4l2_subdev *sd; +int ret;if (pdata ==NULL ) {dev_err (&client->dev,"No platform data\n" );
@@ -385,13 +387,20 @@ static int ths7303_probe(struct i2c_client *client,return -EINVAL ; } + state->sd.dev = &client->dev; + ret =v4l2_async_register_subdev (&state->sd); +if (ret) +return ret; +return 0 ; }static int ths7303_remove (struct i2c_client *client) {struct v4l2_subdev *sd =i2c_get_clientdata (client); +struct ths7303_state *ths7303 =to_state (sd); +v4l2_async_unregister_subdev (&ths7303->sd);v4l2_device_unregister_subdev (sd);return 0 ;
Signature · 1 line
1.7.4.1
Re: [PATCH 2/6] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
In reply to Lad PrabhakarHi Prabhakar,
Thank you for the patch.
Quoted 3 lines · On Wednesday 15 May 2013 17:27:18 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
remove
init_enablefrom ths7303 pdata as it is no longer exists.
You should move this before 1/6, otherwise you will break bisection.
Quoted 27 lines
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 Guennadi Liakhovetski <[email protected]>Cc Sylwester Nawrocki <[email protected]>Cc Sakari Ailus <[email protected]>--- arch/arm/mach-davinci/board-dm365-evm.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-davinci/board-dm365-evm.cindex 2a66743..4e02ae7 100644arch/arm/mach-davinci/board-dm365-evm.c +0
-1@@ -510,7 +510,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 = {
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/6] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
Hi Laurent,
Thanks for the review.
Quoted 11 lines · Laurent Pinchart
Hi Prabhakar,
Thank you for the patch.
Quoted 3 lines · On Wednesday 15 May 2013 17:27:18 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
remove
init_enablefrom ths7303 pdata as it is no longer exists.You should move this before 1/6, otherwise you will break bisection.
OK I'll fix it in next version.
Regards,
--Prabhakar Lad
Re: [PATCH 2/6] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
Hi Laurent,
Quoted 17 lines · Prabhakar Lad
Hi Laurent,
Thanks for the review.
Quoted 11 lines · Laurent Pinchart
Hi Prabhakar,
Thank you for the patch.
Quoted 3 lines · On Wednesday 15 May 2013 17:27:18 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
remove
init_enablefrom ths7303 pdata as it is no longer exists.You should move this before 1/6, otherwise you will break bisection.
How about I just reshuffles while issuing a pull rather than resending the whole series ?
Regards,
--Prabhakar Lad
Re: [PATCH 2/6] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
Hi Prabhakar,
Quoted 11 lines · On Thursday 16 May 2013 17:18:00 Prabhakar Lad wrote:
Quoted 7 lines · Prabhakar Lad
Quoted 6 lines · Laurent Pinchart
Quoted 3 lines · On Wednesday 15 May 2013 17:27:18 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
remove
init_enablefrom ths7303 pdata as it is no longer exists.You should move this before 1/6, otherwise you will break bisection.
How about I just reshuffles while issuing a pull rather than resending the whole series ?
As long as you don't forget to do so, sure :-)
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 1/6] media: i2c: ths7303: remove init_enable option from pdata
In reply to Lad PrabhakarHi Prabhakar,
Thanks for the patch!
drivers/media/i2c/ths7303.c static int ths7303_setup(struct v4l2_subdev *sd) · line 359
Quoted 12 lines · Lad Prabhakar
drivers/media/i2c/ths7303.c +1
-3@@ -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 ;
You can assign mask in declaration. It'd be nice to have a human-readable name for the mask, too.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH 1/6] media: i2c: ths7303: remove init_enable option from pdata
Hi Sakari,
Thanks for the review.
Quoted 13 lines · Sakari Ailus
Hi Prabhakar,
Thanks for the patch!
Quoted 8 lines · Lad Prabhakar
drivers/media/i2c/ths7303.c +0
-0@@ -356,9 +356,7 @@ static int ths7303_setup(struct v4l2_subdev *sd)int ret;u8 mask;
Quoted 8 lines
drivers/media/i2c/ths7303.c static int ths7303_setup(struct v4l2_subdev *sd) · line 359
Quoted 4 lines
drivers/media/i2c/ths7303.c +1
-3- state->stream_on = pdata->init_enable; - - mask = state->stream_on ?0xff :0xf8 ; + mask =0xf8 ;You can assign mask in declaration. It'd be nice to have a human-readable name for the mask, too.
This function gets removed in the preceding patch of this series.
Regards,
--Prabhakar Lad
Quoted 5 lines · On Wed 15 May 2013 13:57:16 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
This patch series enables the ths7303 driver for asynchronous probing, OF support with some cleanup patches.
Quoted 7 lines
Lad, Prabhakar (6):
media: i2c: ths7303: removeinit_enableoption from pdata
ARM: davinci: dm365 evm: removeinit_enablefrom ths7303 pdata
media: i2c: ths7303: remove unnecessary functionths7303_setup()
media: i2c: ths7303: make the pdata as a constant pointer
media: i2c: ths7303: add support for asynchronous probing
media: i2c: ths7303: add OF support
Can you post this again in the right order (swapping the first two patches) and preferably with an ack from the mach-davinci maintainer?
Once I have that I can take in the first four patches and I can take the final two patches once the async support is merged.
Regards,
Hans
Hi Hans,
Quoted 14 lines · Hans Verkuil
Quoted 5 lines · On Wed 15 May 2013 13:57:16 Lad Prabhakar wrote:
From: Lad, Prabhakar <[email protected]>
This patch series enables the ths7303 driver for asynchronous probing, OF support with some cleanup patches.
Quoted 7 lines
Lad, Prabhakar (6):
media: i2c: ths7303: removeinit_enableoption from pdata
ARM: davinci: dm365 evm: removeinit_enablefrom ths7303 pdata
media: i2c: ths7303: remove unnecessary functionths7303_setup()
media: i2c: ths7303: make the pdata as a constant pointer
media: i2c: ths7303: add support for asynchronous probing
media: i2c: ths7303: add OF support
Quoted 6 lines
Can you post this again in the right order (swapping the first two patches) and preferably with an ack from the mach-davinci maintainer?
Once I have that I can take in the first four patches and I can take the final two patches once the async support is merged.
Ok I'll do it today.
Regards,
--Prabhakar Lad
Re: [PATCH 2/6] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
In reply to Lad PrabhakarHi Sekhar,
Quoted 4 lines · Lad Prabhakar
From: Lad, Prabhakar <[email protected]>
remove
init_enablefrom ths7303 pdata as it is no longer exists.
Can you please ack this patch, as this patch is intended to go via media tree.
Regards,
--Prabhakar Lad