Received: by 10.213.65.68 with SMTP id h4csp109001imn; Tue, 27 Mar 2018 23:18:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx49coU81ZU9BOD5M61s5vUgNvTb5JJsBgh8RhJFqeDw9K3LH71J2vqr7cjaw3DDZAVNkKLVz X-Received: by 10.101.96.47 with SMTP id p15mr1631825pgu.430.1522217891421; Tue, 27 Mar 2018 23:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522217891; cv=none; d=google.com; s=arc-20160816; b=yO77OQa/2ZSNnfxnD3XHRHKNod2OCNtLwSJ3mQm9I/qTE8aJWgv52PIyOH1B4OKORs TC/wnnBFii9qaaR9N6Ny7SW6EJIV+yH36qAnurbRJ8DS3F5lChAA+94a7ZsA1VAGStkb axwBqP9WR7vd4BiujCJobnaCyrGHhVLcSTjjb7PzjSaafEJIQVk5bgN4E1qI9MnqROID A2lNBYO9eqh0ipQFO0nfUqRijkdZP9jvkFh3QW0jK9dau3ot5b29VZaA5iOq6S2S++TZ 4FBlUfJgstRH/+UbGP6u09k2laaEeG7CD5/bDNGbp44GePt03F96NXkfJEul14I3aSh+ NR4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=QWsKjjDOgmP2rY5rOyj/R4muXGpAMYKmOViEqSXiOP0=; b=tqcFQCUhfFYndM5oLwQ7AYTiI4F9x+sioWsvmTEAS6FYQ3ZZ3qVs6K8IxWNBk4MCcG zviDhDplwFGpvopqGC6p8zcqUhS9qwxwula2Hguw2DH7H1ZuaVMaE0ziwbSzcBFksREi iVrDzBUgw9CPPIekDJWrrNiJskp5Tr4euJcPa7Iv9xzWWsA7Fn305BJjIDU1CV/TqNi4 LUaiskvxNLfXqexQnHfB6d05m4poDPcXUi+EhOQFIbLpyCuTHjpR+zI7BHQIPe3fiWaO cCVY1aKRyoB/VmlL8iyEQHcNWpdq5kMXzEmhPOZme/l/4qI6pFLlI1szGUa9wAygULD6 rHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R9vnJpx+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si3195503plj.409.2018.03.27.23.17.57; Tue, 27 Mar 2018 23:18:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R9vnJpx+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289AbeC1GQS (ORCPT + 99 others); Wed, 28 Mar 2018 02:16:18 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:32873 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751008AbeC1GQQ (ORCPT ); Wed, 28 Mar 2018 02:16:16 -0400 Received: by mail-pf0-f194.google.com with SMTP id f15so613861pfn.0 for ; Tue, 27 Mar 2018 23:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=QWsKjjDOgmP2rY5rOyj/R4muXGpAMYKmOViEqSXiOP0=; b=R9vnJpx+UPJrOzJqM66YQekQrtF0dvNAoWAKbFsBlAzv8Q2ga0ms+6n0qORSDJAkfy A8kxoYiNS39DypViooqXVEegx68MIHORkwYIGWl2YYR6wRik4Lbj1KQnpCmmuqPkGgxH Te6mgx3C6m3y4gyBjHXxgFmJeJM+kniBWa1rw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QWsKjjDOgmP2rY5rOyj/R4muXGpAMYKmOViEqSXiOP0=; b=QrC/IwXmt5yrL1VEH8mJWqqMDWi9NlmObviwr+eRCGrnaicChV96Jo3SdorLIQCMmi QjYvfkIYThJZKN3YQNu78gitUI4Rn1LetkcXxhtkhJc+WCXVB+N81bNBXiBQ9E3DQJnr vOpGSQ2gz2Bb/wNhgqjo5tDZzhWxDLHrOc2hzwPcsfztLgZs3t1MoMUk+k4+5omhYVnN NPocJKS2VZr+4BInjJ0aXfDonR8g/lxrGLMM5mSUwtHeR8x0jX3s+95iX42AuPrRDXvY S8oRHBt9HF7U7waC8OVxeylfhkcmxBNlVyVNWechi1V+3g7SxOJNQ9RvzPJ49L3LzQuK xlGw== X-Gm-Message-State: AElRT7FE0dJq4UE5ETX/2PKggj/0BkQ+WbM0blehiMxrHAnj2k8HNk09 I9uDGdSWIr80PZrbXle7u+E/nw== X-Received: by 10.98.217.139 with SMTP id b11mr1898924pfl.113.1522217776036; Tue, 27 Mar 2018 23:16:16 -0700 (PDT) Received: from drinkcat.tpe.corp.google.com ([2401:fa00:1:b:9ba:cd16:d555:bacf]) by smtp.gmail.com with ESMTPSA id u10sm4921048pgr.83.2018.03.27.23.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 23:16:15 -0700 (PDT) From: Nicolas Boichat To: Jiri Kosina Cc: Benjamin Tissoires , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, groeck@chromium.org, dtor@chromium.org, Haridhar Kalvala Subject: [PATCH] HID: google: Enable PM Full On mode when adjusting backlight Date: Wed, 28 Mar 2018 14:16:10 +0800 Message-Id: <20180328061610.206090-1-drinkcat@chromium.org> X-Mailer: git-send-email 2.17.0.rc1.321.gba9d0f2565-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Haridhar Kalvala hammer LED backlight brightness is not getting set when USB device is in suspend state. This patch fixes the issue by requesting USB HID device to be in FULLON mode, so that sending hardware output report and hardware raw request won't fail to set brightness, and set device back to NORMAL mode once this call returns. Signed-off-by: Haridhar Kalvala Reviewed-by: Dmitry Torokhov Signed-off-by: Nicolas Boichat --- drivers/hid/hid-google-hammer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Changes from version on Chromium OS gerrit (https://chromium-review.googlesource.com/735259): - Reworded and reflowed commit message, as well as comment in code. diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c index 6486469ce0f64..7b8e17b03cb86 100644 --- a/drivers/hid/hid-google-hammer.c +++ b/drivers/hid/hid-google-hammer.c @@ -41,6 +41,16 @@ static int hammer_kbd_brightness_set_blocking(struct led_classdev *cdev, led->buf[0] = 0; led->buf[1] = br; + /* + * Request USB HID device to be in Full On mode, so that sending + * hardware output report and hardware raw request won't fail. + */ + ret = hid_hw_power(led->hdev, PM_HINT_FULLON); + if (ret < 0) { + hid_err(led->hdev, "failed: device not resumed %d\n", ret); + return ret; + } + ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf)); if (ret == -ENOSYS) ret = hid_hw_raw_request(led->hdev, 0, led->buf, @@ -50,6 +60,10 @@ static int hammer_kbd_brightness_set_blocking(struct led_classdev *cdev, if (ret < 0) hid_err(led->hdev, "failed to set keyboard backlight: %d\n", ret); + + /* Request USB HID device back to Normal Mode. */ + hid_hw_power(led->hdev, PM_HINT_NORMAL); + return ret; } -- 2.17.0.rc1.321.gba9d0f2565-goog