Lines Matching +full:firmware +full:- +full:initialized

1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/firmware.h>
37 * BU21023GUL/BU21023MUV/BU21024FV-M registers map
261 bool initialized; member
270 * rohm_i2c_burst_read - execute combined I2C message for ROHM BU21023/24
285 struct i2c_adapter *adap = client->adapter; in rohm_i2c_burst_read()
289 msg[0].addr = client->addr; in rohm_i2c_burst_read()
294 msg[1].addr = client->addr; in rohm_i2c_burst_read()
303 ret = -EIO; in rohm_i2c_burst_read()
315 struct i2c_client *client = ts->client; in rohm_ts_manual_calibration()
316 struct device *dev = &client->dev; in rohm_ts_manual_calibration()
317 u8 buf[33]; /* for PRM1_X_H(0x08)-TOUCH(0x28) */ in rohm_ts_manual_calibration()
362 #define READ_CALIB_BUF(reg) buf[((reg) - PRM1_X_H)] in rohm_ts_manual_calibration()
374 READ_CALIB_BUF(PRM1_X_L)) - AXIS_OFFSET; in rohm_ts_manual_calibration()
376 READ_CALIB_BUF(PRM1_Y_L)) - AXIS_OFFSET; in rohm_ts_manual_calibration()
393 calib_x -= AXIS_ADJUST; in rohm_ts_manual_calibration()
399 calib_y -= AXIS_ADJUST; in rohm_ts_manual_calibration()
504 error = -EBUSY; in rohm_ts_manual_calibration()
523 struct i2c_client *client = ts->client; in rohm_ts_soft_irq()
524 struct input_dev *input_dev = ts->input; in rohm_ts_soft_irq()
525 struct device *dev = &client->dev; in rohm_ts_soft_irq()
527 u8 buf[10]; /* for POS_X1_H(0x20)-TOUCH_GESTURE(0x29) */ in rohm_ts_soft_irq()
533 int finger_count = -1; in rohm_ts_soft_irq()
534 int prev_finger_count = ts->finger_count; in rohm_ts_soft_irq()
548 #define READ_POS_BUF(reg) buf[((reg) - POS_X1_H)] in rohm_ts_soft_irq()
570 if (++ts->contact_count[0] >= threshold) in rohm_ts_soft_irq()
576 if (++ts->contact_count[1] >= threshold) in rohm_ts_soft_irq()
591 if (++ts->contact_count[2] >= threshold) in rohm_ts_soft_irq()
603 count = ts->contact_count[finger_count]; in rohm_ts_soft_irq()
604 memset(ts->contact_count, 0, sizeof(ts->contact_count)); in rohm_ts_soft_irq()
605 ts->contact_count[finger_count] = count; in rohm_ts_soft_irq()
625 ts->finger_count = finger_count; in rohm_ts_soft_irq()
645 struct device *dev = &client->dev; in rohm_ts_load_firmware()
646 const struct firmware *fw; in rohm_ts_load_firmware()
654 dev_err(dev, "unable to retrieve firmware %s: %d\n", in rohm_ts_load_firmware()
667 dev_warn(dev, "retrying firmware load\n"); in rohm_ts_load_firmware()
688 /* firmware load to the device */ in rohm_ts_load_firmware()
690 len = fw->size; in rohm_ts_load_firmware()
696 xfer_len, &fw->data[offset]); in rohm_ts_load_firmware()
700 len -= xfer_len; in rohm_ts_load_firmware()
704 /* check firmware load result */ in rohm_ts_load_firmware()
719 error = -EIO; in rohm_ts_load_firmware()
736 return sprintf(buf, "%d\n", !!(ts->setup2 & SWAP_XY)); in swap_xy_show()
751 error = mutex_lock_interruptible(&ts->input->mutex); in swap_xy_store()
756 ts->setup2 |= SWAP_XY; in swap_xy_store()
758 ts->setup2 &= ~SWAP_XY; in swap_xy_store()
760 if (ts->initialized) in swap_xy_store()
761 error = i2c_smbus_write_byte_data(ts->client, COMMON_SETUP2, in swap_xy_store()
762 ts->setup2); in swap_xy_store()
764 mutex_unlock(&ts->input->mutex); in swap_xy_store()
775 return sprintf(buf, "%d\n", !!(ts->setup2 & INV_X)); in inv_x_show()
790 error = mutex_lock_interruptible(&ts->input->mutex); in inv_x_store()
795 ts->setup2 |= INV_X; in inv_x_store()
797 ts->setup2 &= ~INV_X; in inv_x_store()
799 if (ts->initialized) in inv_x_store()
800 error = i2c_smbus_write_byte_data(ts->client, COMMON_SETUP2, in inv_x_store()
801 ts->setup2); in inv_x_store()
803 mutex_unlock(&ts->input->mutex); in inv_x_store()
814 return sprintf(buf, "%d\n", !!(ts->setup2 & INV_Y)); in inv_y_show()
829 error = mutex_lock_interruptible(&ts->input->mutex); in inv_y_store()
834 ts->setup2 |= INV_Y; in inv_y_store()
836 ts->setup2 &= ~INV_Y; in inv_y_store()
838 if (ts->initialized) in inv_y_store()
840 ts->setup2); in inv_y_store()
842 mutex_unlock(&ts->input->mutex); in inv_y_store()
861 struct device *dev = &client->dev; in rohm_ts_device_init()
864 disable_irq(client->irq); in rohm_ts_device_init()
877 /* Waiting for the analog warm-up, max. 200usec */ in rohm_ts_device_init()
983 dev_err(dev, "failed to load firmware: %d\n", error); in rohm_ts_device_init()
1040 enable_irq(client->irq); in rohm_ts_device_init()
1052 dev_err(&client->dev, in rohm_ts_power_off()
1060 dev_err(&client->dev, in rohm_ts_power_off()
1069 struct i2c_client *client = ts->client; in rohm_ts_open()
1072 if (!ts->initialized) { in rohm_ts_open()
1073 error = rohm_ts_device_init(client, ts->setup2); in rohm_ts_open()
1075 dev_err(&client->dev, in rohm_ts_open()
1080 ts->initialized = true; in rohm_ts_open()
1090 rohm_ts_power_off(ts->client); in rohm_ts_close()
1092 ts->initialized = false; in rohm_ts_close()
1097 struct device *dev = &client->dev; in rohm_bu21023_i2c_probe()
1102 if (!client->irq) { in rohm_bu21023_i2c_probe()
1104 return -EINVAL; in rohm_bu21023_i2c_probe()
1107 if (!client->adapter->algo->master_xfer) { in rohm_bu21023_i2c_probe()
1109 return -EOPNOTSUPP; in rohm_bu21023_i2c_probe()
1119 return -ENOMEM; in rohm_bu21023_i2c_probe()
1121 ts->client = client; in rohm_bu21023_i2c_probe()
1122 ts->setup2 = MAF_1SAMPLE; in rohm_bu21023_i2c_probe()
1127 return -ENOMEM; in rohm_bu21023_i2c_probe()
1129 input->name = BU21023_NAME; in rohm_bu21023_i2c_probe()
1130 input->id.bustype = BUS_I2C; in rohm_bu21023_i2c_probe()
1131 input->open = rohm_ts_open; in rohm_bu21023_i2c_probe()
1132 input->close = rohm_ts_close; in rohm_bu21023_i2c_probe()
1134 ts->input = input; in rohm_bu21023_i2c_probe()
1150 error = devm_request_threaded_irq(dev, client->irq, in rohm_bu21023_i2c_probe()
1152 IRQF_ONESHOT, client->name, ts); in rohm_bu21023_i2c_probe()