From patchwork Mon Apr 13 21:06:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 212319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEFEEC2BB86 for ; Mon, 13 Apr 2020 21:07:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83CF120732 for ; Mon, 13 Apr 2020 21:07:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eBBGEhSw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388765AbgDMVHA (ORCPT ); Mon, 13 Apr 2020 17:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388759AbgDMVG5 (ORCPT ); Mon, 13 Apr 2020 17:06:57 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28334C0A3BDC for ; Mon, 13 Apr 2020 14:06:57 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id e22so9529425pgm.22 for ; Mon, 13 Apr 2020 14:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=HSxjufempazlx5EL6Oqz0WzuegPQO1JBIjf6VYFe9Lg=; b=eBBGEhSwmUtbM/28R1jPRtSlGoaZjrh5Iw30aQEybCW1f1TsI2w2+Qy0VWPC2m97ZO JMok85CQUNXRhH+16KHF/vM6RGhmirRuYun9Moz78tVUxpMP6OxQrbRd2btFZrBIXtre xqlCj9t3+qlmQzeYstPxszQwbROImI5htMdCYhSNzR24TbaK8Bokor57AJm0sv1ChxMv a9XyUjj6+JoGQvkzN3FWOYrPaWYhWptZreUxY1axoCVDImtsibhIxuG6eEkNUn7XUVLC s4dJ7/i/7OxBLcqYZtmApixSQe85DAB0mzV5Cu2Fm3c/c/+5FFJcij5Ja/nYnzL9kJKG QJmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=HSxjufempazlx5EL6Oqz0WzuegPQO1JBIjf6VYFe9Lg=; b=RViF05O9iv096o9UbhDAGg3jdfAXa4IJMurZD+kOsZBP75ssrOWn+z1u8b5aWbfzwR AgRnmJtqjB5N0kbB2EjRYGmfXYU0e5gdqbqtA/HDqS859QfSh+wUHLOtMQ8s/8iD9Hy+ I+MCwA88JD6d2M7hjxUSBJc16knSiRax6uMyEKID6kJwDCGcPNOP4zqgydqKbXg9vR2X gE1CXjC1q4IXcb6dt3sC9fXYIBprBc8hRlXOQSvZaiTDoS90hYb+TKIeSGhrEm5R6hlE DGYQKSGmey+k45oiXRUd7cUjjeBGTKdH5CkysQW5Ap3Uhj58lvGtBwxees0YUuZymXit 7Z2Q== X-Gm-Message-State: AGi0PuahQZJ+sm7GJmUPwvWN4sirWIjaOOPGltJNEW2La2LevntSqvvY aFJzL2eiO3zmq4d7QH7XQZw/ymNcH36ifzebTm4aag== X-Google-Smtp-Source: APiQypLj2wxTeXWWD/akXvUHZhHVqCJxN8UAQy1avGH0RwTxLR0YBDSDF0srfJAh7ctMWC0hfTGONqJkcAD2wa1lC0/KAg== X-Received: by 2002:a17:90a:858a:: with SMTP id m10mr21257991pjn.178.1586812016579; Mon, 13 Apr 2020 14:06:56 -0700 (PDT) Date: Mon, 13 Apr 2020 14:06:44 -0700 In-Reply-To: <20200413210644.201801-1-matthewgarrett@google.com> Message-Id: <20200413210644.201801-3-matthewgarrett@google.com> Mime-Version: 1.0 References: <20200413210644.201801-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.26.0.110.g2183baf09c-goog Subject: [PATCH 3/3] thermal/int340x_thermal: Don't require IDSP to exist From: Matthew Garrett To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, rui.zhang@intel.com, nisha.aram@intel.com, Matthew Garrett Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Matthew Garrett The IDSP method doesn't appear to exist on the most recent Intel platforms: instead, the IDSP data is included in the GDDV blob. Since we probably don't want to decompress and parse that in-kernel, just allow any UUID to be written if IDSP is missing. Signed-off-by: Matthew Garrett --- .../intel/int340x_thermal/int3400_thermal.c | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index f36e3e9d246ea..bece011451e17 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -96,6 +96,9 @@ static ssize_t available_uuids_show(struct device *dev, int i; int length = 0; + if (!priv->uuid_bitmap) + return sprintf(buf, "UNKNOWN\n"); + for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) { if (priv->uuid_bitmap & (1 << i)) if (PAGE_SIZE - length > 0) @@ -113,11 +116,11 @@ static ssize_t current_uuid_show(struct device *dev, { struct int3400_thermal_priv *priv = dev_get_drvdata(dev); - if (priv->uuid_bitmap & (1 << priv->current_uuid_index)) - return sprintf(buf, "%s\n", - int3400_thermal_uuids[priv->current_uuid_index]); - else + if (priv->current_uuid_index == -1) return sprintf(buf, "INVALID\n"); + + return sprintf(buf, "%s\n", + int3400_thermal_uuids[priv->current_uuid_index]); } static ssize_t current_uuid_store(struct device *dev, @@ -128,9 +131,16 @@ static ssize_t current_uuid_store(struct device *dev, int i; for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) { - if ((priv->uuid_bitmap & (1 << i)) && - !(strncmp(buf, int3400_thermal_uuids[i], - sizeof(int3400_thermal_uuids[i]) - 1))) { + if (!strncmp(buf, int3400_thermal_uuids[i], + sizeof(int3400_thermal_uuids[i]) - 1)) { + /* + * If we have a list of supported UUIDs, make sure + * this one is supported. + */ + if (priv->uuid_bitmap && + !(priv->uuid_bitmap & (1 << i))) + return -EINVAL; + priv->current_uuid_index = i; return count; } @@ -462,9 +472,13 @@ static int int3400_thermal_probe(struct platform_device *pdev) priv->adev = adev; result = int3400_thermal_get_uuids(priv); - if (result) + + /* Missing IDSP isn't fatal */ + if (result && result != -ENODEV) goto free_priv; + priv->current_uuid_index = -1; + result = acpi_parse_art(priv->adev->handle, &priv->art_count, &priv->arts, true); if (result)