Lines Matching full:onkey
3 * Onkey driver for Actions Semi ATC260x PMICs.
74 static int atc2603x_onkey_hw_init(struct atc260x_onkey *onkey, in atc2603x_onkey_hw_init() argument
80 reg_bm = onkey->params->long_int_pnd_bm | in atc2603x_onkey_hw_init()
81 onkey->params->short_int_pnd_bm | in atc2603x_onkey_hw_init()
82 onkey->params->kdwn_int_pnd_bm | in atc2603x_onkey_hw_init()
83 onkey->params->press_int_en_bm | in atc2603x_onkey_hw_init()
84 onkey->params->kdwn_int_en_bm; in atc2603x_onkey_hw_init()
87 reg_bm |= onkey->params->press_time_bm; in atc2603x_onkey_hw_init()
90 reg_bm |= onkey->params->reset_en_bm; in atc2603x_onkey_hw_init()
92 reg_bm |= onkey->params->reset_en_bm | in atc2603x_onkey_hw_init()
93 onkey->params->reset_time_bm; in atc2603x_onkey_hw_init()
94 reg_val |= onkey->params->reset_en_bm | reset_time; in atc2603x_onkey_hw_init()
97 return regmap_update_bits(onkey->atc260x->regmap, in atc2603x_onkey_hw_init()
98 onkey->params->reg_int_ctl, reg_bm, reg_val); in atc2603x_onkey_hw_init()
101 static void atc260x_onkey_query(struct atc260x_onkey *onkey) in atc260x_onkey_query() argument
106 ret = regmap_read(onkey->atc260x->regmap, in atc260x_onkey_query()
107 onkey->params->reg_int_ctl, &key_down); in atc260x_onkey_query()
110 dev_err(onkey->atc260x->dev, in atc260x_onkey_query()
111 "Failed to read onkey status: %d\n", ret); in atc260x_onkey_query()
113 key_down &= onkey->params->kdwn_state_bm; in atc260x_onkey_query()
117 * The hardware generates interrupt only when the onkey pin is in atc260x_onkey_query()
122 schedule_delayed_work(&onkey->work, msecs_to_jiffies(200)); in atc260x_onkey_query()
130 input_report_key(onkey->input_dev, KEY_POWER, 0); in atc260x_onkey_query()
131 input_sync(onkey->input_dev); in atc260x_onkey_query()
133 reg_bits = onkey->params->long_int_pnd_bm | in atc260x_onkey_query()
134 onkey->params->short_int_pnd_bm | in atc260x_onkey_query()
135 onkey->params->kdwn_int_pnd_bm | in atc260x_onkey_query()
136 onkey->params->press_int_en_bm | in atc260x_onkey_query()
137 onkey->params->kdwn_int_en_bm; in atc260x_onkey_query()
140 regmap_update_bits(onkey->atc260x->regmap, onkey->params->reg_int_ctl, in atc260x_onkey_query()
146 struct atc260x_onkey *onkey = container_of(work, struct atc260x_onkey, in atc260x_onkey_work() local
148 atc260x_onkey_query(onkey); in atc260x_onkey_work()
153 struct atc260x_onkey *onkey = data; in atc260x_onkey_irq() local
157 ret = regmap_update_bits(onkey->atc260x->regmap, in atc260x_onkey_irq()
158 onkey->params->reg_int_ctl, in atc260x_onkey_irq()
159 onkey->params->press_int_en_bm | in atc260x_onkey_irq()
160 onkey->params->kdwn_int_en_bm, 0); in atc260x_onkey_irq()
162 dev_err(onkey->atc260x->dev, in atc260x_onkey_irq()
165 input_report_key(onkey->input_dev, KEY_POWER, 1); in atc260x_onkey_irq()
166 input_sync(onkey->input_dev); in atc260x_onkey_irq()
168 atc260x_onkey_query(onkey); in atc260x_onkey_irq()
175 struct atc260x_onkey *onkey = input_get_drvdata(dev); in atc260x_onkey_open() local
177 enable_irq(onkey->irq); in atc260x_onkey_open()
184 struct atc260x_onkey *onkey = input_get_drvdata(dev); in atc260x_onkey_close() local
186 disable_irq(onkey->irq); in atc260x_onkey_close()
187 cancel_delayed_work_sync(&onkey->work); in atc260x_onkey_close()
193 struct atc260x_onkey *onkey; in atc260x_onkey_probe() local
199 onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); in atc260x_onkey_probe()
200 if (!onkey) in atc260x_onkey_probe()
222 onkey->params = &atc2603c_onkey_params; in atc260x_onkey_probe()
229 onkey->params = &atc2609a_onkey_params; in atc260x_onkey_probe()
237 "OnKey not supported for ATC260x PMIC type: %u\n", in atc260x_onkey_probe()
248 onkey->input_dev = input_dev; in atc260x_onkey_probe()
249 onkey->atc260x = atc260x; in atc260x_onkey_probe()
251 input_dev->name = "atc260x-onkey"; in atc260x_onkey_probe()
252 input_dev->phys = "atc260x-onkey/input0"; in atc260x_onkey_probe()
257 input_set_drvdata(input_dev, onkey); in atc260x_onkey_probe()
259 INIT_DELAYED_WORK(&onkey->work, atc260x_onkey_work); in atc260x_onkey_probe()
261 onkey->irq = platform_get_irq(pdev, 0); in atc260x_onkey_probe()
262 if (onkey->irq < 0) in atc260x_onkey_probe()
263 return onkey->irq; in atc260x_onkey_probe()
265 error = devm_request_threaded_irq(&pdev->dev, onkey->irq, NULL, in atc260x_onkey_probe()
267 dev_name(&pdev->dev), onkey); in atc260x_onkey_probe()
270 "Failed to register IRQ %d: %d\n", onkey->irq, error); in atc260x_onkey_probe()
275 disable_irq(onkey->irq); in atc260x_onkey_probe()
284 error = atc2603x_onkey_hw_init(onkey, reset_status, in atc260x_onkey_probe()
297 .name = "atc260x-onkey",
303 MODULE_DESCRIPTION("Onkey driver for ATC260x PMICs");