Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c7c9370 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] v4l2-subdev: remove core.s_config and v4l2_i2c_new_subdev_cfg()



The core.s_config op was meant for legacy drivers that needed to work with old
pre-2.6.26 kernels. This is no longer relevant. Unfortunately, this op was
incorrectly called from several drivers.

Replace those occurences with proper i2c_board_info structs and call
v4l2_i2c_new_subdev_board.

After these changes v4l2_i2c_new_subdev_cfg() was no longer used, so remove
that function as well.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ecb71d26
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -2001,6 +2001,11 @@ static int cafe_pci_probe(struct pci_dev *pdev,
		.min_width = 320,
		.min_width = 320,
		.min_height = 240,
		.min_height = 240,
	};
	};
	struct i2c_board_info ov7670_info = {
		.type = "ov7670",
		.addr = 0x42,
		.platform_data = &sensor_cfg,
	};


	/*
	/*
	 * Start putting together one of our big camera structures.
	 * Start putting together one of our big camera structures.
@@ -2062,9 +2067,9 @@ static int cafe_pci_probe(struct pci_dev *pdev,
	if (dmi_check_system(olpc_xo1_dmi))
	if (dmi_check_system(olpc_xo1_dmi))
		sensor_cfg.clock_speed = 45;
		sensor_cfg.clock_speed = 45;


	cam->sensor_addr = 0x42;
	cam->sensor_addr = ov7670_info.addr;
	cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter,
	cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter,
			"ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL);
			&ov7670_info, NULL);
	if (cam->sensor == NULL) {
	if (cam->sensor == NULL) {
		ret = -ENODEV;
		ret = -ENODEV;
		goto out_smbus;
		goto out_smbus;
+6 −16
Original line number Original line Diff line number Diff line
@@ -1682,20 +1682,6 @@ static int cx25840_log_status(struct v4l2_subdev *sd)
	return 0;
	return 0;
}
}


static int cx25840_s_config(struct v4l2_subdev *sd, int irq, void *platform_data)
{
	struct cx25840_state *state = to_state(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);

	if (platform_data) {
		struct cx25840_platform_data *pdata = platform_data;

		state->pvr150_workaround = pdata->pvr150_workaround;
		set_input(client, state->vid_input, state->aud_input);
	}
	return 0;
}

static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status,
static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status,
			       bool *handled)
			       bool *handled)
{
{
@@ -1787,7 +1773,6 @@ static const struct v4l2_ctrl_ops cx25840_ctrl_ops = {


static const struct v4l2_subdev_core_ops cx25840_core_ops = {
static const struct v4l2_subdev_core_ops cx25840_core_ops = {
	.log_status = cx25840_log_status,
	.log_status = cx25840_log_status,
	.s_config = cx25840_s_config,
	.g_chip_ident = cx25840_g_chip_ident,
	.g_chip_ident = cx25840_g_chip_ident,
	.g_ctrl = v4l2_subdev_g_ctrl,
	.g_ctrl = v4l2_subdev_g_ctrl,
	.s_ctrl = v4l2_subdev_s_ctrl,
	.s_ctrl = v4l2_subdev_s_ctrl,
@@ -1974,7 +1959,6 @@ static int cx25840_probe(struct i2c_client *client,
	state->vid_input = CX25840_COMPOSITE7;
	state->vid_input = CX25840_COMPOSITE7;
	state->aud_input = CX25840_AUDIO8;
	state->aud_input = CX25840_AUDIO8;
	state->audclk_freq = 48000;
	state->audclk_freq = 48000;
	state->pvr150_workaround = 0;
	state->audmode = V4L2_TUNER_MODE_LANG1;
	state->audmode = V4L2_TUNER_MODE_LANG1;
	state->vbi_line_offset = 8;
	state->vbi_line_offset = 8;
	state->id = id;
	state->id = id;
@@ -2034,6 +2018,12 @@ static int cx25840_probe(struct i2c_client *client,
	v4l2_ctrl_cluster(2, &state->volume);
	v4l2_ctrl_cluster(2, &state->volume);
	v4l2_ctrl_handler_setup(&state->hdl);
	v4l2_ctrl_handler_setup(&state->hdl);


	if (client->dev.platform_data) {
		struct cx25840_platform_data *pdata = client->dev.platform_data;

		state->pvr150_workaround = pdata->pvr150_workaround;
	}

	cx25840_ir_probe(sd);
	cx25840_ir_probe(sd);
	return 0;
	return 0;
}
}
+10 −8
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#include <media/saa7115.h>
#include <media/saa7115.h>
#include <media/tvp5150.h>
#include <media/tvp5150.h>
#include <media/tvaudio.h>
#include <media/tvaudio.h>
#include <media/mt9v011.h>
#include <media/i2c-addr.h>
#include <media/i2c-addr.h>
#include <media/tveeprom.h>
#include <media/tveeprom.h>
#include <media/v4l2-common.h>
#include <media/v4l2-common.h>
@@ -1917,11 +1918,6 @@ static unsigned short tvp5150_addrs[] = {
	I2C_CLIENT_END
	I2C_CLIENT_END
};
};


static unsigned short mt9v011_addrs[] = {
	0xba >> 1,
	I2C_CLIENT_END
};

static unsigned short msp3400_addrs[] = {
static unsigned short msp3400_addrs[] = {
	0x80 >> 1,
	0x80 >> 1,
	0x88 >> 1,
	0x88 >> 1,
@@ -2624,11 +2620,17 @@ void em28xx_card_setup(struct em28xx *dev)
			"tvp5150", 0, tvp5150_addrs);
			"tvp5150", 0, tvp5150_addrs);


	if (dev->em28xx_sensor == EM28XX_MT9V011) {
	if (dev->em28xx_sensor == EM28XX_MT9V011) {
		struct mt9v011_platform_data pdata;
		struct i2c_board_info mt9v011_info = {
			.type = "mt9v011",
			.addr = 0xba >> 1,
			.platform_data = &pdata,
		};
		struct v4l2_subdev *sd;
		struct v4l2_subdev *sd;


		sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
		pdata.xtal = dev->sensor_xtal;
			 &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs);
		sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
		v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal);
				&mt9v011_info, NULL);
	}
	}




+7 −2
Original line number Original line Diff line number Diff line
@@ -300,10 +300,15 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
				adap, type, 0, I2C_ADDRS(hw_addrs[idx]));
				adap, type, 0, I2C_ADDRS(hw_addrs[idx]));
	} else if (hw == IVTV_HW_CX25840) {
	} else if (hw == IVTV_HW_CX25840) {
		struct cx25840_platform_data pdata;
		struct cx25840_platform_data pdata;
		struct i2c_board_info cx25840_info = {
			.type = "cx25840",
			.addr = hw_addrs[idx],
			.platform_data = &pdata,
		};


		pdata.pvr150_workaround = itv->pvr150_workaround;
		pdata.pvr150_workaround = itv->pvr150_workaround;
		sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev,
		sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap,
				adap, type, 0, &pdata, hw_addrs[idx], NULL);
				&cx25840_info, NULL);
	} else {
	} else {
		sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
		sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
				adap, type, hw_addrs[idx], NULL);
				adap, type, hw_addrs[idx], NULL);
+34 −20
Original line number Original line Diff line number Diff line
@@ -12,17 +12,41 @@
#include <asm/div64.h>
#include <asm/div64.h>
#include <media/v4l2-device.h>
#include <media/v4l2-device.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-chip-ident.h>
#include "mt9v011.h"
#include <media/mt9v011.h>


MODULE_DESCRIPTION("Micron mt9v011 sensor driver");
MODULE_DESCRIPTION("Micron mt9v011 sensor driver");
MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");



static int debug;
static int debug;
module_param(debug, int, 0);
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0-2)");
MODULE_PARM_DESC(debug, "Debug level (0-2)");


#define R00_MT9V011_CHIP_VERSION	0x00
#define R01_MT9V011_ROWSTART		0x01
#define R02_MT9V011_COLSTART		0x02
#define R03_MT9V011_HEIGHT		0x03
#define R04_MT9V011_WIDTH		0x04
#define R05_MT9V011_HBLANK		0x05
#define R06_MT9V011_VBLANK		0x06
#define R07_MT9V011_OUT_CTRL		0x07
#define R09_MT9V011_SHUTTER_WIDTH	0x09
#define R0A_MT9V011_CLK_SPEED		0x0a
#define R0B_MT9V011_RESTART		0x0b
#define R0C_MT9V011_SHUTTER_DELAY	0x0c
#define R0D_MT9V011_RESET		0x0d
#define R1E_MT9V011_DIGITAL_ZOOM	0x1e
#define R20_MT9V011_READ_MODE		0x20
#define R2B_MT9V011_GREEN_1_GAIN	0x2b
#define R2C_MT9V011_BLUE_GAIN		0x2c
#define R2D_MT9V011_RED_GAIN		0x2d
#define R2E_MT9V011_GREEN_2_GAIN	0x2e
#define R35_MT9V011_GLOBAL_GAIN		0x35
#define RF1_MT9V011_CHIP_ENABLE		0xf1

#define MT9V011_VERSION			0x8232
#define MT9V011_REV_B_VERSION		0x8243

/* supported controls */
/* supported controls */
static struct v4l2_queryctrl mt9v011_qctrl[] = {
static struct v4l2_queryctrl mt9v011_qctrl[] = {
	{
	{
@@ -469,23 +493,6 @@ static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
	return 0;
	return 0;
}
}


static int mt9v011_s_config(struct v4l2_subdev *sd, int dumb, void *data)
{
	struct mt9v011 *core = to_mt9v011(sd);
	unsigned *xtal = data;

	v4l2_dbg(1, debug, sd, "s_config called\n");

	if (xtal) {
		core->xtal = *xtal;
		v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n",
			 *xtal / 1000000, (*xtal / 1000) % 1000);
	}

