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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cx231xx.hlinux/init.hlinux/module.hlinux/slab.hlinux/delay.hlinux/i2c.hmedia/tuner.hmedia/tveeprom.hmedia/v4l2-common.hmedia/drv-intf/cx25840.hmedia/dvb-usb-ids.hxc5000.htda18271.h
Detected Declarations
struct eepromfunction cx231xx_tuner_callbackfunction cx231xx_reset_outfunction cx231xx_enable_OSCfunction cx231xx_sleep_s5h1432function cx231xx_set_modelfunction cx231xx_pre_card_setupfunction cx231xx_config_tunerfunction read_eepromfunction cx231xx_card_setupfunction cx231xx_configfunction cx231xx_config_i2cfunction cx231xx_unregister_media_devicefunction cx231xx_realease_resourcesfunction cx231xx_media_device_initfunction cx231xx_init_devfunction request_module_asyncfunction request_modulesfunction flush_request_modulesfunction cx231xx_init_v4l2function cx231xx_usb_probefunction cx231xx_usb_disconnectexport cx231xx_tuner_callback
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
- Immediate include surface: `cx231xx.h`, `linux/init.h`, `linux/module.h`, `linux/slab.h`, `linux/delay.h`, `linux/i2c.h`, `media/tuner.h`, `media/tveeprom.h`.
- Detected declarations: `struct eeprom`, `function cx231xx_tuner_callback`, `function cx231xx_reset_out`, `function cx231xx_enable_OSC`, `function cx231xx_sleep_s5h1432`, `function cx231xx_set_model`, `function cx231xx_pre_card_setup`, `function cx231xx_config_tuner`, `function read_eeprom`, `function cx231xx_card_setup`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.