From patchwork Thu Jul 23 01:37:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Azael Avalos X-Patchwork-Id: 6848881 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3929B9F1D4 for ; Thu, 23 Jul 2015 01:39:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 046DA206C5 for ; Thu, 23 Jul 2015 01:39:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9432206D4 for ; Thu, 23 Jul 2015 01:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753849AbbGWBjA (ORCPT ); Wed, 22 Jul 2015 21:39:00 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:34201 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbbGWBiM (ORCPT ); Wed, 22 Jul 2015 21:38:12 -0400 Received: by obre1 with SMTP id e1so145617998obr.1; Wed, 22 Jul 2015 18:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k2tH0PNLRbSRdeQGn7BReQIP2HGxJgGkioKodA1XU0M=; b=vFBUqn4HHG1LcOHl0bs5wmS5O0e3hwqY6t0FaXfb3s2cK48kkgBJqwbRafDfGW6Mt8 kf76J8kYwA5PBbC4aXFgn4Ow8WJrKF+328EfCr5R8QR/tGC4PNXFxOsENqip0fRU6sTn sSNdapdViSauqe9eeo23MpN/3hzg/bEs+vO2x481PGqbNpIYLrp4eMoZ626niG+ULtCS NHSHgbCDriKWsd3GZQwp22oSZxmVbgEVw866gvgYb/0381F6yu/dQYhWUj1P5kxqvfNJ W3nfxiZejZeUMTePTlm+ahba0vwWDZdC9JtGwnORtb13/fJQywS0I3JQtOxkQzD3N5i3 CLwA== X-Received: by 10.182.76.100 with SMTP id j4mr5269987obw.14.1437615491483; Wed, 22 Jul 2015 18:38:11 -0700 (PDT) Received: from Shakuras.scurra.org (189.202.43.115.cable.dyn.cableonline.com.mx. [189.202.43.115]) by smtp.gmail.com with ESMTPSA id z19sm1960401obp.17.2015.07.22.18.38.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jul 2015 18:38:10 -0700 (PDT) From: Azael Avalos To: Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Azael Avalos Subject: [PATCH 2/4] toshiba_acpi: Remove "*not supported" feature prints Date: Wed, 22 Jul 2015 19:37:52 -0600 Message-Id: <1437615474-27936-7-git-send-email-coproscefalo@gmail.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1437615474-27936-1-git-send-email-coproscefalo@gmail.com> References: <1437615474-27936-1-git-send-email-coproscefalo@gmail.com> Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the driver prints "*not supported" if any of the features queried are in fact not supported, let us print the available features instead. This patch removes all instances pr_info printing "*not supported", and add a new function called "print_supported_features", which will print the available laptop features. Signed-off-by: Azael Avalos --- drivers/platform/x86/toshiba_acpi.c | 69 +++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 789a17c..653d1fd 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -477,13 +477,10 @@ static void toshiba_illumination_set(struct led_classdev *cdev, state = brightness ? 1 : 0; result = sci_write(dev, SCI_ILLUMINATION, state); sci_close(dev); - if (result == TOS_FAILURE) { + if (result == TOS_FAILURE) pr_err("ACPI call for illumination failed\n"); + else if (result == TOS_NOT_SUPPORTED) return; - } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Illumination not supported\n"); - return; - } } static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev) @@ -503,7 +500,6 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev) pr_err("ACPI call for illumination failed\n"); return LED_OFF; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Illumination not supported\n"); return LED_OFF; } @@ -561,7 +557,6 @@ static int toshiba_kbd_illum_status_set(struct toshiba_acpi_dev *dev, u32 time) pr_err("ACPI call to set KBD backlight status failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Keyboard backlight status not supported\n"); return -ENODEV; } @@ -581,7 +576,6 @@ static int toshiba_kbd_illum_status_get(struct toshiba_acpi_dev *dev, u32 *time) pr_err("ACPI call to get KBD backlight status failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Keyboard backlight status not supported\n"); return -ENODEV; } @@ -600,7 +594,6 @@ static enum led_brightness toshiba_kbd_backlight_get(struct led_classdev *cdev) pr_err("ACPI call to get the keyboard backlight failed\n"); return LED_OFF; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Keyboard backlight not supported\n"); return LED_OFF; } @@ -621,7 +614,6 @@ static void toshiba_kbd_backlight_set(struct led_classdev *cdev, pr_err("ACPI call to set KBD Illumination mode failed\n"); return; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Keyboard backlight not supported\n"); return; } } @@ -822,7 +814,6 @@ static int toshiba_usb_sleep_charge_get(struct toshiba_acpi_dev *dev, pr_err("ACPI call to set USB S&C mode failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("USB Sleep and Charge not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -845,7 +836,6 @@ static int toshiba_usb_sleep_charge_set(struct toshiba_acpi_dev *dev, pr_err("ACPI call to set USB S&C mode failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("USB Sleep and Charge not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -871,7 +861,6 @@ static int toshiba_sleep_functions_status_get(struct toshiba_acpi_dev *dev, pr_err("ACPI call to get USB S&C battery level failed\n"); return -EIO; } else if (out[0] == TOS_NOT_SUPPORTED) { - pr_info("USB Sleep and Charge not supported\n"); return -ENODEV; } else if (out[0] == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -900,7 +889,6 @@ static int toshiba_sleep_functions_status_set(struct toshiba_acpi_dev *dev, pr_err("ACPI call to set USB S&C battery level failed\n"); return -EIO; } else if (out[0] == TOS_NOT_SUPPORTED) { - pr_info("USB Sleep and Charge not supported\n"); return -ENODEV; } else if (out[0] == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -927,7 +915,6 @@ static int toshiba_usb_rapid_charge_get(struct toshiba_acpi_dev *dev, return -EIO; } else if (out[0] == TOS_NOT_SUPPORTED || out[0] == TOS_INPUT_DATA_ERROR) { - pr_info("USB Rapid Charge not supported\n"); return -ENODEV; } @@ -954,7 +941,6 @@ static int toshiba_usb_rapid_charge_set(struct toshiba_acpi_dev *dev, pr_err("ACPI call to set USB Rapid Charge failed\n"); return -EIO; } else if (out[0] == TOS_NOT_SUPPORTED) { - pr_info("USB Rapid Charge not supported\n"); return -ENODEV; } else if (out[0] == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -976,7 +962,6 @@ static int toshiba_usb_sleep_music_get(struct toshiba_acpi_dev *dev, u32 *state) pr_err("ACPI call to get Sleep and Music failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Sleep and Music not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -998,7 +983,6 @@ static int toshiba_usb_sleep_music_set(struct toshiba_acpi_dev *dev, u32 state) pr_err("ACPI call to set Sleep and Music failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Sleep and Music not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -1021,7 +1005,6 @@ static int toshiba_function_keys_get(struct toshiba_acpi_dev *dev, u32 *mode) pr_err("ACPI call to get KBD function keys failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("KBD function keys not supported\n"); return -ENODEV; } @@ -1041,7 +1024,6 @@ static int toshiba_function_keys_set(struct toshiba_acpi_dev *dev, u32 mode) pr_err("ACPI call to set KBD function keys failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("KBD function keys not supported\n"); return -ENODEV; } @@ -1062,7 +1044,6 @@ static int toshiba_panel_power_on_get(struct toshiba_acpi_dev *dev, u32 *state) pr_err("ACPI call to get Panel Power ON failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Panel Power on not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -1084,7 +1065,6 @@ static int toshiba_panel_power_on_set(struct toshiba_acpi_dev *dev, u32 state) pr_err("ACPI call to set Panel Power ON failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("Panel Power ON not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -1107,7 +1087,6 @@ static int toshiba_usb_three_get(struct toshiba_acpi_dev *dev, u32 *state) pr_err("ACPI call to get USB 3 failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("USB 3 not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -1129,7 +1108,6 @@ static int toshiba_usb_three_set(struct toshiba_acpi_dev *dev, u32 state) pr_err("ACPI call to set USB 3 failed\n"); return -EIO; } else if (result == TOS_NOT_SUPPORTED) { - pr_info("USB 3 not supported\n"); return -ENODEV; } else if (result == TOS_INPUT_DATA_ERROR) { return -EIO; @@ -1151,7 +1129,6 @@ static int toshiba_hotkey_event_type_get(struct toshiba_acpi_dev *dev, pr_err("ACPI call to get System type failed\n"); return -EIO; } else if (out[0] == TOS_NOT_SUPPORTED) { - pr_info("System type not supported\n"); return -ENODEV; } @@ -2597,6 +2574,46 @@ static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) return 0; } +static void print_supported_features(struct toshiba_acpi_dev *dev) +{ + pr_info("Supported laptop features:"); + + if (dev->hotkey_dev) + pr_cont(" hotkeys"); + if (dev->backlight_dev) + pr_cont(" backlight"); + if (dev->video_supported) + pr_cont(" video-out"); + if (dev->fan_supported) + pr_cont(" fan"); + if (dev->tr_backlight_supported) + pr_cont(" transflective-backlight"); + if (dev->illumination_supported) + pr_cont(" illumination"); + if (dev->kbd_illum_supported) + pr_cont(" keyboard-backlight"); + if (dev->touchpad_supported) + pr_cont(" touchpad"); + if (dev->eco_supported) + pr_cont(" eco-led"); + if (dev->accelerometer_supported) + pr_cont(" accelerometer-axes"); + if (dev->usb_sleep_charge_supported) + pr_cont(" usb-sleep-charge"); + if (dev->usb_rapid_charge_supported) + pr_cont(" usb-rapid-charge"); + if (dev->usb_sleep_music_supported) + pr_cont(" usb-sleep-music"); + if (dev->kbd_function_keys_supported) + pr_cont(" special-function-keys"); + if (dev->panel_power_on_supported) + pr_cont(" panel-power-on"); + if (dev->usb_three_supported) + pr_cont(" usb3"); + + pr_cont("\n"); +} + static int toshiba_acpi_remove(struct acpi_device *acpi_dev) { struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); @@ -2775,6 +2792,8 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) if (dev->kbd_function_keys_supported && special_functions) toshiba_acpi_enable_special_functions(dev); + print_supported_features(dev); + ret = sysfs_create_group(&dev->acpi_dev->dev.kobj, &toshiba_attr_group); if (ret) {