drivers/input/touchscreen/rohm_bu21023.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/rohm_bu21023.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/rohm_bu21023.c- Extension
.c- Size
- 26879 bytes
- Lines
- 1165
- Domain
- Driver Families
- Bucket
- drivers/input
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/firmware.hlinux/i2c.hlinux/input.hlinux/input/mt.hlinux/interrupt.hlinux/module.hlinux/slab.h
Detected Declarations
struct rohm_ts_datafunction rohm_i2c_burst_readfunction rohm_ts_manual_calibrationfunction rohm_ts_soft_irqfunction rohm_ts_load_firmwarefunction rohm_ts_update_settingfunction scoped_cond_guardfunction swap_xy_showfunction swap_xy_storefunction inv_x_showfunction inv_x_storefunction inv_y_showfunction inv_y_storefunction rohm_ts_device_initfunction rohm_ts_power_offfunction rohm_ts_openfunction rohm_ts_closefunction rohm_bu21023_i2c_probe
Annotated Snippet
struct rohm_ts_data {
struct i2c_client *client;
struct input_dev *input;
bool initialized;
unsigned int contact_count[MAX_CONTACTS + 1];
int finger_count;
u8 setup2;
};
/*
* rohm_i2c_burst_read - execute combined I2C message for ROHM BU21023/24
* @client: Handle to ROHM BU21023/24
* @start: Where to start read address from ROHM BU21023/24
* @buf: Where to store read data from ROHM BU21023/24
* @len: How many bytes to read
*
* Returns negative errno, else zero on success.
*
* Note
* In BU21023/24 burst read, stop condition is needed after "address write".
* Therefore, transmission is performed in 2 steps.
*/
static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
size_t len)
{
struct i2c_adapter *adap = client->adapter;
struct i2c_msg msg[2];
int i, ret = 0;
msg[0].addr = client->addr;
msg[0].flags = 0;
msg[0].len = 1;
msg[0].buf = &start;
msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
msg[1].len = len;
msg[1].buf = buf;
i2c_lock_bus(adap, I2C_LOCK_SEGMENT);
for (i = 0; i < 2; i++) {
if (__i2c_transfer(adap, &msg[i], 1) < 0) {
ret = -EIO;
break;
}
}
i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
return ret;
}
static int rohm_ts_manual_calibration(struct rohm_ts_data *ts)
{
struct i2c_client *client = ts->client;
struct device *dev = &client->dev;
u8 buf[33]; /* for PRM1_X_H(0x08)-TOUCH(0x28) */
int retry;
bool success = false;
bool first_time = true;
bool calibration_done;
u8 reg1, reg2, reg3;
s32 reg1_orig, reg2_orig, reg3_orig;
s32 val;
int calib_x = 0, calib_y = 0;
int reg_x, reg_y;
int err_x, err_y;
int error, error2;
int i;
reg1_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG1);
if (reg1_orig < 0)
return reg1_orig;
reg2_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG2);
if (reg2_orig < 0)
return reg2_orig;
reg3_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG3);
if (reg3_orig < 0)
return reg3_orig;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `linux/input.h`, `linux/input/mt.h`, `linux/interrupt.h`, `linux/module.h`, `linux/slab.h`.
- Detected declarations: `struct rohm_ts_data`, `function rohm_i2c_burst_read`, `function rohm_ts_manual_calibration`, `function rohm_ts_soft_irq`, `function rohm_ts_load_firmware`, `function rohm_ts_update_setting`, `function scoped_cond_guard`, `function swap_xy_show`, `function swap_xy_store`, `function inv_x_show`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.