Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5803922ybl; Tue, 14 Jan 2020 15:28:05 -0800 (PST) X-Google-Smtp-Source: APXvYqx10BsNrIv7EwW6dD0LpGVanHY3szYfPJoABcCLCMTjlHEADoB9TajdBsJFhwUvqwUDFIpL X-Received: by 2002:a54:4f8d:: with SMTP id g13mr17852272oiy.43.1579044485751; Tue, 14 Jan 2020 15:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579044485; cv=none; d=google.com; s=arc-20160816; b=UnbeuQ1YIQQ9gP525foNV+tBYOOuYZMMZhJyIFB60rlhRsN03lxwxMJtGfy/F1BKNY jfImJ1Ex/64G39xBJtVwV6ZZmUanvGeAjxvW9ew+jLhRQgUWLRjYdIDHFhMMH3Sb+Pdt tF1hwx7evZHvI957hGfAIG8gHuSDrK/L4BAIPTDAGrdpuD9/xhUj7ikbPppsDE5cvHBh 8G1XY8k7tp46x1miErPF/JuwgiKzXWhBU2V4gC8eXYtizVvj03+QT1mKB1atjLxu3zYo BF13cFoM8Upcp9XosOuMmc3dbuVh9VksJ1r1fELhwoT0JNnoiKxFS93BAa9Z/8MRLAsJ jjoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bcAzatl2XyyclHkai7dGbcQh/coSPP8i6YfbwNZKXZI=; b=NsCdHXqHvqXMYGV/98WdmT7JhX389dYM4ZMqM2FTjyF3thJ0YMikruo+miHdYQC3QC id1uj7KNlBHMVwD3Q8UCpgt3C9jV2nrWCbN0RzyEvTevnasXr2GFLXlA6sHxwmp+eZ0E 5UJ02gQvoZ0jvaHYbgGg7fJyyLA7r+NCTUrrFpAp4j/Ip3JzDsw1x9TvfmBfkeqVmD/t Jl404sAMNDpM8CiZKCPwcDsW04T/HYuXMwicdBWpmiO+b995PvC8Qe6FYZLd+mOw/JuV cYLglX2muYg/dWOs+ug3ynEyIrei4E4emfLTU3YRshLjlVH/oguWJ8fZcmRroYzO1a9U 90iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U3kW736i; 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 c7si10051995oto.305.2020.01.14.15.27.53; Tue, 14 Jan 2020 15:28:05 -0800 (PST) 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=U3kW736i; 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 S1728650AbgANX0x (ORCPT + 99 others); Tue, 14 Jan 2020 18:26:53 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:40620 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbgANX0w (ORCPT ); Tue, 14 Jan 2020 18:26:52 -0500 Received: by mail-pj1-f66.google.com with SMTP id bg7so6608342pjb.5 for ; Tue, 14 Jan 2020 15:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bcAzatl2XyyclHkai7dGbcQh/coSPP8i6YfbwNZKXZI=; b=U3kW736i5BiRCs3wXG7322fILUUKjZ0VBpecdN2VVG5K66VGIzz7C6L73yKZ1QFKIW yO95EnjRHdB0WJX/m8H+XcmCteeKaCXTVtUNDUslo2h043ib/JOJ9Vl3aIluwggeHW9M bYvnCDfgFatB4/cioa4hbpxs1i0nCajMbUMwk= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bcAzatl2XyyclHkai7dGbcQh/coSPP8i6YfbwNZKXZI=; b=PRlfN5x/S4poCFHy30ULmYtnHvJUYyWXBwMF/QKWC6OHTotIUAD0cqoI5hrf+WSL1p mwp9AAYukDy1D1EnNuM98n3m+7vi9bP4QvwHJbZYc2nVWYrGFSdOnlBgIMfqC2D+yio3 Nj6tUR/0zA7qNiH0VPLiMHVUF5ue7D+Cnd8wD5RlJIz2ZTKf37vuC8h8l7AOnJCBLDo5 3tYw/Bkx+Wv6LBSX2GVvCTeMdXIFHqddndrJDwxnmw7GxhfnvQDPH8jiR8c+V/EF2/Pq GqIxQ8YP1Rgs7wgCn1z3byRmkiyGxYCerdIve4f18XokUU8RVYtbCVqFG+PF3+cI5FSd ITuQ== X-Gm-Message-State: APjAAAXz21Ms6mjQSMeXPAzrh/DTaSP/foTqtM+shjUaaTqtR+fFZXis 1H+lZYiB0q3n2TbDDUoShcxKoQ== X-Received: by 2002:a17:90a:d801:: with SMTP id a1mr32423893pjv.34.1579044411798; Tue, 14 Jan 2020 15:26:51 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:172e:4646:c089:ce59]) by smtp.gmail.com with ESMTPSA id u18sm18521839pgn.9.2020.01.14.15.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2020 15:26:51 -0800 (PST) From: Prashant Malani To: enric.balletbo@collabora.com, groeck@chromium.org, bleung@chromium.org, lee.jones@linaro.org, sre@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Prashant Malani Subject: [PATCH v6 2/3] mfd: cros_ec: Add cros-usbpd-notify subdevice Date: Tue, 14 Jan 2020 15:22:20 -0800 Message-Id: <20200114232219.93171-2-pmalani@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200114232219.93171-1-pmalani@chromium.org> References: <20200114232219.93171-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the cros-usbpd-notify driver as a subdevice on platforms that support the EC_FEATURE_USB_PD EC feature flag and don't have the ACPI PD notification device defined. This driver allows other cros-ec devices to receive PD event notifications from the Chrome OS Embedded Controller (EC) via a notification chain. Signed-off-by: Prashant Malani --- Changes in v6: - No changes. Changes in v5: - Updated the IS_ENABLED() check to check for CONFIG_OF instead of !CONFIG_ACPI according to upstream comments. Changes in v4: - Removed #ifndef usage; instead, moved cros-usbpd-notify to a separate mfd_cell and used an IS_ENABLED() check. - Changed commit title and description slightly to reflect change in code. drivers/mfd/cros_ec_dev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index c4b977a5dd966..d0c28a4c10ad0 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -5,6 +5,7 @@ * Copyright (C) 2014 Google, Inc. */ +#include #include #include #include @@ -87,6 +88,10 @@ static const struct mfd_cell cros_usbpd_charger_cells[] = { { .name = "cros-usbpd-logger", }, }; +static const struct mfd_cell cros_usbpd_notify_cells[] = { + { .name = "cros-usbpd-notify", }, +}; + static const struct cros_feature_to_cells cros_subdevices[] = { { .id = EC_FEATURE_CEC, @@ -202,6 +207,23 @@ static int ec_device_probe(struct platform_device *pdev) } } + /* + * The PD notifier driver cell is separate since it only needs to be + * explicitly added on platforms that don't have the PD notifier ACPI + * device entry defined. + */ + if (IS_ENABLED(CONFIG_OF)) { + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { + retval = mfd_add_hotplug_devices(ec->dev, + cros_usbpd_notify_cells, + ARRAY_SIZE(cros_usbpd_notify_cells)); + if (retval) + dev_err(ec->dev, + "failed to add PD notify devices: %d\n", + retval); + } + } + /* * The following subdevices cannot be detected by sending the * EC_FEATURE_GET_CMD to the Embedded Controller device. -- 2.25.0.341.g760bfbb309-goog