static void cx18_load_and_init_modules(struct cx18 *cx)
{
	u32 hw = cx->card->hw_all;
	int i;

#ifdef MODULE
	/* load modules */
#ifndef CONFIG_MEDIA_TUNER
	hw = cx18_request_module(cx, hw, "tuner", CX18_HW_TUNER);
#endif
#ifndef CONFIG_VIDEO_CS5345
	hw = cx18_request_module(cx, hw, "cs5345", CX18_HW_CS5345);
#endif
#endif

	/* check which i2c devices are actually found */
	for (i = 0; i < 32; i++) {
		u32 device = 1 << i;

		if (!(device & hw))
			continue;
		if (device == CX18_HW_GPIO || device == CX18_HW_TVEEPROM ||
		    device == CX18_HW_CX23418 || device == CX18_HW_DVB) {
			/* These 'devices' do not use i2c probing */
			cx->hw_flags |= device;
			continue;
		}
		cx18_i2c_register(cx, i);
		if (cx18_i2c_hw_addr(cx, device) > 0)
			cx->hw_flags |= device;
	}

	hw = cx->hw_flags;
}
Exemplo n.º 2
0
/* Calls i2c device based on CX18_HW_ flag. If hw == 0, then do nothing.
   If hw == CX18_HW_GPIO then call the gpio handler. */
int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
{
	int addr;

	if (hw == CX18_HW_GPIO || hw == 0)
		return 0;
	if (hw == CX18_HW_CX23418)
		return cx18_av_cmd(cx, cmd, arg);

	addr = cx18_i2c_hw_addr(cx, hw);
	if (addr < 0) {
		CX18_ERR("i2c hardware 0x%08x (%s) not found for cmd 0x%x!\n",
			       hw, cx18_i2c_hw_name(hw), cmd);
		return addr;
	}
	return cx18_call_i2c_client(cx, addr, cmd, arg);
}