^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Generic serial GNSS receiver driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2018 Johan Hovold <johan@kernel.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _LINUX_GNSS_SERIAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _LINUX_GNSS_SERIAL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/termbits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/pm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct gnss_serial {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct serdev_device *serdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct gnss_device *gdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) speed_t speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) const struct gnss_serial_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned long drvdata[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) enum gnss_serial_pm_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) GNSS_SERIAL_OFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) GNSS_SERIAL_ACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) GNSS_SERIAL_STANDBY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct gnss_serial_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int (*set_power)(struct gnss_serial *gserial,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) enum gnss_serial_pm_state state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern const struct dev_pm_ops gnss_serial_pm_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct gnss_serial *gnss_serial_allocate(struct serdev_device *gserial,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) size_t data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void gnss_serial_free(struct gnss_serial *gserial);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int gnss_serial_register(struct gnss_serial *gserial);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void gnss_serial_deregister(struct gnss_serial *gserial);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static inline void *gnss_serial_get_drvdata(struct gnss_serial *gserial)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) return gserial->drvdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #endif /* _LINUX_GNSS_SERIAL_H */