static int ths7353_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct v4l2_subdev *sd; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); if (!client->dev.platform_data) { v4l_warn(client, "No platform data!!\n"); ths7353_luma_channel = THS7353_DEF_LUMA_CHANNEL; } else { ths7353_luma_channel = (int)(client->dev.platform_data); if ((ths7353_luma_channel < THS7353_CHANNEL_1) || (ths7353_luma_channel > THS7353_CHANNEL_3)) { v4l_warn(client, "Wring Luma Channel!!\n"); ths7353_luma_channel = THS7353_DEF_LUMA_CHANNEL; } } sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); if (sd == NULL) return -ENOMEM; v4l2_i2c_subdev_init(sd, client, &ths7353_ops); strlcpy(sd->name, "ths7353", sizeof(sd->name)); return ths7353_setvalue(sd, THS_FILTER_MODE_480I_576I); }
static int ths7353_s_preset(struct v4l2_subdev *sd, struct v4l2_dv_preset *preset) { if (preset->preset == V4L2_DV_576P50 || preset->preset == V4L2_DV_480P59_94) return ths7353_setvalue(sd, THS_FILTER_MODE_480P_576P); else if (preset->preset == V4L2_DV_720P50 || preset->preset == V4L2_DV_720P60 || preset->preset == V4L2_DV_1080I60 || preset->preset == V4L2_DV_1080I50) return ths7353_setvalue(sd, THS_FILTER_MODE_720P_1080I); else if (preset->preset == V4L2_DV_1080P60) return ths7353_setvalue(sd, THS_FILTER_MODE_1080P); else return -EINVAL; }
/* tvp7002_setstd : * Function to set the video standard */ static int tvp7002_setstd(v4l2_std_id * id, void *dec) { int err = 0; struct tvp7002_format_params *tvp7002formats; int ch_id; int i = 0; struct v4l2_standard *standard; int input_idx; if (NULL == dec) { printk("NULL Pointer\n"); return -EINVAL; } err |= set_cpld_for_tvp7002(); if (err) { printk("Failed to set cpld bit.\n"); return -EINVAL; } ch_id = ((struct decoder_device *)dec)->channel_id; dev_dbg(tvp7002_i2c_dev[ch_id], "Start of tvp7002_setstd..\n"); input_idx = tvp7002_channel_info[ch_id].params.inputidx; if (id == NULL) { dev_err(tvp7002_i2c_dev[ch_id], "NULL pointer.\n"); return -EINVAL; } for (i = 0; i < tvp7002_configuration[ch_id].input[input_idx]. no_of_standard; i++) { standard = &tvp7002_configuration[ch_id].input[input_idx]. standard[i]; if (standard->id & *id) { break; } } if (i == tvp7002_configuration[ch_id].input[input_idx].no_of_standard) { dev_err(tvp7002_i2c_dev[ch_id], "Invalid id...\n"); return -EINVAL; } ths7353_setvalue(); tvp7002formats = &tvp7002_configuration[ch_id].input[input_idx].format[i]; err = tvp7002_set_format_params(tvp7002formats, dec); if (err < 0) { dev_err(tvp7002_i2c_dev[ch_id], "Set standard failed\n"); return err; } /* Lock the structure variable and assign std to the member variable */ tvp7002_channel_info[ch_id].params.std = *id; dev_dbg(tvp7002_i2c_dev[ch_id], "End of tvp7002 set standard...\n"); return err; }