Пример #1
0
int __init panel_fwvga_43_init(struct omap_dss_device *disp_data)
{
    const struct archos_display_config *disp_cfg;
    int ret = -ENODEV;
    printk("panel_fwvga_43_init\n");

    disp_cfg = omap_get_config( ARCHOS_TAG_DISPLAY, struct archos_display_config );
    if (disp_cfg == NULL)
        return ret;

    if ( hardware_rev >= disp_cfg->nrev ) {
        printk(KERN_DEBUG "archos_display_init: hardware_rev (%i) >= nrev (%i)\n",
               hardware_rev, disp_cfg->nrev);
        return ret;
    }

    *disp_data = lg_fwvga_43_panel;
    display_gpio = disp_cfg->rev[hardware_rev];

    archos_gpio_init_output(&display_gpio.lcd_pwon, "LCD_PWON");
    archos_gpio_init_output(&display_gpio.lcd_rst, "LCD_RST");

#if !defined(CONFIG_FB_OMAP_BOOTLOADER_INIT)
    panel_disable(&lg_fwvga_43_panel);
#endif

    return 0;
}
void __init archos_usb_ehci_init(void)
{
	const struct archos_usb_config *usb_cfg;
	usb_cfg = omap_get_config( ARCHOS_TAG_USB, struct archos_usb_config );
	if (usb_cfg == NULL) {
		printk(KERN_DEBUG "%s: no board configuration found\n", __FUNCTION__);
		return;
	}
	if ( hardware_rev >= usb_cfg->nrev ) {
		printk(KERN_DEBUG "%s: hardware_rev (%i) >= nrev (%i)\n",
			__FUNCTION__, hardware_rev, usb_cfg->nrev);
		return;
	}

	if ( GPIO_PIN (usb_cfg->rev[hardware_rev].enable_usb_hub) != 0 ) {
		gio_hub_enable = usb_cfg->rev[hardware_rev].enable_usb_hub;
		archos_gpio_init_output(&gio_hub_enable, "hub enable");
	}

	if ( GPIO_PIN (usb_cfg->rev[hardware_rev].enable_5v) != 0 ) {
		gio_5v_enable = usb_cfg->rev[hardware_rev].enable_5v;
		archos_gpio_init_output(&gio_5v_enable, "5v enable");
	}

	if ( GPIO_PIN (usb_cfg->rev[hardware_rev].enable_usb_ehci) != 0 ) {

		gio_ehci_enable = usb_cfg->rev[hardware_rev].enable_usb_ehci;

		archos_gpio_init_output(&gio_ehci_enable, "ehci enable");

		archos_enable_ehci( 0 );

		setup_ehci_io_mux();
	}

#if     defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
	if (platform_device_register(&ehci_device) < 0) {
		printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
		return;
	}
#endif

	if (platform_device_register(&archos_ehci_device) < 0)
		printk(KERN_ERR "Unable to register Archos EHCI device\n");

	device_create_file(&archos_ehci_device.dev, &dev_attr_ehci_enable);
	device_create_file(&archos_ehci_device.dev, &dev_attr_hub_enable);

	platform_driver_register(&archos_ehci_driver);

}
Пример #3
0
static int __init panel_init(void)
{
	if (!have_panel)
		return -ENODEV;
	
	pr_debug("panel_init\n");
	
	archos_gpio_init_output( display_gpio.lcd_pwon, "lcd_pwon" );
	archos_gpio_init_output( display_gpio.bridge_en, "bridge_en" );

	if (gpio_is_valid(display_gpio.lcd_stdby)){
		if (gpio_request(display_gpio.lcd_stdby, "dc_en") < 0) {
			pr_debug("gpio_init_output: cannot acquire GPIO%d \n", display_gpio.lcd_stdby);
			return -1;
		}
	}
	omap_mux_init_signal("gpmc_ncs4.gpio_101", OMAP_PIN_OUTPUT );
	gpio_direction_output(display_gpio.lcd_stdby, 0);

	archos_gpio_init_output( display_gpio.lcd_avdd_en, "bkl_en" );

	if (display_gpio.use_fixed_bkl) {
		if (gpio_is_valid(display_gpio.bkl_en)) {
			archos_gpio_init_output(display_gpio.bkl_en, "bkl_en");
			gpio_set_value( display_gpio.bkl_en, 1);
		}
		if (gpio_is_valid(display_gpio.bkl_pwr)) {
			archos_gpio_init_output(display_gpio.bkl_pwr, "bkl_power");
			gpio_set_value( display_gpio.bkl_pwr, 0);
		}
	}

	if (gpio_is_valid(display_gpio.lcd_pwon))
		gpio_set_value( display_gpio.lcd_pwon, 0);
	if (gpio_is_valid(display_gpio.bridge_en))
		gpio_set_value( display_gpio.bridge_en, 0);
	if (gpio_is_valid(display_gpio.lcd_stdby))
		gpio_set_value( display_gpio.lcd_stdby, 1);
	if (gpio_is_valid(display_gpio.lcd_avdd_en))
		gpio_set_value( display_gpio.lcd_avdd_en, 1);

	/* regulators */
	lcd_1v8 = regulator_get(&lcd_device.dev, "LCD_1V8");
	if (IS_ERR(lcd_1v8))
		dev_dbg(&lcd_device.dev, "no LCD_1V8 for this display\n");
	lcd_vcc = regulator_get(&lcd_device.dev, "LCD_VCC");
	if (IS_ERR(lcd_vcc))
		dev_dbg(&lcd_device.dev, "no LCD_VCC for this display\n");
	
	return 0;
}
void __init archos_usb_ohci_init(void)
{
#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)

	const struct archos_fsusb_config *usb_cfg;
	
	usb_cfg = omap_get_config( ARCHOS_TAG_FSUSB, struct archos_fsusb_config );
	if (usb_cfg == NULL) {
		printk(KERN_DEBUG "%s: no board configuration found\n", __FUNCTION__);
		return;
	}
	if ( hardware_rev >= usb_cfg->nrev ) {
		printk(KERN_DEBUG "%s: hardware_rev (%i) >= nrev (%i)\n",
			__FUNCTION__, hardware_rev, usb_cfg->nrev);
		return;
	}

	printk("archos_usb_ohci_init\n");

	if ( GPIO_EXISTS(usb_cfg->rev[hardware_rev].enable_usb_ohci)) {

		gio_ohci_enable = usb_cfg->rev[hardware_rev].enable_usb_ohci;

		archos_gpio_init_output( &gio_ohci_enable, "fsusb_enable" );

		archos_enable_ohci( 0 );

		gio_ohci_suspend = usb_cfg->rev[hardware_rev].suspend;
		archos_gpio_init_output( &gio_ohci_suspend, "fsusb_suspend" );
		gpio_set_value( GPIO_PIN(gio_ohci_suspend), 0);

		archos_enable_ohci( 1 );

	}

	omap_cfg_reg(AG8_3430_USB2FS_RCV);
	omap_cfg_reg(AH8_3430_USB2FS_VM);
	omap_cfg_reg(AB2_3430_USB2FS_VP);
	omap_cfg_reg(V3_3430_USB2FS_EN);

	if (platform_device_register(&ohci_device) < 0) {
		printk(KERN_ERR "Unable to register FS-USB (OHCI) device\n");
		return;
	}
	
	device_create_file(&ohci_device.dev, &dev_attr_fsusb_enable);
	device_create_file(&ohci_device.dev, &dev_attr_fsusb_suspend);
#endif
}
Пример #5
0
static int panel_init(struct omap_dss_device *ddata)
{

    pr_debug("panel_init [%s]\n", ddata->name);

    archos_gpio_init_output(&display_gpio.lcd_pwon, "lcd_pwon");
    archos_gpio_init_output(&display_gpio.lcd_rst, "lcd_rst");

#if !defined(CONFIG_FB_OMAP_BOOTLOADER_INIT)
    if (GPIO_EXISTS(display_gpio.lcd_pwon))
        gpio_set_value( GPIO_PIN(display_gpio.lcd_pwon), 0);
    if (GPIO_EXISTS(display_gpio.lcd_rst))
        gpio_set_value( GPIO_PIN(display_gpio.lcd_rst), 0);
#endif
    return 0;
}
int __init ads7846_dev_init(void)
{
	const struct archos_tsp_config *tsp_cfg;
	tsp_cfg = omap_get_config( ARCHOS_TAG_TSP, struct archos_tsp_config );
	/* might be NULL */
	if (tsp_cfg == NULL) {
		printk(KERN_DEBUG "ads7846_dev_init: no board configuration found\n");
		return -ENODEV;
	}
	if ( hardware_rev >= tsp_cfg->nrev ) {
		printk(KERN_DEBUG "ads7846_dev_init: hardware_rev (%i) >= nrev (%i)\n",
			hardware_rev, tsp_cfg->nrev);
		return -ENODEV;
	}

	ts_irq = tsp_cfg->rev[hardware_rev].irq_gpio;
	ts_pwron = tsp_cfg->rev[hardware_rev].pwr_gpio;

	tsc2046_config.x_plate_ohms = tsp_cfg->rev[hardware_rev].x_plate_ohms;
	tsc2046_config.pressure_max = tsp_cfg->rev[hardware_rev].pressure_max;
	tsc2046_config.inversion_flags = tsp_cfg->rev[hardware_rev].inversion_flags;

	if (tsp_cfg->rev[hardware_rev].bus_num != 0)
		ts_spi_board_info[0].bus_num = tsp_cfg->rev[hardware_rev].bus_num;

	if (tsp_cfg->rev[hardware_rev].filter_factor != 0)
		filter_factor = tsp_cfg->rev[hardware_rev].filter_factor;

	switch (tsp_cfg->rev[hardware_rev].filter_type) {
		case 1: tsc2046_config.filter = simple_filter; break;
		default: break;
	}

	if (tsp_cfg->rev[hardware_rev].bus_num == 2) {
		omap_cfg_reg(AA3_3430_MCSPI2_CLK);
		omap_cfg_reg(Y2_3430_MCSPI2_SIMO);
		omap_cfg_reg(Y3_3430_MCSPI2_SOMI);
		omap_cfg_reg(Y4_3430_MCSPI2_CS0);
	}

	printk(KERN_DEBUG "ads7846_dev_init: irq_gpio %i, pwr_gpio %i\n",
			ts_irq.nb, ts_pwron.nb);

	archos_gpio_init_output(&ts_pwron, "ts_pwron");
	tsc2046_config.gpio_pendown = GPIO_PIN(ts_irq);
	ads7846_vaux_control( VAUX_DISABLE );

	/* fix spi irq gio nb */
	ts_spi_board_info[0].irq = OMAP_GPIO_IRQ(GPIO_PIN(ts_irq));
	spi_register_board_info(ts_spi_board_info, 1);

	return 0;
}
static void panel_tv_init(void)
{
	if (hardware_rev >= display_config.nrev)
		return;

	pr_info("panel_tv_init\n");

	if (GPIO_EXISTS(display_config.rev[hardware_rev].cvbs_on)) {
		cvbs_on = display_config.rev[hardware_rev].cvbs_on;
		archos_gpio_init_output(&cvbs_on, "cvbs enable");
		gpio_set_value( GPIO_PIN(cvbs_on), 0 );
	}
}
Пример #8
0
static void __init archos_hdmi_gpio_init(
		const struct archos_disp_conf* disp_conf)
{
	/* driver will manage the GPIO, just apply the pin multiplexing
	 * archos_gpio_init_input(&disp_conf->hdmi_int, "hdmi irq"); */
	
	omap_cfg_reg(GPIO_MUX(disp_conf->hdmi_int));
	archos_gpio_init_output(&disp_conf->hdmi_pwr, "hdmi pwr");
	/* FIXME: make userspace configurable */
	gpio_set_value(GPIO_PIN(disp_conf->hdmi_pwr), 1);
	
	/* patch power gpio into platform data */
	board_hdmi_pdata.pwr_gpio = GPIO_PIN(disp_conf->hdmi_pwr);
	
	/* patch IRQ into HDMI I2C bus info */
	board_i2c_bus2_info[1].irq = gpio_to_irq(GPIO_PIN(disp_conf->hdmi_int));
	board_i2c_bus2_info[2].irq = gpio_to_irq(GPIO_PIN(disp_conf->hdmi_int));

	omap_cfg_reg(H26_3630_DSS_DATA0);
	omap_cfg_reg(H25_3630_DSS_DATA1);
	omap_cfg_reg(E28_3630_DSS_DATA2);
	omap_cfg_reg(J26_3630_DSS_DATA3);
	omap_cfg_reg(AC27_3630_DSS_DATA4);
	omap_cfg_reg(AC28_3630_DSS_DATA5);
	
	omap_cfg_reg(D26_3630_DSS_HSYNC);
	omap_cfg_reg(D27_3630_DSS_VSYNC);
	omap_cfg_reg(D28_3630_DSS_PCLK);
	omap_cfg_reg(E27_3630_DSS_ACBIAS);
	omap_cfg_reg(E26_3630_DSS_DATA6);
	omap_cfg_reg(F28_3630_DSS_DATA7);
	omap_cfg_reg(F27_3630_DSS_DATA8);
	omap_cfg_reg(G26_3630_DSS_DATA9);
	omap_cfg_reg(AD28_3630_DSS_DATA10);
	omap_cfg_reg(AD27_3630_DSS_DATA11);
	omap_cfg_reg(AB28_3630_DSS_DATA12);
	omap_cfg_reg(AB27_3630_DSS_DATA13);
	omap_cfg_reg(AA28_3630_DSS_DATA14);
	omap_cfg_reg(AA27_3630_DSS_DATA15);
	omap_cfg_reg(G25_3630_DSS_DATA16);
	omap_cfg_reg(H27_3630_DSS_DATA17);

	omap_cfg_reg(AH26_3630_DSS_DATA18);
	omap_cfg_reg(AG26_3630_DSS_DATA19);
	omap_cfg_reg(AF18_3630_DSS_DATA20);
	omap_cfg_reg(AF19_3630_DSS_DATA21);
	omap_cfg_reg(AE21_3630_DSS_DATA22);
	omap_cfg_reg(AF21_3630_DSS_DATA23);
}
Пример #9
0
static int __init archos_battery_probe(struct platform_device *pdev)
{
	int ret;
	const struct archos_charge_config *chg_cfg;
	
	bat = kzalloc(sizeof(struct archos_battery), GFP_KERNEL);
	if (bat == NULL)
		return -ENOMEM;
	
	bat->main_battery = main_battery_template;
	bat->ac_supply = ac_supply_template;
	bat->usb_supply = usb_supply_template;
	bat->charge_enable = UNUSED_GPIO;
	bat->charge_low = UNUSED_GPIO;
	bat->charge_high = UNUSED_GPIO;

	/* FIXME: default values for now */
	bat->current_mV = 3850;
	bat->current_capacity = 50;
	bat->voltage_max_design = 4200;
	bat->voltage_min_design = 3500;

	/* charger configuration */
	chg_cfg = omap_get_config( ARCHOS_TAG_CHARGE, struct archos_charge_config);
	if (chg_cfg != NULL && hardware_rev < chg_cfg->nrev) {
		if (GPIO_EXISTS(chg_cfg->rev[hardware_rev].charge_enable) &&
		    GPIO_EXISTS(chg_cfg->rev[hardware_rev].charge_low) &&
		    GPIO_EXISTS(chg_cfg->rev[hardware_rev].charge_high) ) {
			bat->charge_enable = chg_cfg->rev[hardware_rev].charge_enable;
			bat->charge_low = chg_cfg->rev[hardware_rev].charge_low;
			bat->charge_high = chg_cfg->rev[hardware_rev].charge_high;

			archos_gpio_init_output(&bat->charge_enable, "charge enable");
			archos_gpio_init_output(&bat->charge_low, "charge low");
			archos_gpio_init_output(&bat->charge_high, "charge high");

			ret = device_create_file(&pdev->dev, &dev_attr_charge_level);
			if (ret < 0)
				dev_dbg(&pdev->dev, "cannot create charge_level attribute\n");
		}
		
		if (chg_cfg->rev[hardware_rev].gpio_dc_detect) {
			int ret;
			
			bat->gpio_dc_detect = chg_cfg->rev[hardware_rev].gpio_dc_detect;
			gpio_request(bat->gpio_dc_detect, "dc detect");
			gpio_direction_input(bat->gpio_dc_detect);
			
			bat->old_dcin = gpio_get_value_cansleep(bat->gpio_dc_detect);

			ret = request_irq(gpio_to_irq(bat->gpio_dc_detect), dcin_irq_handler, 
					IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING, 
					"dc detect", pdev);
			if (ret < 0)
				dev_warn(&pdev->dev, "failed to request irq %i for dc detect\n", 
						gpio_to_irq(bat->gpio_dc_detect));
		}
	}
	
	platform_set_drvdata(pdev, bat);
	
	ret = power_supply_register(&pdev->dev, &bat->main_battery);
	if (ret < 0) {
		printk(KERN_DEBUG "archos_battery_probe: "
				"cannot register main battery: %i\n", ret);
	}
	ret = power_supply_register(&pdev->dev, &bat->ac_supply);
	if (ret < 0) {
		printk(KERN_DEBUG "archos_battery_probe: "
				"cannot register ac supply: %i\n", ret);
	}
	ret = power_supply_register(&pdev->dev, &bat->usb_supply);
	if (ret < 0) {
		printk(KERN_DEBUG "archos_battery_probe: "
				"cannot register usb supply: %i\n", ret);
	}

	ret = device_create_file(&pdev->dev, &dev_attr_voltage_avg);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create voltage_avg attribute\n");
	ret = device_create_file(&pdev->dev, &dev_attr_capacity);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create capacity attribute\n");
	ret = device_create_file(&pdev->dev, &dev_attr_ac_online);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create ac_online attribute\n");
	ret = device_create_file(&pdev->dev, &dev_attr_usb_online);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create usb_online attribute\n");
	ret = device_create_file(&pdev->dev, &dev_attr_voltage_max_design);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create voltage_max_design attribute\n");
	ret = device_create_file(&pdev->dev, &dev_attr_voltage_min_design);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot create voltage_min_design attribute\n");
	return 0;	
}
Пример #10
0
int __init archos_audio_gpio_init(void)
{
	const struct archos_audio_config *audio_cfg;
	struct clk *clkout2_src_ck;
	struct clk *sys_clkout2;
	struct clk *core_ck;

	/* audio  */
	audio_cfg = omap_get_config( ARCHOS_TAG_AUDIO, struct archos_audio_config );
	if (audio_cfg == NULL) {
		pr_err("archos_audio_gpio_init: no board configuration found\n");
		return -ENODEV;
	}
	if ( hardware_rev >= audio_cfg->nrev ) {
		pr_err("archos_audio_gpio_init: hardware_rev (%i) >= nrev (%i)\n",
			hardware_rev, audio_cfg->nrev);
		return -ENODEV;
	}

	audio_gpio = audio_cfg->rev[hardware_rev];

	// a32 & a43 protos where using clkout1.
	if (hardware_rev >= 1 || !(machine_is_archos_a32() || machine_is_archos_a43())) {
		core_ck = clk_get(NULL, "cm_96m_fck");
		if (IS_ERR(core_ck)) {
			printk(KERN_ERR "failed to get core_ck\n");
		}
	
		clkout2_src_ck = clk_get(NULL, "clkout2_src_ck");
		if (IS_ERR(clkout2_src_ck)) {
			printk(KERN_ERR "failed to get clkout2_src_ck\n");
		}
	
		sys_clkout2 = clk_get(NULL, "sys_clkout2");
		if (IS_ERR(sys_clkout2)) {
			printk(KERN_ERR "failed to get sys_clkout2\n");
		}
	
		if ( clk_set_parent(clkout2_src_ck, core_ck) != 0) {
			printk(KERN_ERR "failed to set sys_clkout2 parent to clkout2\n");
		}
	
		/* Set the clock to 12 Mhz */
		omap2_clksel_set_rate(sys_clkout2, 12000000);

		clk_put(sys_clkout2);
		clk_put(clkout2_src_ck);
		clk_put(core_ck);

		sysclock_name = sys_clkout2_name;
		use_mcbsp1_fclk = 1;
	} else {
		sysclock_name = sys_clkout1_name;
	}

	if (GPIO_PIN( audio_gpio.spdif ) != -1)
		archos_gpio_init_output( &audio_gpio.spdif, "spdif" );

	if (GPIO_PIN( audio_gpio.hp_on ) != -1)
		archos_gpio_init_output( &audio_gpio.hp_on, "hp_on" );

	if (GPIO_PIN( audio_gpio.headphone_plugged ) != -1)
		archos_gpio_init_input( &audio_gpio.headphone_plugged, "hp_detect" );

	if (GPIO_PIN( audio_gpio.vamp_vbat ) != -1)
		archos_gpio_init_output( &audio_gpio.vamp_vbat, "vamp_vbat" );
	if (GPIO_PIN( audio_gpio.vamp_dc ) != -1)
		archos_gpio_init_output( &audio_gpio.vamp_dc, "vamp_dc" );

	// XXX maybe prevents OFF mode?
	if (GPIO_PIN( audio_gpio.headphone_plugged ) != -1)
		gpio_set_debounce(GPIO_PIN(audio_gpio.headphone_plugged), (1 + 1) * 0x1f);

	if (GPIO_PIN(audio_gpio.vamp_dc) != -1) {
		int ret = platform_device_register(&archos_audio_vamp_device);
		if (ret < 0)
			return ret;

		ret = platform_driver_register(&archos_audio_vamp_driver);
		if (ret < 0)
			return ret;

		ret = device_create_file(&archos_audio_vamp_device.dev, &dev_attr_vamp_vusb_ctrl);
		if (ret < 0)
			return ret;

		hrtimer_init(&vamp_watchdog_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
		vamp_watchdog_timer.function = vamp_watchdog_timer_func;
	}

	pr_debug("%s init done\n", __FUNCTION__);
	return 0;
}