New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 615109 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

ec: support sub-percent PWM precision

Project Member Reported by sha...@chromium.org, May 26 2016

Issue description

There is a feature request to support sub-percent PWM precision (see http://crosbug.com/p/52005). It will involve the following:

- Change pwm_set_duty() / pwm_get_duty() and chip level functions to support the new precision.
- Verify chip-level PWM code can support the new precision (we might need to change pre-scalers / dividers for some chips).
- Change or rev. console command and host command structs to support the new precision.

Even if we don't add support for this right away, we can make sure our new host command interfaces are future-proof.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/ec/+/d1beddc463f488e527a90bf5adea92e4e9199a8f

commit d1beddc463f488e527a90bf5adea92e4e9199a8f
Author: Shawn Nematbakhsh <shawnn@chromium.org>
Date: Thu May 26 21:38:38 2016

pwm: Modify new PWM host commands to take 16-bit duty cycle

EC_CMD_PWM_SET_DUTY / EC_CMD_PWM_GET_DUTY were recently added and are
not yet in use. Future-proof these commands by taking a 16-bit duty
cycle parameter and converting it between the [0-100] percent used by
internal EC functions.

BUG= chromium:615109 
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty kb 65535` - Verify KB backlight goes to 100%
`ectool pwmgetduty kb` - Prints 65535
`ectool pwmgetduty 0` - Prints 65535
`ectool pwmsetduty 0 0` - Verify KB backlight goes to 0%
`ectool pwmgetduty kb` - Prints 0
`ectool pwmgetduty disp` - Error res 3 (unsupported PWM type)
`ectool pwmsetduty 1` - Error res 3 (non-existent PWM index)
`ectool pwmsetduty kb 6550` +
`ectool pwmgetduty kb` - Prints 6553 (round up)
`ectool pwmsetduty kb 6560` +
`ectool pwmgetduty kb` - Prints 6553 (round down)

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic6996fc6e1e69359274b2f9a1120ee7002db991c
Reviewed-on: https://chromium-review.googlesource.com/347608
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>

[modify] https://crrev.com/d1beddc463f488e527a90bf5adea92e4e9199a8f/include/ec_commands.h
[modify] https://crrev.com/d1beddc463f488e527a90bf5adea92e4e9199a8f/common/pwm.c
[modify] https://crrev.com/d1beddc463f488e527a90bf5adea92e4e9199a8f/util/ectool.c

Comment 2 by sha...@chromium.org, Aug 29 2016

Cc: shu...@chromium.org
Project Member

Comment 3 by bugdroid1@chromium.org, Sep 2 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/ec/+/26c5a22125916a53b62ac8226eb10af4c7a77c58

commit 26c5a22125916a53b62ac8226eb10af4c7a77c58
Author: Sam Hurst <shurst@google.com>
Date: Tue Aug 23 18:43:23 2016

pwm: Increse PWM duty resolution to 16bits

The current PWM interface allows for a pwm duty setting ranging from
0 to 100, resulting in a very coarse adjustment. To alleviate the
problem, the interface now allows for a pwm duty setting in the range
of 0 to 65535.

BUG= chromium:615109 
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty 1 65535` - Verify LCD backlight goes to 100%
`ectool pwmgetduty 1` - Prints 65535
`ectool pwmsetduty 1 0` - Verify LCD backlight goes to 0%
`ectool pwmgetduty 1` - Prints 0

terminal pwmduty tests:
>pwmduty
PWM channels:
  0: 100%
  1: 62%
  2: 100%
  3: 80%
> pwmduty 1 50
Setting channel 1 to 50%
  1: 50%
> pwmduty 1 0
Setting channel 1 to 0%
  1: disabled
> pwmduty 1 100
Setting channel 1 to 100%
  1: 100%
> pwmduty 1 raw 0
Setting channel 1 to raw 0%
  1: disabled
> pwmduty 1 raw 65535
Setting channel 1 to raw 65535%
  1: 65535
> pwmduty
PWM channels:
  0: 100%
  1: 100%
  2: 100%
  3: 80%
> pwmduty 1 raw 30000
Setting channel 1 to raw 30000%
  1: 30000
> pwmduty
PWM channels:
  0: 100%
  1: 46%
  2: 100%
  3: 80%

Change-Id: I299b77585f3988e72d9ac918bdde7dc5fa3df6de
Reviewed-on: https://chromium-review.googlesource.com/374481
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>

[modify] https://crrev.com/26c5a22125916a53b62ac8226eb10af4c7a77c58/board/kevin/board.c
[modify] https://crrev.com/26c5a22125916a53b62ac8226eb10af4c7a77c58/include/pwm.h
[modify] https://crrev.com/26c5a22125916a53b62ac8226eb10af4c7a77c58/common/pwm.c
[modify] https://crrev.com/26c5a22125916a53b62ac8226eb10af4c7a77c58/chip/npcx/pwm.c

Labels: OS-Chrome
Owner: shurst@google.com
Status: Started (was: Untriaged)
Fixed?
Labels: -Pri-3 Pri-1
Status: Fixed (was: Started)
Yup, fixed in above CL. Thanks Sam!
Well, I'm actually testing now and seeing a problem at max duty (65535). Kevin backlight goes off when I do this. Should I file a new bug or reopen?
Status: Started (was: Fixed)
Thanks for testing, we'll check that case.

Comment 8 by shurst@google.com, Sep 6 2016

I have confirmed the issue and I have a fix. File a new bug.
Status: Fixed (was: Started)
Filed: https://code.google.com/p/chrome-os-partner/issues/detail?id=57052

Let's close this one then :)
Labels: VerifyIn-55

Comment 11 by dchan@google.com, Nov 19 2016

Labels: VerifyIn-56

Comment 12 by dchan@google.com, Jan 21 2017

Labels: VerifyIn-57

Comment 13 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 14 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 15 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 17 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)

Sign in to add a comment