コード例 #1
0
int create_decon_mic(struct platform_device *pdev)
{
    struct device *dev = &pdev->dev;
    struct display_driver *dispdrv;
    struct decon_mic *mic;
    struct resource *res;

    dispdrv = get_display_driver();

    mic = devm_kzalloc(dev, sizeof(struct decon_mic), GFP_KERNEL);
    if (!mic) {
        dev_err(&pdev->dev, "no memory for mic driver\n");
        return -ENOMEM;
    }

    mic->dev = dev;

    mic->lcd = decon_get_lcd_info();

    mic->mic_config = dispdrv->dt_ops.get_display_mic_config();

    mic->decon_mic_on = false;

    res = dispdrv->mic_driver.regs;
    if (!res) {
        mic_err("failed to find resource\n");
        return -ENOENT;
    }

    mic->reg_base = ioremap(res->start, resource_size(res));
    if (!mic->reg_base) {
        mic_err("failed to map registers\n");
        return -ENXIO;
    }

    mic_for_decon = mic;

    dispdrv->mic_driver.mic = mic;

#ifdef CONFIG_S5P_LCD_INIT
    decon_mic_enable(mic);
#endif
#ifdef CONFIG_FB_HIBERNATION_DISPLAY
    dispdrv->mic_driver.ops->pwr_on = decon_mic_hibernation_power_on;
    dispdrv->mic_driver.ops->pwr_off = decon_mic_hibernation_power_off;

    mic->lcd_update = kzalloc(sizeof(struct decon_lcd), GFP_KERNEL);
    memcpy(mic->lcd_update, mic->lcd, sizeof(struct decon_lcd));
#endif

    mic_info("MIC driver has been probed\n");
    return 0;
}
コード例 #2
0
int create_decon_mic(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct display_driver *dispdrv;
	struct decon_mic *mic;
	struct resource *res;
	int ret;

	dispdrv = get_display_driver();

	mic = devm_kzalloc(dev, sizeof(struct decon_mic), GFP_KERNEL);
	if (!mic) {
		dev_err(dev, "no memory for mic driver");
		return -ENOMEM;
	}

	mic->dev = dev;

	mic->lcd = decon_get_lcd_info();

	mic->mic_config = dispdrv->dt_ops.get_display_mic_config();

	mic->decon_mic_on = false;

	res = dispdrv->mic_driver.regs;
	if (!res) {
		dev_err(dev, "failed to find resource\n");
		ret = -ENOENT;
	}

	mic->reg_base = ioremap(res->start, resource_size(res));
	if (!mic->reg_base) {
		dev_err(dev, "failed to map registers\n");
		ret = -ENXIO;
	}

	decon_mic_enable(mic);
	mic_for_decon = mic;

	mic->decon_mic_on = true;

	dispdrv->mic_driver.mic = mic;
	dev_info(dev, "MIC driver has been probed\n");
	return 0;
}