Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1327706ybt; Thu, 2 Jul 2020 02:41:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1QIAB8XN8fNNhOdgM+rcZrlJZN+N3UTun1wgpUI2Nzkmf4izcpR2p72+n3dBKM4pswAoQ X-Received: by 2002:a17:906:2b9b:: with SMTP id m27mr15532894ejg.19.1593682899807; Thu, 02 Jul 2020 02:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593682899; cv=none; d=google.com; s=arc-20160816; b=JHRWfcrnoB20y4H2qXPiM+9Sk5vanaQQEpheD2vvffPtV1NA7YydUqT7LxHOTN+NKi s22oJeEADXihgN6tGIs6SinzOGwoNHgvS5/5+h5GAgxlUVytSAX+SrdR9hDqe9KM46pr maIaOT3R9fhR6eusHLfdPxNQnysDXtX9qwZ5vmQNQkGh2d6DhYx8Z5MTzGVBPR+3mnm3 CZc+i5mIeaF1ZL0tV+Ue6AlnGpfftSc/whWbh8uwLAB5di2E9GQTzdiCFKmWkDmMiut5 7U6gYcPjiTtpMipg43W1HDldVfAsUtsbwPBhnOcDyyTHPqpgXj443TBoYmZapGMRUC8d wibw== 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=PshYPWi7fvTQHrWfUZQEN624Xq+S5W73EgfXf3KFYes=; b=hnnbcnJefFRpBrUTz28D8/g1ApQy16h/KxuzVVgrgFr8J6GshQJuz6ZftZMxYL5yRV qrvYbq61CtL+yLX+EIIzZy4Q0Wb65FCNlnAGDAU9547BDfjVcndSEGJkHcGPbDPYLYGv 4lMwQgMBCunQsyPol6V5JaHJGpobIJlyIt6AriS8LAMwS8SJoDrVrUkSfr3QKMgyal/R fb78Y1csrIejtd5oqRK8ufSed4w10iMv1MKesp85yWyCzUV9nekbkqzZsM33yeFBwlbo nebmc8msMvGRfavJaOLdB7RrHpn1EP+DPsiRZ8ZUfzlDjUVpmhX7PcJzYjTYCdU4sBCa tVbA== 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 dm22si1586641edb.499.2020.07.02.02.41.16; Thu, 02 Jul 2020 02:41: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 S1728008AbgGBJii (ORCPT + 99 others); Thu, 2 Jul 2020 05:38:38 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:35086 "EHLO mail-ej1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbgGBJii (ORCPT ); Thu, 2 Jul 2020 05:38:38 -0400 Received: by mail-ej1-f66.google.com with SMTP id rk21so28533318ejb.2; Thu, 02 Jul 2020 02:38:36 -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=PshYPWi7fvTQHrWfUZQEN624Xq+S5W73EgfXf3KFYes=; b=NaQHhUrxO9pz1UVhLoP87ySykgLihsttvuiBlu+Ie0qbRPY7opFkGi9UrMVZxLUSxl BLnRDu4i9P0mVIngS8gO4hNFld+Uz+GdFviz0y1ukFaNWmUgxNeBQmeUlERmq1+ndxwx zVWJeOtpi6veki2mZAVf6gMAoYWeDZ45J1NGb6LFztrpmr094jgLE3kDYVunD3wlBKbr p36IurybV5T0I42q6TpULk1P2i0l+lNpAhVmc8iMNeNw/D6OWRyhfz3GmFUHD/q4Z0gH ad3szld7fo8dZUQV1j9CqA6uEvZ5NMNiWCLWtlcLJVn8nIIoeW/ereq4MqBOgCFsdHeq NdbA== X-Gm-Message-State: AOAM5307PgQHsNuA8HcxN0H5IIyYtmY0Gc1+w4Bm3P5uCbPfDmnLz4+e bfHqLbJ7RnjuuCqGwV/qjhsnKEDpJcE= X-Received: by 2002:a17:906:9387:: with SMTP id l7mr25768386ejx.274.1593682716186; Thu, 02 Jul 2020 02:38:36 -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 g8sm9215406edk.13.2020.07.02.02.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 02:38:34 -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 v3] i2c: designware: platdrv: Set class based on dmi Date: Thu, 2 Jul 2020 11:38:32 +0200 Message-Id: <20200702093832.2077252-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. Dmi is probed only on Qtechnology QT5222 Industrial Camera Platform https://qtec.com/camera-technology-camera-platforms/ Fixes: 3eddad96c439 ("i2c: designware: reverts "i2c: designware: Add support for AMD I2C controller"") Signed-off-by: Ricardo Ribalda --- v3: Comment by Andy Shevchenko - Add Fixes tag - Do not user strstr for dmidecode Comment by Jarkko Nikula - Use dmi_check_system() 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..a9f2d416b7d1 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 @@ -191,6 +192,18 @@ static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev) return ret; } +static const struct dmi_system_id allow_probe[] = { + { + .ident = "Qtechnology QT5222", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Qtechnology"), + DMI_MATCH(DMI_PRODUCT_NAME, "QT5222") + } + }, + + { } +}; + static int dw_i2c_plat_probe(struct platform_device *pdev) { struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -267,7 +280,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 = dmi_check_system(allow_probe) ? + 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