@@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
regmap = <&snvs>;
interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
linux,keycode = <KEY_POWER>;
+ key-release-only;
wakeup-source;
status = "disabled";
};
@@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct timer_list *t)
}
}
+static void imx_imx_snvs_check_for_release_events(struct timer_list *t)
+{
+ struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
+ struct input_dev *input = pdata->input;
+ u32 state;
+
+ /* interrupt only reports release of key so do not wait for state change */
+ state = 1;
+ input_event(input, EV_KEY, pdata->keycode, state);
+ input_sync(input);
+
+ state = 0;
+ input_event(input, EV_KEY, pdata->keycode, state);
+ input_sync(input);
+}
+
static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
{
struct platform_device *pdev = dev_id;
@@ -177,7 +193,10 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
/* clear the unexpected interrupt before driver ready */
regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
- timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
+ if (of_property_read_bool(np, "key-release-only"))
+ timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_release_events, 0);
+ else
+ timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
input = devm_input_allocate_device(&pdev->dev);
if (!input) {