From patchwork Mon May 8 22:02:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benson Leung X-Patchwork-Id: 9716761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6321E60365 for ; Mon, 8 May 2017 22:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D70D20952 for ; Mon, 8 May 2017 22:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51F362522B; Mon, 8 May 2017 22:03:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC33020952 for ; Mon, 8 May 2017 22:02:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbdEHWC6 (ORCPT ); Mon, 8 May 2017 18:02:58 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:32985 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbdEHWC5 (ORCPT ); Mon, 8 May 2017 18:02:57 -0400 Received: by mail-pg0-f54.google.com with SMTP id u187so33568401pgb.0 for ; Mon, 08 May 2017 15:02:57 -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=+f460vxnKqOqwYCz6vwSuTb9bF/Z4agnhcBAGjcfdZk=; b=VA18O03Qt1h6ZJ992K8Zq5cuUhBadu7XKEvUz7U3lBVYDDDcPLOF2XGybEAuYxJKBO m6gJp8Ht21ccgVerFwfLvFHZcVs/yNPSbF81wjdgZ1WmkPJUxBCjboKd04pYoFfXvA0A Zt4/7pfDWXAcKiQ2t//CYbYiK1cfFRQTdVrR0= 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=+f460vxnKqOqwYCz6vwSuTb9bF/Z4agnhcBAGjcfdZk=; b=tkK+ySfCDmmNqnAqP1JXYmVbyRajCwnuO7wMclL3coyG3Al3FRCsKroPjfbQSHUDNj CdnCaUJY4OgCcUpTDtt62E1Cf4eAOLJ3gZiru0M2yZyf9Rz9y3lcjTHCYRNfV8OVKga3 s2FhUdHgiwATZ+XsjNufysqb1soUL3sPAbqXYCFBtxJqmHrOV7fgJQwGWd86RLQ9Th9F iw4tGtrQe/8vZ+J8e+6R1cDHfynxKpnYg4SVx2wLisvDb/nGT966jYDrQ8iOhuM6g/hn 0TOzr99rjCm5GuPvviev2bbumxlIWcE7tZRJF6c+weIxhnItkIRbRovuG4UHKNzK/fqC nJhA== X-Gm-Message-State: AN3rC/6Wg0Fajoo6U9oW3wPu/+sN0hikTfHlsYD7irq0telt0lW9Y3Ge eAZRCjD/LdFC8Ywu X-Received: by 10.84.176.100 with SMTP id u91mr87166730plb.39.1494280977201; Mon, 08 May 2017 15:02:57 -0700 (PDT) Received: from decatoncale.mtv.corp.google.com ([172.22.64.18]) by smtp.gmail.com with ESMTPSA id o10sm1916068pge.67.2017.05.08.15.02.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 May 2017 15:02:56 -0700 (PDT) From: Benson Leung To: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ras@apple.com, tomeu.vizoso@collabora.com, bleung@chromium.org, bleung@google.com Subject: [PATCH] power_supply: Add Apple Brick ID power supply type Date: Mon, 8 May 2017 15:02:48 -0700 Message-Id: <20170508220248.97372-1-bleung@chromium.org> X-Mailer: git-send-email 2.13.0.rc2.291.g57267f2277-goog Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Apple currently supports three very common USB chargers: https://www.apple.com/power-adapters/ These chargers implement a proprietary Apple method for advertising 1A, 2.1A, and 2.4A at 5V called "Brick ID". In addition, 3rd parties implement the same charging method in many charging accessories that work with iOS devices. Devices that have charger detection chips such as the Pericom PI3USB9281, eg. Google Chromebook Pixel 2015, are capable of detecting these chargers, so let's add a type to facilicate passing that info up to userspace. This adds a separate power supply type for Apple's proprietary "Brick ID" charging method. Signed-off-by: Benson Leung --- drivers/power/supply/power_supply_sysfs.c | 2 +- include/linux/power_supply.h | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index bcde8d13476a..07b484f995c1 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -46,7 +46,7 @@ static ssize_t power_supply_show_property(struct device *dev, static char *type_text[] = { "Unknown", "Battery", "UPS", "Mains", "USB", "USB_DCP", "USB_CDP", "USB_ACA", "USB_C", - "USB_PD", "USB_PD_DRP" + "USB_PD", "USB_PD_DRP", "BrickID" }; static char *status_text[] = { "Unknown", "Charging", "Discharging", "Not charging", "Full" diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 3965503315ef..4bd34051995e 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -159,13 +159,14 @@ enum power_supply_type { POWER_SUPPLY_TYPE_BATTERY, POWER_SUPPLY_TYPE_UPS, POWER_SUPPLY_TYPE_MAINS, - POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */ - POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */ - POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */ - POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */ - POWER_SUPPLY_TYPE_USB_TYPE_C, /* Type C Port */ - POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */ - POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */ + POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */ + POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */ + POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */ + POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */ + POWER_SUPPLY_TYPE_USB_TYPE_C, /* Type C Port */ + POWER_SUPPLY_TYPE_USB_PD, /* Power Delivery Port */ + POWER_SUPPLY_TYPE_USB_PD_DRP, /* PD Dual Role Port */ + POWER_SUPPLY_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */ }; enum power_supply_notifier_events {