diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-05-03 14:14:56 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-05-11 15:15:54 -0700 |
commit | d1bf1333593f1d19740b2619377abf760b138cbe (patch) | |
tree | eecb1bcf44540a0d75a24eeec8eed6644bef1692 /drivers | |
parent | dea4648595c273fb017ccafaabc7cbcfcc546bf7 (diff) |
media: sh532u: Adding board related init/deinit
When device sh532u is open, it calls board related initialization
and de- initialization function.
In the board related functions, the client can initialize the required
signal, power on/off the device etc.
bug 802264
Change-Id: Ie69a6e70c5d104489d248bef538e89263208ee54
Reviewed-on: http://git-master/r/30169
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Danielle Sun <dsun@nvidia.com>
Tested-by: Danielle Sun <dsun@nvidia.com>
Reviewed-by: Prayas Mohanty <pmohanty@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tegra/sh532u.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/sh532u.c b/drivers/media/video/tegra/sh532u.c index fbbf320a8099..7a707dff21e8 100644 --- a/drivers/media/video/tegra/sh532u.c +++ b/drivers/media/video/tegra/sh532u.c @@ -38,6 +38,7 @@ struct sh532u_info { struct i2c_client *i2c_client; struct sh532u_config config; + struct sh532u_platform_data sh532u_pdata; }; static struct sh532u_info *info; @@ -534,6 +535,9 @@ static int sh532u_open(struct inode *inode, struct file *file) { pr_info("sh532 open\n"); file->private_data = info; + if (info->sh532u_pdata.board_init) + info->sh532u_pdata.board_init( + info->sh532u_pdata.context_data); init_driver(); return 0; } @@ -541,6 +545,9 @@ static int sh532u_open(struct inode *inode, struct file *file) int sh532u_release(struct inode *inode, struct file *file) { pr_info("sh532 release\n"); + if (info->sh532u_pdata.board_deinit) + info->sh532u_pdata.board_deinit( + info->sh532u_pdata.context_data); file->private_data = NULL; return 0; } @@ -564,6 +571,7 @@ static int sh532u_probe( const struct i2c_device_id *id) { int err; + struct sh532u_platform_data *sh532u_pdata = client->dev.platform_data; pr_info("sh532u: probing sensor.\n"); info = kzalloc(sizeof(struct sh532u_info), GFP_KERNEL); @@ -584,6 +592,12 @@ static int sh532u_probe( info->config.pos_low = POS_LOW; info->config.pos_high = POS_HIGH; i2c_set_clientdata(client, info); + + if (sh532u_pdata) { + info->sh532u_pdata.context_data = sh532u_pdata->context_data; + info->sh532u_pdata.board_init = sh532u_pdata->board_init; + info->sh532u_pdata.board_deinit = sh532u_pdata->board_deinit; + } return 0; } |