• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pwm_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pwm_free函数的典型用法代码示例。如果您正苦于以下问题:C++ pwm_free函数的具体用法?C++ pwm_free怎么用?C++ pwm_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pwm_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pm8058_led_remove

static int __devexit pm8058_led_remove(struct platform_device *pdev)
{
	struct pm8058_led_platform_data *pdata;
	struct pm8058_led_data *ldata;
	int i;

	pdata = pdev->dev.platform_data;
	ldata = platform_get_drvdata(pdev);

	for (i = 0; i < pdata->num_leds; i++) {
		led_classdev_unregister(&ldata[i].ldev);
		switch (pdata->led_config[i].type) {
		case PM8058_LED_RGB:
			device_remove_file(ldata[i].ldev.dev,
					    &dev_attr_blink);
			device_remove_file(ldata[i].ldev.dev,
					    &dev_attr_off_timer);
			pwm_free(ldata[i].pwm_led);
			break;
		case PM8058_LED_PWM:
		case PM8058_LED_DRVX:
			pwm_free(ldata[i].pwm_led);
			break;
		}
	}

	destroy_workqueue(g_led_work_queue);
	kfree(ldata);
	return 0;
}
开发者ID:Akinus,项目名称:htc-kernel-msm7x30,代码行数:30,代码来源:leds-pm8058.c


示例2: pwm_fan_remove

static int pwm_fan_remove(struct platform_device *pdev)
{
	struct fan_dev_data *fan_data = platform_get_drvdata(pdev);

	if (!fan_data)
		return -EINVAL;
	debugfs_remove_recursive(fan_debugfs_root);
	free_irq(fan_data->tach_irq, NULL);
	gpio_free(fan_data->tach_gpio);
	pwm_config(fan_data->pwm_dev, 0, fan_data->pwm_period);
	pwm_disable(fan_data->pwm_dev);
	pwm_free(fan_data->pwm_dev);
	thermal_cooling_device_unregister(fan_data->cdev);
	cancel_delayed_work(&fan_data->fan_tach_work);
	destroy_workqueue(fan_data->tach_workqueue);
	cancel_delayed_work(&fan_data->fan_ramp_work);
	destroy_workqueue(fan_data->workqueue);
	devm_kfree(&pdev->dev, (void *)(fan_data->fan_pwm));
	devm_kfree(&pdev->dev, (void *)(fan_data->fan_state_cap_lookup));
	devm_kfree(&pdev->dev, (void *)(fan_data->fan_rrd));
	devm_kfree(&pdev->dev, (void *)(fan_data->fan_rru));
	devm_kfree(&pdev->dev, (void *)(fan_data->fan_rpm));
	devm_kfree(&pdev->dev, (void *)fan_data);
	remove_sysfs_entry(&pdev->dev);

	if (fan_data->fan_reg)
		regulator_put(fan_data->fan_reg);
	return 0;
}
开发者ID:Toradex-Apalis-TK1-AndroidTV,项目名称:android_kernel_nvidia_mm,代码行数:29,代码来源:pwm_fan.c


示例3: pwm_fan_suspend

static int pwm_fan_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct fan_dev_data *fan_data = platform_get_drvdata(pdev);
	int err;

	mutex_lock(&fan_data->fan_state_lock);
	cancel_delayed_work(&fan_data->fan_ramp_work);
	/*Turn the fan off*/
	fan_data->fan_cur_pwm = 0;
	fan_data->next_target_pwm = 0;

	set_pwm_duty_cycle(0, fan_data);
	pwm_disable(fan_data->pwm_dev);
	pwm_free(fan_data->pwm_dev);

	err = gpio_request(fan_data->pwm_gpio, "pwm-fan");
	if (err < 0) {
		dev_err(&pdev->dev, "%s:gpio request failed %d\n",
			__func__, fan_data->pwm_gpio);
	}

	gpio_direction_output(fan_data->pwm_gpio, 1);

	/*Stop thermal control*/
	fan_data->fan_temp_control_flag = 0;
	mutex_unlock(&fan_data->fan_state_lock);
	return 0;
}
开发者ID:SuperPichu,项目名称:shield-tablet-kernel,代码行数:28,代码来源:pwm_fan.c


