forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'pwm/for-4.5-rc1' of git://git.kernel.org/pub/scm/linux/ker…
…nel/git/thierry.reding/linux-pwm Pull pwm updates from Thierry Reding: "This set of changes contains a new driver for OMAP (using the dual-mode timers) as well as an assortment of fixes all across the board" * tag 'pwm/for-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: Mark all devices as "might sleep" pwm: omap-dmtimer: Potential NULL dereference on error pwm: add HAS_IOMEM dependency to PWM_FSL_FTM pwm: Add PWM driver for OMAP using dual-mode timers pwm: rcar: Improve accuracy of frequency division setting pwm: lpc32xx: return ERANGE, if requested period is not supported pwm: lpc32xx: fix and simplify duty cycle and period calculations pwm: lpc32xx: make device usable with common clock framework pwm: lpc32xx: correct number of PWM channels from 2 to 1 dt: lpc32xx: pwm: update documentation of LPC32xx PWM device dt: lpc32xx: pwm: correct LPC32xx PWM device node example pwm: fsl-ftm: Fix clock enable/disable when using PM pwm: lpss: Rework the sequence of programming PWM_SW_UPDATE pwm: lpss: Select core part automatically pwm: lpss: Update PWM setting for Broxton pwm: bcm2835: Fix email address specification pwm: bcm2835: Prevent division by zero pwm: bcm2835: Calculate scaler in ->config() pwm: lpss: Remove ->free() callback
- Loading branch information
Showing
13 changed files
with
539 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
* OMAP PWM for dual-mode timers | ||
|
||
Required properties: | ||
- compatible: Shall contain "ti,omap-dmtimer-pwm". | ||
- ti,timers: phandle to PWM capable OMAP timer. See arm/omap/timer.txt for info | ||
about these timers. | ||
- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of | ||
the cells format. | ||
|
||
Optional properties: | ||
- ti,prescaler: Should be a value between 0 and 7, see the timers datasheet | ||
|
||
Example: | ||
pwm9: dmtimer-pwm@9 { | ||
compatible = "ti,omap-dmtimer-pwm"; | ||
ti,timers = <&timer9>; | ||
#pwm-cells = <3>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ | |
struct bcm2835_pwm { | ||
struct pwm_chip chip; | ||
struct device *dev; | ||
unsigned long scaler; | ||
void __iomem *base; | ||
struct clk *clk; | ||
}; | ||
|
@@ -66,15 +65,24 @@ static int bcm2835_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |
int duty_ns, int period_ns) | ||
{ | ||
struct bcm2835_pwm *pc = to_bcm2835_pwm(chip); | ||
unsigned long rate = clk_get_rate(pc->clk); | ||
unsigned long scaler; | ||
|
||
if (!rate) { | ||
dev_err(pc->dev, "failed to get clock rate\n"); | ||
return -EINVAL; | ||
} | ||
|
||
scaler = NSEC_PER_SEC / rate; | ||
|
||
if (period_ns <= MIN_PERIOD) { | ||
dev_err(pc->dev, "period %d not supported, minimum %d\n", | ||
period_ns, MIN_PERIOD); | ||
return -EINVAL; | ||
} | ||
|
||
writel(duty_ns / pc->scaler, pc->base + DUTY(pwm->hwpwm)); | ||
writel(period_ns / pc->scaler, pc->base + PERIOD(pwm->hwpwm)); | ||
writel(duty_ns / scaler, pc->base + DUTY(pwm->hwpwm)); | ||
writel(period_ns / scaler, pc->base + PERIOD(pwm->hwpwm)); | ||
|
||
return 0; | ||
} | ||
|
@@ -156,8 +164,6 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) | |
if (ret) | ||
return ret; | ||
|
||
pc->scaler = NSEC_PER_SEC / clk_get_rate(pc->clk); | ||
|
||
pc->chip.dev = &pdev->dev; | ||
pc->chip.ops = &bcm2835_pwm_ops; | ||
pc->chip.npwm = 2; | ||
|
@@ -200,6 +206,6 @@ static struct platform_driver bcm2835_pwm_driver = { | |
}; | ||
module_platform_driver(bcm2835_pwm_driver); | ||
|
||
MODULE_AUTHOR("Bart Tanghe <[email protected]"); | ||
MODULE_AUTHOR("Bart Tanghe <[email protected]>"); | ||
MODULE_DESCRIPTION("Broadcom BCM2835 PWM driver"); | ||
MODULE_LICENSE("GPL v2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.