static void cpufreq_allstats_free(void)
{
	int cpu;
	struct all_cpufreq_stats *all_stat;

	sysfs_remove_file(cpufreq_global_kobject,
						&_attr_all_time_in_state.attr);

	for_each_possible_cpu(cpu) {
		all_stat = per_cpu(all_cpufreq_stats, cpu);
		if (!all_stat)
			continue;
		kfree(all_stat->time_in_state);
		kfree(all_stat);
		per_cpu(all_cpufreq_stats, cpu) = NULL;
	}
	if (all_freq_table) {
		kfree(all_freq_table->freq_table);
		kfree(all_freq_table);
		all_freq_table = NULL;
	}
}
static void synaptics_rmi4_prox_remove(struct synaptics_rmi4_data *rmi4_data)
{
	unsigned char attr_count;

	if (!prox)
		goto exit;

	for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) {
		sysfs_remove_file(&rmi4_data->input_dev->dev.kobj,
				&attrs[attr_count].attr);
	}

	input_unregister_device(prox->prox_dev);
	kfree(prox->finger_data);
	kfree(prox);
	prox = NULL;

exit:
	complete(&prox_remove_complete);

	return;
}
static void cpufreq_allstats_free(void)
{
	int i;
	struct all_cpufreq_stats *all_stat;

	sysfs_remove_file(cpufreq_global_kobject,
						&_attr_all_time_in_state.attr);

	for (i = 0; i < total_cpus; i++) {
		all_stat = per_cpu(all_cpufreq_stats, i);
		if (!all_stat)
			continue;
		kfree(all_stat->time_in_state);
		kfree(all_stat);
		per_cpu(all_cpufreq_stats, i) = NULL;
	}
	if (all_freq_table) {
		kfree(all_freq_table->freq_table);
		kfree(all_freq_table);
		all_freq_table = NULL;
	}
}
Exemplo n.º 4
0
static int __init enhance_init(void)
{
	int retval;
	int attr_count = 0;

	enhance__kobj = kobject_create_and_add("lcd_enhance", kernel_kobj);

	if (!enhance__kobj)
		return -ENOMEM;

	/* Create the files associated with this kobject */
	for (attr_count = 0; attr_count < ARRAY_SIZE(attrs); attr_count++) {
		
		if(!zte_enhance_val.en_colortmp && (attr_count == 1))
			continue;
	
		retval = sysfs_create_file(enhance__kobj, &attrs[attr_count].attr);
		if (retval < 0) {
			pr_err("%s: Failed to create sysfs attributes\n", __func__);
			goto err_sys;
		}
	}
	
	pr_info("lcd: %s Done.\n",__func__);

	return retval;
	
err_sys:
	for (attr_count--; attr_count >= 0; attr_count--) {
		sysfs_remove_file(enhance__kobj, &attrs[attr_count].attr);
	}
	
	kobject_put(enhance__kobj);
	
	pr_info("lcd: %s init ERR.\n",__func__);

	return retval;
}
Exemplo n.º 5
0
static int __init edac_init_mce_inject(void)
{
	struct sysdev_class *edac_class = NULL;
	int i, err = 0;

	edac_class = edac_get_sysfs_class();
	if (!edac_class)
		return -EINVAL;

	mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj);
	if (!mce_kobj) {
		printk(KERN_ERR "Error creating a mce kset.\n");
		err = -ENOMEM;
		goto err_mce_kobj;
	}

	for (i = 0; i < ARRAY_SIZE(sysfs_attrs); i++) {
		err = sysfs_create_file(mce_kobj, &sysfs_attrs[i]->attr);
		if (err) {
			printk(KERN_ERR "Error creating %s in sysfs.\n",
					sysfs_attrs[i]->attr.name);
			goto err_sysfs_create;
		}
	}
	return 0;

err_sysfs_create:
	while (--i >= 0)
		sysfs_remove_file(mce_kobj, &sysfs_attrs[i]->attr);

	kobject_del(mce_kobj);

err_mce_kobj:
	edac_put_sysfs_class();

	return err;
}
Exemplo n.º 6
0
int sysfs_add_meshif(struct net_device *dev)
{
    struct kobject *batif_kobject = &dev->dev.kobj;
    struct bat_priv *bat_priv = netdev_priv(dev);
    struct bat_attribute **bat_attr;
    int err;

    bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR,
                         batif_kobject);
    if (!bat_priv->mesh_obj) {
        bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name,
                SYSFS_IF_MESH_SUBDIR);
        goto out;
    }

    for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) {
        err = sysfs_create_file(bat_priv->mesh_obj,
                                &((*bat_attr)->attr));
        if (err) {
            bat_err(dev, "Can't add sysfs file: %s/%s/%s\n",
                    dev->name, SYSFS_IF_MESH_SUBDIR,
                    ((*bat_attr)->attr).name);
            goto rem_attr;
        }
    }

    return 0;

rem_attr:
    for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr)
        sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));

    kobject_put(bat_priv->mesh_obj);
    bat_priv->mesh_obj = NULL;
out:
    return -ENOMEM;
}
Exemplo n.º 7
0
static int bu21150_remove(struct spi_device *client)
{
	struct bu21150_data *ts = spi_get_drvdata(client);
	int i;

	mutex_destroy(&ts->mutex_wake);
	if (ts->wake_up)
		device_init_wakeup(&client->dev, 0);

	for (i = 0; i < ARRAY_SIZE(bu21150_prop_attrs); i++)
		sysfs_remove_file(ts->bu21150_obj,
					&bu21150_prop_attrs[i].attr);
	kobject_put(ts->bu21150_obj);
	fb_unregister_client(&ts->fb_notif);
	misc_deregister(&g_bu21150_misc_device);
	bu21150_power_enable(ts, false);
	bu21150_regulator_config(ts, false);
	free_irq(client->irq, ts);
	mutex_destroy(&ts->mutex_frame);
	bu21150_pin_enable(ts, false);
	kfree(ts);

	return 0;
}
Exemplo n.º 8
0
/*
 * edac_device_delete_block(edac_dev,block);
 */
static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
				struct edac_device_block *block)
{
	struct edac_dev_sysfs_block_attribute *sysfs_attrib;
	int i;

