mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
Input: stmfts - abstract reading information from the firmware
Improves readability and makes splitting power on function in following commit easier. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20260409-stmfts5-v4-4-64fe62027db5@ixit.cz Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
18ac49e763
commit
9ea34baf20
|
|
@ -518,22 +518,11 @@ static struct attribute *stmfts_sysfs_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(stmfts_sysfs);
|
||||
|
||||
static int stmfts_power_on(struct stmfts_data *sdata)
|
||||
static int stmfts_read_system_info(struct stmfts_data *sdata)
|
||||
{
|
||||
int err;
|
||||
u8 reg[8];
|
||||
|
||||
err = regulator_bulk_enable(ARRAY_SIZE(stmfts_supplies),
|
||||
sdata->supplies);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* The datasheet does not specify the power on time, but considering
|
||||
* that the reset time is < 10ms, I sleep 20ms to be sure
|
||||
*/
|
||||
msleep(20);
|
||||
|
||||
err = i2c_smbus_read_i2c_block_data(sdata->client, STMFTS_READ_INFO,
|
||||
sizeof(reg), reg);
|
||||
if (err < 0)
|
||||
|
|
@ -547,6 +536,28 @@ static int stmfts_power_on(struct stmfts_data *sdata)
|
|||
sdata->config_id = reg[4];
|
||||
sdata->config_ver = reg[5];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int stmfts_power_on(struct stmfts_data *sdata)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = regulator_bulk_enable(ARRAY_SIZE(stmfts_supplies),
|
||||
sdata->supplies);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* The datasheet does not specify the power on time, but considering
|
||||
* that the reset time is < 10ms, I sleep 20ms to be sure
|
||||
*/
|
||||
msleep(20);
|
||||
|
||||
err = stmfts_read_system_info(sdata);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
enable_irq(sdata->client->irq);
|
||||
|
||||
msleep(50);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user