From: Pavel Machek <pavel@ucw.cz>
To: list@c-mauderer.de
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Dan Murphy <dmurphy@ti.com>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Christian Mauderer <oss@c-mauderer.de>
Subject: Re: [PATCH 2/2] leds: ubnt-spi: Add Ubnt AirCube ISP LED driver
Date: Sat, 4 May 2019 18:20:09 +0200 [thread overview]
Message-ID: <20190504162009.GB24060@amd> (raw)
In-Reply-To: <20190504122825.11883-2-list@c-mauderer.de>
[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]
On Sat 2019-05-04 14:28:25, list@c-mauderer.de wrote:
> From: Christian Mauderer <oss@c-mauderer.de>
>
> This driver adds support for the custom LED controller used in Ubiquity
> airCube ISP devices and most likely some other simmilar Ubiquity
> products.
similar.
> +config LEDS_UBNT_SPI
> + tristate "LED support for Ubnt aircube ISP custom SPI LED controller"
> + depends on LEDS_CLASS
> + depends on SPI
> + depends on OF
> + help
> + This option enables basic support for the LED controller used in
> + Ubiquity airCube ISP devices. The controller is microcontroller based
> + and uses a single byte on the SPI to set brightness or blink patterns.
> +/*
> + * Custom controller based LED controller used in Ubiquity airCube ISP.
> + *
> + * Reverse engineered protocol:
> + * - The device uses only a single byte sent via SPI.
> + * - The SPI input doesn't contain any relevant information.
> + * - Higher two bits set a mode. Lower six bits are a parameter.
> + * - Mode: 00 -> set brightness between 0x00 (min) and 0x3F (max)
> + * - Mode: 01 -> pulsing pattern (min -> max -> min) with an interval. From
> + * some tests, the period is about (50ms + 102ms * parameter). There is a
> + * slightly different pattern starting from 0x100 (longer gap between the
> + * pulses) but the time still follows that calculation.
> + * - Mode: 10 -> same as 01 but with only a ramp from min to max. Again a
> + * slight jump in the pattern at 0x100.
> + * - Mode: 11 -> blinking (off -> 25% -> off -> 25% -> ...) with a period of
> + * (105ms * parameter)
> + *
> + * NOTE: This driver currently only implements mode 00 (brightness).
> + */
Aha, so this is not as simple as I thought.
"Slightly different pattern starting from 0x100"? What does 0x100 mean
here.
> + mutex_init(&led->mutex);
> + led->ldev.name = led->name;
> + led->ldev.brightness = LED_OFF;
> + led->ldev.max_brightness = led->max_bright - led->off_bright;
What happens when DTS has off_bright > max_bright? :-).
> +
> +static int ubnt_spi_remove(struct spi_device *spi)
> +{
> + struct ubnt_spi_led *led = spi_get_drvdata(spi);
> +
> + led_classdev_unregister(&led->ldev);
> +
> + return 0;
> +}
Do you need to do mutex_destroy?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2019-05-04 16:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-04 12:28 [PATCH 1/2] dt-bindings: leds: Add binding for ubnt-spi LED list
2019-05-04 12:28 ` [PATCH 2/2] leds: ubnt-spi: Add Ubnt AirCube ISP LED driver list
2019-05-04 16:20 ` Pavel Machek [this message]
2019-05-04 16:43 ` Christian Mauderer
2019-05-04 17:25 ` Pavel Machek
2019-05-04 16:12 ` [PATCH 1/2] dt-bindings: leds: Add binding for ubnt-spi LED Pavel Machek
2019-05-04 16:46 ` Christian Mauderer
2019-05-04 19:34 ` Jacek Anaszewski
2019-05-04 19:45 ` Jacek Anaszewski
2019-05-04 20:01 ` Christian Mauderer
2019-05-04 20:07 ` Jacek Anaszewski
2019-05-04 19:48 ` Christian Mauderer
2019-05-04 20:01 ` Jacek Anaszewski
2019-05-04 20:34 ` Pavel Machek
2019-05-04 22:17 ` Pavel Machek
2019-05-05 8:01 ` Christian Mauderer
2019-05-05 10:56 ` Jacek Anaszewski
2019-05-05 11:51 ` Christian Mauderer
2019-05-05 12:15 ` Jacek Anaszewski
2019-05-05 11:54 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190504162009.GB24060@amd \
--to=pavel@ucw.cz \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-leds@vger.kernel.org \
--cc=list@c-mauderer.de \
--cc=mark.rutland@arm.com \
--cc=oss@c-mauderer.de \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).