linux/drivers/hid/hid-picolcd.h

/* SPDX-License-Identifier: GPL-2.0-only */
/***************************************************************************
 *   Copyright (C) 2010-2012 by Bruno Prémont <[email protected]>  *
 *                                                                         *
 *   Based on Logitech G13 driver (v0.4)                                   *
 *     Copyright (C) 2009 by Rick L. Vinyard, Jr. <[email protected]>   *
 *                                                                         *
 ***************************************************************************/

#define PICOLCD_NAME

/* Report numbers */
#define REPORT_ERROR_CODE
#define ERR_SUCCESS
#define ERR_PARAMETER_MISSING
#define ERR_DATA_MISSING
#define ERR_BLOCK_READ_ONLY
#define ERR_BLOCK_NOT_ERASABLE
#define ERR_BLOCK_TOO_BIG
#define ERR_SECTION_OVERFLOW
#define ERR_INVALID_CMD_LEN
#define ERR_INVALID_DATA_LEN
#define REPORT_KEY_STATE
#define REPORT_IR_DATA
#define REPORT_EE_DATA
#define REPORT_MEMORY
#define REPORT_LED_STATE
#define REPORT_BRIGHTNESS
#define REPORT_CONTRAST
#define REPORT_RESET
#define REPORT_LCD_CMD
#define REPORT_LCD_DATA
#define REPORT_LCD_CMD_DATA
#define REPORT_EE_READ
#define REPORT_EE_WRITE
#define REPORT_ERASE_MEMORY
#define REPORT_READ_MEMORY
#define REPORT_WRITE_MEMORY
#define REPORT_SPLASH_RESTART
#define REPORT_EXIT_KEYBOARD
#define REPORT_VERSION
#define REPORT_BL_ERASE_MEMORY
#define REPORT_BL_READ_MEMORY
#define REPORT_BL_WRITE_MEMORY
#define REPORT_DEVID
#define REPORT_SPLASH_SIZE
#define REPORT_HOOK_VERSION
#define REPORT_EXIT_FLASHER

/* Description of in-progress IO operation, used for operations
 * that trigger response from device */
struct picolcd_pending {};


#define PICOLCD_KEYS

/* Per device data structure */
struct picolcd_data {};

#ifdef CONFIG_HID_PICOLCD_FB
struct picolcd_fb_data {};
#endif /* CONFIG_HID_PICOLCD_FB */

/* Find a given report */
#define picolcd_in_report(id, dev)
#define picolcd_out_report(id, dev)

struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir);

#ifdef CONFIG_DEBUG_FS
void picolcd_debug_out_report(struct picolcd_data *data,
		struct hid_device *hdev, struct hid_report *report);
#define hid_hw_request(a, b, c)

void picolcd_debug_raw_event(struct picolcd_data *data,
		struct hid_device *hdev, struct hid_report *report,
		u8 *raw_data, int size);

void picolcd_init_devfs(struct picolcd_data *data,
		struct hid_report *eeprom_r, struct hid_report *eeprom_w,
		struct hid_report *flash_r, struct hid_report *flash_w,
		struct hid_report *reset);

void picolcd_exit_devfs(struct picolcd_data *data);
#else
static inline void picolcd_debug_out_report(struct picolcd_data *data,
		struct hid_device *hdev, struct hid_report *report)
{
}
static inline void picolcd_debug_raw_event(struct picolcd_data *data,
		struct hid_device *hdev, struct hid_report *report,
		u8 *raw_data, int size)
{
}
static inline void picolcd_init_devfs(struct picolcd_data *data,
		struct hid_report *eeprom_r, struct hid_report *eeprom_w,
		struct hid_report *flash_r, struct hid_report *flash_w,
		struct hid_report *reset)
{
}
static inline void picolcd_exit_devfs(struct picolcd_data *data)
{
}
#endif /* CONFIG_DEBUG_FS */


#ifdef CONFIG_HID_PICOLCD_FB
int picolcd_fb_reset(struct picolcd_data *data, int clear);

int picolcd_init_framebuffer(struct picolcd_data *data);

void picolcd_exit_framebuffer(struct picolcd_data *data);

void picolcd_fb_refresh(struct picolcd_data *data);
#define picolcd_fbinfo(d)
#else
static inline int picolcd_fb_reset(struct picolcd_data *data, int clear)
{
	return 0;
}
static inline int picolcd_init_framebuffer(struct picolcd_data *data)
{
	return 0;
}
static inline void picolcd_exit_framebuffer(struct picolcd_data *data)
{
}
static inline void picolcd_fb_refresh(struct picolcd_data *data)
{
}
#define picolcd_fbinfo
#endif /* CONFIG_HID_PICOLCD_FB */


#ifdef CONFIG_HID_PICOLCD_BACKLIGHT
int picolcd_init_backlight(struct picolcd_data *data,
		struct hid_report *report);

void picolcd_exit_backlight(struct picolcd_data *data);

int picolcd_resume_backlight(struct picolcd_data *data);

void picolcd_suspend_backlight(struct picolcd_data *data);
#else
static inline int picolcd_init_backlight(struct picolcd_data *data,
		struct hid_report *report)
{
	return 0;
}
static inline void picolcd_exit_backlight(struct picolcd_data *data)
{
}
static inline int picolcd_resume_backlight(struct picolcd_data *data)
{
	return 0;
}
static inline void picolcd_suspend_backlight(struct picolcd_data *data)
{
}

#endif /* CONFIG_HID_PICOLCD_BACKLIGHT */


#ifdef CONFIG_HID_PICOLCD_LCD
int picolcd_init_lcd(struct picolcd_data *data,
		struct hid_report *report);

void picolcd_exit_lcd(struct picolcd_data *data);

int picolcd_resume_lcd(struct picolcd_data *data);
#else
static inline int picolcd_init_lcd(struct picolcd_data *data,
		struct hid_report *report)
{
	return 0;
}
static inline void picolcd_exit_lcd(struct picolcd_data *data)
{
}
static inline int picolcd_resume_lcd(struct picolcd_data *data)
{
	return 0;
}
#endif /* CONFIG_HID_PICOLCD_LCD */


#ifdef CONFIG_HID_PICOLCD_LEDS
int picolcd_init_leds(struct picolcd_data *data,
		struct hid_report *report);

void picolcd_exit_leds(struct picolcd_data *data);

void picolcd_leds_set(struct picolcd_data *data);
#else
static inline int picolcd_init_leds(struct picolcd_data *data,
		struct hid_report *report)
{
	return 0;
}
static inline void picolcd_exit_leds(struct picolcd_data *data)
{
}
static inline void picolcd_leds_set(struct picolcd_data *data)
{
}
#endif /* CONFIG_HID_PICOLCD_LEDS */


#ifdef CONFIG_HID_PICOLCD_CIR
int picolcd_raw_cir(struct picolcd_data *data,
		struct hid_report *report, u8 *raw_data, int size);

int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report);

void picolcd_exit_cir(struct picolcd_data *data);
#else
static inline int picolcd_raw_cir(struct picolcd_data *data,
		struct hid_report *report, u8 *raw_data, int size)
{
	return 1;
}
static inline int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
{
	return 0;
}
static inline void picolcd_exit_cir(struct picolcd_data *data)
{
}
#endif /* CONFIG_HID_PICOLCD_CIR */

int picolcd_reset(struct hid_device *hdev);
struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev,
			int report_id, const u8 *raw_data, int size);