Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1090805ybl; Fri, 24 Jan 2020 15:25:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy9gkmYbXT3pQYXdrnZuuKW+BGJ2TMi9HXAGSJXpgnMxnbvob3OalFzKghvIiRYGlNF6Qx4 X-Received: by 2002:a9d:6ac1:: with SMTP id m1mr4514954otq.101.1579908357299; Fri, 24 Jan 2020 15:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579908357; cv=none; d=google.com; s=arc-20160816; b=dz5oqUU/wr4cCkBy5zhrrEgqHc9WELBMT80PxKt2zzU55/5FQiLztbaHdByIVmEXSU MuFhaoLA5YVgCO9x7TGoSk1QzBzXnP4K0vT2hYM84EmTUWRqq6DtxkjC3y9jrveHuhfz dqs6a3oX5/BExn218kDRVe0PFQrEBtfIBUch0IxY09WRlaHf0NMKu116SYDpGfOSDwVx SzpCOcpWxSMTIv7EFZnQdWWV9V2Z1xO3yRa534MUulJSl5kP/Av7h7oR9GdQUp5psYwP 8lK+1h62VFySKDbRBKHEfL6RGWdr/qBnqdtO4BZP4WTA3aEomfzK0hXVLI03zzRGpouU 5Cuw== 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=WzqWvK5o+ybR/i3ON58T7OBtUXSoGrpaLS3XPpmmh0A=; b=Vb9xZij64c77Ma5jYK8gZS0os73sNlkDV0C+fE8v67zoCTVBtkzRLjf46TLHAhCd2w 836xZ7qkMWFuqjNJVZSI8ZFSNlNZHewBQsUGyKD7TAjv/LmXpVW30cQULpLxC85oatYa PXyJ7q0fUloVz49JYW/dp9C8fVKK96pGc4tOOjTLLP8AjholKnkxWq3a7iStnDRsk/XD lL/CDWO5GAJxx1Sa1k4u5MA66qJvl5908U7/yp6y+XXQyjM9oTnNA3IvQ7MHggdYt3cz AG9o/K7z0x8TCt87h8ZAHsYi0hUXEzQ2hVhmASlntTc3ydIAG5wi7v/utNQK+P2Uu8vy jT2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oAxRHSpk; 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 x186si482744oig.209.2020.01.24.15.25.43; Fri, 24 Jan 2020 15:25:57 -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=oAxRHSpk; 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 S2387406AbgAXXYp (ORCPT + 99 others); Fri, 24 Jan 2020 18:24:45 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:52288 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729236AbgAXXYp (ORCPT ); Fri, 24 Jan 2020 18:24:45 -0500 Received: by mail-pj1-f68.google.com with SMTP id a6so473746pjh.2 for ; Fri, 24 Jan 2020 15:24:45 -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=WzqWvK5o+ybR/i3ON58T7OBtUXSoGrpaLS3XPpmmh0A=; b=oAxRHSpko6+wbCZ+XPcsBwlhuXzprapRJ6ZcGOKxys0g1A1XFkMUzICXYjOw0u8Clc beS9cyE9tFJ3aIpjvNjFsWSqrWIRMKb4SnQJOJxujHrG9aKGH9fTSb9N6RFx+HqqD3/3 uZ3yU+hdm7BcFpK0QoABL0UJAWC3DCu02w3Ws= 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=WzqWvK5o+ybR/i3ON58T7OBtUXSoGrpaLS3XPpmmh0A=; b=ekU4ie2oWNBOVrPx9DK88Tz3+dgJ7jYcBWTR7Y2aFKgSYJGQBfGFPXGA+HQTIe9UwV YzoWRWkr6KfK/UIzWHwiagOocf1CV6s9yt4vfGXDj3LiQrSqxEhw1ta8vvQq3+29dm3i iQ8GfKm5OfW6m18vnchM/JLpMt0OGOJhnTiOadhajqB9/UT00ipXI3yk/tdB5zXl0GL9 O5MY6MccLuPob1qEihsMc+OcsMA7KbFc9BamnXNgUD/ijLEaTzAjftffBFDOMcR2pMBM RKVcn0GYYpvJoTbjwGXyP4hmaFTpida7/+z67erKoKAF01E5WNsea6J3BqMy7lAFabC6 S+wg== X-Gm-Message-State: APjAAAVEaicJrsv+1WLPsN5HYqJ5Aq/lUNVlqXdEwGkDiEXv3jcdDj+K 3pLfUW1IzzQ+yafYmAc2i2A98Q== X-Received: by 2002:a17:902:ba86:: with SMTP id k6mr5847880pls.96.1579908284673; Fri, 24 Jan 2020 15:24:44 -0800 (PST) Received: from pmalani2.mtv.corp.google.com ([2620:15c:202:201:172e:4646:c089:ce59]) by smtp.gmail.com with ESMTPSA id b12sm2823103pfr.26.2020.01.24.15.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 15:24:44 -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 v8 2/4] mfd: cros_ec: Add cros-usbpd-notify subdevice Date: Fri, 24 Jan 2020 15:18:34 -0800 Message-Id: <20200124231834.63628-2-pmalani@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200124231834.63628-1-pmalani@chromium.org> References: <20200124231834.63628-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. Reviewed-by: Benson Leung Signed-off-by: Prashant Malani --- Changes in v8: - No changes. Patch v6 was applied, but maintaining it in this series, since Patch 3/4 adds a change to the if condition. Changes in v7: - No changes. 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