Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Generic serial GNSS receiver driver
0004  *
0005  * Copyright (C) 2018 Johan Hovold <johan@kernel.org>
0006  */
0007 
0008 #ifndef _LINUX_GNSS_SERIAL_H
0009 #define _LINUX_GNSS_SERIAL_H
0010 
0011 #include <asm/termbits.h>
0012 #include <linux/pm.h>
0013 
0014 struct gnss_serial {
0015     struct serdev_device *serdev;
0016     struct gnss_device *gdev;
0017     speed_t speed;
0018     const struct gnss_serial_ops *ops;
0019     unsigned long drvdata[];
0020 };
0021 
0022 enum gnss_serial_pm_state {
0023     GNSS_SERIAL_OFF,
0024     GNSS_SERIAL_ACTIVE,
0025     GNSS_SERIAL_STANDBY,
0026 };
0027 
0028 struct gnss_serial_ops {
0029     int (*set_power)(struct gnss_serial *gserial,
0030                 enum gnss_serial_pm_state state);
0031 };
0032 
0033 extern const struct dev_pm_ops gnss_serial_pm_ops;
0034 
0035 struct gnss_serial *gnss_serial_allocate(struct serdev_device *gserial,
0036                         size_t data_size);
0037 void gnss_serial_free(struct gnss_serial *gserial);
0038 
0039 int gnss_serial_register(struct gnss_serial *gserial);
0040 void gnss_serial_deregister(struct gnss_serial *gserial);
0041 
0042 static inline void *gnss_serial_get_drvdata(struct gnss_serial *gserial)
0043 {
0044     return gserial->drvdata;
0045 }
0046 
0047 #endif /* _LINUX_GNSS_SERIAL_H */