Esempio n. 1
0
/*
 * ip5170dpf_init
 *	Called to add the devices which we have on this board
 */
static int __init ip5170dpf_init(void)
{
	ubi_gpio_init();

	vdc_tio_init();

	printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
	platform_add_devices(ip5170dpf_devices, ARRAY_SIZE(ip5170dpf_devices));

	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip5170dpf_i2c_board_info, ARRAY_SIZE(ip5170dpf_i2c_board_info));

	return 0;
}
Esempio n. 2
0
/*
 * ip7145dpf_init
 *	Called to add the devices which we have on this board
 */
static int __init ip7145dpf_init(void)
{
	int ret;
	struct platform_device *audio_dev;

	if (ubicom32_flash_single_init()) {
		printk(KERN_ERR "%s: could not initialize flash controller\n", __FUNCTION__);
	}

	ubi_gpio_init();

#ifdef CONFIG_UIO_UBICOM32RING
	ring_tio_init("decoder_ring");
#endif

	/*
	 * Start the flash driver
	 */
	ubicom32_flash_single_init();

	/*
	 * Start up the video driver first
	 */
	vdc_tio_init(NULL);

	/*
	 * Take over holding of the power from the system
	 */
	ret = gpio_request(GPIO_RE_5, "power_hold");
	if (ret) {
		printk(KERN_ERR "%s: could not request power hold GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RE_5, 1);
	mach_power_off = ip7145dpf_power_off;

	/*
	 * USB SEL_HOST_USB line
	 */
	ret = gpio_request(GPIO_RF_11, "SEL_HOST_USB");
	if (ret) {
		printk(KERN_ERR "%s: could not request SEL_HOST_USB GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RF_11, 0);

	/*
	 * Setup audio
	 */
	audio_dev = audio_device_alloc("snd-ubi32-generic", "audio", "audio-i2sout", 0);
	if (audio_dev) {
		platform_device_register(audio_dev);
	}

	/*
	 * Register all of the devices we have on this board
	 */
	printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
	platform_add_devices(ip7145dpf_devices, ARRAY_SIZE(ip7145dpf_devices));

	/*
	 * Register all of the devices which sit on the I2C bus
	 */
	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip7145dpf_i2c_board_info, ARRAY_SIZE(ip7145dpf_i2c_board_info));

	/*
	 * We have to initialize the SPI after the I2C IOB gets setup. SPI is initialized in
	 * ip7145dpf_u72_setup
	 */

	return 0;
}
Esempio n. 3
0
/*
 * ip7500av_init
 *	Called to add the devices which we have on this board
 */
static int __init ip7500av_init(void)
{
	struct platform_device *audio_dev;
	struct platform_device *audio_dev2;
	struct ubi32_cs4384_platform_data *cs4384_pd;

	if (ubicom32_flash_single_init()) {
		printk(KERN_ERR "%s: could not initialize flash controller\n", __FUNCTION__);
	}

	board_init();

	ubi_gpio_init();

	/*
	 * Start the flash driver
	 */
	ubicom32_flash_single_init();

	vdc_tio_init(NULL);

	printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
	platform_add_devices(ip7500av_devices, ARRAY_SIZE(ip7500av_devices));

	/*
	 * CS4384 DAC
	 */
	audio_dev = audio_device_alloc("snd-ubi32-cs4384", "audio", "audio-i2sout",
			sizeof(struct ubi32_cs4384_platform_data));
	if (audio_dev) {
		/*
		 * Attempt to figure out a good divisor.  This will only work
		 * assuming the core frequency is compatible.
		 */
		int i;
		unsigned int freq = processor_frequency();
		for (i = 0; i < ARRAY_SIZE(ip7500av_cs4384_mclk_entries); i++) {
			unsigned int div;
			unsigned int rate = ip7500av_cs4384_mclk_entries[i].rate / 1000;
			div = ((freq / rate) + 500) / 1000;
			ip7500av_cs4384_mclk_entries[i].div = div;
			printk("CS4384 mclk %d rate %u000Hz div %u act %u\n", i, rate, div, freq / div);
		}

		cs4384_pd = audio_device_priv(audio_dev);
		cs4384_pd->mclk_src = UBI32_CS4384_MCLK_PWM_0;
		cs4384_pd->n_mclk = ARRAY_SIZE(ip7500av_cs4384_mclk_entries);
		cs4384_pd->mclk_entries = ip7500av_cs4384_mclk_entries;
		ip7500av_i2c_board_info[0].platform_data = audio_dev;

		/*
		 * Reset the DAC
		 */
		if (gpio_request(GPIO_RF_4, "DAC Reset") == 0) {
			gpio_direction_output(GPIO_RF_4, 0);
			udelay(1);
			gpio_direction_output(GPIO_RF_4, 1);
		} else {
			printk("Unable to request DAC reset GPIO\n");
		}
	}

	/*
	 * SPDIF port
	 */
	audio_dev2 = audio_device_alloc("snd-ubi32-generic", "audio", "audio-spdifout", 0);
	if (audio_dev2) {
		platform_device_register(audio_dev2);
	}

	/*
	 * Register all of the devices which sit on the I2C bus
	 */
	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip7500av_i2c_board_info, ARRAY_SIZE(ip7500av_i2c_board_info));

	printk(KERN_INFO "IP7500 Audio/Video Board\n");
	return 0;
}
Esempio n. 4
0
/*
 * ip7500iap_init_offboard_video
 */
static int __init ip7500iap_init_offboard_video(struct lcd_adapter_info *info)
{
	struct i2c_adapter *adap;

#ifdef CONFIG_FB_UBICOM32
	/*
	 * If we are autodetect then bring up the display now
	 */
#ifdef CONFIG_DISPLAY_AUTODETECT
	/*
	 * Check for 8000-0210 PPI-TFP410
	 */
	if (info->panel_type == 12) {
		tfp410_init(0, 0x38, GPIO_RD_1);
	}

	/*
	 * Check for 8000-0310 PPI-ADV7393
	 */
	if (info->panel_type == 11) {
		adv7393_init(0, 0x2B, GPIO_RD_1);
	}

	/*
	 * Use the VDC for devices which are HV/TCON
	 */
	if (info->driver_type[0] & (LCD_ADAPTER_DTYPE0_HV | LCD_ADAPTER_DTYPE0_TCON | LCD_ADAPTER_DTYPE0_DE)) {
		struct ubicom32fb_platform_data *pd = &ip7500iap_ubicom32fb_platform_data;

		memset(pd, 0, sizeof(*pd));

		if (info->driver_type[0] & LCD_ADAPTER_DTYPE0_HV) {
			pd->mode = UBICOM32FB_MODE_SYNC;
		} else if (info->driver_type[0] & LCD_ADAPTER_DTYPE0_TCON) {
			pd->mode = UBICOM32FB_MODE_TCON;
		} else if (info->driver_type[0] & LCD_ADAPTER_DTYPE0_DE) {
			pd->mode = UBICOM32FB_MODE_DE;
		}

		pd->flags |= UBICOM32FB_PLATFORM_DATA_FLAG_TIMING | UBICOM32FB_PLATFORM_DATA_FLAG_MODE;
		pd->hfp = info->hfp;
		pd->hsync = info->hsync;
		pd->hbp = info->hbp;
		pd->vfp = info->vfp;
		pd->vsync = info->vsync;
		pd->vbp = info->vbp;
		pd->fclk = info->fclk;

		if (info->active_h && info->active_w) {
			pd->flags |= UBICOM32FB_PLATFORM_DATA_FLAG_DIM;
			pd->height_mm = info->active_h / 10;
			pd->width_mm = info->active_w / 10;
		}

		vdc_tio_init(pd);
	} else {
		/*
		 * Use the VFB device for other displays
		 */
		platform_device_register(&ip7500iap_vfb_device);
	}
#endif

	/*
	 * Start up the LCD Power driver if needed
	 */
	if (info->driver_type[2] & LCD_ADAPTER_DTYPE2_POWER) {
		if (info->lcd_power_pin == 38) {
			ip7500iap_lcdpower_data.vgh_gpio = GPIO_RD_2;
			platform_device_register(&ip7500iap_lcdpower_device);
		} else {
			printk(KERN_WARNING "%s: don't know about LCD power pin %u\n", __FUNCTION__, info->lcd_power_pin);
		}
	}

	/*
	 * Start up the backlight driver if needed
	 */
	if (info->backlight_type == 0x01) {
		ip7500iap_backlight_data.pwm_prescale = 7;
		platform_device_register(&ip7500iap_backlight_device);
	} else if (info->backlight_type == 0x02) {
		platform_device_register(&ip7500iap_backlight_device);
	}

	printk(KERN_INFO "%s: registering LCD Adapter Board resources\n", __FUNCTION__);

	adap = i2c_get_adapter(0);
	if (!adap) {
		printk(KERN_WARNING "%s: Failed to get i2c adapter\n", __FUNCTION__);
		return -ENODEV;
	}

	/*
	 * Offboard touch controller if needed.
	 */
	if (info->touch_addr) {
		ip7500iap_touch_i2c_board_info.addr = info->touch_addr;
		i2c_new_device(adap, &ip7500iap_touch_i2c_board_info);
	}

	i2c_put_adapter(adap);
#endif	// CONFIG_FB_UBICOM32

	return 0;
}
Esempio n. 5
0
/*
 * ip7500iap_init
 *	Called to add the devices which we have on this board
 */
static int __init ip7500iap_init(void)
{
	struct platform_device *audio_dev;
	struct platform_device *audio_dev2;
	int ret;

	if (ubicom32_flash_single_init()) {
		printk(KERN_ERR "%s: could not initialize flash controller\n", __FUNCTION__);
	}

	board_init();

	ubi_gpio_init();

	/*
	 * Start the flash driver
	 */
	ubicom32_flash_single_init();

	/*
	 * Hold the POWER_HOLD line
	 */
	ret = gpio_request(GPIO_RF_11, "POWER_HOLD");
	if (ret) {
		printk(KERN_ERR "%s: could not request POWER_HOLD GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RF_11, 1);
	mach_power_off = ip7500iap_power_off;

#ifndef CONFIG_DISPLAY_AUTODETECT
	/*
	 * Bring up video
	 */
	vdc_tio_fill_platform_data(&ip7500iap_ubicom32fb_platform_data);

	printk(KERN_INFO "%s: initializing video driver\n", __FUNCTION__);

	vdc_tio_init(&ip7500iap_ubicom32fb_platform_data);
#endif

	/*
	 * DAC nRESET line
	 */
	ret = gpio_request(GPIO_RE_7, "DAC_nRESET");
	if (ret) {
		printk(KERN_ERR "%s: could not request DAC_nRESET GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RE_7, 0);
	udelay(1);
	gpio_set_value(GPIO_RE_7, 1);

	/*
	 * Bring up any SDIO slots
	 */
	ip7500iap_portb_sd_init();
	ip7500iap_portf_sd_init();

#ifdef CONFIG_SOUND
	/*
	 * Bring up audio devices
	 */
	platform_add_devices(ip7500iap_devices, ARRAY_SIZE(ip7500iap_devices));

	audio_dev = audio_device_alloc("snd-ubi32-cs4350", "audio", "audio-i2sout", 0);
	if (audio_dev) {
		ip7500iap_i2c_board_info[0].platform_data = audio_dev;
	}

	audio_dev2 = audio_device_alloc("snd-ubi32-generic", "audio", "audio-spdifout", 0);
	if (audio_dev2) {
		platform_device_register(audio_dev2);
	}

	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip7500iap_i2c_board_info, ARRAY_SIZE(ip7500iap_i2c_board_info));
#endif

	printk(KERN_INFO "IP7500 Internet Audio Player\n");
	return 0;
}
Esempio n. 6
0
/*
 * ip7160dpf_init
 *	Called to add the devices which we have on this board
 */
static int __init ip7160dpf_init(void)
{
	int ret;
	struct platform_device *audio_dev;

	if (ubicom32_flash_single_init()) {
		printk(KERN_ERR "%s: could not initialize flash controller\n", __FUNCTION__);
	}

	ubi_gpio_init();

	/*
	 * Start the flash driver
	 */
	ubicom32_flash_single_init();

	/*
	 * Hold the POWER_HOLD line
	 */
	ret = gpio_request(GPIO_RF_14, "POWER_HOLD");
	if (ret) {
		printk(KERN_ERR "%s: could not request POWER_HOLD GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RF_14, 1);
	mach_power_off = ip7160dpf_power_off;

	/*
	 * USB SEL_HOST_USB line
	 */
	ret = gpio_request(GPIO_RI_13, "SEL_HOST_USB");
	if (ret) {
		printk(KERN_ERR "%s: could not request SEL_HOST_USB GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RI_13, 0);

	/*
	 * USB/DAC nRESET line
	 */
	ret = gpio_request(GPIO_RI_3, "USB_DAC_nRESET");
	if (ret) {
		printk(KERN_ERR "%s: could not request USB_DAC_nRESET GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RI_3, 0);
	udelay(1);
	gpio_direction_output(GPIO_RI_3, 1);

	/*
	 * I2C BUS2 Disable line
	 */
	ret = gpio_request(GPIO_RI_0, "DISABLE_BUS2");
	if (ret) {
		printk(KERN_ERR "%s: could not request DISABLE_BUS2 GPIO\n", __FUNCTION__);
	}
	gpio_direction_output(GPIO_RI_0, 0);

	vdc_tio_init(NULL);

	printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
	platform_add_devices(ip7160dpf_devices, ARRAY_SIZE(ip7160dpf_devices));

	/*
	 * Allocate the audio driver if we can
	 */
	audio_dev = audio_device_alloc("snd-ubi32-cs4350", "audio-i2sout", 0);
	if (audio_dev) {
		ip7160dpf_i2c_board_info[0].platform_data = audio_dev;
	}

	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip7160dpf_i2c_board_info, ARRAY_SIZE(ip7160dpf_i2c_board_info));

	return 0;
}