Skip to content

Commit

Permalink
bmips: leds-sercomm-msp430: improve driver
Browse files Browse the repository at this point in the history
- Add missing module functions.
- Fix infinite pattern trigger by converting negative values to 0.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
  • Loading branch information
Noltari authored and pull[bot] committed Feb 2, 2024
1 parent b3fa4f1 commit c9578e1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ static int msp430_pattern_set(struct led_classdev *led_cdev,
delay0 = msp430_blink_delay(pattern[0].delta_t);
delay1 = msp430_blink_delay(pattern[1].delta_t);

/* Infinite pattern */
if (repeat < 0)
repeat = 0;

/* Pulse: <off> <delay> <max> <delay> */
if (delay0 == delay1 &&
pattern[0].brightness == LED_OFF &&
Expand Down Expand Up @@ -354,14 +358,15 @@ static int msp430_leds_probe(struct spi_device *spi)

static const struct of_device_id msp430_leds_of_match[] = {
{ .compatible = "sercomm,msp430-leds", },
{ },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, msp430_leds_of_match);

static const struct spi_device_id msp430_leds_id_table[] = {
{ "msp430-leds", 0 },
{ }
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(spi, msp430_leds_id_table);

static struct spi_driver msp430_leds_driver = {
.driver = {
Expand All @@ -371,7 +376,6 @@ static struct spi_driver msp430_leds_driver = {
.id_table = msp430_leds_id_table,
.probe = msp430_leds_probe,
};

module_spi_driver(msp430_leds_driver);

MODULE_AUTHOR("Álvaro Fernández Rojas <noltari@gmail.com>");
Expand Down

0 comments on commit c9578e1

Please sign in to comment.