From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B6D3C00449 for ; Wed, 3 Oct 2018 09:10:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C32421471 for ; Wed, 3 Oct 2018 09:10:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C32421471 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727746AbeJCP5f (ORCPT ); Wed, 3 Oct 2018 11:57:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:52526 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727347AbeJCP5e (ORCPT ); Wed, 3 Oct 2018 11:57:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id ACDB1ACC1; Wed, 3 Oct 2018 09:10:03 +0000 (UTC) Date: Wed, 3 Oct 2018 11:10:02 +0200 (CEST) From: Jiri Kosina To: Kai-Heng Feng cc: benjamin.tissoires@redhat.com, hdegoede@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: i2c-hid: Add a small delay after powering on/off the device In-Reply-To: <20181001035313.21453-1-kai.heng.feng@canonical.com> Message-ID: References: <20181001035313.21453-1-kai.heng.feng@canonical.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Oct 2018, Kai-Heng Feng wrote: > Raydium touchpanel (2386:4B33) sometimes does not workin desktop session > although it works in display manager. > > During user logging, the display manager exits, close the HID device, > then the device gets runtime suspended and powered off. The desktop > session begins shortly after, opens the HID device, then the device gets > runtime resumed and powered on. > > If the trasition from display manager to desktop sesesion is fast, the > touchpanel cannot switch from powered off to powered on in short > timeframe. So add a small delay to workaround the issue. > > Signed-off-by: Kai-Heng Feng > --- > drivers/hid/i2c-hid/i2c-hid.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c > index f3076659361a..ff5682cc1bce 100644 > --- a/drivers/hid/i2c-hid/i2c-hid.c > +++ b/drivers/hid/i2c-hid/i2c-hid.c > @@ -409,6 +409,8 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state) > > if (ret) > dev_err(&client->dev, "failed to change power setting.\n"); > + else > + msleep(20); In case there really is no other way around it, at least please add comment explaining why this ugly msleep() is there. Thanks, -- Jiri Kosina SUSE Labs