	/* if this block has 'attributes' then we need to iterate over the list
	 * and 'remove' the attributes on this block
	 */
	sysfs_attrib = block->block_attributes;
	if (sysfs_attrib && block->nr_attribs) {
		for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) {

			/* remove each block_attrib file */
			sysfs_remove_file(&block->kobj,
				(struct attribute *) sysfs_attrib);
		}
	}

	/* unregister this block's kobject, SEE:
	 *	edac_device_ctrl_block_release() callback operation
	 */
	kobject_put(&block->kobj);
}
Exemplo n.º 9
0
static int __devinit mipi_samsung_disp_probe(struct platform_device *pdev)
{
	struct platform_device *msm_fb_added_dev;
#if defined(CONFIG_LCD_CLASS_DEVICE)
	struct lcd_device *lcd_device;
#endif
#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	struct backlight_device *bd = NULL;
#endif
	int ret = 0;
	int i;

	msd.dstat.acl_on = false;

	if (pdev->id == 0) {
		msd.mipi_samsung_disp_pdata = pdev->dev.platform_data;
		return 0;
	}

	msm_fb_added_dev = msm_fb_add_device(pdev);

	mutex_init(&dsi_tx_mutex);

#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_LCD_CLASS_DEVICE)
	msd.msm_pdev = msm_fb_added_dev;
#endif

#if defined(CONFIG_HAS_EARLYSUSPEND)
	msd.early_suspend.suspend = mipi_samsung_disp_early_suspend;
	msd.early_suspend.resume = mipi_samsung_disp_late_resume;
	msd.early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
	register_early_suspend(&msd.early_suspend);
#endif

	msd.mpd->lcd_no = get_disp_switch();
	for (i = 0; i < LCD_LOTS; i++) {
		msd.dstat.is_elvss_loaded[i] = false;
		msd.dstat.is_smart_dim_loaded[i] = false;
	}

#if defined(CONFIG_LCD_CLASS_DEVICE)
	lcd_device = lcd_device_register("panel", &pdev->dev, NULL,
					&mipi_samsung_disp_props);

	if (IS_ERR(lcd_device)) {
		ret = PTR_ERR(lcd_device);
		printk(KERN_ERR "lcd : failed to register device\n");
		return ret;
	}

#ifdef WA_FOR_FACTORY_MODE
	sysfs_remove_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_power.attr);

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_power.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_power.attr.name);
	}
#endif

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_type.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_type.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_gamma_mode.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_gamma_mode.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_power_reduce.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_power_reduce.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_siop_enable.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_siop_enable.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_backlight.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_backlight.attr.name);
	}

#if defined(CONFIG_RUNTIME_MIPI_CLK_CHANGE)
	ret = sysfs_create_file(&lcd_device->dev.kobj,
						&dev_attr_fps_change.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_fps_change.attr.name);
	}
#endif

#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	bd = backlight_device_register("panel", &lcd_device->dev,
						NULL, NULL, NULL);
	if (IS_ERR(bd)) {
		ret = PTR_ERR(bd);
		pr_info("backlight : failed to register device\n");
		return ret;
	}

	ret = sysfs_create_file(&bd->dev.kobj,
					&dev_attr_auto_brightness.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_auto_brightness.attr.name);
	}
#endif
#endif
#if defined(CONFIG_MDNIE_LITE_TUNING) \
	|| defined(CONFIG_FB_MDP4_ENHANCE)
	init_mdnie_class();
#endif

#if defined(DDI_VIDEO_ENHANCE_TUNING)
		ret = sysfs_create_file(&lcd_device->dev.kobj,
				&dev_attr_tuning.attr);
		if (ret) {
			pr_info("sysfs create fail-%s\n",
					dev_attr_tuning.attr.name);
		}
