Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
linux-arm
linux-rm
Commits
d75c2287
Commit
d75c2287
authored
Apr 19, 2022
by
Robin Murphy
Browse files
fixup! auxdisplay: add support for Titanmec TM1628 7 segment display controller
parent
a328a6c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
drivers/auxdisplay/tm1628.c
View file @
d75c2287
...
...
@@ -227,12 +227,16 @@ static const DEVICE_ATTR_RW(display_text);
static
int
tm1628_spi_probe
(
struct
spi_device
*
spi
)
{
struct
fwnode_handle
*
child
;
unsigned
int
num_leds
;
struct
fwnode_handle
*
leds_node
,
*
child
;
unsigned
int
num_leds
=
0
;
struct
tm1628
*
s
;
int
ret
,
i
;
num_leds
=
device_get_child_node_count
(
&
spi
->
dev
);
leds_node
=
device_get_named_child_node
(
&
spi
->
dev
,
"leds"
);
if
(
IS_REACHABLE
(
CONFIG_LEDS_CLASS
))
{
fwnode_for_each_child_node
(
leds_node
,
child
)
num_leds
++
;
}
s
=
devm_kzalloc
(
&
spi
->
dev
,
struct_size
(
s
,
leds
,
num_leds
),
GFP_KERNEL
);
if
(
!
s
)
...
...
@@ -260,12 +264,11 @@ static int tm1628_spi_probe(struct spi_device *spi)
if
(
ret
)
return
ret
;
num_leds
=
0
;
if
(
!
IS_REACHABLE
(
CONFIG_LEDS_CLASS
))
if
(
num_leds
==
0
)
goto
no_leds
;
device_for_each_child_node
(
&
spi
->
dev
,
child
)
{
i
=
0
;
fwnode_for_each_child_node
(
leds_node
,
child
)
{
u32
reg
[
2
];
ret
=
fwnode_property_read_u32_array
(
child
,
"reg"
,
reg
,
2
);
...
...
@@ -287,16 +290,17 @@ static int tm1628_spi_probe(struct spi_device *spi)
continue
;
}
ret
=
tm1628_register_led
(
s
,
child
,
reg
[
0
],
reg
[
1
],
s
->
leds
+
num_leds
);
ret
=
tm1628_register_led
(
s
,
child
,
reg
[
0
],
reg
[
1
],
s
->
leds
+
i
);
if
(
ret
)
{
dev_err
(
&
spi
->
dev
,
"Failed to register LED %s (%d)
\n
"
,
fwnode_get_name
(
child
),
ret
);
continue
;
}
num_leds
++
;
i
++
;
}
no_leds:
fwnode_handle_put
(
leds_node
);
ret
=
device_property_count_u8
(
&
spi
->
dev
,
"titanmec,grid"
);
if
(
ret
<
1
||
ret
>
MAX_GRID_SIZE
)
{
dev_err
(
&
spi
->
dev
,
"Invalid display length (%d)
\n
"
,
ret
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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