Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp494005ybt; Wed, 24 Jun 2020 04:27:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW7TUXkCl96gnBtXKlXWRsgFEFRGiwjPLUTDg0+YWvuyC0hHasgDhMMSjTOfX/7S6vP/U/ X-Received: by 2002:a17:907:369:: with SMTP id rs9mr24218126ejb.187.1592998036915; Wed, 24 Jun 2020 04:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592998036; cv=none; d=google.com; s=arc-20160816; b=kNzaJQidsPFsce4SLoJIQdL2zXWzejYOE2N3LWudtOhZcWPfNlXuuCWySe4uGDmoB1 Gde6CK1d7wXkE3Te7gk4Jm0SUScg2xaPowoDx0fWcYysJUdMwzsZxhYoj9UcS3PtvwqR rZ6CjTlcD7qEpIBFUE81bxyX7G0Kyl2okevK+jKx6AYbO9JBUw6SOx/D+8buE/DbBnE4 GaklxDV7S8hFG72/95oTvIfrvrEWaktzJ7fhHUhOGuq5S4hblN28gDzt+aUAcpnWl8lA n+7ArMjq2e0VDSNMUHDLpW10yPhKB2SBELy5YIkqpkB0OFC4h8ENZ9M1bc99ZeQ3VJx/ 7vpQ== 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=LA2XapGq4IaVD7/Jz16sK+vZWcKUBPvVZlD7kxpKK+4=; b=G1CchdBzfWg9aJrQIdzfjbfmvgasR09l8rkxJoFpmmfVAmOI4+UlgJc/Pm9jORcfS9 u6p2hcoVW47ktLFNmOmhhxq+UAenOtH/XOHWedl0FnT0dS0l2Us6fPTxWmXK10Tga15/ STbS7EgTdaaGVeRaF/RyorqKTf2XtY4l01U95c45sTfkcUywAMMitZLcDGJugda+hD7D Rqx+6yQJQN6VAqR7GZqp7N1OBb+wWi650yxkB/CNEzKpiK/W8u8qf6KGayXlQUDHF80d SK3gaFb8L4sX43KwxVchC7HNnS7YANTI/tL+Jwy3jXtu+CX+i7Wq2L7m1niZSFRnrfPj f4dw== 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 g22si6384734edm.294.2020.06.24.04.26.53; Wed, 24 Jun 2020 04:27:16 -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 S2388954AbgFXLZg (ORCPT + 99 others); Wed, 24 Jun 2020 07:25:36 -0400 Received: from mail-ej1-f68.google.com ([209.85.218.68]:45003 "EHLO mail-ej1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388811AbgFXLZf (ORCPT ); Wed, 24 Jun 2020 07:25:35 -0400 Received: by mail-ej1-f68.google.com with SMTP id ga4so2046783ejb.11; Wed, 24 Jun 2020 04:25:34 -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=LA2XapGq4IaVD7/Jz16sK+vZWcKUBPvVZlD7kxpKK+4=; b=UqSQWr7HR57YOBTpk+tpYtlRdcQ24t9ztAs+LGnu7k4mvP1Fxexu1MYm0z6E2G7t7l soOdfCVFTiUZn3e1M7+cWPBUOLdr6uPXIg6C2DVyV2e+lSdSwRe58tBxxXPw3GzUYrnb W7jlI+CeGr8CUX4vLIGcLOPD5lbDKJ+IQ40B6UF0w/gjo3N9jnsbaEC4ryp+Ja+HVDjI u0zKtypXiTCPAWSiMucZ6trnBLTCbr4zLu/d5AzLYkmb3N27IKW0+9zwbLaqSw/i2IU6 6F/XJiy1VF3e6CVEA/8EpNCjMe97w2PWitIoRMdjwf4q7M3ggnZc3NYV3Xcw5TnDbRAy zDxw== X-Gm-Message-State: AOAM532pmpKynj9jNi8VkEsTlbv9EsbYtIJiyc+fdalGtbQ0CpVYoBQW NC7QY49Un4DPinH3lSM2xBQ= X-Received: by 2002:a17:906:3042:: with SMTP id d2mr3703894ejd.420.1592997933359; Wed, 24 Jun 2020 04:25:33 -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 a24sm15147934ejc.109.2020.06.24.04.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 04:25:32 -0700 (PDT) From: Ricardo Ribalda To: Jarkko Nikula , Andy Shevchenko , Mika Westerberg , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Wolfram Sang Cc: Ricardo Ribalda Subject: [PATCH v2] i2c: designware: platdrv: Set class based on dmi Date: Wed, 24 Jun 2020 13:25:30 +0200 Message-Id: <20200624112530.852254-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 --- v2: Changes by Andy Shevchenko : - CodeStyle Changes by kernel test robot - Include dmi header to fix build error on arc - check if dmi_get_system_info returned NULL drivers/i2c/busses/i2c-designware-platdrv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index c2efaaaac252..5892fdba9c25 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,19 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev) pm_runtime_put_noidle(dev->dev); } +static bool dw_i2c_hwmon_bus(void) +{ + const char *product_name = dmi_get_system_info(DMI_PRODUCT_NAME); + + if (!product_name) + return false; + + if (strstr(product_name, "QT5222")) + return true; + + return false; +} + static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) { struct platform_device *pdev = to_platform_device(dev->dev); @@ -267,7 +281,7 @@ 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