Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3aeeb375
Commit
3aeeb375
authored
Feb 10, 2017
by
Thierry Reding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-4.11/core' into for-4.11/acpi
parents
0c744ea4
b526a314
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
55 additions
and
80 deletions
+55
-80
drivers/leds/leds-pwm.c
drivers/leds/leds-pwm.c
+3
-13
drivers/pwm/core.c
drivers/pwm/core.c
+36
-34
drivers/pwm/pwm-atmel-hlcdc.c
drivers/pwm/pwm-atmel-hlcdc.c
+0
-1
drivers/pwm/pwm-atmel.c
drivers/pwm/pwm-atmel.c
+0
-1
drivers/pwm/pwm-bcm-kona.c
drivers/pwm/pwm-bcm-kona.c
+0
-1
drivers/pwm/pwm-berlin.c
drivers/pwm/pwm-berlin.c
+0
-1
drivers/pwm/pwm-brcmstb.c
drivers/pwm/pwm-brcmstb.c
+0
-1
drivers/pwm/pwm-fsl-ftm.c
drivers/pwm/pwm-fsl-ftm.c
+0
-1
drivers/pwm/pwm-imx.c
drivers/pwm/pwm-imx.c
+0
-1
drivers/pwm/pwm-lp3943.c
drivers/pwm/pwm-lp3943.c
+0
-1
drivers/pwm/pwm-mxs.c
drivers/pwm/pwm-mxs.c
+1
-1
drivers/pwm/pwm-pca9685.c
drivers/pwm/pwm-pca9685.c
+0
-1
drivers/pwm/pwm-sti.c
drivers/pwm/pwm-sti.c
+0
-1
drivers/pwm/pwm-sun4i.c
drivers/pwm/pwm-sun4i.c
+0
-1
drivers/pwm/pwm-twl-led.c
drivers/pwm/pwm-twl-led.c
+0
-1
drivers/pwm/pwm-twl.c
drivers/pwm/pwm-twl.c
+0
-1
drivers/staging/greybus/pwm.c
drivers/staging/greybus/pwm.c
+0
-1
include/linux/pwm.h
include/linux/pwm.h
+15
-18
No files found.
drivers/leds/leds-pwm.c
View file @
3aeeb375
...
...
@@ -29,7 +29,6 @@ struct led_pwm_data {
unsigned
int
active_low
;
unsigned
int
period
;
int
duty
;
bool
can_sleep
;
};
struct
led_pwm_priv
{
...
...
@@ -49,8 +48,8 @@ static void __led_pwm_set(struct led_pwm_data *led_dat)
pwm_enable
(
led_dat
->
pwm
);
}
static
void
led_pwm_set
(
struct
led_classdev
*
led_cdev
,
enum
led_brightness
brightness
)
static
int
led_pwm_set
(
struct
led_classdev
*
led_cdev
,
enum
led_brightness
brightness
)
{
struct
led_pwm_data
*
led_dat
=
container_of
(
led_cdev
,
struct
led_pwm_data
,
cdev
);
...
...
@@ -66,12 +65,7 @@ static void led_pwm_set(struct led_classdev *led_cdev,
led_dat
->
duty
=
duty
;
__led_pwm_set
(
led_dat
);
}
static
int
led_pwm_set_blocking
(
struct
led_classdev
*
led_cdev
,
enum
led_brightness
brightness
)
{
led_pwm_set
(
led_cdev
,
brightness
);
return
0
;
}
...
...
@@ -112,11 +106,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
return
ret
;
}
led_data
->
can_sleep
=
pwm_can_sleep
(
led_data
->
pwm
);
if
(
!
led_data
->
can_sleep
)
led_data
->
cdev
.
brightness_set
=
led_pwm_set
;
else
led_data
->
cdev
.
brightness_set_blocking
=
led_pwm_set_blocking
;
led_data
->
cdev
.
brightness_set_blocking
=
led_pwm_set
;
/*
* FIXME: pwm_apply_args() should be removed when switching to the
...
...
drivers/pwm/core.c
View file @
3aeeb375
...
...
@@ -137,9 +137,14 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
{
struct
pwm_device
*
pwm
;
/* check, whether the driver supports a third cell for flags */
if
(
pc
->
of_pwm_n_cells
<
3
)
return
ERR_PTR
(
-
EINVAL
);
/* flags in the third cell are optional */
if
(
args
->
args_count
<
2
)
return
ERR_PTR
(
-
EINVAL
);
if
(
args
->
args
[
0
]
>=
pc
->
npwm
)
return
ERR_PTR
(
-
EINVAL
);
...
...
@@ -148,11 +153,10 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
return
pwm
;
pwm
->
args
.
period
=
args
->
args
[
1
];
pwm
->
args
.
polarity
=
PWM_POLARITY_NORMAL
;
if
(
args
->
args
[
2
]
&
PWM_POLARITY_INVERTED
)
if
(
args
->
args
_count
>
2
&&
args
->
args
[
2
]
&
PWM_POLARITY_INVERTED
)
pwm
->
args
.
polarity
=
PWM_POLARITY_INVERSED
;
else
pwm
->
args
.
polarity
=
PWM_POLARITY_NORMAL
;
return
pwm
;
}
...
...
@@ -163,9 +167,14 @@ of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
{
struct
pwm_device
*
pwm
;
/* sanity check driver support */
if
(
pc
->
of_pwm_n_cells
<
2
)
return
ERR_PTR
(
-
EINVAL
);
/* all cells are required */
if
(
args
->
args_count
!=
pc
->
of_pwm_n_cells
)
return
ERR_PTR
(
-
EINVAL
);
if
(
args
->
args
[
0
]
>=
pc
->
npwm
)
return
ERR_PTR
(
-
EINVAL
);
...
...
@@ -663,24 +672,17 @@ struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)
err
=
of_parse_phandle_with_args
(
np
,
"pwms"
,
"#pwm-cells"
,
index
,
&
args
);
if
(
err
)
{
pr_
debug
(
"%s(): can't parse
\"
pwms
\"
property
\n
"
,
__func__
);
pr_
err
(
"%s(): can't parse
\"
pwms
\"
property
\n
"
,
__func__
);
return
ERR_PTR
(
err
);
}
pc
=
of_node_to_pwmchip
(
args
.
np
);
if
(
IS_ERR
(
pc
))
{
pr_
debug
(
"%s(): PWM chip not found
\n
"
,
__func__
);
pr_
err
(
"%s(): PWM chip not found
\n
"
,
__func__
);
pwm
=
ERR_CAST
(
pc
);
goto
put
;
}
if
(
args
.
args_count
!=
pc
->
of_pwm_n_cells
)
{
pr_debug
(
"%s: wrong #pwm-cells for %s
\n
"
,
np
->
full_name
,
args
.
np
->
full_name
);
pwm
=
ERR_PTR
(
-
EINVAL
);
goto
put
;
}
pwm
=
pc
->
of_xlate
(
pc
,
&
args
);
if
(
IS_ERR
(
pwm
))
goto
put
;
...
...
@@ -757,12 +759,13 @@ void pwm_remove_table(struct pwm_lookup *table, size_t num)
*/
struct
pwm_device
*
pwm_get
(
struct
device
*
dev
,
const
char
*
con_id
)
{
struct
pwm_device
*
pwm
=
ERR_PTR
(
-
EPROBE_DEFER
);
const
char
*
dev_id
=
dev
?
dev_name
(
dev
)
:
NULL
;
struct
pwm_chip
*
chip
=
NULL
;
struct
pwm_device
*
pwm
;
struct
pwm_chip
*
chip
;
unsigned
int
best
=
0
;
struct
pwm_lookup
*
p
,
*
chosen
=
NULL
;
unsigned
int
match
;
int
err
;
/* look up via DT first */
if
(
IS_ENABLED
(
CONFIG_OF
)
&&
dev
&&
dev
->
of_node
)
...
...
@@ -817,24 +820,35 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
}
}
if
(
!
chosen
)
{
pwm
=
ERR_PTR
(
-
ENODEV
);
goto
out
;
}
mutex_unlock
(
&
pwm_lookup_lock
);
if
(
!
chosen
)
return
ERR_PTR
(
-
ENODEV
);
chip
=
pwmchip_find_by_name
(
chosen
->
provider
);
/*
* If the lookup entry specifies a module, load the module and retry
* the PWM chip lookup. This can be used to work around driver load
* ordering issues if driver's can't be made to properly support the
* deferred probe mechanism.
*/
if
(
!
chip
&&
chosen
->
module
)
{
err
=
request_module
(
chosen
->
module
);
if
(
err
==
0
)
chip
=
pwmchip_find_by_name
(
chosen
->
provider
);
}
if
(
!
chip
)
goto
out
;
return
ERR_PTR
(
-
EPROBE_DEFER
)
;
pwm
=
pwm_request_from_chip
(
chip
,
chosen
->
index
,
con_id
?:
dev_id
);
if
(
IS_ERR
(
pwm
))
goto
out
;
return
pwm
;
pwm
->
args
.
period
=
chosen
->
period
;
pwm
->
args
.
polarity
=
chosen
->
polarity
;
out:
mutex_unlock
(
&
pwm_lookup_lock
);
return
pwm
;
}
EXPORT_SYMBOL_GPL
(
pwm_get
);
...
...
@@ -960,18 +974,6 @@ void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
}
EXPORT_SYMBOL_GPL
(
devm_pwm_put
);
/**
* pwm_can_sleep() - report whether PWM access will sleep
* @pwm: PWM device
*
* Returns: True if accessing the PWM can sleep, false otherwise.
*/
bool
pwm_can_sleep
(
struct
pwm_device
*
pwm
)
{
return
true
;
}
EXPORT_SYMBOL_GPL
(
pwm_can_sleep
);
#ifdef CONFIG_DEBUG_FS
static
void
pwm_dbg_show
(
struct
pwm_chip
*
chip
,
struct
seq_file
*
s
)
{
...
...
drivers/pwm/pwm-atmel-hlcdc.c
View file @
3aeeb375
...
...
@@ -270,7 +270,6 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
chip
->
chip
.
npwm
=
1
;
chip
->
chip
.
of_xlate
=
of_pwm_xlate_with_flags
;
chip
->
chip
.
of_pwm_n_cells
=
3
;
chip
->
chip
.
can_sleep
=
1
;
ret
=
pwmchip_add_with_polarity
(
&
chip
->
chip
,
PWM_POLARITY_INVERSED
);
if
(
ret
)
{
...
...
drivers/pwm/pwm-atmel.c
View file @
3aeeb375
...
...
@@ -385,7 +385,6 @@ static int atmel_pwm_probe(struct platform_device *pdev)
atmel_pwm
->
chip
.
base
=
-
1
;
atmel_pwm
->
chip
.
npwm
=
4
;
atmel_pwm
->
chip
.
can_sleep
=
true
;
atmel_pwm
->
config
=
data
->
config
;
atmel_pwm
->
updated_pwms
=
0
;
mutex_init
(
&
atmel_pwm
->
isr_lock
);
...
...
drivers/pwm/pwm-bcm-kona.c
View file @
3aeeb375
...
...
@@ -276,7 +276,6 @@ static int kona_pwmc_probe(struct platform_device *pdev)
kp
->
chip
.
npwm
=
6
;
kp
->
chip
.
of_xlate
=
of_pwm_xlate_with_flags
;
kp
->
chip
.
of_pwm_n_cells
=
3
;
kp
->
chip
.
can_sleep
=
true
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
kp
->
base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
...
...
drivers/pwm/pwm-berlin.c
View file @
3aeeb375
...
...
@@ -206,7 +206,6 @@ static int berlin_pwm_probe(struct platform_device *pdev)
pwm
->
chip
.
ops
=
&
berlin_pwm_ops
;
pwm
->
chip
.
base
=
-
1
;
pwm
->
chip
.
npwm
=
4
;
pwm
->
chip
.
can_sleep
=
true
;
pwm
->
chip
.
of_xlate
=
of_pwm_xlate_with_flags
;
pwm
->
chip
.
of_pwm_n_cells
=
3
;
...
...
drivers/pwm/pwm-brcmstb.c
View file @
3aeeb375
...
...
@@ -270,7 +270,6 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
p
->
chip
.
ops
=
&
brcmstb_pwm_ops
;
p
->
chip
.
base
=
-
1
;
p
->
chip
.
npwm
=
2
;
p
->
chip
.
can_sleep
=
true
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
p
->
base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
...
...
drivers/pwm/pwm-fsl-ftm.c
View file @
3aeeb375
...
...
@@ -446,7 +446,6 @@ static int fsl_pwm_probe(struct platform_device *pdev)
fpc
->
chip
.
of_pwm_n_cells
=
3
;
fpc
->
chip
.
base
=
-
1
;
fpc
->
chip
.
npwm
=
8
;
fpc
->
chip
.
can_sleep
=
true
;
ret
=
pwmchip_add
(
&
fpc
->
chip
);
if
(
ret
<
0
)
{
...
...
drivers/pwm/pwm-imx.c
View file @
3aeeb375
...
...
@@ -304,7 +304,6 @@ static int imx_pwm_probe(struct platform_device *pdev)
imx
->
chip
.
dev
=
&
pdev
->
dev
;
imx
->
chip
.
base
=
-
1
;
imx
->
chip
.
npwm
=
1
;
imx
->
chip
.
can_sleep
=
true
;
r
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
imx
->
mmio_base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
r
);
...
...
drivers/pwm/pwm-lp3943.c
View file @
3aeeb375
...
...
@@ -278,7 +278,6 @@ static int lp3943_pwm_probe(struct platform_device *pdev)
lp3943_pwm
->
chip
.
dev
=
&
pdev
->
dev
;
lp3943_pwm
->
chip
.
ops
=
&
lp3943_pwm_ops
;
lp3943_pwm
->
chip
.
npwm
=
LP3943_NUM_PWMS
;
lp3943_pwm
->
chip
.
can_sleep
=
true
;
platform_set_drvdata
(
pdev
,
lp3943_pwm
);
...
...
drivers/pwm/pwm-mxs.c
View file @
3aeeb375
...
...
@@ -151,7 +151,7 @@ static int mxs_pwm_probe(struct platform_device *pdev)
mxs
->
chip
.
dev
=
&
pdev
->
dev
;
mxs
->
chip
.
ops
=
&
mxs_pwm_ops
;
mxs
->
chip
.
base
=
-
1
;
mxs
->
chip
.
can_sleep
=
true
;
ret
=
of_property_read_u32
(
np
,
"fsl,pwm-number"
,
&
mxs
->
chip
.
npwm
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"failed to get pwm number: %d
\n
"
,
ret
);
...
...
drivers/pwm/pwm-pca9685.c
View file @
3aeeb375
...
...
@@ -343,7 +343,6 @@ static int pca9685_pwm_probe(struct i2c_client *client,
pca
->
chip
.
dev
=
&
client
->
dev
;
pca
->
chip
.
base
=
-
1
;
pca
->
chip
.
can_sleep
=
true
;
return
pwmchip_add
(
&
pca
->
chip
);
}
...
...
drivers/pwm/pwm-sti.c
View file @
3aeeb375
...
...
@@ -635,7 +635,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
pc
->
chip
.
ops
=
&
sti_pwm_ops
;
pc
->
chip
.
base
=
-
1
;
pc
->
chip
.
npwm
=
pc
->
cdata
->
pwm_num_devs
;
pc
->
chip
.
can_sleep
=
true
;
ret
=
pwmchip_add
(
&
pc
->
chip
);
if
(
ret
<
0
)
{
...
...
drivers/pwm/pwm-sun4i.c
View file @
3aeeb375
...
...
@@ -340,7 +340,6 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
pwm
->
chip
.
ops
=
&
sun4i_pwm_ops
;
pwm
->
chip
.
base
=
-
1
;
pwm
->
chip
.
npwm
=
pwm
->
data
->
npwm
;
pwm
->
chip
.
can_sleep
=
true
;
pwm
->
chip
.
of_xlate
=
of_pwm_xlate_with_flags
;
pwm
->
chip
.
of_pwm_n_cells
=
3
;
...
...
drivers/pwm/pwm-twl-led.c
View file @
3aeeb375
...
...
@@ -303,7 +303,6 @@ static int twl_pwmled_probe(struct platform_device *pdev)
twl
->
chip
.
dev
=
&
pdev
->
dev
;
twl
->
chip
.
base
=
-
1
;
twl
->
chip
.
can_sleep
=
true
;
mutex_init
(
&
twl
->
mutex
);
...
...
drivers/pwm/pwm-twl.c
View file @
3aeeb375
...
...
@@ -323,7 +323,6 @@ static int twl_pwm_probe(struct platform_device *pdev)
twl
->
chip
.
dev
=
&
pdev
->
dev
;
twl
->
chip
.
base
=
-
1
;
twl
->
chip
.
npwm
=
2
;
twl
->
chip
.
can_sleep
=
true
;
mutex_init
(
&
twl
->
mutex
);
...
...
drivers/staging/greybus/pwm.c
View file @
3aeeb375
...
...
@@ -284,7 +284,6 @@ static int gb_pwm_probe(struct gbphy_device *gbphy_dev,
pwm
->
ops
=
&
gb_pwm_ops
;
pwm
->
base
=
-
1
;
/* Allocate base dynamically */
pwm
->
npwm
=
pwmc
->
pwm_max
+
1
;
pwm
->
can_sleep
=
true
;
/* FIXME */
ret
=
pwmchip_add
(
pwm
);
if
(
ret
)
{
...
...
include/linux/pwm.h
View file @
3aeeb375
...
...
@@ -287,8 +287,6 @@ struct pwm_ops {
* @pwms: array of PWM devices allocated by the framework
* @of_xlate: request a PWM device given a device tree PWM specifier
* @of_pwm_n_cells: number of cells expected in the device tree PWM specifier
* @can_sleep: must be true if the .config(), .enable() or .disable()
* operations may sleep
*/
struct
pwm_chip
{
struct
device
*
dev
;
...
...
@@ -302,7 +300,6 @@ struct pwm_chip {
struct
pwm_device
*
(
*
of_xlate
)(
struct
pwm_chip
*
pc
,
const
struct
of_phandle_args
*
args
);
unsigned
int
of_pwm_n_cells
;
bool
can_sleep
;
};
/**
...
...
@@ -451,8 +448,6 @@ struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
struct
pwm_device
*
devm_of_pwm_get
(
struct
device
*
dev
,
struct
device_node
*
np
,
const
char
*
con_id
);
void
devm_pwm_put
(
struct
device
*
dev
,
struct
pwm_device
*
pwm
);
bool
pwm_can_sleep
(
struct
pwm_device
*
pwm
);
#else
static
inline
struct
pwm_device
*
pwm_request
(
int
pwm_id
,
const
char
*
label
)
{
...
...
@@ -566,11 +561,6 @@ static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
static
inline
void
devm_pwm_put
(
struct
device
*
dev
,
struct
pwm_device
*
pwm
)
{
}
static
inline
bool
pwm_can_sleep
(
struct
pwm_device
*
pwm
)
{
return
false
;
}
#endif
static
inline
void
pwm_apply_args
(
struct
pwm_device
*
pwm
)
...
...
@@ -613,18 +603,25 @@ struct pwm_lookup {
const
char
*
con_id
;
unsigned
int
period
;
enum
pwm_polarity
polarity
;
const
char
*
module
;
/* optional, may be NULL */
};
#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
{ \
.provider = _provider, \
.index = _index, \
.dev_id = _dev_id, \
.con_id = _con_id, \
.period = _period, \
.polarity = _polarity \
#define PWM_LOOKUP_WITH_MODULE(_provider, _index, _dev_id, _con_id, \
_period, _polarity, _module) \
{ \
.provider = _provider, \
.index = _index, \
.dev_id = _dev_id, \
.con_id = _con_id, \
.period = _period, \
.polarity = _polarity, \
.module = _module, \
}
#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
PWM_LOOKUP_WITH_MODULE(_provider, _index, _dev_id, _con_id, _period, \
_polarity, NULL)
#if IS_ENABLED(CONFIG_PWM)
void
pwm_add_table
(
struct
pwm_lookup
*
table
,
size_t
num
);
void
pwm_remove_table
(
struct
pwm_lookup
*
table
,
size_t
num
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment