drivers/media/usb/cx231xx/cx231xx-cards.c

Source file repositories/reference/linux-study-clean/drivers/media/usb/cx231xx/cx231xx-cards.c

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/cx231xx/cx231xx-cards.c
Extension
.c
Size
52105 bytes
Lines
1987
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct eeprom {
				struct tveeprom tvee;
				u8 eeprom[256];
				struct i2c_client client;
			};
			struct eeprom *e = kzalloc_obj(*e);

			if (e == NULL) {
				dev_err(dev->dev,
					"failed to allocate memory to read eeprom\n");
				break;
			}
			e->client.adapter = cx231xx_get_i2c_adap(dev, I2C_1_MUX_1);
			e->client.addr = 0xa0 >> 1;

			read_eeprom(dev, &e->client, e->eeprom, sizeof(e->eeprom));
			tveeprom_hauppauge_analog(&e->tvee, e->eeprom + 0xc0);
			kfree(e);
			break;
		}
	}

}

/*
 * cx231xx_config()
 * inits registers with sane defaults
 */
int cx231xx_config(struct cx231xx *dev)
{
	/* TBD need to add cx231xx specific code */

	return 0;
}

/*
 * cx231xx_config_i2c()
 * configure i2c attached devices
 */
void cx231xx_config_i2c(struct cx231xx *dev)
{
	/* u32 input = INPUT(dev->video_input)->vmux; */

	call_all(dev, video, s_stream, 1);
}

static void cx231xx_unregister_media_device(struct cx231xx *dev)
{
#ifdef CONFIG_MEDIA_CONTROLLER
	if (dev->media_dev) {
		media_device_unregister(dev->media_dev);
		media_device_cleanup(dev->media_dev);
		kfree(dev->media_dev);
		dev->media_dev = NULL;
	}
#endif
}

/*
 * cx231xx_realease_resources()
 * unregisters the v4l2,i2c and usb devices
 * called when the device gets disconnected or at module unload
*/
void cx231xx_release_resources(struct cx231xx *dev)
{
	cx231xx_ir_exit(dev);

	cx231xx_release_analog_resources(dev);

	cx231xx_remove_from_devlist(dev);

	/* Release I2C buses */
	cx231xx_dev_uninit(dev);

	/* delete v4l2 device */
	v4l2_device_unregister(&dev->v4l2_dev);

	cx231xx_unregister_media_device(dev);

	/* Mark device as unused */
	clear_bit(dev->devno, &cx231xx_devused);
}

static int cx231xx_media_device_init(struct cx231xx *dev,
				      struct usb_device *udev)
{
#ifdef CONFIG_MEDIA_CONTROLLER
	struct media_device *mdev;

	mdev = kzalloc_obj(*mdev);

Annotation

Implementation Notes