#endif
	return 0;
}
Exemplo n.º 10
0
static void __devexit etb_sysfs_exit(void)
{
	sysfs_remove_file(etb.kobj, &trigger_cntr_attr.attr);
	kobject_put(etb.kobj);
}
static void qdss_sysfs_exit(void)
{
	sysfs_remove_file(qdss.modulekobj, &max_clk_attr.attr);
}
Exemplo n.º 12
0
static void met_emi_delete(void)
{
    sysfs_remove_file(kobj_emi, &rwtype_attr.attr);
    sysfs_remove_file(kobj_emi, &emi_clock_rate_attr.attr);
    kobj_emi = NULL;
}
Exemplo n.º 13
0
static void __exit lpm_mode_exit(void)
{
	sysfs_remove_file(mot_lpm_kobj, (const struct attribute *) &lpm_mode);
	kobject_del(mot_lpm_kobj);
}
Exemplo n.º 14
0
static void iommu_group_remove_file(struct iommu_group *group,
				    struct iommu_group_attribute *attr)
{
	sysfs_remove_file(&group->kobj, &attr->attr);
}
int mdss_dsi_panel_init(struct device_node *node,
	struct mdss_dsi_ctrl_pdata *ctrl_pdata,
	bool cmd_cfg_cont_splash)
{
	int rc = 0;
	static const char *panel_name;
	bool cont_splash_enabled;
#if defined(CONFIG_ESD_ERR_FG_RECOVERY)
	int disp_esd_gpio;
#endif
#if defined(CONFIG_LCD_CLASS_DEVICE)
	struct lcd_device *lcd_device;

#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	struct backlight_device *bd = NULL;
#endif
#endif
#if defined(CONFIG_LCD_CLASS_DEVICE)
	struct device_node *np = NULL;
	struct platform_device *pdev = NULL;
	np = of_parse_phandle(node,
			"qcom,mdss-dsi-panel-controller", 0);
	if (!np) {
		pr_err("%s: Dsi controller node not initialized\n", __func__);
		return -EPROBE_DEFER;
	}

	pdev = of_find_device_by_node(np);
#endif
#if defined(CONFIG_BACKLIGHT_IC_KTD253)
	mutex_init(&bg_lock);
#endif

#if defined(CONFIG_FB_MSM8x26_MDSS_CHECK_LCD_CONNECTION)
	printk("%s: LCD attached status: %d !\n",
				__func__, get_samsung_lcd_attached());
#endif
#ifdef DDI_VIDEO_ENHANCE_TUNING
	mutex_init(&msd.lock);
#endif
	if (!node) {
		pr_err("%s: no panel node\n", __func__);
		return -ENODEV;
	}

	pr_debug("%s:%d\n", __func__, __LINE__);
	panel_name = of_get_property(node, "qcom,mdss-dsi-panel-name", NULL);
	if (!panel_name)
		pr_info("%s:%d, Panel name not specified\n",
						__func__, __LINE__);
	else
		pr_info("%s: Panel Name = %s\n", __func__, panel_name);

#if defined(CONFIG_BACKLIGHT_IC_KTD2801)
	virt_mmss_gp0_base = ioremap(MMSS_GP0_BASE,MMSS_GP0_SIZE);
	if(virt_mmss_gp0_base == NULL) {
		pr_err("%s: I/O remap failed \n", __func__);
		return 0;
	}
#endif

	rc = mdss_panel_parse_dt(node, ctrl_pdata);
	if (rc) {
		pr_err("%s:%d panel dt parse failed\n", __func__, __LINE__);
		return rc;
	}

#if defined(CONFIG_SEC_VICTOR3GDSDTV_PROJECT)
		gpio_tlmm_config(GPIO_CFG(34, 0, GPIO_CFG_INPUT,GPIO_CFG_PULL_DOWN,GPIO_CFG_8MA),GPIO_CFG_ENABLE);
#else
		gpio_tlmm_config(GPIO_CFG(24, 0, GPIO_CFG_INPUT,GPIO_CFG_PULL_DOWN,GPIO_CFG_8MA),GPIO_CFG_ENABLE);
		gpio_set_value(24, 0);
#endif

		cont_splash_enabled = of_property_read_bool(node,
				"qcom,cont-splash-enabled");

	if (!cont_splash_enabled) {
		pr_info("%s:%d Continuous splash flag not found.\n",
				__func__, __LINE__);
		ctrl_pdata->panel_data.panel_info.cont_splash_enabled = 0;
	} else {
		pr_info("%s:%d Continuous splash flag enabled.\n",
				__func__, __LINE__);
		ctrl_pdata->panel_data.panel_info.cont_splash_enabled = 1;
	}


#if defined(CONFIG_FB_MSM8x26_MDSS_CHECK_LCD_CONNECTION)
	pr_err("CONFIG_LCD_CONNECTION_CHECK is set kky\n");
	if (get_samsung_lcd_attached() == 0)
	{
		printk("%s: aaaLCD not connected.... Disabling Continous Splash!\n",__func__);
//		ctrl_pdata->panel_data.panel_info.cont_splash_enabled = 0;
	}
#endif

	ctrl_pdata->on = mdss_dsi_panel_on;
	ctrl_pdata->off = mdss_dsi_panel_off;
	ctrl_pdata->panel_reset = mdss_dsi_himax_panel_reset;
	ctrl_pdata->panel_data.set_backlight = mdss_dsi_panel_bl_ctrl;

#if defined(CONFIG_LCD_CLASS_DEVICE)
	lcd_device = lcd_device_register("panel", &pdev->dev, NULL,
					&mdss_himax_disp_props);

	if (IS_ERR(lcd_device)) {
		rc = PTR_ERR(lcd_device);
		printk(KERN_ERR "lcd : failed to register device\n");
		return rc;
	}

	sysfs_remove_file(&lcd_device->dev.kobj,&dev_attr_lcd_power.attr);

	rc = sysfs_create_file(&lcd_device->dev.kobj,&dev_attr_lcd_power.attr);

	if (rc) {
		pr_info("sysfs create fail-%s\n",dev_attr_lcd_power.attr.name);

	}
	rc = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_type.attr);
	if (rc) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_type.attr.name);
	}


	rc= sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_siop_enable.attr);
	if (rc) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_siop_enable.attr.name);
	}
#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	bd = backlight_device_register("panel", &lcd_device->dev,
			NULL, NULL, NULL);
	if (IS_ERR(bd)) {
		rc = PTR_ERR(bd);
		pr_info("backlight : failed to register device\n");
		return rc;
	}
	rc= sysfs_create_file(&bd->dev.kobj,
					&dev_attr_auto_brightness.attr);
	if (rc) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_auto_brightness.attr.name);
	}
#endif
#endif
#if defined(DDI_VIDEO_ENHANCE_TUNING)
	rc = sysfs_create_file(&lcd_device->dev.kobj,
			&dev_attr_tuning.attr);
	if (rc) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_tuning.attr.name);
	}
#endif
#if defined(CONFIG_MDNIE_LITE_TUNING) || defined(CONFIG_MDNIE_VIDEO_ENHANCED)
		pr_info("[%s] CONFIG_MDNIE_LITE_TUNING ok ! initclass called!\n",__func__);
		init_mdnie_class();
#if defined(CONFIG_MDNIE_LITE_TUNING)
		mdnie_lite_tuning_init(&msd);
#endif
#endif
#if defined(CONFIG_ESD_ERR_FG_RECOVERY)
#ifdef ESD_DEBUG
	rc = sysfs_create_file(&lcd_device->dev.kobj,
							&dev_attr_esd_check.attr);
	if (rc) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_esd_check.attr.name);
	}
#endif
	msd.msm_pdev = pdev;

	disp_esd_gpio =of_get_named_gpio(node,"qcom,oled-esd-gpio", 0);
	err_fg_gpio = gpio_to_irq(disp_esd_gpio);
	rc = gpio_request(disp_esd_gpio, "err_fg");
	if (rc) {
		pr_err("request gpio GPIO_ESD failed, ret=%d\n",rc);
		gpio_free(disp_esd_gpio);
		return rc;
	}
	gpio_tlmm_config(GPIO_CFG(disp_esd_gpio,  0, GPIO_CFG_INPUT,
					GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);
	rc = gpio_direction_input(disp_esd_gpio);
	if (unlikely(rc < 0)) {
		pr_err("%s: failed to set gpio %d as input (%d)\n",
			__func__, disp_esd_gpio, rc);
	}
#endif
	return 0;
}
Exemplo n.º 16
0
static int __devinit mipi_novatek_disp_probe(struct platform_device *pdev)
{
	struct platform_device *msm_fb_added_dev;
#if defined(CONFIG_LCD_CLASS_DEVICE)
	struct lcd_device *lcd_device;
	int ret;
#endif
#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	struct backlight_device *bd;
#endif
	msd.dstat.acl_on = false;
    is_lcd_on = LCD_STATUS_ON;

	if (pdev->id == 0) {
		msd.mipi_novatek_disp_pdata = pdev->dev.platform_data;

#ifdef CONFIG_SAMSUNG_CMC624
	if (samsung_has_cmc624()) {
		printk(KERN_DEBUG "Is_There_cmc624 : CMC624 is there!!!!");
		samsung_cmc624_init();
	} else {
		printk(KERN_DEBUG "Is_There_cmc624 : CMC624 is not there!!!!");
	}
#endif

		return 0;
	}

	msm_fb_added_dev = msm_fb_add_device(pdev);

#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_LCD_CLASS_DEVICE)
	msd.msm_pdev = msm_fb_added_dev;
#endif

#if defined(CONFIG_HAS_EARLYSUSPEND)
	msd.early_suspend.suspend = mipi_novatek_disp_early_suspend;
	msd.early_suspend.resume = mipi_novatek_disp_late_resume;
	msd.early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
	register_early_suspend(&msd.early_suspend);

#endif

#if defined(CONFIG_LCD_CLASS_DEVICE)
	lcd_device = lcd_device_register("panel", &pdev->dev, NULL,
					&mipi_novatek_disp_props);

	if (IS_ERR(lcd_device)) {
		ret = PTR_ERR(lcd_device);
		printk(KERN_ERR "lcd : failed to register device\n");
		return ret;
	}

#ifdef WA_FOR_FACTORY_MODE
	sysfs_remove_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_power.attr);

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_power.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_power.attr.name);
	}
