示例#1
0
static int ux500_pd_bus_notify(struct notifier_block *nb,
			       unsigned long action, void *data)
{
	struct ux500_regulator *regulator = NULL;
	struct ux500_pins *pins = NULL;
	struct device *dev = data;
	const char *onoff = NULL;

	dev_dbg(dev, "%s() %ld !\n", __func__, action);

	switch (action) {
	case BUS_NOTIFY_BIND_DRIVER:
		pins = ux500_pins_get(dev_name(dev));
		if (pins) {
			ux500_pins_enable(pins);
			ux500_pins_put(pins);
		}

		regulator = ux500_regulator_get(dev);
		if (IS_ERR(regulator))
			regulator = NULL;
		else {
			ux500_regulator_atomic_enable(regulator);
			ux500_regulator_put(regulator);
		}

		onoff = "on";
		break;
	case BUS_NOTIFY_UNBOUND_DRIVER:
		pins = ux500_pins_get(dev_name(dev));
		if (pins) {
			ux500_pins_disable(pins);
			ux500_pins_put(pins);
		}

		regulator = ux500_regulator_get(dev);
		if (IS_ERR(regulator))
			regulator = NULL;
		else {
			ux500_regulator_atomic_disable(regulator);
			ux500_regulator_put(regulator);
		}

		onoff = "off";
		break;
	}

	if (pins || regulator) {
		dev_info(dev, "runtime pm disabled, forced %s: %s%s\n",
			 onoff,
			 pins ? "pins " : "",
			 regulator ? "regulator " : "");
	}

	return 0;
}
static int ske_kp_exit(void)
{
	struct ux500_pins *pins;

	pins = ux500_pins_get("ske");
	if (pins)
		ux500_pins_disable(pins);

	return 0;
}
static int get_gpio(struct device *device)
{
	usb_gpio_pins = ux500_pins_get(dev_name(device));

	if (usb_gpio_pins == NULL) {
		dev_err(device, "Could not get %s:usb_gpio_pins structure\n",
				dev_name(device));

		return PTR_ERR(usb_gpio_pins);
	}
	return 0;
}
int __init init_janice_display_devices(void)
{
	struct mcde_platform_data *pdata = ux500_mcde_device.dev.platform_data;

	int ret;

	ret = mcde_dss_register_notifier(&display_nb);
	if (ret)
		pr_warning("Failed to register dss notifier\n");
	 
	if (display_initialized_during_boot) {
		generic_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
		janice_dpi_pri_display_info.platform_enabled = 1;
	}

	/*
	 * The pixclock setting is not used within MCDE. The clock is
	 * setup elsewhere. But the pixclock value is visible in user
	 * space.
	 */
	janice_dpi_pri_display_info.video_mode.pixclock /=
						port0.phy.dpi.clock_div;

	/* MCDE pixelfetchwtrmrk levels per overlay */
	{
#if 1 /* 16 bit overlay */
#define BITS_PER_WORD (4 * 64)
	u32 fifo = (1024*8 - 8 * BITS_PER_WORD) / 3;
	fifo &= ~(BITS_PER_WORD - 1);
	pdata->pixelfetchwtrmrk[0] = fifo * 2 / 32;	/* LCD 32bpp */
	pdata->pixelfetchwtrmrk[1] = fifo * 1 / 16;	/* LCD 16bpp */
#else /* 24 bit overlay */
	u32 fifo = (1024*8 - 8 * BITS_PER_WORD) / 7;
	fifo &= ~(BITS_PER_WORD - 1);
	pdata->pixelfetchwtrmrk[0] = fifo * 4 / 32;	/* LCD 32bpp */
	pdata->pixelfetchwtrmrk[1] = fifo * 3 / 24;	/* LCD 24bpp */
#endif
	}
	pdata->update_opp = update_mcde_opp;

	ret = mcde_display_device_register(&generic_display0);
	if (ret)
		pr_warning("Failed to register generic display device 0\n");

	#ifndef CONFIG_HAS_EARLYSUSPEND
	dpi_pins = ux500_pins_get("mcde-dpi");
	if (!dpi_pins)
		return -EINVAL;
	#endif

	return ret;
}
static void ux500_pl011_init(void)
{
	int ret;

	if (!uart0_pins) {
		uart0_pins = ux500_pins_get("uart0");
		if (!uart0_pins) {
			pr_err("pl011: uart0 pins_get failed\n");
			return;
		}
	}

	ret = ux500_pins_enable(uart0_pins);
	if (ret)
		pr_err("pl011: uart0 pins_enable failed\n");
}
static int dpi_display_platform_enable(struct mcde_display_device *ddev)
{
	int res;

	if (!dpi_pins) {
		dpi_pins = ux500_pins_get("mcde-dpi");
		if (!dpi_pins)
			return -EINVAL;
	}

	dev_info(&ddev->dev, "%s\n", __func__);
	res = ux500_pins_enable(dpi_pins);
	if (res)
		dev_warn(&ddev->dev, "Failure during %s\n", __func__);

	return res;
}
示例#7
0
static void platform_pm_runtime_init(struct device *dev,
				     struct pm_runtime_data *prd)
{
	prd->pins = ux500_pins_get(dev_name(dev));