示例4: pwm_backlight_remove

static int pwm_backlight_remove(struct platform_device *pdev)
{
	struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
	struct backlight_device *bl = platform_get_drvdata(pdev);
	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
	struct pin_config new_pin_config;

	backlight_device_unregister(bl);
	pwm_config(pb->pwm, 0, pb->period);
	pwm_disable(pb->pwm);
	pwm_free(pb->pwm);
	if (data && data->exit)
		data->exit(&pdev->dev);
	if (data && pdev->dev.of_node) {
		kfree(data);
		pdev->dev.platform_data = NULL;
	}


	/*reset the pwm pin to GPIO function if defined in the kernel-dtb*/
	if (pwm_pin >= 0 && pwm_pin_reboot_func >= 0) {
		pr_info("remove reset the pwm pin to GPIO function\r\n");
		pr_err("remove reset the pwm pin to GPIO function\r\n");
		new_pin_config.name = pwm_pin;
		pinmux_get_pin_config(&new_pin_config);
		new_pin_config.func = pwm_pin_reboot_func;
		pinmux_set_pin_config(&new_pin_config);

		gpio_direction_output( 24, 0 );
		gpio_set_value( 24, 0 );

	}

	return 0;
}
开发者ID:birey,项目名称:android_kernel_samsung_kyleproxx,代码行数:35,代码来源:pwm_bl.c


示例5: pwm_backlight_probe

static int pwm_backlight_probe(struct platform_device *pdev)
{
	struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
	struct backlight_device *bl;
	struct pwm_bl_data *pb;
	int ret;

	if (!data) {
		dev_err(&pdev->dev, "failed to find platform data\n");
		return -EINVAL;
	}

	if (data->init) {
		ret = data->init(&pdev->dev);
		if (ret < 0)
			return ret;
	}

	pb = kzalloc(sizeof(*pb), GFP_KERNEL);
	if (!pb) {
		dev_err(&pdev->dev, "no memory for state\n");
		ret = -ENOMEM;
		goto err_alloc;
	}

	pb->period = data->pwm_period_ns;
	pb->notify = data->notify;

	pb->pwm = pwm_request(data->pwm_id, "backlight");
	if (IS_ERR(pb->pwm)) {
		dev_err(&pdev->dev, "unable to request PWM for backlight\n");
		ret = PTR_ERR(pb->pwm);
		goto err_pwm;
	} else
		dev_dbg(&pdev->dev, "got pwm for backlight\n");

	bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev,
			pb, &pwm_backlight_ops);
	if (IS_ERR(bl)) {
		dev_err(&pdev->dev, "failed to register backlight\n");
		ret = PTR_ERR(bl);
		goto err_bl;
	}

	bl->props.max_brightness = data->max_brightness;
	bl->props.brightness = data->dft_brightness;
	backlight_update_status(bl);

	platform_set_drvdata(pdev, bl);
	return 0;

err_bl:
	pwm_free(pb->pwm);
err_pwm:
	kfree(pb);
err_alloc:
	if (data->exit)
		data->exit(&pdev->dev);
	return ret;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:60,代码来源:pwm_bl.c


示例6: pwm_beeper_probe

