本文整理汇总了C++中pwm_disable函数的典型用法代码示例。如果您正苦于以下问题:C++ pwm_disable函数的具体用法?C++ pwm_disable怎么用?C++ pwm_disable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwm_disable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: max77693_haptic_enable
static void max77693_haptic_enable(struct max77693_haptic *haptic)
{
int error;
if (haptic->enabled)
return;
error = pwm_enable(haptic->pwm_dev);
if (error) {
dev_err(haptic->dev,
"failed to enable haptic pwm device: %d\n", error);
return;
}
error = max77693_haptic_lowsys(haptic, true);
if (error)
goto err_enable_lowsys;
error = max77693_haptic_configure(haptic, true);
if (error)
goto err_enable_config;
haptic->enabled = true;
return;
err_enable_config:
max77693_haptic_lowsys(haptic, false);
err_enable_lowsys:
pwm_disable(haptic->pwm_dev);
}
开发者ID:3null,项目名称:linux,代码行数:31,代码来源:max77693-haptic.c
示例2: 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
示例3: vibtonz_en
void vibtonz_en(bool en)
{
struct vibrator_drvdata *data = g_data;
if (en) {
if (data->running)
return ;
if (data->pdata->motor_en)
data->pdata->motor_en(true);
else
regulator_enable(data->regulator);
i2c_max8997_hapticmotor(data, true);
pwm_enable(data->pwm);
data->running = true;
} else {
if (!data->running)
return ;
pwm_disable(data->pwm);
i2c_max8997_hapticmotor(data, false);
if (data->pdata->motor_en)
data->pdata->motor_en(false);
else
regulator_force_disable(data->regulator);
data->running = false;
}
}
开发者ID:morristech,项目名称:xxICSKernel,代码行数:27,代码来源:max8997_vibrator.c
示例4: ev3_output_port_unregister
void ev3_output_port_unregister(struct lego_port_device *port)
{
struct ev3_output_port_data *data;
/* port can be null if disabled via module parameter */
if (!port)
return;
data = container_of(port, struct ev3_output_port_data, out_port);
pwm_disable(data->pwm);
pwm_put(data->pwm);
hrtimer_cancel(&data->timer);
cancel_work_sync(&data->change_uevent_work);
cancel_work_sync(&data->work);
if (data->motor)
ev3_output_port_unregister_motor(&data->work);
if (port->mode == EV3_OUTPUT_PORT_MODE_RAW)
ev3_output_port_disable_raw_mode(data);
lego_port_unregister(&data->out_port);
ev3_output_port_float(data);
gpio_free_array(data->gpio, ARRAY_SIZE(data->gpio));
put_legoev3_analog(data->analog);
dev_set_drvdata(&port->dev, NULL);
kfree(data);
}
开发者ID:zanderdk,项目名称:lego-linux-drivers,代码行数:25,代码来源:legoev3_ports_out.c
示例5: qpnp_vib_set
static int qpnp_vib_set(struct qpnp_vib *vib, int on)
{
int rc;
u8 val;
if (on) {
if (vib->mode != QPNP_VIB_MANUAL)
pwm_enable(vib->pwm_info.pwm_dev);
else {
val = vib->reg_en_ctl;
val |= QPNP_VIB_EN;
rc = qpnp_vib_write_u8(vib, &val,
QPNP_VIB_EN_CTL(vib->base));
if (rc < 0)
return rc;
vib->reg_en_ctl = val;
}
} else {
if (vib->mode != QPNP_VIB_MANUAL)
pwm_disable(vib->pwm_info.pwm_dev);
else {
val = vib->reg_en_ctl;
val &= ~QPNP_VIB_EN;
rc = qpnp_vib_write_u8(vib, &val,
QPNP_VIB_EN_CTL(vib->base));
if (rc < 0)
return rc;
vib->reg_en_ctl = val;
}
}
return 0;
}
开发者ID:chhapil,项目名称:Kernel-Lenovo-A6000-KK,代码行数:33,代码来源:qpnp-vibrator.c
示例6: qpnp_hap_set
/* set api for haptics */
static int qpnp_hap_set(struct qpnp_hap *hap, int on)
{
int rc = 0;
if (hap->play_mode == QPNP_HAP_PWM) {
if (on)
rc = pwm_enable(hap->pwm_info.pwm_dev);
else
pwm_disable(hap->pwm_info.pwm_dev);
} else if (hap->play_mode == QPNP_HAP_BUFFER ||
hap->play_mode == QPNP_HAP_DIRECT) {
if (on) {
rc = qpnp_hap_mod_enable(hap, on);
if (rc < 0)
return rc;
rc = qpnp_hap_play(hap, on);
} else {
rc = qpnp_hap_play(hap, on);
if (rc < 0)
return rc;
rc = qpnp_hap_mod_enable(hap, on);
}
}
return rc;
}
开发者ID:TeamRegular,项目名称:android_kernel_lge_msm8992,代码行数:28,代码来源:qpnp-haptic.c
示例7: led_pwm_exit
static void led_pwm_exit(struct led_t * led)
{
struct led_pwm_private_data_t * dat = (struct led_pwm_private_data_t *)led->priv;
dat->brightness = 0;
pwm_disable(dat->pwm);
}
开发者ID:philippe-nuaa,项目名称:xboot,代码行数:7,代码来源:led-pwm.c
示例8: ImmVibeSPI_ForceOut_AmpDisable
/*
** Called to disable amp (disable output force)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpDisable(VibeUInt8 nActuatorIndex)
{
#if 0
#error Please review the code between the #if and #endif
if (g_bAmpEnabled)
{
DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpDisable.\n"));
g_bAmpEnabled = false;
#if 0
mhn_gpio_set_level(GPIO_EN, GPIO_LEVEL_LOW);
mz_ops.bstat &= ~HN_BATTERY_MOTOR;
#endif
}
#endif
if (g_bAmpEnabled)
{
g_bAmpEnabled = false;
pwm_config(Immvib_pwm, 0, freq_count/2);
pwm_disable(Immvib_pwm);
//gpio_request(GPIO_VIBTONE_EN1, "GPIO_VIBTONE_EN1");
gpio_direction_output(GPIO_VIBTONE_EN1, GPIO_LEVEL_LOW);
gpio_direction_input(GPIO_VIBTONE_EN1);
s3c_gpio_setpull(GPIO_VIBTONE_EN1,S3C_GPIO_PULL_DOWN);
//gpio_free(GPIO_VIBTONE_EN1);
}
return VIBE_S_SUCCESS;
}
开发者ID:angel12,项目名称:sch-i510_kernel,代码行数:36,代码来源:ImmVibeSPI.c
示例9: pwm_backlight_update_status
static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
int brightness = bl->props.brightness;
int max = bl->props.max_brightness;
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
if (pb->notify)
brightness = pb->notify(pb->dev, brightness);
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
pwm_config(pb->pwm, asus_remapped_brightness[brightness] * (pb->period / 100) / max, pb->period);
pwm_enable(pb->pwm);
}
if (pb->notify_after)
pb->notify_after(pb->dev, brightness);
return 0;
}
开发者ID:corvusmod,项目名称:kernel_asus_tf101-lumpy,代码行数:29,代码来源:pwm_bl.c
示例10: pwm_beeper_event
static int pwm_beeper_event(struct input_dev *input,
unsigned int type, unsigned int code, int value)
{
int ret = 0;
struct pwm_beeper *beeper = input_get_drvdata(input);
unsigned long period;
if (type != EV_SND || value < 0)
return -EINVAL;
switch (code) {
case SND_BELL:
value = value ? 1000 : 0;
break;
case SND_TONE:
break;
default:
return -EINVAL;
}
if (value == 0) {
pwm_disable(beeper->pwm);
} else {
period = HZ_TO_NANOSECONDS(value);
ret = pwm_config(beeper->pwm, period / 2, period);
if (ret)
return ret;
ret = pwm_enable(beeper->pwm);
if (ret)
return ret;
beeper->period = period;
}
return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:35,代码来源:pwm-beeper.c
示例11: stopPwm
int stopPwm(char *channel)
{
char key[8];
int allowed = -1;
clear_error_msg();
if (!get_pwm_key(channel, key)) {
printf("Invalid PWM key or name.");
return 0;
}
// Check to see if PWM is allowed on the hardware
// A 1 means we're good to go
allowed = pwm_allowed(key);
if (allowed == -1) {
char err[2000];
snprintf(err, sizeof(err), "Error determining hardware. (%s)", get_error_msg());
return 0;
} else if (allowed == 0) {
char err[2000];
snprintf(err, sizeof(err), "PWM %s not available on current Hardware", key);
return 0;
}
if (pwm_disable(key) < 0) {
char err[2000];
snprintf(err, sizeof(err), "PWM: %s issue: (%s)", channel, get_error_msg());
return 0;
}
}
开发者ID:Groguard,项目名称:CHIP_IO_C,代码行数:31,代码来源:chip_io_c_pwm.c
示例12: mipi_toshiba_set_backlight
static void mipi_toshiba_set_backlight(struct msm_fb_data_type *mfd)
{
int ret;
static int bklight_pwm_cfg;
if (bklight_pwm_cfg == 0) {
mipi_bklight_pwm_cfg();
bklight_pwm_cfg++;
}
if (bl_lpm) {
ret = pwm_config(bl_lpm, MIPI_TOSHIBA_PWM_DUTY_LEVEL *
mfd->bl_level, MIPI_TOSHIBA_PWM_PERIOD_USEC);
if (ret) {
pr_err("pwm_config on lpm failed %d\n", ret);
return;
}
if (mfd->bl_level) {
ret = pwm_enable(bl_lpm);
if (ret)
pr_err("pwm enable/disable on lpm failed"
"for bl %d\n", mfd->bl_level);
} else {
pwm_disable(bl_lpm);
}
}
}
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:27,代码来源:mipi_toshiba.c
示例13: max77665_haptic_on
static int max77665_haptic_on(struct haptic_data *chip, bool en)
{
int ret = 0;
if (en) {
ret = max77665_update_reg(chip->pmic, MAX77665_PMIC_REG_LSCNFG,
LSEN, LSEN_MASK);
ret = max77665_update_reg(chip->client,
MAX77665_HAPTIC_REG_CONFIG2,
(0x1 << HAPTIC_CONF2_MEN_SHIFT),
HAPTIC_CONF2_MEN_MASK);
ret = pwm_config(chip->pwm, chip->duty,
chip->period);
ret = pwm_enable(chip->pwm);
} else {
pwm_disable(chip->pwm);
ret = max77665_update_reg(chip->client,
MAX77665_HAPTIC_REG_CONFIG2,
(0x0 << HAPTIC_CONF2_MEN_SHIFT),
HAPTIC_CONF2_MEN_MASK);
ret = max77665_update_reg(chip->pmic, MAX77665_PMIC_REG_LSCNFG,
LSDEN, LSEN_MASK);
}
return ret;
}
开发者ID:Abioy,项目名称:meizu-mx-kernel,代码行数:27,代码来源:max77665_haptic.c
示例14: msm_flashlight_led_set
static void msm_flashlight_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
int rc = 0;
int PWM_PERIOD = NSEC_PER_SEC / 500;
if(value==1) // some apps expect the flashlight to be either on or off
value=100;
if (!msm_flash_pwm) {
rc = pm8058_gpio_config( 23, &camera_flash);
if (rc) {
pr_err("%s PMIC GPIO 23 write failed\n", __func__);
return;
}
msm_flash_pwm = pwm_request(0, "camera-flash");
if (msm_flash_pwm == NULL) {
pr_err("%s: FAIL pwm_request(): msm_flash_pwm=%p\n",
__func__, msm_flash_pwm);
msm_flash_pwm = NULL;
return;
}
}
if(value==0) {
pwm_disable(msm_flash_pwm);
} else {
rc = pwm_config(msm_flash_pwm,(PWM_PERIOD/255)*value/NSEC_PER_USEC,PWM_PERIOD/NSEC_PER_USEC);
if (rc >= 0)
rc = pwm_enable(msm_flash_pwm);
}
}
开发者ID:miuiportugal,项目名称:kernel_u8800-1,代码行数:31,代码来源:leds-msm-pmic.c
示例15: pwm_test_store_run
static ssize_t pwm_test_store_run(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int rc;
struct pwm_test *pwm_test = dev_get_drvdata(dev);
int run;
rc = kstrtoint(buf, 0, &run);
if (rc)
return rc;
/* only 0 & 1 allowed */
if (run != 0 && run != 1)
return -EINVAL;
/* same state, don't bother */
if (run == pwm_test->run)
return count;
if (run) {
rc = pwm_enable(pwm_test->pwm);
if (rc != 0) {
dev_err(dev, "pwm_enable failed\n");
return rc;
}
} else
pwm_disable(pwm_test->pwm);
pwm_test->run = run;
return count;
}
开发者ID:SynerconTechnologies,项目名称:FLA-Kernel,代码行数:32,代码来源:pwm_test.c
示例16: pm8058_pwm_led_brightness_set
static void pm8058_pwm_led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
struct pm8058_led_data *ldata;
int enable = 0;
/* struct pwm_device* pwm_led; */
ldata = container_of(led_cdev, struct pm8058_led_data, ldev);
pwm_disable(ldata->pwm_led);
brightness = (brightness > LED_FULL) ? LED_FULL : brightness;
brightness = (brightness < LED_OFF) ? LED_OFF : brightness;
LED_INFO_LOG("%s: bank %d brightness %d\n", __func__,
ldata->bank, brightness);
enable = (brightness) ? 1 : 0;
if (strcmp(ldata->ldev.name, "charming-led") == 0)
charming_led_enable(enable);
if (brightness) {
pwm_config(ldata->pwm_led, 64000, 64000);
#if 0
pwm_conf.pwm_size = ldata->pwm_size;
pwm_conf.clk = ldata->clk;
pwm_conf.pre_div = ldata->pre_div;
pwm_conf.pre_div_exp = ldata->pre_div_exp;
pwm_conf.pwm_value = ldata->pwm_value;
pwm_conf.bypass_lut = 1;
pwm_configure(ldata->pwm_led, &pwm_conf);
#endif
pwm_enable(ldata->pwm_led);
}
}
开发者ID:vurrut,项目名称:pyramid_kernel,代码行数:34,代码来源:leds-pm8058.c
示例17: pwm_backlight_update_status
static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
int brightness = bl->props.brightness;
int max = bl->props.max_brightness;
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
if (pb->notify)
brightness = pb->notify(pb->dev, brightness);
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
brightness = pb->lth_brightness +
(brightness * (pb->period - pb->lth_brightness) / max);
pwm_config(pb->pwm, brightness, pb->period);
pwm_enable(pb->pwm);
}
return 0;
}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:26,代码来源:pwm_bl.c
示例18: 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
示例19: max77660_haptic_enable
static void max77660_haptic_enable(struct max77660_haptic *chip, bool enable)
{
// printk("Ivan max77660_haptic_enable = %d \n", enable);
if (chip->enabled == enable)
return;
// mutex_lock(&chip->enable_lock);
chip->enabled = enable;
if (enable) {
// printk("Ivan max77660_haptic_enable ENABLE! \n");
regulator_enable(chip->regulator);
max77660_haptic_configure(chip);
if (chip->mode == MAX77660_EXTERNAL_MODE)
pwm_enable(chip->pwm);
// haptic_enable_processing = 0; //Ivan
} else {
// printk("Ivan max77660_haptic_enable DISABLE! \n");
max77660_haptic_configure(chip);
max77660_reg_write(chip->dev->parent, MAX77660_HAPTIC_SLAVE,
MAX77660_HAPTIC_REG_CONF2, 2);
if (chip->mode == MAX77660_EXTERNAL_MODE)
pwm_disable(chip->pwm);
regulator_disable(chip->regulator);
}
// mutex_unlock(&chip->enable_lock);
}
开发者ID:Packmaan7144,项目名称:kernel_nvidia_s8515,代码行数:29,代码来源:max77660_haptic.c
示例20: pwm_backlight_edpcb
static void pwm_backlight_edpcb(unsigned int new_state, void *priv_data)
{
struct backlight_device *bl = (struct backlight_device *) priv_data;
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
int max = bl->props.max_brightness;
int brightness = pb->edp_brightness_states[new_state];
if (brightness == 0) {
gpio_set_value(DSI_PANEL_BL_EN, 0);
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
brightness = pb->lth_brightness +
(brightness * (pb->period - pb->lth_brightness) / max);
pwm_config(pb->pwm, brightness, pb->period);
pwm_enable(pb->pwm);
msleep(10);
gpio_set_value(DSI_PANEL_BL_EN, 1);
}
if (pb->notify_after)
pb->notify_after(pb->dev, brightness);
}
开发者ID:thypon,项目名称:bowser-kernel,代码行数:25,代码来源:pwm_bl.c
注:本文中的pwm_disable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论