	prd->regulator = ux500_regulator_get(dev);
	if (IS_ERR(prd->regulator))
		prd->regulator = NULL;

	if (prd->pins || prd->regulator) {
		dev_info(dev, "managed by runtime pm: %s%s\n",
			 prd->pins ? "pins " : "",
			 prd->regulator ? "regulator " : "");

		set_bit(BIT_ACTIVE, &prd->flags);
	}
}
static int av8100_plat_exit(void)
{
	struct ux500_pins *pins;
	int res;

	pins = ux500_pins_get("av8100-hdmi");
	if (!pins) {
		res = -EINVAL;
		goto failed;
	}
	res = ux500_pins_disable(pins);
	if (res != 0)
		goto failed;
	return res;

failed:
	pr_err("%s failed\n");
	return res;
}
static int ab8500_platform_enable(struct mcde_display_device *ddev)
{
	int res = 0;

	if (!tvout_pins) {
		tvout_pins = ux500_pins_get("mcde-tvout");
		if (!tvout_pins)
			return -EINVAL;
	}

	dev_info(&ddev->dev, "%s\n", __func__);
	res = ux500_pins_enable(tvout_pins);
	if (res != 0)
		goto failed;

	return res;

failed:
	dev_warn(&ddev->dev, "Failure during %s\n", __func__);
	return res;
}
/*
 * ske_kp_init - enable the gpio configuration
 */
