Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp447173pxb; Thu, 9 Sep 2021 04:48:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoiWLB+BIHllzvcafCF1Fb22dj1oN0yqk9pDLFsWmlBIiFgCsbtRYcy6l/zC8+EnAx94Xa X-Received: by 2002:a5d:9ac1:: with SMTP id x1mr2232942ion.191.1631188130193; Thu, 09 Sep 2021 04:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188130; cv=none; d=google.com; s=arc-20160816; b=odAqb1k61+2ly3vosneiNFZ1t64vJJIoAQ4SJyAhaqONSEYCQaAGS08sA1P1iM53zk DijeadlEwnHW7pkiqF5i1l4c1WTXQoL7UoI+Q9KJBMfOg0ikfy6blx0VK47F6whfQqQF Ly8AwyKMR7+sWqjZ7ZoNDNurNH5JDEZ5t72ZfD3hv1bjNx5ywEh7ydd+W4QCMWXclvxh OgF8lLhk61HJgTsSqoRW9UoOz0zvSzVrNndiU2AL2NSMin0R+hQsxbT1f3v5c6HxO0s6 otUoUGz5gWMqzdRIg9ssnY5IFPVRNqRabzZeL8fZz2JvMNOfefM0VriMu9pVLZkfKLzD NJpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5+Mo2vb349Ctd12T8KpOIEbnc7Ydb8hVQeK7/f6Cyxg=; b=B0Z0MVTVuqgD1ClFgbiVvnTdqj3Z1jppN+Ge5Ztmb9xpafPMZo19uPXD4o8mMdtKcO xcf3Gwd4RdOixdQxIMk8Z1b4vyW/0Yqids/PcaIAVh2WZ2OlOWSioHeLxR3vB9YRYVpe hgSuJcbO94oUsRA+1hrNxjL4DAfuYEtWloqdfSkQJUxNpWF3W7IpJKM3SHy5EMHOh6x/ 4rIS+L5CcpexJkQf1Kq3yjqEp/twz//GrZaH2eoYDujDkyHlvzYlO8XWRbd9cJVPbZ5w kNuIX5S8KZUm3Roidfoy1e4SI+VYEHxpbgzhbg7fcX2wnjp9cslHhtAQ0ResrJg0VzMq 6YVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uTZeCtsr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si1630847iow.110.2021.09.09.04.48.36; Thu, 09 Sep 2021 04:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uTZeCtsr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240499AbhIILr6 (ORCPT + 99 others); Thu, 9 Sep 2021 07:47:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238883AbhIILpW (ORCPT ); Thu, 9 Sep 2021 07:45:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70505611C2; Thu, 9 Sep 2021 11:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187766; bh=taLJ9PKWC7x9RU8xDW2ToEJ9OVv2CFyuQyAlImHraLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTZeCtsr0FnnPETBU78ZtUwe5brd5sjICqbtlAmv3e9eDxScAP2MjgrSB+iX9ZXsc OrGWWOk5Z+oL2yzOBDfsssa3zyqTV0qcpE1TAQFfdqBcl4yRakRw1uDjMCbyHJ4AB4 wAXDtZ3GLw3XV31ZEzxCfJMAEU/+YkmRp3UTKXta/zE1xw2Xb3XtVzzh1Hg/0DVvzo M0AjjsvH7sagttVxMxRBJoIm1XRfOCf3jKdh7b8HHU0B70H6LdQERQ7PgrnetzQ2n6 0n3mo6BEeLxf40iJrgnON56FY3u9IrvqpmClB92UXn+LPtT+KH1XiTcV7VAmuDn1o1 gV+bugAlqZiqQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andy Shevchenko , Dennis Giaya , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 078/252] serial: max310x: Use clock-names property matching to recognize EXTCLK Date: Thu, 9 Sep 2021 07:38:12 -0400 Message-Id: <20210909114106.141462-78-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko [ Upstream commit 3d1fa055ea7298345795b982de7a5b9ec6ae238d ] Dennis reported that on ACPI-based systems the clock frequency isn't enough to configure device properly. We have to respect the clock source as well. To achieve this match the clock-names property against "osc" to recognize external clock connection. On DT-based system this doesn't change anything. Reported-and-tested-by: Dennis Giaya Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210723125943.22039-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/max310x.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index ef11860cd69e..3df0788ddeb0 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1271,18 +1271,13 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty /* Always ask for fixed clock rate from a property. */ device_property_read_u32(dev, "clock-frequency", &uartclk); - s->clk = devm_clk_get_optional(dev, "osc"); + xtal = device_property_match_string(dev, "clock-names", "osc") < 0; + if (xtal) + s->clk = devm_clk_get_optional(dev, "xtal"); + else + s->clk = devm_clk_get_optional(dev, "osc"); if (IS_ERR(s->clk)) return PTR_ERR(s->clk); - if (s->clk) { - xtal = false; - } else { - s->clk = devm_clk_get_optional(dev, "xtal"); - if (IS_ERR(s->clk)) - return PTR_ERR(s->clk); - - xtal = true; - } ret = clk_prepare_enable(s->clk); if (ret) -- 2.30.2