#endif

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_lcd_type.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_type.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_gamma_mode.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_gamma_mode.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_power_reduce.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_power_reduce.attr.name);
	}

#if defined(CONFIG_MACH_MELIUS)
	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_siop_enable.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_siop_enable.attr.name);
	}
#endif

#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE)
	bd = backlight_device_register("panel", &lcd_device->dev,
						NULL, NULL, NULL);
	if (IS_ERR(bd)) {
		ret = PTR_ERR(bd);
		pr_info("backlight : failed to register device\n");
		return ret;
	}

	ret = sysfs_create_file(&bd->dev.kobj,
					&dev_attr_auto_brightness.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_auto_brightness.attr.name);
	}
#endif
#endif

#ifdef CONFIG_SAMSUNG_CMC624
	if (samsung_has_cmc624()) {
			ret = cmc624_sysfs_init();
			if (ret < 0)
				pr_debug("CMC624 sysfs initialize FAILED\n");
		}
	else
#if defined(CONFIG_FB_MDP4_ENHANCE)
		init_mdnie_class();
#endif
#endif

	pr_debug("%s:Display probe completed\n", __func__);
	return 0;
}
Exemplo n.º 17
0
static int __devinit pch_phub_probe(struct pci_dev *pdev,
				    const struct pci_device_id *id)
{
	int retval;

	int ret;
	ssize_t rom_size;
	struct pch_phub_reg *chip;

	chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL);
	if (chip == NULL)
		return -ENOMEM;

	ret = pci_enable_device(pdev);
	if (ret) {
		dev_err(&pdev->dev,
		"%s : pci_enable_device FAILED(ret=%d)", __func__, ret);
		goto err_pci_enable_dev;
	}
	dev_dbg(&pdev->dev, "%s : pci_enable_device returns %d\n", __func__,
		ret);

	ret = pci_request_regions(pdev, KBUILD_MODNAME);
	if (ret) {
		dev_err(&pdev->dev,
		"%s : pci_request_regions FAILED(ret=%d)", __func__, ret);
		goto err_req_regions;
	}
	dev_dbg(&pdev->dev, "%s : "
		"pci_request_regions returns %d\n", __func__, ret);

	chip->pch_phub_base_address = pci_iomap(pdev, 1, 0);


	if (chip->pch_phub_base_address == 0) {
		dev_err(&pdev->dev, "%s : pci_iomap FAILED", __func__);
		ret = -ENOMEM;
		goto err_pci_iomap;
	}
	dev_dbg(&pdev->dev, "%s : pci_iomap SUCCESS and value "
		"in pch_phub_base_address variable is %p\n", __func__,
		chip->pch_phub_base_address);
	chip->pch_phub_extrom_base_address = pci_map_rom(pdev, &rom_size);

	if (chip->pch_phub_extrom_base_address == 0) {
		dev_err(&pdev->dev, "%s : pci_map_rom FAILED", __func__);
		ret = -ENOMEM;
		goto err_pci_map;
	}
	dev_dbg(&pdev->dev, "%s : "
		"pci_map_rom SUCCESS and value in "
		"pch_phub_extrom_base_address variable is %p\n", __func__,
		chip->pch_phub_extrom_base_address);

	if (id->driver_data == 1) {
		retval = sysfs_create_file(&pdev->dev.kobj,
					   &dev_attr_pch_mac.attr);
		if (retval)
			goto err_sysfs_create;

		retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (retval)
			goto exit_bin_attr;

		pch_phub_read_modify_write_reg(chip,
					       (unsigned int)CLKCFG_REG_OFFSET,
					       CLKCFG_CAN_50MHZ,
					       CLKCFG_CANCLK_MASK);

		/* quirk for CM-iTC board */
		if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
			pch_phub_read_modify_write_reg(chip,
						(unsigned int)CLKCFG_REG_OFFSET,
						CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |
						CLKCFG_PLL2VCO | CLKCFG_UARTCLKSEL,
						CLKCFG_UART_MASK);

		/* set the prefech value */
		iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
		/* set the interrupt delay value */
		iowrite32(0x25, chip->pch_phub_base_address + 0x44);
	} else if (id->driver_data == 2) {
		retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (retval)
			goto err_sysfs_create;
		/* set the prefech value
		 * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a
		 * Device4(SDIO #0,1,2):f
		 * Device6(SATA 2):f
		 * Device8(USB OHCI #0/ USB EHCI #0):a
		 */
		iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14);
	}
	pci_set_drvdata(pdev, chip);

	return 0;
exit_bin_attr:
	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr);

err_sysfs_create:
	pci_unmap_rom(pdev, chip->pch_phub_extrom_base_address);
err_pci_map:
	pci_iounmap(pdev, chip->pch_phub_base_address);
err_pci_iomap:
	pci_release_regions(pdev);
err_req_regions:
	pci_disable_device(pdev);
