Lines Matching full:iqs62x
14 * Link to conversion tool: https://github.com/jlabundy/iqs62x-h2bin.git
27 #include <linux/mfd/iqs62x.h>
108 static int iqs62x_dev_init(struct iqs62x_core *iqs62x) in iqs62x_dev_init() argument
114 list_for_each_entry(fw_blk, &iqs62x->fw_blk_head, list) { in iqs62x_dev_init()
124 ret = regmap_update_bits(iqs62x->regmap, fw_blk->addr, in iqs62x_dev_init()
127 ret = regmap_raw_write(iqs62x->regmap, fw_blk->addr, in iqs62x_dev_init()
133 switch (iqs62x->dev_desc->prod_num) { in iqs62x_dev_init()
136 ret = regmap_read(iqs62x->regmap, in iqs62x_dev_init()
137 iqs62x->dev_desc->prox_settings, &val); in iqs62x_dev_init()
142 iqs62x->ui_sel = IQS62X_UI_SAR1; in iqs62x_dev_init()
146 ret = regmap_write(iqs62x->regmap, IQS620_GLBL_EVENT_MASK, in iqs62x_dev_init()
148 iqs62x->dev_desc->prox_mask | in iqs62x_dev_init()
149 iqs62x->dev_desc->sar_mask | in iqs62x_dev_init()
150 iqs62x->dev_desc->hall_mask | in iqs62x_dev_init()
151 iqs62x->dev_desc->hyst_mask | in iqs62x_dev_init()
152 iqs62x->dev_desc->temp_mask | in iqs62x_dev_init()
153 iqs62x->dev_desc->als_mask | in iqs62x_dev_init()
154 iqs62x->dev_desc->ir_mask); in iqs62x_dev_init()
160 ret = regmap_write(iqs62x->regmap, IQS624_HALL_UI, in iqs62x_dev_init()
177 ret = regmap_read(iqs62x->regmap, IQS624_INTERVAL_DIV, &val); in iqs62x_dev_init()
181 if (val >= iqs62x->dev_desc->interval_div) in iqs62x_dev_init()
184 ret = regmap_write(iqs62x->regmap, IQS624_INTERVAL_DIV, in iqs62x_dev_init()
185 iqs62x->dev_desc->interval_div); in iqs62x_dev_init()
200 ret = regmap_update_bits(iqs62x->regmap, IQS62X_SYS_SETTINGS, in iqs62x_dev_init()
220 static int iqs62x_firmware_parse(struct iqs62x_core *iqs62x, in iqs62x_firmware_parse() argument
223 struct i2c_client *client = iqs62x->client; in iqs62x_firmware_parse()
251 if (fw_rec->data == iqs62x->dev_desc->prod_num) in iqs62x_firmware_parse()
262 ret = regmap_write(iqs62x->regmap, in iqs62x_firmware_parse()
268 ret = regmap_read(iqs62x->regmap, in iqs62x_firmware_parse()
332 list_add(&fw_blk->list, &iqs62x->fw_blk_head); in iqs62x_firmware_parse()
456 struct iqs62x_core *iqs62x = context; in iqs62x_irq() local
457 struct i2c_client *client = iqs62x->client; in iqs62x_irq()
471 ret = regmap_raw_read(iqs62x->regmap, IQS62X_SYS_FLAGS, event_map, in iqs62x_irq()
480 event_reg = iqs62x->dev_desc->event_regs[iqs62x->ui_sel][i]; in iqs62x_irq()
504 event_map[i] <<= iqs62x->dev_desc->hyst_shift; in iqs62x_irq()
533 ret = iqs62x_dev_init(iqs62x); in iqs62x_irq()
540 iqs62x->event_cache |= BIT(IQS62X_EVENT_SYS_RESET); in iqs62x_irq()
541 reinit_completion(&iqs62x->ati_done); in iqs62x_irq()
543 iqs62x->event_cache |= BIT(IQS62X_EVENT_SYS_ATI); in iqs62x_irq()
544 reinit_completion(&iqs62x->ati_done); in iqs62x_irq()
545 } else if (!completion_done(&iqs62x->ati_done)) { in iqs62x_irq()
546 ret = regmap_update_bits(iqs62x->regmap, IQS62X_SYS_SETTINGS, in iqs62x_irq()
555 complete_all(&iqs62x->ati_done); in iqs62x_irq()
563 if (completion_done(&iqs62x->ati_done)) { in iqs62x_irq()
564 event_flags |= iqs62x->event_cache; in iqs62x_irq()
565 ret = blocking_notifier_call_chain(&iqs62x->nh, event_flags, in iqs62x_irq()
570 iqs62x->event_cache = 0; in iqs62x_irq()
585 struct iqs62x_core *iqs62x = context; in iqs62x_firmware_load() local
586 struct i2c_client *client = iqs62x->client; in iqs62x_firmware_load()
590 ret = iqs62x_firmware_parse(iqs62x, fw); in iqs62x_firmware_load()
598 ret = iqs62x_dev_init(iqs62x); in iqs62x_firmware_load()
606 client->name, iqs62x); in iqs62x_firmware_load()
612 if (!wait_for_completion_timeout(&iqs62x->ati_done, in iqs62x_firmware_load()
619 iqs62x->dev_desc->sub_devs, in iqs62x_firmware_load()
620 iqs62x->dev_desc->num_sub_devs, in iqs62x_firmware_load()
626 complete_all(&iqs62x->fw_done); in iqs62x_firmware_load()
631 .name = "iqs62x-keys",
643 .name = "iqs62x-keys",
654 .name = "iqs62x-keys",
662 .name = "iqs62x-keys",
670 .name = "iqs62x-keys",
678 .name = "iqs62x-keys",
897 struct iqs62x_core *iqs62x; in iqs62x_probe() local
903 iqs62x = devm_kzalloc(&client->dev, sizeof(*iqs62x), GFP_KERNEL); in iqs62x_probe()
904 if (!iqs62x) in iqs62x_probe()
907 i2c_set_clientdata(client, iqs62x); in iqs62x_probe()
908 iqs62x->client = client; in iqs62x_probe()
910 BLOCKING_INIT_NOTIFIER_HEAD(&iqs62x->nh); in iqs62x_probe()
911 INIT_LIST_HEAD(&iqs62x->fw_blk_head); in iqs62x_probe()
913 init_completion(&iqs62x->ati_done); in iqs62x_probe()
914 init_completion(&iqs62x->fw_done); in iqs62x_probe()
916 iqs62x->regmap = devm_regmap_init_i2c(client, &iqs62x_regmap_config); in iqs62x_probe()
917 if (IS_ERR(iqs62x->regmap)) { in iqs62x_probe()
918 ret = PTR_ERR(iqs62x->regmap); in iqs62x_probe()
924 ret = regmap_raw_read(iqs62x->regmap, IQS62X_PROD_NUM, &info, in iqs62x_probe()
946 iqs62x->dev_desc = &iqs62x_devs[i]; in iqs62x_probe()
948 if (info.sw_num < iqs62x->dev_desc->sw_num) in iqs62x_probe()
951 iqs62x->sw_num = info.sw_num; in iqs62x_probe()
952 iqs62x->hw_num = info.hw_num; in iqs62x_probe()
961 for (j = 0; j < iqs62x->dev_desc->num_cal_regs; j++) { in iqs62x_probe()
962 ret = regmap_read(iqs62x->regmap, in iqs62x_probe()
963 iqs62x->dev_desc->cal_regs[j], &val); in iqs62x_probe()
978 if (j == iqs62x->dev_desc->num_cal_regs) in iqs62x_probe()
982 if (!iqs62x->dev_desc) { in iqs62x_probe()
988 if (!iqs62x->sw_num) { in iqs62x_probe()
1002 fw_name ? : iqs62x->dev_desc->fw_name, in iqs62x_probe()
1003 &client->dev, GFP_KERNEL, iqs62x, in iqs62x_probe()
1013 struct iqs62x_core *iqs62x = i2c_get_clientdata(client); in iqs62x_remove() local
1015 wait_for_completion(&iqs62x->fw_done); in iqs62x_remove()
1020 struct iqs62x_core *iqs62x = dev_get_drvdata(dev); in iqs62x_suspend() local
1023 wait_for_completion(&iqs62x->fw_done); in iqs62x_suspend()
1029 ret = regmap_update_bits(iqs62x->regmap, IQS62X_PWR_SETTINGS, in iqs62x_suspend()
1034 return regmap_update_bits(iqs62x->regmap, IQS62X_PWR_SETTINGS, in iqs62x_suspend()
1041 struct iqs62x_core *iqs62x = dev_get_drvdata(dev); in iqs62x_resume() local
1044 ret = regmap_update_bits(iqs62x->regmap, IQS62X_PWR_SETTINGS, in iqs62x_resume()
1050 return regmap_update_bits(iqs62x->regmap, IQS62X_PWR_SETTINGS, in iqs62x_resume()
1068 .name = "iqs62x",