The patch titled video-initial-support-for-adv7180-update has been added to the -mm tree. Its filename is video-initial-support-for-adv7180-update.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: video-initial-support-for-adv7180-update From: Richard Röjfors <richard.rojfors.ext@xxxxxxxxxxxxxxx> Signed-off-by: Richard Röjfors <richard.rojfors.ext@xxxxxxxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx> Cc: Hans Verkuil <hverkuil@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/media/video/adv7180.c | 95 ++++++++++++-------------------- 1 file changed, 38 insertions(+), 57 deletions(-) diff -puN drivers/media/video/adv7180.c~video-initial-support-for-adv7180-update drivers/media/video/adv7180.c --- a/drivers/media/video/adv7180.c~video-initial-support-for-adv7180-update +++ a/drivers/media/video/adv7180.c @@ -27,8 +27,8 @@ #include <linux/videodev2.h> #include <media/v4l2-device.h> #include <media/v4l2-chip-ident.h> -#include <media/v4l2-i2c-drv.h> +#define DRIVER_NAME "adv7180" #define ADV7180_INPUT_CONTROL_REG 0x00 #define ADV7180_INPUT_CONTROL_PAL_BG_NTSC_J_SECAM 0x00 @@ -51,10 +51,6 @@ #define ADV7180_ID_7180 0x18 -static unsigned short normal_i2c[] = { 0x42 >> 1, I2C_CLIENT_END }; - -I2C_CLIENT_INSMOD; - struct adv7180_state { struct v4l2_subdev sd; }; @@ -98,16 +94,6 @@ static int adv7180_querystd(struct v4l2_ return 0; } -static int adv7180_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) -{ - return -EINVAL; -} - -static int adv7180_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) -{ - return -EINVAL; -} - static int adv7180_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) { @@ -116,26 +102,12 @@ static int adv7180_g_chip_ident(struct v return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_ADV7180, 0); } -static int adv7180_log_status(struct v4l2_subdev *sd) -{ - v4l2_info(sd, "Normal operation\n"); - return 0; -} - -static irqreturn_t adv7180_irq(int irq, void *devid) -{ - return IRQ_NONE; -} - static const struct v4l2_subdev_video_ops adv7180_video_ops = { .querystd = adv7180_querystd, }; static const struct v4l2_subdev_core_ops adv7180_core_ops = { - .log_status = adv7180_log_status, .g_chip_ident = adv7180_g_chip_ident, - .g_ctrl = adv7180_g_ctrl, - .s_ctrl = adv7180_s_ctrl, }; static const struct v4l2_subdev_ops adv7180_ops = { @@ -153,6 +125,7 @@ static int adv7180_probe(struct i2c_clie { struct adv7180_state *state; struct v4l2_subdev *sd; + int ret; /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) @@ -161,32 +134,26 @@ static int adv7180_probe(struct i2c_clie v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - state = kmalloc(sizeof(struct adv7180_state), GFP_KERNEL); + state = kzalloc(sizeof(struct adv7180_state), GFP_KERNEL); if (state == NULL) return -ENOMEM; sd = &state->sd; v4l2_i2c_subdev_init(sd, client, &adv7180_ops); /* Initialize adv7180 */ - - /* register interrupt, can be used later */ - if (client->irq > 0) { - /* we can use IRQ */ - int err = request_irq(client->irq, adv7180_irq, IRQF_SHARED, - "adv7180", sd); - if (err) { - printk(KERN_ERR "adv7180: Failed to request IRQ\n"); - v4l2_device_unregister_subdev(sd); - kfree(state); - return err; - } - } - /* enable autodetection */ - i2c_smbus_write_byte_data(client, ADV7180_INPUT_CONTROL_REG, + ret = i2c_smbus_write_byte_data(client, ADV7180_INPUT_CONTROL_REG, ADV7180_INPUT_CONTROL_PAL_BG_NTSC_J_SECAM); - i2c_smbus_write_byte_data(client, ADV7180_AUTODETECT_ENABLE_REG, - ADV7180_AUTODETECT_DEFAULT); + if (ret > 0) + ret = i2c_smbus_write_byte_data(client, + ADV7180_AUTODETECT_ENABLE_REG, + ADV7180_AUTODETECT_DEFAULT); + if (ret < 0) { + printk(KERN_ERR DRIVER_NAME + ": Failed to communicate to chip: %d\n", ret); + return ret; + } + return 0; } @@ -194,27 +161,41 @@ static int adv7180_remove(struct i2c_cli { struct v4l2_subdev *sd = i2c_get_clientdata(client); - if (client->irq > 0) - free_irq(client->irq, sd); - v4l2_device_unregister_subdev(sd); kfree(to_state(sd)); return 0; } static const struct i2c_device_id adv7180_id[] = { - { "adv7180", 0 }, - { } + {DRIVER_NAME, 0}, + {}, }; + MODULE_DEVICE_TABLE(i2c, adv7180_id); -static struct v4l2_i2c_driver_data v4l2_i2c_data = { - .name = "adv7180", - .probe = adv7180_probe, - .remove = adv7180_remove, - .id_table = adv7180_id, +static struct i2c_driver adv7180_driver = { + .driver = { + .owner = THIS_MODULE, + .name = DRIVER_NAME, + }, + .probe = adv7180_probe, + .remove = adv7180_remove, + .id_table = adv7180_id, }; +static __init int adv7180_init(void) +{ + return i2c_add_driver(&adv7180_driver); +} + +static __exit void adv7180_exit(void) +{ + i2c_del_driver(&adv7180_driver); +} + +module_init(adv7180_init); +module_exit(adv7180_exit); + MODULE_DESCRIPTION("Analog Devices ADV7180 video decoder driver"); MODULE_AUTHOR("Mocean Laboratories"); MODULE_LICENSE("GPL v2"); _ Patches currently in -mm which might be from richard.rojfors.ext@xxxxxxxxxxxxxxx are linux-next.patch video-initial-support-for-adv7180.patch video-initial-support-for-adv7180-update.patch video-initial-support-for-adv7180-update-fix.patch gpio-add-mc33880-driver.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html