static int __devinit pwm_beeper_probe(struct platform_device *pdev)
{
	unsigned long pwm_id = (unsigned long)pdev->dev.platform_data;
	struct pwm_beeper *beeper;
	int error;

	beeper = kzalloc(sizeof(*beeper), GFP_KERNEL);
	if (!beeper)
		return -ENOMEM;

	beeper->pwm = pwm_request(pwm_id, "pwm beeper");

	if (IS_ERR(beeper->pwm)) {
		error = PTR_ERR(beeper->pwm);
		dev_err(&pdev->dev, "Failed to request pwm device: %d\n", error);
		goto err_free;
	}

	beeper->input = input_allocate_device();
	if (!beeper->input) {
		dev_err(&pdev->dev, "Failed to allocate input device\n");
		error = -ENOMEM;
		goto err_pwm_free;
	}
	beeper->input->dev.parent = &pdev->dev;

	beeper->input->name = "pwm-beeper";
	beeper->input->phys = "pwm/input0";
	beeper->input->id.bustype = BUS_HOST;
	beeper->input->id.vendor = 0x001f;
	beeper->input->id.product = 0x0001;
	beeper->input->id.version = 0x0100;

	beeper->input->evbit[0] = BIT(EV_SND);
	beeper->input->sndbit[0] = BIT(SND_TONE) | BIT(SND_BELL);

	beeper->input->event = pwm_beeper_event;

	input_set_drvdata(beeper->input, beeper);

	error = input_register_device(beeper->input);
	if (error) {
		dev_err(&pdev->dev, "Failed to register input device: %d\n", error);
		goto err_input_free;
	}

	platform_set_drvdata(pdev, beeper);

	return 0;

err_input_free:
	input_free_device(beeper->input);
err_pwm_free:
	pwm_free(beeper->pwm);
err_free:
	kfree(beeper);

	return error;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:59,代码来源:pwm-beeper.c


示例7: rx1950_backlight_exit

static void rx1950_backlight_exit(struct device *dev)
{
	rx1950_bl_power(0);
	rx1950_lcd_power(0);

	pwm_free(lcd_pwm);
	gpio_free(S3C2410_GPB(0));
}
开发者ID:atixing,项目名称:linux,代码行数:8,代码来源:mach-rx1950.c


示例8: acx00_i2c_remove

static __devexit int acx00_i2c_remove(struct i2c_client *i2c)
{
	struct acx00 *acx00 = i2c_get_clientdata(i2c);

	acx00_device_exit(acx00);

	pwm_disable(acx00->pwm_ac200);
	pwm_free(acx00->pwm_ac200);
	return 0;
}
开发者ID:phi-psi,项目名称:linux-3.4-sunxi,代码行数:10,代码来源:acx00-core.c


示例9: pwm_ir_tx_probe

static int __devinit pwm_ir_tx_probe(struct pwm_ir_dev *dev)
{
    struct pwm_ir_data *data = dev->pdev->dev.platform_data;
    int rc = 0;

    if (data->reg_id) {
        dev->reg = regulator_get(&dev->pdev->dev, data->reg_id);
        if (IS_ERR(dev->reg)) {
            dev_err(&dev->pdev->dev,
                    "failed to regulator_get(%s)\n",
                    data->reg_id);
            return PTR_ERR(dev->reg);
        }
    }

    dev->pwm = pwm_request(data->pwm_id, PWM_IR_NAME);
    if (IS_ERR(dev->pwm)) {
        dev_err(&dev->pdev->dev,
                "failed to pwm_request(%d)\n",
                data->pwm_id);
        rc = PTR_ERR(dev->pwm);
        goto err_regulator_put;
    }

    if (data->low_active) {
#if 0 /* need the latest kernel */
        rc = pwm_set_polarity(dev->pwm, PWM_POLARITY_INVERSED);
#else
        rc = -ENOSYS;
#endif
        if (rc != 0) {
            dev_err(&dev->pdev->dev, "failed to change polarity\n");
            goto err_pwm_free;
        }
    }

    rc = pwm_ir_tx_config(dev, 38000, 50);
    if (rc != 0) {
        dev_err(&dev->pdev->dev, "failed to change carrier and duty\n");
        goto err_pwm_free;
    }

    dev->rdev->tx_ir           = pwm_ir_tx_transmit;
    dev->rdev->s_tx_carrier    = pwm_ir_tx_carrier;
    dev->rdev->s_tx_duty_cycle = pwm_ir_tx_duty_cycle;

    return rc;

err_pwm_free:
    pwm_free(dev->pwm);
err_regulator_put:
    if (dev->reg)
        regulator_put(dev->reg);
    return rc;
}
开发者ID:vasishath,项目名称:kernel_cancro,代码行数:55,代码来源:pwm-ir.c


示例10: shooter_u_3Dpanel_remove

static int shooter_u_3Dpanel_remove(struct platform_device * pdev)
{
	printk(KERN_INFO "%s\n", __func__);
	if (pwm_3d) {
		pwm_free(pwm_3d);
		pwm_3d = NULL;
	}
	device_remove_file(&pdev->dev, &dev_attr_3D_mode);
	kobject_del(uevent_kobj);
	kobject_del(kobj);
	return 0;
}
开发者ID:anryl,项目名称:shooteru_HTC,代码行数:12,代码来源:shooter_u-panel.c


示例11: qpnp_hap_pwm_config

/* configuration api for pwm */
static int qpnp_hap_pwm_config(struct qpnp_hap *hap)
{
	u8 reg = 0;
	int rc, temp;

	/* Configure the EXTERNAL_PWM register */
	if (hap->ext_pwm_freq_khz <= QPNP_HAP_EXT_PWM_FREQ_25_KHZ) {
		hap->ext_pwm_freq_khz = QPNP_HAP_EXT_PWM_FREQ_25_KHZ;
		temp = 0;
	} else if (hap->ext_pwm_freq_khz <=
				QPNP_HAP_EXT_PWM_FREQ_50_KHZ) {
		hap->ext_pwm_freq_khz = QPNP_HAP_EXT_PWM_FREQ_50_KHZ;
		temp = 1;
	} else if (hap->ext_pwm_freq_khz <=
				QPNP_HAP_EXT_PWM_FREQ_75_KHZ) {
		hap->ext_pwm_freq_khz = QPNP_HAP_EXT_PWM_FREQ_75_KHZ;
		temp = 2;
	} else {
		hap->ext_pwm_freq_khz = QPNP_HAP_EXT_PWM_FREQ_100_KHZ;
		temp = 3;
	}

	rc = qpnp_hap_read_reg(hap, &reg,
			QPNP_HAP_EXT_PWM_REG(hap->base));
	if (rc < 0)
		return rc;
	reg &= QPNP_HAP_EXT_PWM_MASK;
	reg |= temp;
	rc = qpnp_hap_write_reg(hap, &reg,
			QPNP_HAP_EXT_PWM_REG(hap->base));
	if (rc)
		return rc;

	hap->pwm_info.pwm_dev = pwm_request(hap->pwm_info.pwm_channel,
							 "qpnp-hap");
	if (IS_ERR_OR_NULL(hap->pwm_info.pwm_dev)) {
		dev_err(&hap->spmi->dev, "hap pwm request failed\n");
		return -ENODEV;
	}

	rc = pwm_config(hap->pwm_info.pwm_dev, hap->pwm_info.duty_us,
					hap->pwm_info.period_us);
	if (rc < 0) {
		dev_err(&hap->spmi->dev, "hap pwm config failed\n");
		pwm_free(hap->pwm_info.pwm_dev);
		return -ENODEV;
	}

	hap->pwm_cfg_state = true;

	return 0;
}
开发者ID:auras76,项目名称:aur-kernel-XZxx,代码行数:53,代码来源:qpnp-haptic.c


示例12: pwm_beeper_remove

static int pwm_beeper_remove(struct platform_device *pdev)
{
	struct pwm_beeper *beeper = platform_get_drvdata(pdev);

	input_unregister_device(beeper->input);

	pwm_disable(beeper->pwm);
	pwm_free(beeper->pwm);

	kfree(beeper);

	return 0;
}
开发者ID:3null,项目名称:linux,代码行数:13,代码来源:pwm-beeper.c


示例13: vibrator_remove

static int __devexit vibrator_remove(struct platform_device *pdev)
{
	struct vibrator_drvdata *data = platform_get_drvdata(pdev);
	timed_output_dev_unregister(&data->dev);
#ifdef CONFIG_MACH_Q1_BD
	gpio_free(GPIO_MOTOR_EN);
#else
	regulator_put(data->regulator);
#endif
	pwm_free(data->pwm);
	kfree(data);
	return 0;
}
开发者ID:gadido30,项目名称:bigfatwifi,代码行数:13,代码来源:max8997_vibrator.c


示例14: pwm_backlight_remove

static int pwm_backlight_remove(struct platform_device *pdev)
{
	struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
	struct backlight_device *bl = platform_get_drvdata(pdev);
	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);

	backlight_device_unregister(bl);
	pwm_config(pb->pwm, 0, pb->period);
	pwm_disable(pb->pwm);
	pwm_free(pb->pwm);
	if (data->exit)
		data->exit(&pdev->dev);
	return 0;
}
开发者ID:turter99,项目名称:android_kernel_samsung_jaltektt_perseus_4.2.2,代码行数:14,代码来源:pwm_bl.c


