Lines Matching full:pad

75 static int psxpad_command(struct psxpad *pad, const u8 sendcmdlen)  in psxpad_command()  argument
78 .tx_buf = pad->sendbuf, in psxpad_command()
79 .rx_buf = pad->response, in psxpad_command()
84 err = spi_sync_transfer(pad->spi, &xfers, 1); in psxpad_command()
86 dev_err(&pad->spi->dev, in psxpad_command()
96 static void psxpad_control_motor(struct psxpad *pad, in psxpad_control_motor() argument
101 pad->motor1enable = motor1enable; in psxpad_control_motor()
102 pad->motor2enable = motor2enable; in psxpad_control_motor()
104 memcpy(pad->sendbuf, PSX_CMD_ENTER_CFG, sizeof(PSX_CMD_ENTER_CFG)); in psxpad_control_motor()
105 err = psxpad_command(pad, sizeof(PSX_CMD_ENTER_CFG)); in psxpad_control_motor()
107 dev_err(&pad->spi->dev, in psxpad_control_motor()
113 memcpy(pad->sendbuf, PSX_CMD_ENABLE_MOTOR, in psxpad_control_motor()
115 pad->sendbuf[3] = pad->motor1enable ? 0x00 : 0xFF; in psxpad_control_motor()
116 pad->sendbuf[4] = pad->motor2enable ? 0x80 : 0xFF; in psxpad_control_motor()
117 err = psxpad_command(pad, sizeof(PSX_CMD_ENABLE_MOTOR)); in psxpad_control_motor()
119 dev_err(&pad->spi->dev, in psxpad_control_motor()
125 memcpy(pad->sendbuf, PSX_CMD_EXIT_CFG, sizeof(PSX_CMD_EXIT_CFG)); in psxpad_control_motor()
126 err = psxpad_command(pad, sizeof(PSX_CMD_EXIT_CFG)); in psxpad_control_motor()
128 dev_err(&pad->spi->dev, in psxpad_control_motor()
135 static void psxpad_set_motor_level(struct psxpad *pad, in psxpad_set_motor_level() argument
138 pad->motor1level = motor1level ? 0xFF : 0x00; in psxpad_set_motor_level()
139 pad->motor2level = REVERSE_BIT(motor2level); in psxpad_set_motor_level()
145 struct psxpad *pad = input_get_drvdata(idev); in psxpad_spi_play_effect() local
149 psxpad_set_motor_level(pad, in psxpad_spi_play_effect()
158 static int psxpad_spi_init_ff(struct psxpad *pad) in psxpad_spi_init_ff() argument
162 input_set_capability(pad->idev, EV_FF, FF_RUMBLE); in psxpad_spi_init_ff()
164 err = input_ff_create_memless(pad->idev, NULL, psxpad_spi_play_effect); in psxpad_spi_init_ff()
166 dev_err(&pad->spi->dev, in psxpad_spi_init_ff()
176 static void psxpad_control_motor(struct psxpad *pad, in psxpad_control_motor() argument
181 static void psxpad_set_motor_level(struct psxpad *pad, in psxpad_set_motor_level() argument
186 static inline int psxpad_spi_init_ff(struct psxpad *pad) in psxpad_spi_init_ff() argument
194 struct psxpad *pad = input_get_drvdata(input); in psxpad_spi_poll_open() local
196 pm_runtime_get_sync(&pad->spi->dev); in psxpad_spi_poll_open()
203 struct psxpad *pad = input_get_drvdata(input); in psxpad_spi_poll_close() local
205 pm_runtime_put_sync(&pad->spi->dev); in psxpad_spi_poll_close()
210 struct psxpad *pad = input_get_drvdata(input); in psxpad_spi_poll() local
214 psxpad_control_motor(pad, true, true); in psxpad_spi_poll()
216 memcpy(pad->sendbuf, PSX_CMD_POLL, sizeof(PSX_CMD_POLL)); in psxpad_spi_poll()
217 pad->sendbuf[3] = pad->motor1enable ? pad->motor1level : 0x00; in psxpad_spi_poll()
218 pad->sendbuf[4] = pad->motor2enable ? pad->motor2level : 0x00; in psxpad_spi_poll()
219 err = psxpad_command(pad, sizeof(PSX_CMD_POLL)); in psxpad_spi_poll()
221 dev_err(&pad->spi->dev, in psxpad_spi_poll()
226 switch (pad->response[1]) { in psxpad_spi_poll()
229 b_rsp3 = ~pad->response[3]; in psxpad_spi_poll()
230 b_rsp4 = ~pad->response[4]; in psxpad_spi_poll()
232 input_report_abs(input, ABS_X, REVERSE_BIT(pad->response[7])); in psxpad_spi_poll()
233 input_report_abs(input, ABS_Y, REVERSE_BIT(pad->response[8])); in psxpad_spi_poll()
234 input_report_abs(input, ABS_RX, REVERSE_BIT(pad->response[5])); in psxpad_spi_poll()
235 input_report_abs(input, ABS_RY, REVERSE_BIT(pad->response[6])); in psxpad_spi_poll()
256 b_rsp3 = ~pad->response[3]; in psxpad_spi_poll()
257 b_rsp4 = ~pad->response[4]; in psxpad_spi_poll()
287 struct psxpad *pad; in psxpad_spi_probe() local
291 pad = devm_kzalloc(&spi->dev, sizeof(struct psxpad), GFP_KERNEL); in psxpad_spi_probe()
292 if (!pad) in psxpad_spi_probe()
302 pad->idev = idev; in psxpad_spi_probe()
303 pad->spi = spi; in psxpad_spi_probe()
306 input_set_drvdata(idev, pad); in psxpad_spi_probe()
309 snprintf(pad->phys, sizeof(pad->phys), "%s/input", dev_name(&spi->dev)); in psxpad_spi_probe()
337 err = psxpad_spi_init_ff(pad); in psxpad_spi_probe()
349 /* pad settings */ in psxpad_spi_probe()
350 psxpad_set_motor_level(pad, 0, 0); in psxpad_spi_probe()
380 struct psxpad *pad = spi_get_drvdata(spi); in psxpad_spi_suspend() local
382 psxpad_set_motor_level(pad, 0, 0); in psxpad_spi_suspend()