err_pci_enable_dev:
	kfree(chip);
	dev_err(&pdev->dev, "%s returns %d\n", __func__, ret);
	return ret;
}
Exemplo n.º 18
0
static void xen_sysfs_type_destroy(void)
{
	sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
}
Exemplo n.º 19
0
static void taskmonitor_exit(void)
{
	sysfs_remove_file(kernel_kobj, &(hellosysfs_kattr.attr));

	pr_info("rmmod: removed module hellosysfs\n");
}
static int ge_counter_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct ge_counter_platform_data *pdata = dev_get_platdata(dev);
	struct driver_data *data;
	struct counter_data *dest;
	unsigned int irq;
	int i, ret;

	if (!pdata) {
		pdata = ge_counter_get_devtree_pdata(dev);
		if (IS_ERR(pdata))
			return PTR_ERR(pdata);
	}

	data = kzalloc(sizeof(struct driver_data) + sizeof(struct counter_data)
			* pdata->num_counter, GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->dir = kobject_create_and_add("counter", &pdev->dev.kobj);
	if (!data->dir) {
		dev_err(&pdev->dev, "Cannot create sysfs counter dir 'counter'\n");
		kfree(data);
		return -EIO;
	}

	data->num_counter = pdata->num_counter;
	for (i = 0; i < pdata->num_counter; i++) {
		struct ge_counter *src = &pdata->counter[i];
		dest = &data->vdata[i];

		if (!src->name) {
			dev_err(&pdev->dev, "Counter name must be set\n");
			ret = -EINVAL;
			goto err;
		}

		if (!src->gpio || gpio_request(src->gpio, src->name)) {
			dev_err(&pdev->dev, "Invalid counter GPIO %d\n", src->gpio);
			ret = -EINVAL;
			goto err;
		}

		gpio_direction_input(src->gpio);
		irq = gpio_to_irq(src->gpio);
		enable_irq_wake(irq);
		ret = request_any_context_irq(irq, counter_event, src->irq_type,
				"ge_counter", dest);
		if (ret < 0) {
			dev_err(&pdev->dev, "Cannot request IRQ %u for GPIO %u", irq, src->gpio);
			ret = -EINVAL;
			goto err_gpio;
		}

		dest->subdir = kobject_create_and_add(src->name, data->dir);
		if (!dest->subdir) {
			dev_err(&pdev->dev, "Cannot create sysfs counter dir '%s'\n",
					src->name);
			ret = -EIO;
			goto err_irq;
		}

		spin_lock_init(&dest->lock);

		dest->gpio = src->gpio;
		dest->interval = msecs_to_jiffies(src->interval);
		dest->counter = 0UL;
		dest->start_jiffies = jiffies;
		dest->start_count = 0UL;
		dest->reset_on_read = src->reset_on_read;
		dest->use_timer = false;
		dest->interval_count_valid = false;

		dest->counter_attr.show = counter_show;
		dest->counter_attr.store = counter_store;
		sysfs_attr_init(&dest->counter_attr.attr);
		dest->counter_attr.attr.name = "counter";
		dest->counter_attr.attr.mode = S_IRUGO | S_IWUSR;

		ret = sysfs_create_file(dest->subdir, &dest->counter_attr.attr);
		if (ret)
			goto err_dir;

		dest->elapsed_attr.show = elapsed_show;
		dest->elapsed_attr.store = elapsed_store;
		sysfs_attr_init(&dest->elapsed_attr.attr);
		dest->elapsed_attr.attr.name = "elapsed";
		dest->elapsed_attr.attr.mode = S_IRUGO | S_IWUSR;

		ret = sysfs_create_file(dest->subdir, &dest->elapsed_attr.attr);
		if (ret)
			goto err_file1;

		dest->state_attr.show = state_show;
		sysfs_attr_init(&dest->state_attr.attr);
		dest->state_attr.attr.name = "state";
		dest->state_attr.attr.mode = S_IRUGO;

		ret = sysfs_create_file(dest->subdir, &dest->state_attr.attr);
		if (ret)
			goto err_file2;

		dest->reset_on_read_attr.show = reset_on_read_show;
		dest->reset_on_read_attr.store = reset_on_read_store;
		sysfs_attr_init(&dest->reset_on_read_attr.attr);
		dest->reset_on_read_attr.attr.name = "reset_on_read";
		dest->reset_on_read_attr.attr.mode = S_IRUGO | S_IWUSR;

		ret = sysfs_create_file(dest->subdir, &dest->reset_on_read_attr.attr);
		if (ret)
			goto err_file3;

		if (src->interval) {
			dest->interval_attr.show = interval_show;
			dest->interval_attr.store = interval_store;
			sysfs_attr_init(&dest->interval_attr.attr);
			dest->interval_attr.attr.name = "interval";
			dest->interval_attr.attr.mode = S_IRUGO | S_IWUSR;

			ret = sysfs_create_file(dest->subdir, &dest->interval_attr.attr);
			if (ret)
				goto err_file4;

			dest->interval_count_attr.show = interval_count_show;
			sysfs_attr_init(&dest->interval_count_attr.attr);
			dest->interval_count_attr.attr.name = "interval_count";
			dest->interval_count_attr.attr.mode = S_IRUGO;

			ret = sysfs_create_file(dest->subdir, &dest->interval_count_attr.attr);
			if (ret)
				goto err_file5;

			dest->use_timer = true;
			init_timer(&dest->timer);
			dest->timer.data = (unsigned long)dest;
			dest->timer.function = timeout;
			dest->jiffies = jiffies;
			dest->timer.expires = jiffies + dest->interval;
			add_timer(&dest->timer);
		}
	}

	platform_set_drvdata(pdev, data);
	return 0;

err_file5:
	sysfs_remove_file(dest->subdir, &dest->interval_attr.attr);
err_file4:
	sysfs_remove_file(dest->subdir, &dest->reset_on_read_attr.attr);
err_file3:
	sysfs_remove_file(dest->subdir, &dest->state_attr.attr);
err_file2:
	sysfs_remove_file(dest->subdir, &dest->elapsed_attr.attr);
err_file1:
	sysfs_remove_file(dest->subdir, &dest->counter_attr.attr);
err_dir:
	kobject_put(dest->subdir);
err_irq:
	free_irq(irq, dest);
err_gpio:
	gpio_free(dest->gpio);
err:
	for (--i; i >= 0; i--)
		delete_counter(&data->vdata[i]);

	kobject_put(data->dir);
	kfree(data);
	return ret;
}
Exemplo n.º 21
0
static void __devexit funnel_sysfs_exit(void)
{
	sysfs_remove_file(drvdata->kobj, &dev_attr_priority.attr);
	kobject_put(drvdata->kobj);
}
Exemplo n.º 22
0
static int gsensor_sysfs_init(void)
{
    int ret ;

    android_gsensor_kobj = kobject_create_and_add("android_gsensor", NULL);
    if (android_gsensor_kobj == NULL) {
        printk(KERN_ERR
               "akm8977 gsensor_sysfs_init:"\
               "subsystem_register failed\n");
        ret = -ENOMEM;
        goto err;
    }

    ret = sysfs_create_file(android_gsensor_kobj, &dev_attr_vendor.attr);
    if (ret) {
        printk(KERN_ERR
               "akm8977 gsensor_sysfs_init:"\
               "sysfs_create_group failed\n");
        goto err4;
    }
    
#if SENSOR_6AXIS_STATE_TEST
    ret = sysfs_create_file(android_gsensor_kobj, &dev_attr_speaker.attr);
    if (ret) {
        printk(KERN_ERR
               "akm8977 gsensor_sysfs_init:"\
               "sysfs_create_group failed\n");
        goto err4;
    }
    memset(g_spkstat, 0, 8);
    memcpy(g_spkstat, "off", 4);
#endif
    

#if SENSOR_6AXIS_ACCEL_MODE_TEST
    akmd_acceleration_mode = AKMD_ACCELERATION_MODE_NORMAL;
    ret = sysfs_create_file(android_gsensor_kobj, &dev_attr_acceleration_mode.attr);
    if (ret) {
        printk(KERN_ERR
               "akm8977 gsensor_sysfs_init:"\
               "sysfs_create_group failed\n");
        goto err5;
    }
#endif 

    return 0 ;

#if SENSOR_6AXIS_ACCEL_MODE_TEST
err5:
    sysfs_remove_file(android_gsensor_kobj, &dev_attr_acceleration_mode.attr);
#endif 

err4:
    
#if SENSOR_6AXIS_STATE_TEST
    sysfs_remove_file(android_gsensor_kobj, &dev_attr_vendor.attr);
#endif
    
    kobject_del(android_gsensor_kobj);
err:
    return ret ;
}
static int __devinit mipi_samsung_disp_probe(struct platform_device *pdev)
{
	int ret, rc;
	struct platform_device *msm_fb_added_dev;
	struct lcd_device *lcd_device;
	struct backlight_device *bd = NULL;

	printk(KERN_INFO "[lcd] mipi_samsung_disp_probe start\n");
	if (pdev->id == 0) {
		msd.mipi_samsung_disp_pdata = pdev->dev.platform_data;

		printk(KERN_INFO
		"[lcd] pdev->id =%d,  pdev-name = %s\n", pdev->id, pdev->name);
		sec_debug_mdp_init();
		printk(KERN_INFO "[lcd] mipi_samsung_disp_probe end since pdev-id is 0\n");

		return 0;
	}

	printk(KERN_INFO "[lcd] msm_fb_add_device : %s\n", pdev->name);

	msm_fb_added_dev = msm_fb_add_device(pdev);

	mutex_init(&dsi_tx_mutex);

#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_LCD_CLASS_DEVICE)
	msd.msm_pdev = msm_fb_added_dev;
#endif

	pm_gpio8 = PM8921_GPIO_PM_TO_SYS(PMIC_GPIO_ERR_FG);

	rc = gpio_request(pm_gpio8, "err_fg");

	if (rc) {
		pr_err("request gpio err_fg failed, rc=%d\n", rc);
		return -ENODEV;
	}

	rc = pm8xxx_gpio_config(pm_gpio8, &gpio_get_param);

	if (rc) {
		pr_err("gpio_config mlcd_rst failed (3), rc=%d\n", rc);
		return -EINVAL;
	}

#if defined(CONFIG_HAS_EARLYSUSPEND)
	msd.early_suspend.suspend = mipi_samsung_disp_early_suspend;
	msd.early_suspend.resume = mipi_samsung_disp_late_resume;
	msd.early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
	register_early_suspend(&msd.early_suspend);
#endif

#if defined(CONFIG_LCD_CLASS_DEVICE)
	printk(KERN_INFO "[lcd] lcd_device_register for panel start\n");

	lcd_device = lcd_device_register("panel", &pdev->dev, NULL,
			&mipi_samsung_disp_props);

	if (IS_ERR(lcd_device)) {
		ret = PTR_ERR(lcd_device);
		printk(KERN_ERR "lcd : failed to register device\n");
		return ret;
	}

	sysfs_remove_file(&lcd_device->dev.kobj,
			&dev_attr_lcd_power.attr);

	ret = sysfs_create_file(&lcd_device->dev.kobj,
			&dev_attr_lcd_power.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_power.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
			&dev_attr_lcd_type.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_lcd_type.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
			&dev_attr_window_type.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_window_type.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_power_reduce.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_power_reduce.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_siop_enable.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_siop_enable.attr.name);
	}
	
	ret = sysfs_create_file(&lcd_device->dev.kobj,
					&dev_attr_backlight.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_backlight.attr.name);
	}