示例15: max77660_haptic_remove

static int max77660_haptic_remove(struct platform_device *pdev)
{
	struct max77660_haptic *chip = platform_get_drvdata(pdev);

	destroy_work_on_stack(&chip->work);
	input_unregister_device(chip->input_dev);
	sysfs_remove_group(&pdev->dev.kobj, &max77660_haptics_attr_group);
	regulator_put(chip->regulator);

	if (chip->mode == MAX77660_EXTERNAL_MODE)
		pwm_free(chip->pwm);

	return 0;
}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:14,代码来源:max77660_haptic.c


示例16: max77693_haptic_remove

static int __devexit max77693_haptic_remove(struct platform_device *pdev)
{
	struct max77693_haptic_data *data = platform_get_drvdata(pdev);
#ifdef CONFIG_ANDROID_TIMED_OUTPUT
	timed_output_dev_unregister(&data->tout_dev);
#endif
	regulator_put(data->regulator);
	pwm_free(data->pwm);
	destroy_workqueue(data->workqueue);
	kfree(data);
	g_hap_data = NULL;

	return 0;
}
开发者ID:gokussjx,项目名称:Googy-Max-Kernel,代码行数:14,代码来源:max77693_haptic.c


示例17: max8997_haptic_remove

static int __devexit max8997_haptic_remove(struct platform_device *pdev)
{
	struct max8997_haptic *chip = platform_get_drvdata(pdev);

	input_unregister_device(chip->input_dev);
	regulator_put(chip->regulator);

	if (chip->mode == MAX8997_EXTERNAL_MODE)
		pwm_free(chip->pwm);

	kfree(chip);

	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:14,代码来源:max8997_haptic.c


示例18: msm_pmic_led_suspend

static int msm_pmic_led_suspend(struct platform_device *dev,
		pm_message_t state)
{
/* if phone is set in system sleep indicator mode and is sleepping,bl_pwm must be free for GPIO_24 is being controled by modem*/
#ifdef CONFIG_HUAWEI_LEDS_PMIC
    if( machine_is_msm8255_u8860lp()
    || machine_is_msm8255_u8860_r()
	 ||machine_is_msm8255_u8860_51())
    {
        pwm_free(bl_pwm);
    }
#endif
	led_classdev_suspend(&msm_kp_bl_led);
	return 0;
}
开发者ID:markcn,项目名称:kernel_huawei_c8812,代码行数:15,代码来源:leds-msm-pmic.c


示例19: pwm_backlight_remove

static int pwm_backlight_remove(struct platform_device *pdev)
{
	struct backlight_device *bl = platform_get_drvdata(pdev);
	struct pwm_bl_data *pb = bl_get_data(bl);

	backlight_device_unregister(bl);
	pwm_backlight_power_off(pb);

	if (pb->exit)
		pb->exit(&pdev->dev);
	if (pb->legacy)
		pwm_free(pb->pwm);

	return 0;
}
开发者ID:Anjali05,项目名称:linux,代码行数:15,代码来源:pwm_bl.c


示例20: pwm_fan_remove

static int pwm_fan_remove(struct platform_device *pdev)
{
	struct fan_dev_data *fan_data = platform_get_drvdata(pdev);

	if (!fan_data)
		return -EINVAL;
	debugfs_remove_recursive(fan_debugfs_root);
	free_irq(fan_data->tach_irq, NULL);
	gpio_free(fan_data->tach_gpio);
	pwm_config(fan_data->pwm_dev, 0, fan_data->pwm_period);
	pwm_disable(fan_data->pwm_dev);
	pwm_free(fan_data->pwm_dev);
	thermal_cooling_device_unregister(fan_data->cdev);
	remove_sysfs_entry(&pdev->dev);
	return 0;
}
开发者ID:SuperPichu,项目名称:shield-tablet-kernel,代码行数:16,代码来源:pwm_fan.c



注:本文中的pwm_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pwm_init函数代码示例发布时间:2022-05-30
下一篇:
C++ pwm_enable函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap