diff options
Diffstat (limited to 'include/linux/mfd/rpisense')
-rw-r--r-- | include/linux/mfd/rpisense/core.h | 47 | ||||
-rw-r--r-- | include/linux/mfd/rpisense/framebuffer.h | 32 | ||||
-rw-r--r-- | include/linux/mfd/rpisense/joystick.h | 35 |
3 files changed, 114 insertions, 0 deletions
diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h new file mode 100644 index 000000000000..4856aa3c8b06 --- /dev/null +++ b/include/linux/mfd/rpisense/core.h @@ -0,0 +1,47 @@ +/* + * Raspberry Pi Sense HAT core driver + * http://raspberrypi.org + * + * Copyright (C) 2015 Raspberry Pi + * + * Author: Serge Schneider + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __LINUX_MFD_RPISENSE_CORE_H_ +#define __LINUX_MFD_RPISENSE_CORE_H_ + +#include <linux/mfd/rpisense/joystick.h> +#include <linux/mfd/rpisense/framebuffer.h> + +/* + * Register values. + */ +#define RPISENSE_FB 0x00 +#define RPISENSE_WAI 0xF0 +#define RPISENSE_VER 0xF1 +#define RPISENSE_KEYS 0xF2 +#define RPISENSE_EE_WP 0xF3 + +#define RPISENSE_ID 's' + +struct rpisense { + struct device *dev; + struct i2c_client *i2c_client; + + /* Client devices */ + struct rpisense_js joystick; + struct rpisense_fb framebuffer; +}; + +struct rpisense *rpisense_get_dev(void); +s32 rpisense_reg_read(struct rpisense *rpisense, int reg); +int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); +int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); + +#endif diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h new file mode 100644 index 000000000000..2ba95d7eebaf --- /dev/null +++ b/include/linux/mfd/rpisense/framebuffer.h @@ -0,0 +1,32 @@ +/* + * Raspberry Pi Sense HAT framebuffer driver + * http://raspberrypi.org + * + * Copyright (C) 2015 Raspberry Pi + * + * Author: Serge Schneider + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __LINUX_RPISENSE_FB_H_ +#define __LINUX_RPISENSE_FB_H_ + +#define SENSEFB_FBIO_IOC_MAGIC 0xF1 + +#define SENSEFB_FBIOGET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 0) +#define SENSEFB_FBIOSET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 1) +#define SENSEFB_FBIORESET_GAMMA _IO(SENSEFB_FBIO_IOC_MAGIC, 2) + +struct rpisense; + +struct rpisense_fb { + struct platform_device *pdev; + struct fb_info *info; +}; + +#endif diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h new file mode 100644 index 000000000000..56196dc2af10 --- /dev/null +++ b/include/linux/mfd/rpisense/joystick.h @@ -0,0 +1,35 @@ +/* + * Raspberry Pi Sense HAT joystick driver + * http://raspberrypi.org + * + * Copyright (C) 2015 Raspberry Pi + * + * Author: Serge Schneider + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#ifndef __LINUX_RPISENSE_JOYSTICK_H_ +#define __LINUX_RPISENSE_JOYSTICK_H_ + +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/gpio/consumer.h> +#include <linux/platform_device.h> + +struct rpisense; + +struct rpisense_js { + struct platform_device *pdev; + struct input_dev *keys_dev; + struct gpio_desc *keys_desc; + struct work_struct keys_work_s; + int keys_irq; +}; + + +#endif |