Thread (3 messages) 3 messages, 2 authors, 2011-04-01

Re: [rtc-linux] Re: [PATCH 2/3] input: pmic8xxx_pwrkey: Add support for power key

From: Anirudh Ghayal <hidden>
Date: 2011-04-01 09:23:26
Also in: linux-arm-msm, lkml

Hi Stephen,

Thanks for reviewing. I will submit a V2 patch with the changes.

On 3/29/2011 2:27 AM, Stephen Boyd wrote:
On 3/26/2011 9:52 AM, Anirudh Ghayal wrote:
quoted
+static void pmic8xxx_pwrkey_timer(unsigned long handle)
+{
+	unsigned long flags;
+	struct pmic8xxx_pwrkey *pwrkey = (struct pmic8xxx_pwrkey *)handle;
+
+	spin_lock_irqsave(&pwrkey->lock, flags);
+	pwrkey->key_pressed = true;
+
+	input_report_key(pwrkey->pwr, KEY_POWER, 1);
+	input_sync(pwrkey->pwr);
+	spin_unlock_irqrestore(&pwrkey->lock, flags);
+}
+
[snip]
quoted
+
+static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
+{
+	struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
+	unsigned long flags;
+
+	/* no pwrkey time, means no delay in pwr key reporting */
+	if (!pwrkey->pdata->pwrkey_time_ms) {
+		input_report_key(pwrkey->pwr, KEY_POWER, 0);
+		input_sync(pwrkey->pwr);
+		return IRQ_HANDLED;
+	}
+
+	spin_lock_irqsave(&pwrkey->lock, flags);
+	del_timer_sync(&pwrkey->timer);
Can you call del_timer_sync() while holding the lock that your timer
function also acquires? I thought lockdep would have complained loudly
about that but I'm not sure. It looks like a deadlock scenario.
Right. I will move del_timer_sync outside the spinlock.
quoted
+static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev)
+{
[snip]
quoted
+
+	if (pdata->kpd_trigger_delay_us>  62500) {
+		dev_err(&pdev->dev, "invalid pwr key trigger delay\n");
Nitpick: Can you spell out "power" here instead of pwr? Or use
"kpd_trigger_delay_us" instead.
Ok.
quoted
+		return -EINVAL;
+	}
+
+	if (pdata->pwrkey_time_ms&&
+	     (pdata->pwrkey_time_ms<  500 || pdata->pwrkey_time_ms>  1000)) {
+		dev_err(&pdev->dev, "invalid pwr key time supplied\n");
Ok.
Ditto
quoted
+
+	pon_cntl&= ~PON_CNTL_TRIG_DELAY_MASK;
+	pon_cntl |= (delay&  PON_CNTL_TRIG_DELAY_MASK);
+	pon_cntl |= (pdata->pull_up ? PON_CNTL_PULL_UP : ~PON_CNTL_PULL_UP);
Did you just set a bunch of bits you didn't want to when pdata->pull_up
== false?
Oops right. I will fix this.
Thank you,
~Anirudh

-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help