Skip to content

Commit 372eb09

Browse files
elkabloarndb
authored andcommitted
platform: cznic: turris-omnia-mcu: Document the driver private data structure
Add more comprehensive documentation for the driver private data structure, `struct omnia_mcu`. Signed-off-by: Marek Behún <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 0efa0fc commit 372eb09

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

drivers/platform/cznic/turris-omnia-mcu.h

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,71 @@
2323
struct i2c_client;
2424
struct rtc_device;
2525

26+
/**
27+
* struct omnia_mcu - driver private data structure
28+
* @client: I2C client
29+
* @type: MCU type (STM32, GD32, MKL, or unknown)
30+
* @features: bitmap of features supported by the MCU firmware
31+
* @board_serial_number: board serial number, if stored in MCU
32+
* @board_first_mac: board first MAC address, if stored in MCU
33+
* @board_revision: board revision, if stored in MCU
34+
* @gc: GPIO chip
35+
* @lock: mutex to protect internal GPIO chip state
36+
* @mask: bitmap of masked IRQs
37+
* @rising: bitmap of rising edge IRQs
38+
* @falling: bitmap of falling edge IRQs
39+
* @both: bitmap of both edges IRQs
40+
* @cached: bitmap of cached IRQ line values (when an IRQ line is configured for
41+
* both edges, we cache the corresponding GPIO values in the IRQ
42+
* handler)
43+
* @is_cached: bitmap of which IRQ line values are cached
44+
* @button_release_emul_work: front button release emulation work, used with old MCU firmware
45+
* versions which did not send button release events, only button press
46+
* events
47+
* @last_status: cached value of the status word, to be compared with new value to
48+
* determine which interrupt events occurred, used with old MCU
49+
* firmware versions which only informed that the status word changed,
50+
* but not which bits of the status word changed
51+
* @button_pressed_emul: the front button is still emulated to be pressed
52+
* @rtcdev: RTC device, does not actually count real-time, the device is only
53+
* used for the RTC alarm mechanism, so that the board can be
54+
* configured to wake up from poweroff state at a specific time
55+
* @rtc_alarm: RTC alarm that was set for the board to wake up on, in MCU time
56+
* (seconds since last MCU reset)
57+
* @front_button_poweron: the front button should power on the device after it is powered off
58+
* @wdt: watchdog driver structure
59+
* @trng: RNG driver structure
60+
* @trng_entropy_ready: RNG entropy ready completion
61+
*/
2662
struct omnia_mcu {
2763
struct i2c_client *client;
2864
const char *type;
2965
u32 features;
3066

31-
/* board information */
3267
u64 board_serial_number;
3368
u8 board_first_mac[ETH_ALEN];
3469
u8 board_revision;
3570

3671
#ifdef CONFIG_TURRIS_OMNIA_MCU_GPIO
37-
/* GPIO chip */
3872
struct gpio_chip gc;
3973
struct mutex lock;
4074
unsigned long mask, rising, falling, both, cached, is_cached;
41-
/* Old MCU firmware handling needs the following */
4275
struct delayed_work button_release_emul_work;
4376
unsigned long last_status;
4477
bool button_pressed_emul;
4578
#endif
4679

4780
#ifdef CONFIG_TURRIS_OMNIA_MCU_SYSOFF_WAKEUP
48-
/* RTC device for configuring wake-up */
4981
struct rtc_device *rtcdev;
5082
u32 rtc_alarm;
5183
bool front_button_poweron;
5284
#endif
5385

5486
#ifdef CONFIG_TURRIS_OMNIA_MCU_WATCHDOG
55-
/* MCU watchdog */
5687
struct watchdog_device wdt;
5788
#endif
5889

5990
#ifdef CONFIG_TURRIS_OMNIA_MCU_TRNG
60-
/* true random number generator */
6191
struct hwrng trng;
6292
struct completion trng_entropy_ready;
6393
#endif

0 commit comments

Comments
 (0)