#if defined(RUMTIME_MIPI_CLK_CHANGE)
	ret = sysfs_create_file(&lcd_device->dev.kobj,
						&dev_attr_fps_change.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_fps_change.attr.name);
	}
#endif

	ret = sysfs_create_file(&lcd_device->dev.kobj,
						&dev_attr_temperature.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_temperature.attr.name);
	}

	ret = sysfs_create_file(&lcd_device->dev.kobj,
						&dev_attr_panel_colors.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_panel_colors.attr.name);
	}

	printk(KERN_INFO "[lcd] backlight_device_register for panel start\n");

	bd = backlight_device_register("panel", &lcd_device->dev,
			NULL, NULL, NULL);
	if (IS_ERR(bd)) {
		ret = PTR_ERR(bd);
		pr_info("backlight : failed to register device\n");
		return ret;
	}

	ret = sysfs_create_file(&bd->dev.kobj,
			&dev_attr_auto_brightness.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_auto_brightness.attr.name);
	}
#endif

#if defined(CONFIG_MDNIE_LITE_TUNING)
	pr_info("[%s] CONFIG_MDNIE_LITE_TUNING ok ! init class called!\n",
		__func__);
	mdnie_lite_tuning_init();
#endif

#if defined(DDI_VIDEO_ENHANCE_TUNING)
	ret = sysfs_create_file(&lcd_device->dev.kobj,
			&dev_attr_tuning.attr);
	if (ret) {
		pr_info("sysfs create fail-%s\n",
				dev_attr_tuning.attr.name);
	}
