mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[media] marvell-cam: Allocate the i2c adapter in the platform driver
The upcoming mmp-camera driver will need an i2c_adapter structure allocated externally, so change the core adapter to a pointer and require the platform code to fill it in. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
1c68f889c3
commit
595a93a47a
3 changed files with 9 additions and 4 deletions
|
@ -334,9 +334,13 @@ static struct i2c_algorithm cafe_smbus_algo = {
|
||||||
|
|
||||||
static int cafe_smbus_setup(struct cafe_camera *cam)
|
static int cafe_smbus_setup(struct cafe_camera *cam)
|
||||||
{
|
{
|
||||||
struct i2c_adapter *adap = &cam->mcam.i2c_adapter;
|
struct i2c_adapter *adap;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
adap = kzalloc(sizeof(*adap), GFP_KERNEL);
|
||||||
|
if (adap == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
cam->mcam.i2c_adapter = adap;
|
||||||
cafe_smbus_enable_irq(cam);
|
cafe_smbus_enable_irq(cam);
|
||||||
adap->owner = THIS_MODULE;
|
adap->owner = THIS_MODULE;
|
||||||
adap->algo = &cafe_smbus_algo;
|
adap->algo = &cafe_smbus_algo;
|
||||||
|
@ -351,7 +355,8 @@ static int cafe_smbus_setup(struct cafe_camera *cam)
|
||||||
|
|
||||||
static void cafe_smbus_shutdown(struct cafe_camera *cam)
|
static void cafe_smbus_shutdown(struct cafe_camera *cam)
|
||||||
{
|
{
|
||||||
i2c_del_adapter(&cam->mcam.i2c_adapter);
|
i2c_del_adapter(cam->mcam.i2c_adapter);
|
||||||
|
kfree(cam->mcam.i2c_adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1581,7 +1581,7 @@ int mccic_register(struct mcam_camera *cam)
|
||||||
sensor_cfg.use_smbus = cam->use_smbus;
|
sensor_cfg.use_smbus = cam->use_smbus;
|
||||||
cam->sensor_addr = ov7670_info.addr;
|
cam->sensor_addr = ov7670_info.addr;
|
||||||
cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev,
|
cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev,
|
||||||
&cam->i2c_adapter, &ov7670_info, NULL);
|
cam->i2c_adapter, &ov7670_info, NULL);
|
||||||
if (cam->sensor == NULL) {
|
if (cam->sensor == NULL) {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto out_unregister;
|
goto out_unregister;
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct mcam_camera {
|
||||||
* These fields should be set by the platform code prior to
|
* These fields should be set by the platform code prior to
|
||||||
* calling mcam_register().
|
* calling mcam_register().
|
||||||
*/
|
*/
|
||||||
struct i2c_adapter i2c_adapter;
|
struct i2c_adapter *i2c_adapter;
|
||||||
unsigned char __iomem *regs;
|
unsigned char __iomem *regs;
|
||||||
spinlock_t dev_lock;
|
spinlock_t dev_lock;
|
||||||
struct device *dev; /* For messages, dma alloc */
|
struct device *dev; /* For messages, dma alloc */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue