^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /***************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2010-2012 by Bruno Prémont <bonbons@linux-vserver.org> *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Based on Logitech G13 driver (v0.4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2009 by Rick L. Vinyard, Jr. <rvinyard@cs.nmsu.edu> *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ***************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define PICOLCD_NAME "PicoLCD (graphic)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* Report numbers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define REPORT_ERROR_CODE 0x10 /* LCD: IN[16] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define ERR_SUCCESS 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define ERR_PARAMETER_MISSING 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define ERR_DATA_MISSING 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define ERR_BLOCK_READ_ONLY 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define ERR_BLOCK_NOT_ERASABLE 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define ERR_BLOCK_TOO_BIG 0x05
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define ERR_SECTION_OVERFLOW 0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define ERR_INVALID_CMD_LEN 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define ERR_INVALID_DATA_LEN 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define REPORT_KEY_STATE 0x11 /* LCD: IN[2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define REPORT_IR_DATA 0x21 /* LCD: IN[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define REPORT_EE_DATA 0x32 /* LCD: IN[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define REPORT_MEMORY 0x41 /* LCD: IN[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define REPORT_LED_STATE 0x81 /* LCD: OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define REPORT_BRIGHTNESS 0x91 /* LCD: OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define REPORT_CONTRAST 0x92 /* LCD: OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define REPORT_RESET 0x93 /* LCD: OUT[2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define REPORT_LCD_CMD 0x94 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define REPORT_LCD_DATA 0x95 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define REPORT_LCD_CMD_DATA 0x96 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define REPORT_EE_READ 0xa3 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define REPORT_EE_WRITE 0xa4 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define REPORT_ERASE_MEMORY 0xb2 /* LCD: OUT[2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define REPORT_READ_MEMORY 0xb3 /* LCD: OUT[3] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define REPORT_WRITE_MEMORY 0xb4 /* LCD: OUT[63] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define REPORT_SPLASH_RESTART 0xc1 /* LCD: OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define REPORT_EXIT_KEYBOARD 0xef /* LCD: OUT[2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define REPORT_VERSION 0xf1 /* LCD: IN[2],OUT[1] Bootloader: IN[2],OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define REPORT_BL_ERASE_MEMORY 0xf2 /* Bootloader: IN[36],OUT[4] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define REPORT_BL_READ_MEMORY 0xf3 /* Bootloader: IN[36],OUT[4] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define REPORT_BL_WRITE_MEMORY 0xf4 /* Bootloader: IN[36],OUT[36] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define REPORT_DEVID 0xf5 /* LCD: IN[5], OUT[1] Bootloader: IN[5],OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define REPORT_SPLASH_SIZE 0xf6 /* LCD: IN[4], OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define REPORT_HOOK_VERSION 0xf7 /* LCD: IN[2], OUT[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define REPORT_EXIT_FLASHER 0xff /* Bootloader: OUT[2] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) /* Description of in-progress IO operation, used for operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * that trigger response from device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct picolcd_pending {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct hid_report *out_report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct hid_report *in_report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct completion ready;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int raw_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) u8 raw_data[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define PICOLCD_KEYS 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /* Per device data structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) struct picolcd_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct hid_device *hdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct dentry *debug_reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct dentry *debug_eeprom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct dentry *debug_flash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct mutex mutex_flash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int addr_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) u8 version[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) unsigned short opmode_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) /* input stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) u8 pressed_keys[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct input_dev *input_keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #ifdef CONFIG_HID_PICOLCD_CIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct rc_dev *rc_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) unsigned short keycode[PICOLCD_KEYS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #ifdef CONFIG_HID_PICOLCD_FB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /* Framebuffer stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct fb_info *fb_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #endif /* CONFIG_HID_PICOLCD_FB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #ifdef CONFIG_HID_PICOLCD_LCD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct lcd_device *lcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) u8 lcd_contrast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #endif /* CONFIG_HID_PICOLCD_LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #ifdef CONFIG_HID_PICOLCD_BACKLIGHT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct backlight_device *backlight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) u8 lcd_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) u8 lcd_power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #endif /* CONFIG_HID_PICOLCD_BACKLIGHT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #ifdef CONFIG_HID_PICOLCD_LEDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* LED stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) u8 led_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct led_classdev *led[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif /* CONFIG_HID_PICOLCD_LEDS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* Housekeeping stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct picolcd_pending *pending;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define PICOLCD_BOOTLOADER 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define PICOLCD_FAILED 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define PICOLCD_CIR_SHUN 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #ifdef CONFIG_HID_PICOLCD_FB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct picolcd_fb_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /* Framebuffer stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct picolcd_data *picolcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) u8 update_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) u8 bpp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) u8 force;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) u8 ready;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u8 *vbitmap; /* local copy of what was sent to PicoLCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) u8 *bitmap; /* framebuffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #endif /* CONFIG_HID_PICOLCD_FB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* Find a given report */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define picolcd_in_report(id, dev) picolcd_report(id, dev, HID_INPUT_REPORT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define picolcd_out_report(id, dev) picolcd_report(id, dev, HID_OUTPUT_REPORT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) void picolcd_debug_out_report(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct hid_device *hdev, struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define hid_hw_request(a, b, c) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) picolcd_debug_out_report(hid_get_drvdata(a), a, b); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) hid_hw_request(a, b, c); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) void picolcd_debug_raw_event(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct hid_device *hdev, struct hid_report *report,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) u8 *raw_data, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) void picolcd_init_devfs(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) struct hid_report *eeprom_r, struct hid_report *eeprom_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct hid_report *flash_r, struct hid_report *flash_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct hid_report *reset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) void picolcd_exit_devfs(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static inline void picolcd_debug_out_report(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct hid_device *hdev, struct hid_report *report)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static inline void picolcd_debug_raw_event(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct hid_device *hdev, struct hid_report *report,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) u8 *raw_data, int size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static inline void picolcd_init_devfs(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct hid_report *eeprom_r, struct hid_report *eeprom_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct hid_report *flash_r, struct hid_report *flash_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct hid_report *reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) static inline void picolcd_exit_devfs(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #endif /* CONFIG_DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) #ifdef CONFIG_HID_PICOLCD_FB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int picolcd_fb_reset(struct picolcd_data *data, int clear);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int picolcd_init_framebuffer(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) void picolcd_exit_framebuffer(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) void picolcd_fb_refresh(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define picolcd_fbinfo(d) ((d)->fb_info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static inline int picolcd_fb_reset(struct picolcd_data *data, int clear)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static inline int picolcd_init_framebuffer(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static inline void picolcd_exit_framebuffer(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static inline void picolcd_fb_refresh(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) #define picolcd_fbinfo(d) NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #endif /* CONFIG_HID_PICOLCD_FB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #ifdef CONFIG_HID_PICOLCD_BACKLIGHT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) int picolcd_init_backlight(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) void picolcd_exit_backlight(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int picolcd_resume_backlight(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) void picolcd_suspend_backlight(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static inline int picolcd_init_backlight(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct hid_report *report)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static inline void picolcd_exit_backlight(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static inline int picolcd_resume_backlight(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static inline void picolcd_suspend_backlight(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #endif /* CONFIG_HID_PICOLCD_BACKLIGHT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #ifdef CONFIG_HID_PICOLCD_LCD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) int picolcd_init_lcd(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) void picolcd_exit_lcd(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int picolcd_resume_lcd(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static inline int picolcd_init_lcd(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct hid_report *report)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) static inline void picolcd_exit_lcd(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static inline int picolcd_resume_lcd(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #endif /* CONFIG_HID_PICOLCD_LCD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) #ifdef CONFIG_HID_PICOLCD_LEDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) int picolcd_init_leds(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) void picolcd_exit_leds(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) void picolcd_leds_set(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) static inline int picolcd_init_leds(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) struct hid_report *report)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) static inline void picolcd_exit_leds(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) static inline void picolcd_leds_set(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) #endif /* CONFIG_HID_PICOLCD_LEDS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #ifdef CONFIG_HID_PICOLCD_CIR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) int picolcd_raw_cir(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) struct hid_report *report, u8 *raw_data, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) void picolcd_exit_cir(struct picolcd_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) static inline int picolcd_raw_cir(struct picolcd_data *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) struct hid_report *report, u8 *raw_data, int size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) static inline int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) static inline void picolcd_exit_cir(struct picolcd_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #endif /* CONFIG_HID_PICOLCD_CIR */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) int picolcd_reset(struct hid_device *hdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) int report_id, const u8 *raw_data, int size);