	return 0;
}


#ifdef CONFIG_VIDEO_ADV_DEBUG
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int mt9v011_g_register(struct v4l2_subdev *sd,
static int mt9v011_g_register(struct v4l2_subdev *sd,
			      struct v4l2_dbg_register *reg)
			      struct v4l2_dbg_register *reg)
@@ -536,7 +543,6 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = {
	.g_ctrl = mt9v011_g_ctrl,
	.g_ctrl = mt9v011_g_ctrl,
	.s_ctrl = mt9v011_s_ctrl,
	.s_ctrl = mt9v011_s_ctrl,
	.reset = mt9v011_reset,
	.reset = mt9v011_reset,
	.s_config = mt9v011_s_config,
	.g_chip_ident = mt9v011_g_chip_ident,
	.g_chip_ident = mt9v011_g_chip_ident,
#ifdef CONFIG_VIDEO_ADV_DEBUG
#ifdef CONFIG_VIDEO_ADV_DEBUG
	.g_register = mt9v011_g_register,
	.g_register = mt9v011_g_register,
@@ -596,6 +602,14 @@ static int mt9v011_probe(struct i2c_client *c,
	core->height = 480;
	core->height = 480;
	core->xtal = 27000000;	/* Hz */
	core->xtal = 27000000;	/* Hz */


	if (c->dev.platform_data) {
		struct mt9v011_platform_data *pdata = c->dev.platform_data;

		core->xtal = pdata->xtal;
		v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n",
			core->xtal / 1000000, (core->xtal / 1000) % 1000);
	}

	v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n",
	v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n",
		 c->addr << 1, c->adapter->name, version);
		 c->addr << 1, c->adapter->name, version);


Loading