#endif

	printk(KERN_INFO "[lcd] mipi_samsung_disp_probe end\n");

	return 0;
}
Exemplo n.º 24
0
void sysfs_remove_files(struct kobject * kobj, const struct attribute **ptr)
{
	int i;
	for (i = 0; ptr[i]; i++)
		sysfs_remove_file(kobj, ptr[i]);
}
Exemplo n.º 25
0
static int qpnp_haptic_probe(struct spmi_device *spmi)
{
	struct qpnp_hap *hap;
	struct resource *hap_resource;
	int rc, i;

	hap = devm_kzalloc(&spmi->dev, sizeof(*hap), GFP_KERNEL);
	if (!hap)
		return -ENOMEM;

	hap->spmi = spmi;

	hap_resource = spmi_get_resource(spmi, 0, IORESOURCE_MEM, 0);
	if (!hap_resource) {
		dev_err(&spmi->dev, "Unable to get haptic base address\n");
		return -EINVAL;
	}
	hap->base = hap_resource->start;

	dev_set_drvdata(&spmi->dev, hap);

	rc = qpnp_hap_parse_dt(hap);
	if (rc) {
		dev_err(&spmi->dev, "DT parsing failed\n");
		return rc;
	}

	rc = qpnp_hap_config(hap);
	if (rc) {
		dev_err(&spmi->dev, "hap config failed\n");
		return rc;
	}

	mutex_init(&hap->lock);
	mutex_init(&hap->wf_lock);
	INIT_WORK(&hap->work, qpnp_hap_worker);

	hrtimer_init(&hap->hap_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	hap->hap_timer.function = qpnp_hap_timer;

	hap->timed_dev.name = "vibrator";
	hap->timed_dev.get_time = qpnp_hap_get_time;
	hap->timed_dev.enable = qpnp_hap_td_enable;

	rc = timed_output_dev_register(&hap->timed_dev);
	if (rc < 0) {
		dev_err(&spmi->dev, "timed_output registration failed\n");
		goto timed_output_fail;
	}

	for (i = 0; i < ARRAY_SIZE(qpnp_hap_attrs); i++) {
		rc = sysfs_create_file(&hap->timed_dev.dev->kobj,
				&qpnp_hap_attrs[i].attr);
		if (rc < 0) {
			dev_err(&spmi->dev, "sysfs creation failed\n");
			goto sysfs_fail;
		}
	}

	return 0;

sysfs_fail:
	for (i--; i >= 0; i--)
		sysfs_remove_file(&hap->timed_dev.dev->kobj,
				&qpnp_hap_attrs[i].attr);
	timed_output_dev_unregister(&hap->timed_dev);
timed_output_fail:
	cancel_work_sync(&hap->work);
	hrtimer_cancel(&hap->hap_timer);
	mutex_destroy(&hap->lock);
	mutex_destroy(&hap->wf_lock);

	return rc;
}
Exemplo n.º 26
0
static int qpnp_wled_probe(struct spmi_device *spmi)
{
	struct qpnp_wled *wled;
	struct resource *wled_resource;
	int rc, i;

	wled = devm_kzalloc(&spmi->dev, sizeof(*wled), GFP_KERNEL);
	if (!wled)
		return -ENOMEM;

	wled->spmi = spmi;

	wled_resource = spmi_get_resource_byname(spmi, NULL, IORESOURCE_MEM,
					QPNP_WLED_SINK_BASE);
	if (!wled_resource) {
		dev_err(&spmi->dev, "Unable to get wled sink base address\n");
		return -EINVAL;
	}

	wled->sink_base = wled_resource->start;

	wled_resource = spmi_get_resource_byname(spmi, NULL, IORESOURCE_MEM,
					QPNP_WLED_CTRL_BASE);
	if (!wled_resource) {
		dev_err(&spmi->dev, "Unable to get wled ctrl base address\n");
		return -EINVAL;
	}

	wled->ctrl_base = wled_resource->start;

	wled_resource = spmi_get_resource_byname(spmi, NULL, IORESOURCE_MEM,
					QPNP_WLED_IBB_BASE);
	if (!wled_resource) {
		dev_err(&spmi->dev, "Unable to get IBB base address\n");
		return -EINVAL;
	}

	wled->ibb_base = wled_resource->start;

	wled_resource = spmi_get_resource_byname(spmi, NULL, IORESOURCE_MEM,
					QPNP_WLED_LAB_BASE);
	if (!wled_resource) {
		dev_err(&spmi->dev, "Unable to get LAB base address\n");
		return -EINVAL;
	}

	wled->lab_base = wled_resource->start;

	dev_set_drvdata(&spmi->dev, wled);

	rc = qpnp_wled_parse_dt(wled);
	if (rc) {
		dev_err(&spmi->dev, "DT parsing failed\n");
		return rc;
	}

	rc = qpnp_wled_config(wled);
	if (rc) {
		dev_err(&spmi->dev, "wled config failed\n");
		return rc;
	}

	mutex_init(&wled->lock);
	INIT_WORK(&wled->work, qpnp_wled_work);
	wled->ramp_ms = QPNP_WLED_RAMP_DLY_MS;
	wled->ramp_step = 1;

	wled->cdev.brightness_set = qpnp_wled_set;
	wled->cdev.brightness_get = qpnp_wled_get;

	if (wled->en_9b_dim_res)
		wled->cdev.max_brightness = WLED_MAX_LEVEL_511;
	else
		wled->cdev.max_brightness = WLED_MAX_LEVEL_4095;

	rc = led_classdev_register(&spmi->dev, &wled->cdev);
	if (rc) {
		dev_err(&spmi->dev, "wled registration failed(%d)\n", rc);
		goto wled_register_fail;
	}

	for (i = 0; i < ARRAY_SIZE(qpnp_wled_attrs); i++) {
		rc = sysfs_create_file(&wled->cdev.dev->kobj,
				&qpnp_wled_attrs[i].attr);
		if (rc < 0) {
			dev_err(&spmi->dev, "sysfs creation failed\n");
			goto sysfs_fail;
		}
	}

	gwled = wled;

	return 0;

sysfs_fail:
	for (i--; i >= 0; i--)
		sysfs_remove_file(&wled->cdev.dev->kobj,
				&qpnp_wled_attrs[i].attr);
	led_classdev_unregister(&wled->cdev);
wled_register_fail:
	cancel_work_sync(&wled->work);
	mutex_destroy(&wled->lock);
	return rc;
}
Exemplo n.º 27
0
static int pch_phub_probe(struct pci_dev *pdev,
				    const struct pci_device_id *id)
{
	int ret;
	struct pch_phub_reg *chip;

	chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL);
	if (chip == NULL)
		return -ENOMEM;

	ret = pci_enable_device(pdev);
	if (ret) {
		dev_err(&pdev->dev,
		"%s : pci_enable_device FAILED(ret=%d)", __func__, ret);
		goto err_pci_enable_dev;
	}
	dev_dbg(&pdev->dev, "%s : pci_enable_device returns %d\n", __func__,
		ret);

	ret = pci_request_regions(pdev, KBUILD_MODNAME);
	if (ret) {
		dev_err(&pdev->dev,
		"%s : pci_request_regions FAILED(ret=%d)", __func__, ret);
		goto err_req_regions;
	}
	dev_dbg(&pdev->dev, "%s : "
		"pci_request_regions returns %d\n", __func__, ret);

	chip->pch_phub_base_address = pci_iomap(pdev, 1, 0);


	if (chip->pch_phub_base_address == NULL) {
		dev_err(&pdev->dev, "%s : pci_iomap FAILED", __func__);
		ret = -ENOMEM;
		goto err_pci_iomap;
	}
	dev_dbg(&pdev->dev, "%s : pci_iomap SUCCESS and value "
		"in pch_phub_base_address variable is %p\n", __func__,
		chip->pch_phub_base_address);

	chip->pdev = pdev; /* Save pci device struct */

	if (id->driver_data == 1) { /* EG20T PCH */
		const char *board_name;

		ret = sysfs_create_file(&pdev->dev.kobj,
					&dev_attr_pch_mac.attr);
		if (ret)
			goto err_sysfs_create;

		ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (ret)
			goto exit_bin_attr;

		pch_phub_read_modify_write_reg(chip,
					       (unsigned int)CLKCFG_REG_OFFSET,
					       CLKCFG_CAN_50MHZ,
					       CLKCFG_CANCLK_MASK);

		/* quirk for CM-iTC board */
		board_name = dmi_get_system_info(DMI_BOARD_NAME);
		if (board_name && strstr(board_name, "CM-iTC"))
			pch_phub_read_modify_write_reg(chip,
						(unsigned int)CLKCFG_REG_OFFSET,
						CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |
						CLKCFG_PLL2VCO | CLKCFG_UARTCLKSEL,
						CLKCFG_UART_MASK);

		/* set the prefech value */
		iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
		/* set the interrupt delay value */
		iowrite32(0x25, chip->pch_phub_base_address + 0x44);
		chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T;
		chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T;
	} else if (id->driver_data == 2) { /* ML7213 IOH */
		ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (ret)
			goto err_sysfs_create;
		/* set the prefech value
		 * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a
		 * Device4(SDIO #0,1,2):f
		 * Device6(SATA 2):f
		 * Device8(USB OHCI #0/ USB EHCI #0):a
		 */
		iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14);
		chip->pch_opt_rom_start_address =\
						 PCH_PHUB_ROM_START_ADDR_ML7213;
	} else if (id->driver_data == 3) { /* ML7223 IOH Bus-m*/
		/* set the prefech value
		 * Device8(GbE)
		 */
		iowrite32(0x000a0000, chip->pch_phub_base_address + 0x14);
		/* set the interrupt delay value */
		iowrite32(0x25, chip->pch_phub_base_address + 0x140);
		chip->pch_opt_rom_start_address =\
						 PCH_PHUB_ROM_START_ADDR_ML7223;
		chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
	} else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/
		ret = sysfs_create_file(&pdev->dev.kobj,
					&dev_attr_pch_mac.attr);
		if (ret)
			goto err_sysfs_create;
		ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (ret)
			goto exit_bin_attr;
		/* set the prefech value
		 * Device2(USB OHCI #0,1,2,3/ USB EHCI #0):a
		 * Device4(SDIO #0,1):f
		 * Device6(SATA 2):f
		 */
		iowrite32(0x0000ffa0, chip->pch_phub_base_address + 0x14);
		chip->pch_opt_rom_start_address =\
						 PCH_PHUB_ROM_START_ADDR_ML7223;
		chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
	} else if (id->driver_data == 5) { /* ML7831 */
		ret = sysfs_create_file(&pdev->dev.kobj,
					&dev_attr_pch_mac.attr);
		if (ret)
			goto err_sysfs_create;

		ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
		if (ret)
			goto exit_bin_attr;

		/* set the prefech value */
		iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
		/* set the interrupt delay value */
		iowrite32(0x25, chip->pch_phub_base_address + 0x44);
		chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T;
		chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T;
	}

	chip->ioh_type = id->driver_data;
	pci_set_drvdata(pdev, chip);

	return 0;
exit_bin_attr:
	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr);

err_sysfs_create:
	pci_iounmap(pdev, chip->pch_phub_base_address);
err_pci_iomap:
	pci_release_regions(pdev);
err_req_regions:
	pci_disable_device(pdev);
err_pci_enable_dev:
	kfree(chip);
	dev_err(&pdev->dev, "%s returns %d\n", __func__, ret);
	return ret;
}
Exemplo n.º 28
0
static void ts_key_report_deinit(void)
{
	sysfs_remove_file(virtual_key_kobj, &dev_attr_virtualkeys.attr);
	kobject_del(virtual_key_kobj);
}
Exemplo n.º 29
0
/**
 * driver_remove_file - remove sysfs file for driver.
 * @drv: driver.
 * @attr: driver attribute descriptor.
 */
void driver_remove_file(struct device_driver *drv,
			struct driver_attribute *attr)
{
	if (drv)
		sysfs_remove_file(&drv->p->kobj, &attr->attr);
}
Exemplo n.º 30
0
void skl_nhlt_remove_sysfs(struct skl *skl)
{
	struct device *dev = &skl->pci->dev;

	sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
}