Re: [PATCH V2 3/3] input: pmic8xxx_pwrkey: Add support for power key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

On 5/5/2011 9:38 PM, Dmitry Torokhov wrote:
Hi Anirudh,

On Thu, May 05, 2011 at 11:03:24AM +0530, Anirudh Ghayal wrote:
From: Trilok Soni<tsoni@xxxxxxxxxxxxxx>

Add support for PMIC8XXX power key driven over dedicated
KYPD_PWR_N pin. It allows the user to specify the amount
of time by which the power key reporting can be delayed.

+
+static irqreturn_t pwrkey_press_irq(int irq, void *_pwrkey)
+{
+	struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
+	const struct pm8xxx_pwrkey_platform_data *pdata = pwrkey->pdata;
+	unsigned long flags;
+
+	/* no pwrkey time duration, means no screen lock key simulation */
+	if (!pwrkey->pdata->pwrkey_time_ms) {
+		input_report_key(pwrkey->pwr, KEY_POWER, 1);
+		input_sync(pwrkey->pwr);
+		return IRQ_HANDLED;
+	}
+
+	spin_lock_irqsave(&pwrkey->lock, flags);
+
+	input_report_key(pwrkey->pwr, KEY_SCREENLOCK, 1);
+	input_sync(pwrkey->pwr);
+

I am very sorry for misleading Trilok and you earlier but I think this
kind of transformation should be done in your userspace framework. Have
the driver emit KEY_SCREENLOCK and have userspace initiate device
shutdown if it detects that KEY_SCREENLOCK is pressed for longer than X
seconds.

After giving this a further thought, I agree that this handling should be in the userspace. I will submit a new patch with the changes.


Thanks.


Thank you,
~Anirudh

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux