本文整理汇总了C++中pwm_config函数的典型用法代码示例。如果您正苦于以下问题:C++ pwm_config函数的具体用法?C++ pwm_config怎么用?C++ pwm_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwm_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: haptic_work
static void haptic_work(struct work_struct *work)
{
struct max77843_haptic_data *hap_data
= container_of(work, struct max77843_haptic_data, work);
pr_info("[VIB] %s\n", __func__);
if (hap_data->timeout > 0) {
if (hap_data->running)
return;
max77843_haptic_i2c(hap_data, true);
pwm_config(hap_data->pwm, hap_data->pdata->duty,
hap_data->pdata->period);
pwm_enable(hap_data->pwm);
if (hap_data->pdata->motor_en)
hap_data->pdata->motor_en(true);
else {
int ret;
ret = regulator_enable(hap_data->regulator);
pr_info("regulator_enable returns %d\n", ret);
}
hap_data->running = true;
} else {
if (!hap_data->running)
return;
if (hap_data->pdata->motor_en)
hap_data->pdata->motor_en(false);
else
regulator_disable(hap_data->regulator);
pwm_disable(hap_data->pwm);
max77843_haptic_i2c(hap_data, false);
hap_data->running = false;
}
return;
}
开发者ID:Silverblade-nz,项目名称:Alpha15Copy,代码行数:38,代码来源:max77843_haptic.c
示例2: mipi_lg_lcd_off
static int mipi_lg_lcd_off(struct platform_device *pdev)
{
struct msm_fb_data_type *mfd;
int ret;
printk("%s+\n", __func__);
mfd = platform_get_drvdata(pdev);
if (!mfd)
return -ENODEV;
if (mfd->key != MFD_KEY)
return -EINVAL;
if (bl_lpm) {
ret = pwm_config(bl_lpm, 0, PWM_PERIOD_USEC);
if (ret) {
pr_err("pwm_config on lpm failed %d\n", ret);
}
pwm_disable(bl_lpm);
}
mdelay(210);
printk("%s, lg display off command+\n", __func__);
cmdreq_lg.cmds = lg_display_off_cmds;
cmdreq_lg.cmds_cnt = ARRAY_SIZE(lg_display_off_cmds);
cmdreq_lg.flags = CMD_REQ_COMMIT;
cmdreq_lg.rlen = 0;
cmdreq_lg.cb = NULL;
mipi_dsi_cmdlist_put(&cmdreq_lg);
printk("%s, lg display off command-\n", __func__);
mdelay(20);
printk("%s-\n", __func__);
return 0;
}
开发者ID:DiscoStarslayer,项目名称:Whatever-Flo-Android-Kernel,代码行数:38,代码来源:mipi_lg.c
示例3: 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_config(beeper->pwm, 0, 0);
pwm_disable(beeper->pwm);
xc2440_beeper_disable();
} else {
xc2440_beeper_enable();
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:gq213,项目名称:linux-3.4.108,代码行数:38,代码来源:pwm-beeper.c
示例4: enable_lvds
static void enable_lvds(struct display_info_t const *dev)
{
imx_iomux_v3_setup_multiple_pads(
display_pads,
ARRAY_SIZE(display_pads));
imx_iomux_v3_setup_multiple_pads(
backlight_pads,
ARRAY_SIZE(backlight_pads));
/* enable backlight PWM 3 */
if (pwm_init(2, 0, 0))
goto error;
/* duty cycle 500ns, period: 3000ns */
if (pwm_config(2, 500, 3000))
goto error;
if (pwm_enable(2))
goto error;
return;
error:
puts("error init pwm for backlight\n");
return;
}
开发者ID:Digilent,项目名称:u-boot-digilent,代码行数:23,代码来源:aristainetos-v1.c
示例5: lcdc_chimei_set_backlight
static void lcdc_chimei_set_backlight(int level)
{
int ret;
if (bl_pwm) {
ret = pwm_config(bl_pwm, PWM_DUTY_LEVEL * level,
PWM_PERIOD_USEC);
if (ret) {
pr_err("%s: pwm_config on pwm failed %d\n",
__func__, ret);
return;
}
ret = pwm_enable(bl_pwm);
if (ret) {
pr_err("%s: pwm_enable on pwm failed %d\n",
__func__, ret);
return;
}
}
chimei_bl_level = level;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:23,代码来源:lcdc_chimei_wxga.c
示例6: lvds_chimei_set_backlight
static void lvds_chimei_set_backlight(struct msm_fb_data_type *mfd)
{
int ret;
pr_debug("%s: back light level %d\n", __func__, mfd->bl_level);
if (bl_lpm) {
ret = pwm_config(bl_lpm, LVDS_CHIMEI_PWM_DUTY_LEVEL *
mfd->bl_level, LVDS_CHIMEI_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:Yannicked,项目名称:htc-m7,代码行数:23,代码来源:lvds_chimei_wxga.c
示例7: vibtonz_pwm
void vibtonz_pwm(int nForce)
{
int pwm_period = 0, pwm_duty = 0;
if (g_hap_data == NULL) {
printk(KERN_ERR "[VIB] the motor is not ready!!!");
return ;
}
pwm_period = g_hap_data->pdata->period;
pwm_duty = pwm_period / 2 + ((pwm_period / 2 - 2) * nForce) / 127;
if (pwm_duty > g_hap_data->pdata->duty)
pwm_duty = g_hap_data->pdata->duty;
else if (pwm_period - pwm_duty > g_hap_data->pdata->duty)
pwm_duty = pwm_period - g_hap_data->pdata->duty;
/* add to avoid the glitch issue */
if (prev_duty != pwm_duty) {
prev_duty = pwm_duty;
pwm_config(g_hap_data->pwm, pwm_duty, pwm_period);
}
}
开发者ID:BigBot96,项目名称:android_kernel_samsung_gts2wifi,代码行数:23,代码来源:max77828_haptic.c
示例8: pwm_regulator_set_voltage_sel
static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev);
unsigned int pwm_reg_period;
int dutycycle;
int ret;
pwm_reg_period = pwm_get_period(drvdata->pwm);
dutycycle = (pwm_reg_period *
drvdata->duty_cycle_table[selector].dutycycle) / 100;
ret = pwm_config(drvdata->pwm, dutycycle, pwm_reg_period);
if (ret) {
dev_err(&rdev->dev, "Failed to configure PWM\n");
return ret;
}
drvdata->state = selector;
return 0;
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:23,代码来源:pwm-regulator.c
示例9: bd_display_run
void bd_display_run(char *cmd, int bl_duty, int bl_on)
{
static int display_init = 0;
if (cmd) {
run_command(cmd, 0);
lcd_draw_boot_logo(CONFIG_FB_ADDR, CFG_DISP_PRI_RESOL_WIDTH,
CFG_DISP_PRI_RESOL_HEIGHT, CFG_DISP_PRI_SCREEN_PIXEL_BYTE);
}
if (!display_init) {
bd_display();
pwm_init(CFG_LCD_PRI_PWM_CH, 0, 0);
display_init = 1;
}
pwm_config(CFG_LCD_PRI_PWM_CH,
TO_DUTY_NS(bl_duty, CFG_LCD_PRI_PWM_FREQ),
TO_PERIOD_NS(CFG_LCD_PRI_PWM_FREQ));
if (bl_on)
pwm_enable(CFG_LCD_PRI_PWM_CH);
}
开发者ID:projectnano,项目名称:zeus,代码行数:23,代码来源:board.c
示例10: enable_display_power
static void enable_display_power(void)
{
imx_iomux_v3_setup_multiple_pads(backlight_pads,
ARRAY_SIZE(backlight_pads));
/* backlight enable */
gpio_direction_output(IMX_GPIO_NR(6, 31), 1);
/* LCD power enable */
gpio_direction_output(IMX_GPIO_NR(6, 15), 1);
/* enable backlight PWM 1 */
if (pwm_init(0, 0, 0))
goto error;
/* duty cycle 500ns, period: 3000ns */
if (pwm_config(0, 50000, 300000))
goto error;
if (pwm_enable(0))
goto error;
return;
error:
puts("error init pwm for backlight\n");
return;
}
开发者ID:Digilent,项目名称:u-boot-digilent,代码行数:24,代码来源:aristainetos-v2.c
示例11: mipi_d2l_set_backlight_level
/**
* Set Backlight level.
*
* @param pwm
* @param level
*
* @return int
*/
static int mipi_d2l_set_backlight_level(struct pwm_device *pwm, int level)
{
int ret = 0;
pr_debug("%s: level=%d.\n", __func__, level);
#if defined(CONFIG_FB_MSM_MIPI_BOEOT_TFT_VIDEO_WSVGA_PT_PANEL) \
|| defined(CONFIG_FB_MSM_MIPI_SAMSUNG_TFT_VIDEO_WXGA_PT_PANEL)
if ((pwm == NULL) || (level > BRIGHTNESS_MAX) || (level < 0)) {
pr_err("%s.pwm=NULL.\n", __func__);
return -EINVAL;
}
level = scale_pwm_dutycycle(level);
#else
if ((pwm == NULL) || (level > PWM_LEVEL) || (level < 0)) {
pr_err("%s.pwm=NULL.\n", __func__);
return -EINVAL;
}
#endif
ret = pwm_config(pwm, PWM_DUTY_LEVEL * level, PWM_PERIOD_USEC);
if (ret) {
pr_err("%s: pwm_config() failed err=%d.\n", __func__, ret);
return ret;
}
ret = pwm_enable(pwm);
if (ret) {
pr_err("%s: pwm_enable() failed err=%d\n",
__func__, ret);
return ret;
}
return 0;
}
开发者ID:AnDr0id,项目名称:SGH-I747,代码行数:44,代码来源:mipi_tc358764_dsi2lvds.c
示例12: pwm_test_store_duty
static ssize_t pwm_test_store_duty(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 duty;
rc = kstrtoint(buf, 0, &duty);
if (rc)
return rc;
if (duty < 0)
return -EINVAL;
rc = pwm_config(pwm_test->pwm, duty, pwm_test->period);
if (rc) {
dev_err(dev, "pwm_config() failed\n");
return rc;
}
pwm_test->duty = duty;
return count;
}
开发者ID:SynerconTechnologies,项目名称:FLA-Kernel,代码行数:24,代码来源:pwm_test.c
示例13: isa1000_vib_set
static int isa1000_vib_set(struct isa1000_vib *vib, int on)
{
int rc;
if (on) {
rc = pwm_config(pwm,
(pwm_period_ns * pwm_duty) / 100,
pwm_period_ns);
if (rc < 0){
printk( "Unable to config pwm%d\n",rc);
}
rc = pwm_enable(pwm);
if (rc < 0){
printk("Unable to enable pwm\n");
}
gpio_set_value_cansleep(GPIO_ISA1000_EN, 1);
} else {
gpio_set_value_cansleep(GPIO_ISA1000_EN, 0);
pwm_disable(pwm);
}
return rc;
}
开发者ID:KhioGie,项目名称:armani,代码行数:24,代码来源:ImmVibeSPI.c
示例14: vibtonz_en
void vibtonz_en(bool en)
{
int ret;
if (g_hap_data == NULL) {
printk(KERN_ERR "[VIB] the motor is not ready!!!");
return ;
}
if (en) {
if (g_hap_data->running)
return;
max77888_haptic_i2c(g_hap_data, true);
pwm_config(g_hap_data->pwm, prev_duty, g_hap_data->pdata->period);
pwm_enable(g_hap_data->pwm);
if (g_hap_data->pdata->motor_en)
g_hap_data->pdata->motor_en(true);
else
ret = regulator_enable(g_hap_data->regulator);
g_hap_data->running = true;
} else {
if (!g_hap_data->running)
return;
if (g_hap_data->pdata->motor_en)
g_hap_data->pdata->motor_en(false);
else
regulator_disable(g_hap_data->regulator);
pwm_disable(g_hap_data->pwm);
max77888_haptic_i2c(g_hap_data, false);
g_hap_data->running = false;
}
}
开发者ID:BigBot96,项目名称:android_kernel_samsung_gts2wifi,代码行数:36,代码来源:max77888_haptic.c
示例15: set_pwm
static void set_pwm(unsigned int percent)
{
unsigned long duty;
if(percent > 100)
{
duty = PERIOD;
gDuty = 100;
}
else if(percent < 0)
{
duty = 0;
gDuty = 0;
}
else
{
duty = (PERIOD * percent)/100;
gDuty = percent;
}
pr_info("Duty set to : %ld\n", duty);
if(duty != gDuty)
{
pwm_config(pwm_dev, duty, PERIOD);
}
}
开发者ID:wheelin,项目名称:CSEL,代码行数:24,代码来源:skeleton.c
示例16: unicorn_setup
/*
* Setup all sub sys of unicorn
*/
static int unicorn_setup()
{
int ret = 0;
if (bbp_board_type == BOARD_BBP1) {
printf("Board is FastBot BBP 1\n");
ret = analog_config(analog_config_bbp1, NR_ITEMS(analog_config_bbp1));
if (ret < 0) {
printf("analog_config failed\n");
goto out;
}
ret = temp_config(temp_config_data_bbp1, NR_ITEMS(temp_config_data_bbp1));
if (ret < 0) {
printf("temp_config failed\n");
goto out;
}
ret = pwm_config(pwm_config_bbp1, NR_ITEMS(pwm_config_bbp1));
if (ret < 0) {
printf("pwm_config failed\n");
goto out;
}
ret = fan_config(fan_config_bbp1, NR_ITEMS(fan_config_bbp1));
if (ret < 0) {
printf("fan_config failed\n");
goto out;
}
ret = heater_config(heater_config_data_bbp, NR_ITEMS(heater_config_data_bbp));
if (ret < 0) {
printf("heater_config failed\n");
goto out;
}
ret = stepper_config(stepper_config_bbp1, NR_ITEMS(stepper_config_bbp1));
if (ret < 0) {
printf("stepper_config failed\n");
goto out;
}
} else if (bbp_board_type == BOARD_BBP1S) {
printf("Board is FastBot BBP 1s\n");
ret = analog_config(analog_config_bbp1s, NR_ITEMS(analog_config_bbp1s));
if (ret < 0) {
printf("analog_config failed\n");
goto out;
}
ret = temp_config(temp_config_data_bbp1s, NR_ITEMS(temp_config_data_bbp1s));
if (ret < 0) {
printf("temp_config failed\n");
goto out;
}
ret = pwm_config(pwm_config_bbp1s, NR_ITEMS(pwm_config_bbp1s));
if (ret < 0) {
printf("pwm_config failed\n");
goto out;
}
ret = fan_config(fan_config_bbp1s, NR_ITEMS(fan_config_bbp1s));
if (ret < 0) {
printf("fan_config failed\n");
goto out;
}
ret = heater_config(heater_config_data_bbp1s, NR_ITEMS(heater_config_data_bbp1s));
if (ret < 0) {
printf("heater_config failed\n");
goto out;
}
#ifdef SERVO
if (bbp_board_type == BOARD_BBP1S) {
ret = servo_config(servo_config_data, NR_ITEMS(servo_config_data));
if (ret < 0) {
printf("servo_config failed\n");
goto out;
}
}
#endif
ret = stepper_config(stepper_config_bbp1s, NR_ITEMS(stepper_config_bbp1s));
if (ret < 0) {
printf("stepper_config failed\n");
goto out;
}
} else {
printf("Not supported board!\n");
}
out:
return ret;
}
开发者ID:SHINOTECH,项目名称:firmware,代码行数:97,代码来源:unicorn.c
示例17: vibrator_probe
static int __devinit vibrator_probe(struct platform_device *pdev)
{
struct max8997_dev *max8997 = dev_get_drvdata(pdev->dev.parent);
struct max8997_platform_data *max8997_pdata
= dev_get_platdata(max8997->dev);
struct max8997_motor_data *pdata = max8997_pdata->motor;
struct vibrator_drvdata *ddata;
int error = 0;
ddata = kzalloc(sizeof(struct vibrator_drvdata), GFP_KERNEL);
if (NULL == ddata) {
pr_err("[VIB] Failed to alloc memory\n");
error = -ENOMEM;
goto err_free_mem;
}
if (pdata->init_hw)
pdata->init_hw();
else {
ddata->regulator = regulator_get(NULL, "vmotor");
if (IS_ERR(ddata->regulator)) {
pr_err("[VIB] Failed to get vmoter regulator.\n");
error = -EFAULT;
goto err_regulator_get;
}
}
ddata->pdata = pdata;
ddata->dev.name = "vibrator";
ddata->dev.get_time = vibrator_get_time;
ddata->dev.enable = vibrator_enable;
ddata->client = max8997->hmotor;
platform_set_drvdata(pdev, ddata);
hrtimer_init(&ddata->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
ddata->timer.function = vibrator_timer_func;
INIT_WORK(&ddata->work, vibrator_work);
spin_lock_init(&ddata->lock);
ddata->pwm = pwm_request(pdata->pwm_id, "vibrator");
if (IS_ERR(ddata->pwm)) {
pr_err("[VIB] Failed to request pwm.\n");
error = -EFAULT;
goto err_pwm_request;
}
pwm_config(ddata->pwm,
ddata->pdata->period/2, ddata->pdata->period);
vibetonz_clk_on(&pdev->dev, true);
error = timed_output_dev_register(&ddata->dev);
if (error < 0) {
pr_err("[VIB] Failed to register timed_output : %d\n", error);
error = -EFAULT;
goto err_timed_output_register;
}
/* User controllable pwm level */
error = device_create_file(ddata->dev.dev, &dev_attr_pwm_value);
if (error < 0) {
pr_err("[VIB] create sysfs fail: pwm_value\n");
}
#ifdef CONFIG_VIBETONZ
g_data = ddata;
pwm_duty_max = g_data->pdata->duty;
pwm_duty_min = pwm_duty_max/2;
pwm_duty = (pwm_duty_min + pwm_duty_max)/2;
#endif
return 0;
err_timed_output_register:
timed_output_dev_unregister(&ddata->dev);
err_regulator_get:
regulator_put(ddata->regulator);
err_pwm_request:
pwm_free(ddata->pwm);
err_free_mem:
kfree(ddata);
return error;
}
开发者ID:gadido30,项目名称:bigfatwifi,代码行数:83,代码来源:max8997_vibrator.c
示例18: rx1950_lcd_power
static void rx1950_lcd_power(int enable)
{
int i;
static int enabled;
if (enabled == enable)
return;
if (!enable) {
/* GPC11-GPC15->OUTPUT */
for (i = 11; i < 16; i++)
gpio_direction_output(S3C2410_GPC(i), 1);
/* Wait a bit here... */
mdelay(100);
/* GPD2-GPD7->OUTPUT */
/* GPD11-GPD15->OUTPUT */
/* GPD2-GPD7->1, GPD11-GPD15->1 */
for (i = 2; i < 8; i++)
gpio_direction_output(S3C2410_GPD(i), 1);
for (i = 11; i < 16; i++)
gpio_direction_output(S3C2410_GPD(i), 1);
/* Wait a bit here...*/
mdelay(100);
/* GPB0->OUTPUT, GPB0->0 */
gpio_direction_output(S3C2410_GPB(0), 0);
/* GPC1-GPC4->OUTPUT, GPC1-4->0 */
for (i = 1; i < 5; i++)
gpio_direction_output(S3C2410_GPC(i), 0);
/* GPC15-GPC11->0 */
for (i = 11; i < 16; i++)
gpio_direction_output(S3C2410_GPC(i), 0);
/* GPD15-GPD11->0, GPD2->GPD7->0 */
for (i = 11; i < 16; i++)
gpio_direction_output(S3C2410_GPD(i), 0);
for (i = 2; i < 8; i++)
gpio_direction_output(S3C2410_GPD(i), 0);
/* GPC6->0, GPC7->0, GPC5->0 */
gpio_direction_output(S3C2410_GPC(6), 0);
gpio_direction_output(S3C2410_GPC(7), 0);
gpio_direction_output(S3C2410_GPC(5), 0);
/* GPB1->OUTPUT, GPB1->0 */
gpio_direction_output(S3C2410_GPB(1), 0);
pwm_config(lcd_pwm, 0, LCD_PWM_PERIOD);
pwm_disable(lcd_pwm);
/* GPC0->0, GPC10->0 */
gpio_direction_output(S3C2410_GPC(0), 0);
gpio_direction_output(S3C2410_GPC(10), 0);
} else {
pwm_config(lcd_pwm, LCD_PWM_DUTY, LCD_PWM_PERIOD);
pwm_enable(lcd_pwm);
gpio_direction_output(S3C2410_GPC(0), 1);
gpio_direction_output(S3C2410_GPC(5), 1);
s3c_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPB1_TOUT1);
gpio_direction_output(S3C2410_GPC(7), 1);
for (i = 1; i < 5; i++)
s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
for (i = 11; i < 16; i++)
s3c_gpio_cfgpin(S3C2410_GPC(i), S3C_GPIO_SFN(2));
for (i = 2; i < 8; i++)
s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
for (i = 11; i < 16; i++)
s3c_gpio_cfgpin(S3C2410_GPD(i), S3C_GPIO_SFN(2));
gpio_direction_output(S3C2410_GPC(10), 1);
gpio_direction_output(S3C2410_GPC(6), 1);
}
enabled = enable;
}
开发者ID:atixing,项目名称:linux,代码行数:84,代码来源:mach-rx1950.c
示例19: pm8xxx_led_current_set_flagged
static void pm8xxx_led_current_set_flagged(struct led_classdev *led_cdev, enum led_brightness brightness, int blink)
{
struct pm8xxx_led_data *led = container_of(led_cdev, struct pm8xxx_led_data, cdev);
int rc, offset;
u8 level;
int *pduties;
LED_INFO("%s, bank:%d, brightness:%d\n", __func__, led->bank, brightness);
cancel_delayed_work_sync(&led->fade_delayed_work);
virtual_key_state = brightness;
if (flag_hold_virtual_key == 1) {
LED_INFO("%s, key control \n", __func__);
return;
}
if(brightness) {
level = (led->out_current << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
offset = PM8XXX_LED_OFFSET(led->id);
led->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
led->reg |= level;
rc = pm8xxx_writeb(led->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), led->reg);
if (rc)
LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, led->id, rc);
if (led->function_flags & LED_BRETH_FUNCTION) {
if (blink == 0) {
buttons_led_is_on = 1;
// no blink needed
pduties = &dutys_array[0];
pm8xxx_pwm_lut_config(led->pwm_led,
led->period_us,
pduties,
led->duty_time_ms,
led->start_index,
led->duites_size,
0, 0,
led->lut_flag);
} else {
pduties = &dutys_array[0];
// LUT_LOOP for blinking
pm8xxx_pwm_lut_config(led->pwm_led,
led->period_us,
pduties,
led->duty_time_ms, // slower, 2x
led->start_index,
led->duites_size * 8, // 16 duty entries -> original size * 2, + 6 * 8 zeroes for pause
0, 0,
PM_PWM_LUT_LOOP | PM_PWM_LUT_PAUSE_HI_EN);
}
pm8xxx_pwm_lut_enable(led->pwm_led, 0);
pm8xxx_pwm_lut_enable(led->pwm_led, 1);
} else {
pwm_config(led->pwm_led, 6400 * led->pwm_coefficient / 100, 6400);
pwm_enable(led->pwm_led);
}
} else {
if (led->function_flags & LED_BRETH_FUNCTION) {
buttons_led_is_on = 0;
wake_lock_timeout(&pmic_led_wake_lock, HZ*2);
pduties = &dutys_array[8];
pm8xxx_pwm_lut_config(led->pwm_led,
led->period_us,
pduties,
led->duty_time_ms,
led->start_index,
led->duites_size,
0, 0,
led->lut_flag);
pm8xxx_pwm_lut_enable(led->pwm_led, 0);
pm8xxx_pwm_lut_enable(led->pwm_led, 1);
queue_delayed_work(g_led_work_queue,
&led->fade_delayed_work,
msecs_to_jiffies(led->duty_time_ms*led->duites_size));
} else {
pwm_disable(led->pwm_led);
level = (0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
offset = PM8XXX_LED_OFFSET(led->id);
led->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
led->reg |= level;
rc = pm8xxx_writeb(led->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), led->reg);
if (rc)
LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, led->id, rc);
}
}
}
开发者ID:flar2,项目名称:ElementalX-ville-6.0,代码行数:86,代码来源:leds-pm8921.c
示例20: backlight_pwm_gpio_config
//.........这里部分代码省略.........
|| machine_is_msm8255_u8680()
|| machine_is_msm8255_u8667()
|| machine_is_msm8255_u8860_51()
|| machine_is_msm8255_u8730())
{
bl_pwm = pwm_request(PM_GPIO25_PWM_ID, "backlight");
}
else if(machine_is_msm7x30_u8820())
{
bl_pwm = pwm_request(PM_GPIO26_PWM_ID, "backlight");
}
else
{
bl_pwm = NULL;
}
if (NULL == bl_pwm || IS_ERR(bl_pwm))
{
pr_err("%s: pwm_request() failed\n", __func__);
bl_pwm = NULL;
}
first_set_bl = FALSE;
}
if (bl_pwm)
{
if(level)
{
level = ((level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE);
if (level < BL_MIN_LEVEL)
{
level = BL_MIN_LEVEL;
}
}
if (last_level == level)
{
return ;
}
last_level = level;
pwm_config(bl_pwm, PWM_DUTY_LEVEL*level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC);
pwm_enable(bl_pwm);
}
#endif
}
void cabc_backlight_set(struct msm_fb_data_type * mfd)
{
struct msm_fb_panel_data *pdata = NULL;
uint32 bl_level = mfd->bl_level;
/* keep duty 10% < level < 100% */
if (bl_level)
{
/****delete one line codes for backlight*****/
if (bl_level < BL_MIN_LEVEL)
{
bl_level = BL_MIN_LEVEL;
}
}
/* backlight ctrl by LCD-self, like as CABC */
pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;
if ((pdata) && (pdata->set_cabc_brightness))
{
pdata->set_cabc_brightness(mfd,bl_level);
}
}
void pwm_set_backlight(struct msm_fb_data_type *mfd)
{
#ifdef CONFIG_HUAWEI_OLD_BACKLIGHT
lcd_panel_type lcd_panel_wvga = LCD_NONE;
#endif
/*When all the device are resume that can turn the light*/
if(atomic_read(&suspend_flag))
{
mfd_local = mfd;
backlight_set = TRUE;
return;
}
#ifdef CONFIG_HUAWEI_OLD_BACKLIGHT
lcd_panel_wvga = get_lcd_panel_type();
if ((MIPI_CMD_RSP61408_CHIMEI_WVGA == lcd_panel_wvga )
|| (MIPI_CMD_RSP61408_BYD_WVGA == lcd_panel_wvga )
|| (MIPI_CMD_RSP61408_TRULY_WVGA == lcd_panel_wvga )
|| (MIPI_CMD_HX8369A_TIANMA_WVGA == lcd_panel_wvga ))
{
/* keep duty is 75% of the quondam duty */
mfd->bl_level = mfd->bl_level * 75 / 100;
}
#endif
if (get_hw_lcd_ctrl_bl_type() == CTRL_BL_BY_MSM)
{
msm_backlight_set(mfd->bl_level);
}
else
{
cabc_backlight_set(mfd);
}
return;
}
开发者ID:android-armv7a-belalang-tempur,项目名称:huawei-kernel-3.4,代码行数:101,代码来源:hw_backlight.c
注:本文中的pwm_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论