static int ske_kp_init(void)
{
	struct ux500_pins *pins;
	int ret, i;

	pins = ux500_pins_get("ske");
	if (pins)
		ux500_pins_enable(pins);

	for (i = 0; i < SKE_KPD_MAX_ROWS; i++) {
		ret = ske_set_gpio_row(ske_kp_rows[i]);
		if (ret < 0) {
			pr_err("ske_kp_init: failed init\n");
			return ret;
		}
	}
	if (!ske_config)
		ske_config = true;

	return 0;
}
int __init init_gavini_display_devices(void)
{
	int ret;

	ret = fb_register_client(&framebuffer_nb);
	if (ret)
		pr_warning("Failed to register framebuffer notifier\n");
	 
	ret = mcde_dss_register_notifier(&display_nb);
	if (ret)
		pr_warning("Failed to register dss notifier\n");
	 
	if (display_initialized_during_boot) {
		generic_display0.power_mode = MCDE_DISPLAY_PM_ON;
		gavini_dpi_pri_display_info.platform_enabled = 1;
	}

	/*
	 * The pixclock setting is not used within MCDE. The clock is
	 * setup elsewhere. But the pixclock value is visible in user
	 * space.
	 */
	gavini_dpi_pri_display_info.video_mode.pixclock /= port0.phy.dpi.clock_div;

	ret = mcde_display_device_register(&generic_display0);
	if (ret)
		pr_warning("Failed to register generic display device 0\n");

	#ifndef CONFIG_HAS_EARLYSUSPEND
	dpi_pins = ux500_pins_get("mcde-dpi");
	if (!dpi_pins)
		return -EINVAL;
	#endif

	return ret;
}
int __init init_codina_display_devices(void)
{
	int ret;
	struct mcde_platform_data *pdata = ux500_mcde_device.dev.platform_data;

	ret = mcde_dss_register_notifier(&display_nb);
	if (ret)
		pr_warning("Failed to register dss notifier\n");

	if (display_initialized_during_boot) {
		generic_display0.power_mode = MCDE_DISPLAY_PM_ON;
		codina_dpi_pri_display_info.platform_enabled = 1;
	}

	/*
	 * The pixclock setting is not used within MCDE. The clock is
	 * setup elsewhere. But the pixclock value is visible in user
	 * space.
	 */
	if (lcd_type == LCD_PANEL_TYPE_SMD) {
		port0.phy.dpi.clock_div = 2;
		port0.phy.dpi.lcd_freq = PRCMU_DPI_CLK_SMD_FREQ;
		codina_dpi_pri_display_info.video_mode.pixclock	=
				(int)(1e+12 * (1.0 / PRCMU_DPI_CLK_SMD_FREQ));
	} else {
		port0.phy.dpi.clock_div = 1;
		port0.phy.dpi.lcd_freq = PRCMU_DPI_CLK_SHARP_FREQ;
		codina_dpi_pri_display_info.video_mode.pixclock	=
				(int)(1e+12 * (1.0 / PRCMU_DPI_CLK_SHARP_FREQ));
	}

	codina_dpi_pri_display_info.video_mode.pixclock /=
		port0.phy.dpi.clock_div;

	/* MCDE pixelfetchwtrmrk levels per overlay */
	{
#if 1
/*
	 * The pixel fetcher FIFO is 128*64bit = 8192bits = 1024bytes.
	 * Overlay 0 is assumed 32bpp and overlay 1 is assumed 16bpp
	 */
    pdata->pixelfetchwtrmrk[0] = 160; /* 160 -> 160px*32bpp/8=640bytes */
	pdata->pixelfetchwtrmrk[1] = 192; /* 192 -> 192px*16bpp/8=384bytes */
#else /* 24 bit overlay */
	u32 fifo = (1024*8 - 8 * BITS_PER_WORD) / 7;
	fifo &= ~(BITS_PER_WORD - 1);
	pdata->pixelfetchwtrmrk[0] = fifo * 4 / 32;	/* LCD 32bpp */
	pdata->pixelfetchwtrmrk[1] = fifo * 3 / 24;	/* LCD 24bpp */
#endif
	}
	pdata->update_opp = update_mcde_opp;

	if (lcd_type == LCD_PANEL_TYPE_SMD){
		generic_display0.name = LCD_DRIVER_NAME_WS2401;
		codina_dpi_pri_display_info.video_mode.hsw = 10;
		codina_dpi_pri_display_info.video_mode.hbp = 8;
		codina_dpi_pri_display_info.video_mode.hfp = 8;
		codina_dpi_pri_display_info.video_mode.vsw = 2;
		codina_dpi_pri_display_info.video_mode.vbp = 8;
		codina_dpi_pri_display_info.video_mode.vfp = 18;
	} else {
		generic_display0.name = LCD_DRIVER_NAME_S6D27A1;
		codina_dpi_pri_display_info.video_mode.hsw = 2;
		codina_dpi_pri_display_info.video_mode.hbp = 63;
		codina_dpi_pri_display_info.video_mode.hfp = 63;
		codina_dpi_pri_display_info.video_mode.vsw = 2;
		codina_dpi_pri_display_info.video_mode.vbp = 11;
		codina_dpi_pri_display_info.video_mode.vfp = 10;
	}
	
	ret = mcde_display_device_register(&generic_display0);
	if (ret)
		pr_warning("Failed to register generic display device 0\n");


	dpi_pins = ux500_pins_get("mcde-dpi");
	if (!dpi_pins)
		return -EINVAL;
error:
	return ret;
}