Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gnss / serial.h
blob621953f7821da17ee4160666706e7fbd110a9021
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Generic serial GNSS receiver driver
5 * Copyright (C) 2018 Johan Hovold <johan@kernel.org>
6 */
8 #ifndef _LINUX_GNSS_SERIAL_H
9 #define _LINUX_GNSS_SERIAL_H
11 #include <asm/termbits.h>
12 #include <linux/pm.h>
14 struct gnss_serial {
15 struct serdev_device *serdev;
16 struct gnss_device *gdev;
17 speed_t speed;
18 const struct gnss_serial_ops *ops;
19 unsigned long drvdata[];
22 enum gnss_serial_pm_state {
23 GNSS_SERIAL_OFF,
24 GNSS_SERIAL_ACTIVE,
25 GNSS_SERIAL_STANDBY,
28 struct gnss_serial_ops {
29 int (*set_power)(struct gnss_serial *gserial,
30 enum gnss_serial_pm_state state);
33 extern const struct dev_pm_ops gnss_serial_pm_ops;
35 struct gnss_serial *gnss_serial_allocate(struct serdev_device *gserial,
36 size_t data_size);
37 void gnss_serial_free(struct gnss_serial *gserial);
39 int gnss_serial_register(struct gnss_serial *gserial);
40 void gnss_serial_deregister(struct gnss_serial *gserial);
42 static inline void *gnss_serial_get_drvdata(struct gnss_serial *gserial)
44 return gserial->drvdata;
47 #endif /* _LINUX_GNSS_SERIAL_H */