Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp407987ybt; Wed, 24 Jun 2020 02:13:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY+KO+3UZk2VW4XU5mn2y7eHUGRmoYqfIF6ehOoNwA2H4fDyTG9TQLvvkyGwJX7IDlV6Q4 X-Received: by 2002:a05:6402:3044:: with SMTP id bu4mr25939454edb.69.1592990019629; Wed, 24 Jun 2020 02:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592990019; cv=none; d=google.com; s=arc-20160816; b=JFMc7qWVHPFzckW2o6ZZxC734BcQh5+oHnM4l7jsFBCqtx74lBaqELgnhYDbSb45jb Y0kwq3+19kawZUb7LrVd9f1nEWWTeOGkTLU5YqDDFx0nKUpBf7mbMYK3DPeW8VwfETyx xvY8gPmizkfbXScLu6uMnO4MGJb8Vm08DD1c7Yr0nRW5grY2WGTRz1+vtmc5DTusIR3r Xn4+a6ERpFa88eLUf39PZ1104lKSLx/+KXB8Dui6N6H2VVYFOjW0p6L9ZVHArs5ZfG2u HZvgfbTF8qvj52s3Aj70MVVVN7YRpmUJmtBLuSvyyqlEcRK2PBzkbYcRmcOVmgO+Uoln QHGQ== 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 :message-id:date:subject:cc:to:from; bh=YdWYqCcMRr77s7ONOlycpXkNOF5ibDahUUAFISahTZ8=; b=bHoqvDzz1P2YMe2cFXhnMOThb+VQLd/HETQ8z748XC8UmGMfrDQAXUMWHkTDp0ghV/ XY2z3Qic+FriqYC3MKwqInc8NQp50GFcJXIgr0VaSLqrdQKHJPchgG6q6jK/1EFZPlva LjamMMTUzFhqaTK4s8xjTB65lGKi5LT9vAj2PKXjuasAyOe7RqrGoPOs7ghgPBaORwPs LctfTN4bIeJjgzsXEhpzGJJVkGO6MlitJEy0xIiaWPuCIjlvWU6YsG2LxnQ9pGOeJTiT UhkUNl4sdE3rlXglrRGAWegSRGrRUGjh/+3MI9NbhiRwP3ux6VLx8NJlDYlCk+JmlvlR 8/4w== ARC-Authentication-Results: i=1; mx.google.com; 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 cc10si12454152edb.236.2020.06.24.02.13.15; Wed, 24 Jun 2020 02:13:39 -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; 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 S2388602AbgFXJMp (ORCPT + 99 others); Wed, 24 Jun 2020 05:12:45 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:33840 "EHLO mail-ej1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387614AbgFXJMo (ORCPT ); Wed, 24 Jun 2020 05:12:44 -0400 Received: by mail-ej1-f66.google.com with SMTP id y10so1737382eje.1; Wed, 24 Jun 2020 02:12:43 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=YdWYqCcMRr77s7ONOlycpXkNOF5ibDahUUAFISahTZ8=; b=rPyKw2iNt+MTqobRya2IA59wOB0kW2fPybRkeBN3EmjBzaGBk/j6Y7zrGS+TlZu1rK fvHnBWpSZc0jp7aFKMerC3VbFgc+fvyo328Nh5omIr3we0wmB6OVIOcti8k5emV7PfRv Ve2nTpLMwgxAQ1jczDtisSIErjv2yU+mbvgRjQBboBZ/Y622m0oyxVoyfhwH05ex1K/2 Kt6bUtWgbvTjIcJVKNxjxXn/LupfinVJWugGEeZ9PGWQQNW9oASqwhaDRuNI068JQTOc gVq2LWj1F8dHavy6nOEgd5hzbEriaeubfFRxslW5193k45zsUnEA3y9G0/BMvKCP60ki k8gw== X-Gm-Message-State: AOAM533j86JTTNYid2gDlz+SzXiRYwxNmcvfKzJC9K3PfJQNOEF+RlYu FddUqiRJgGxR1dc2bNSkpC4= X-Received: by 2002:a17:906:4c81:: with SMTP id q1mr24499860eju.273.1592989962320; Wed, 24 Jun 2020 02:12:42 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id 36sm16585162edl.31.2020.06.24.02.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 02:12:41 -0700 (PDT) From: Ricardo Ribalda To: Jarkko Nikula , Andy Shevchenko , Mika Westerberg , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Subject: [PATCH] i2c: designware: platdrv: Set class based on dmi Date: Wed, 24 Jun 2020 11:12:39 +0200 Message-Id: <20200624091239.802218-1-ribalda@kernel.org> X-Mailer: git-send-email 2.27.0 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 Current AMD's zen-based APUs use this core for some of its i2c-buses. With this patch we re-enable autodetection of hwmon-alike devices, so lm-sensors will be able to work automatically. It does not affect the boot-time of embedded devices, as the class is set based on the dmi information. Signed-off-by: Ricardo Ribalda --- drivers/i2c/busses/i2c-designware-platdrv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index c2efaaaac252..f0a02fc3c135 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -191,6 +191,13 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) return ret; } +static bool dw_i2c_hwmon_bus(void) +{ + if (strstr(dmi_get_system_info(DMI_PRODUCT_NAME), "QT5222")) + return true; + return false; +} + static int dw_i2c_plat_probe(struct platform_device *pdev) { struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -267,7 +274,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) adap = &dev->adapter; adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_DEPRECATED; + adap->class = dw_i2c_hwmon_bus() ? I2C_CLASS_HWMON + : I2C_CLASS_DEPRECATED; ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); adap->dev.of_node = pdev->dev.of_node; adap->nr = -1; -- 2.27.0