From nobody Fri Nov 29 12:32:22 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C193D185B42 for ; Fri, 20 Sep 2024 17:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726853620; cv=none; b=Lit2nuE+lxRyiOsLzoApyB3PAv8joIkkOvQGmyebJBrkYh0rlQSbZJIgSRRz6SUcUkJbgO6cvmk76Cz19Tz3JexlV+vsNXUQXEjzR8rrYtDXHQIQY3p/segxyhd5yuUsjmnOoSAOylLdfh0KldG7BtNsrPgaKcHgKQH/hiJW2Dg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726853620; c=relaxed/simple; bh=fuWeZdZAtXd8rMGyPZJvoL1he1KOv88DgrMKYX9gf5A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z0Dgrm7W7mCQ2LwHCBOYfeXPqP1KUAHZXeI69sGlbanO72J6zjIcWu+zHdbkWMM1cwOMc0pjzJfNZ10UeBqsrHrh/GbosbUA8EMfFeVWrl5sHWJbb2E9YIveO2qf7vI91UU+5yK66DSA3NIsSaXR1n5sMqWhycJJAQKG5BKhyqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=W7pMnu3g; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="W7pMnu3g" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-42cb9a0c300so19784615e9.0 for ; Fri, 20 Sep 2024 10:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1726853613; x=1727458413; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vv19IsM1bE4LEmErHqweMrxFva6RQxz/zQSSqYTyIdM=; b=W7pMnu3gb7XeABh9C/uvNH1n9tSB9JVgFijVt7v6nlQgq3kves57eqBVnfh33fCMFv MDImJzNUk0CDnzxmupVBOsUfLah4bym5v41yGo5IS3ui6EGniFDS0e3YPRcN4qFSSHxk NT9MIysWaoyJuHCAuQojP9+i0l39OHT/sf/CKX65xNhNAhIK4hRECTF+MBe2Q/o1FNcG gZFsOHb9P4YUphabLsQkTWyKMUn/DMAmdhaCYHaDd5q1CBfvAGsQWLbmWnO6xi20Q8Wr 6fumoKuZn12c/ovuCRsM40qAdJAkfqQzg52+FVQQPaLvgNeIfnIuwFGcsEQ9HdZfQF7A hVfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726853613; x=1727458413; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vv19IsM1bE4LEmErHqweMrxFva6RQxz/zQSSqYTyIdM=; b=iIoRRjzr3oGXbXEOJLEiyT+x0JGJGWSmW5NwuOlSYKyISeXDyVzQdM5HNSjPVIjj+l wgQStm918ZOaBsYExuMB0Tk7ZAJIL0eZdsVN7X95A2WgOdhcAsFvSMR2ml7DeMCKd26n O68gLSSd5Fbq71DZCcwmaJD++gyoIhLZQTqTGn6zRJKipzUc50aiwP+sOkgrXO/vTJ0U u+9acE2HADojnIQk6NcjUnzLYraHWGWpdQhy/A61W6v1vChb4OMHROhoSKof3ZjJOq/D doUvgkGEoFwPTSAF8MPfV4dE/L0XpE/MtyupV6jx7D+9Y6zlBey9wWaW9dFLAuoMGrkH E0qA== X-Forwarded-Encrypted: i=1; AJvYcCVa0vnPm3CaA8loqrzDJ9PCWBJQc5WNYRfk7aJcyAOGqJILJ/K2mv9htGcAcNej1hm3qzsBs2F6eS1Kufs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxzbc5wvdg2QTE+VkqILhmac3tmng/SJFbIDtP5PJlMGPFGxiUS Ua1YUQI7Haq3DVHqf8sJgK8xbXI414kiDf/M3zOc5EWLOZL8ZcOULidCCt3q/+0= X-Google-Smtp-Source: AGHT+IGL6vfqfGi6Z7IWSrm4xlJwm4PF1Z7woAUfWI1dOX15RNSvnp51jlUH8XoytHh9rGsz/L7kSQ== X-Received: by 2002:a5d:6e92:0:b0:374:c945:2569 with SMTP id ffacd0b85a97d-37a4227192fmr1913676f8f.15.1726853612504; Fri, 20 Sep 2024 10:33:32 -0700 (PDT) Received: from [127.0.1.1] (frhb82016ds.ikexpress.com. [185.246.87.17]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378e780e029sm18111177f8f.116.2024.09.20.10.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2024 10:33:31 -0700 (PDT) From: Guillaume Stols Date: Fri, 20 Sep 2024 17:33:27 +0000 Subject: [PATCH v2 07/10] iio: adc: ad7606: Add compatibility to fw_nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240920-ad7606_add_iio_backend_support-v2-7-0e78782ae7d0@baylibre.com> References: <20240920-ad7606_add_iio_backend_support-v2-0-0e78782ae7d0@baylibre.com> In-Reply-To: <20240920-ad7606_add_iio_backend_support-v2-0-0e78782ae7d0@baylibre.com> To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jonathan Corbet , Michal Marek Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Hennerich , linux-fbdev@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, aardelean@baylibre.com, dlechner@baylibre.com, Guillaume Stols , jstephan@baylibre.com X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1726853604; l=14598; i=gstols@baylibre.com; s=20240417; h=from:subject:message-id; bh=fuWeZdZAtXd8rMGyPZJvoL1he1KOv88DgrMKYX9gf5A=; b=dbMIwK0lwOnaaMdTebmlSP9dy4cLxLrx9/I8U1qI/hBlefobVsgli89cD96H91ZdchZJPxhik 5cmLe6R7qozDRWGrCGMcseX9pBF0dBx5Bvge0212Q2Xky88dJkEdb+w X-Developer-Key: i=gstols@baylibre.com; a=ed25519; pk=XvMm5WHuV67sGYOJZqIYzXndbaJOlNd8Q6li6vnb4Cs= On the parallel version, the current implementation is only compatible with id tables and won't work with fw_nodes, this commit intends to fix it. Also, chip info is moved in the .h file so to be accessible to all the driver files that can set a pointer to the corresponding chip as the driver data. Signed-off-by: Guillaume Stols --- drivers/iio/adc/ad7606.c | 208 ++++++++++++++++++++++++---------------= ---- drivers/iio/adc/ad7606.h | 34 +++++-- drivers/iio/adc/ad7606_par.c | 29 +++--- drivers/iio/adc/ad7606_spi.c | 31 ++++--- 4 files changed, 173 insertions(+), 129 deletions(-) diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c index b98057138295..7f2ff1674638 100644 --- a/drivers/iio/adc/ad7606.c +++ b/drivers/iio/adc/ad7606.c @@ -51,6 +51,116 @@ static const unsigned int ad7616_oversampling_avail[8] = =3D { 1, 2, 4, 8, 16, 32, 64, 128, }; =20 +static const struct iio_chan_spec ad7605_channels[] =3D { + IIO_CHAN_SOFT_TIMESTAMP(4), + AD7605_CHANNEL(0), + AD7605_CHANNEL(1), + AD7605_CHANNEL(2), + AD7605_CHANNEL(3), +}; + +static const struct iio_chan_spec ad7606_channels[] =3D { + IIO_CHAN_SOFT_TIMESTAMP(8), + AD7606_CHANNEL(0), + AD7606_CHANNEL(1), + AD7606_CHANNEL(2), + AD7606_CHANNEL(3), + AD7606_CHANNEL(4), + AD7606_CHANNEL(5), + AD7606_CHANNEL(6), + AD7606_CHANNEL(7), +}; + +/* + * The current assumption that this driver makes for AD7616, is that it's + * working in Hardware Mode with Serial, Burst and Sequencer modes activat= ed. + * To activate them, following pins must be pulled high: + * -SER/PAR + * -SEQEN + * And following pins must be pulled low: + * -WR/BURST + * -DB4/SER1W + */ +static const struct iio_chan_spec ad7616_channels[] =3D { + IIO_CHAN_SOFT_TIMESTAMP(16), + AD7606_CHANNEL(0), + AD7606_CHANNEL(1), + AD7606_CHANNEL(2), + AD7606_CHANNEL(3), + AD7606_CHANNEL(4), + AD7606_CHANNEL(5), + AD7606_CHANNEL(6), + AD7606_CHANNEL(7), + AD7606_CHANNEL(8), + AD7606_CHANNEL(9), + AD7606_CHANNEL(10), + AD7606_CHANNEL(11), + AD7606_CHANNEL(12), + AD7606_CHANNEL(13), + AD7606_CHANNEL(14), + AD7606_CHANNEL(15), +}; + +const struct ad7606_chip_info ad7605_4_info =3D { + .channels =3D ad7605_channels, + .num_channels =3D 5, + .name =3D "ad7605-4", + .id =3D ID_AD7605_4, +}; +EXPORT_SYMBOL_NS_GPL(ad7605_4_info, IIO_AD7606); + +const struct ad7606_chip_info ad7606_8_info =3D { + .channels =3D ad7606_channels, + .num_channels =3D 9, + .oversampling_avail =3D ad7606_oversampling_avail, + .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), + .name =3D "ad7606-8", + .id =3D ID_AD7606_8, +}; +EXPORT_SYMBOL_NS_GPL(ad7606_8_info, IIO_AD7606); + +const struct ad7606_chip_info ad7606_6_info =3D { + .channels =3D ad7606_channels, + .num_channels =3D 7, + .oversampling_avail =3D ad7606_oversampling_avail, + .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), + .name =3D "ad7606-6", + .id =3D ID_AD7606_6, +}; +EXPORT_SYMBOL_NS_GPL(ad7606_6_info, IIO_AD7606); + +const struct ad7606_chip_info ad7606_4_info =3D { + .channels =3D ad7606_channels, + .num_channels =3D 5, + .oversampling_avail =3D ad7606_oversampling_avail, + .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), + .name =3D "ad7606-4", + .id =3D ID_AD7606_4, +}; +EXPORT_SYMBOL_NS_GPL(ad7606_4_info, IIO_AD7606); + +const struct ad7606_chip_info ad7606b_info =3D { + .channels =3D ad7606_channels, + .num_channels =3D 9, + .oversampling_avail =3D ad7606_oversampling_avail, + .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), + .name =3D "ad7606B", + .id =3D ID_AD7606B, +}; +EXPORT_SYMBOL_NS_GPL(ad7606b_info, IIO_AD7606); + +const struct ad7606_chip_info ad7616_info =3D { + .channels =3D ad7616_channels, + .num_channels =3D 17, + .oversampling_avail =3D ad7616_oversampling_avail, + .oversampling_num =3D ARRAY_SIZE(ad7616_oversampling_avail), + .os_req_reset =3D true, + .init_delay_ms =3D 15, + .name =3D "ad7616", + .id =3D ID_AD7616, +}; +EXPORT_SYMBOL_NS_GPL(ad7616_info, IIO_AD7606); + int ad7606_reset(struct ad7606_state *st) { if (st->gpio_reset) { @@ -395,96 +505,6 @@ static const struct attribute_group ad7606_attribute_g= roup_range =3D { .attrs =3D ad7606_attributes_range, }; =20 -static const struct iio_chan_spec ad7605_channels[] =3D { - IIO_CHAN_SOFT_TIMESTAMP(4), - AD7605_CHANNEL(0), - AD7605_CHANNEL(1), - AD7605_CHANNEL(2), - AD7605_CHANNEL(3), -}; - -static const struct iio_chan_spec ad7606_channels[] =3D { - IIO_CHAN_SOFT_TIMESTAMP(8), - AD7606_CHANNEL(0), - AD7606_CHANNEL(1), - AD7606_CHANNEL(2), - AD7606_CHANNEL(3), - AD7606_CHANNEL(4), - AD7606_CHANNEL(5), - AD7606_CHANNEL(6), - AD7606_CHANNEL(7), -}; - -/* - * The current assumption that this driver makes for AD7616, is that it's - * working in Hardware Mode with Serial, Burst and Sequencer modes activat= ed. - * To activate them, following pins must be pulled high: - * -SER/PAR - * -SEQEN - * And following pins must be pulled low: - * -WR/BURST - * -DB4/SER1W - */ -static const struct iio_chan_spec ad7616_channels[] =3D { - IIO_CHAN_SOFT_TIMESTAMP(16), - AD7606_CHANNEL(0), - AD7606_CHANNEL(1), - AD7606_CHANNEL(2), - AD7606_CHANNEL(3), - AD7606_CHANNEL(4), - AD7606_CHANNEL(5), - AD7606_CHANNEL(6), - AD7606_CHANNEL(7), - AD7606_CHANNEL(8), - AD7606_CHANNEL(9), - AD7606_CHANNEL(10), - AD7606_CHANNEL(11), - AD7606_CHANNEL(12), - AD7606_CHANNEL(13), - AD7606_CHANNEL(14), - AD7606_CHANNEL(15), -}; - -static const struct ad7606_chip_info ad7606_chip_info_tbl[] =3D { - /* More devices added in future */ - [ID_AD7605_4] =3D { - .channels =3D ad7605_channels, - .num_channels =3D 5, - }, - [ID_AD7606_8] =3D { - .channels =3D ad7606_channels, - .num_channels =3D 9, - .oversampling_avail =3D ad7606_oversampling_avail, - .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), - }, - [ID_AD7606_6] =3D { - .channels =3D ad7606_channels, - .num_channels =3D 7, - .oversampling_avail =3D ad7606_oversampling_avail, - .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), - }, - [ID_AD7606_4] =3D { - .channels =3D ad7606_channels, - .num_channels =3D 5, - .oversampling_avail =3D ad7606_oversampling_avail, - .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), - }, - [ID_AD7606B] =3D { - .channels =3D ad7606_channels, - .num_channels =3D 9, - .oversampling_avail =3D ad7606_oversampling_avail, - .oversampling_num =3D ARRAY_SIZE(ad7606_oversampling_avail), - }, - [ID_AD7616] =3D { - .channels =3D ad7616_channels, - .num_channels =3D 17, - .oversampling_avail =3D ad7616_oversampling_avail, - .oversampling_num =3D ARRAY_SIZE(ad7616_oversampling_avail), - .os_req_reset =3D true, - .init_delay_ms =3D 15, - }, -}; - static int ad7606_request_gpios(struct ad7606_state *st) { struct device *dev =3D st->dev; @@ -624,7 +644,7 @@ static void ad7606_pwm_disable(void *data) } =20 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, - const char *name, unsigned int id, + const struct ad7606_chip_info *chip_info, const struct ad7606_bus_ops *bops) { struct ad7606_state *st; @@ -653,7 +673,7 @@ int ad7606_probe(struct device *dev, int irq, void __io= mem *base_address, return dev_err_probe(dev, ret, "Failed to enable specified AVcc supply\n"); =20 - st->chip_info =3D &ad7606_chip_info_tbl[id]; + st->chip_info =3D chip_info; =20 if (st->chip_info->oversampling_num) { st->oversampling_avail =3D st->chip_info->oversampling_avail; @@ -676,7 +696,7 @@ int ad7606_probe(struct device *dev, int irq, void __io= mem *base_address, indio_dev->info =3D &ad7606_info_no_os_or_range; } indio_dev->modes =3D INDIO_DIRECT_MODE; - indio_dev->name =3D name; + indio_dev->name =3D chip_info->name; indio_dev->channels =3D st->chip_info->channels; indio_dev->num_channels =3D st->chip_info->num_channels; =20 @@ -758,7 +778,7 @@ int ad7606_probe(struct device *dev, int irq, void __io= mem *base_address, NULL, &ad7606_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - name, indio_dev); + chip_info->name, indio_dev); if (ret) return ret; =20 diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h index c13dda444526..18c87fe9a41a 100644 --- a/drivers/iio/adc/ad7606.h +++ b/drivers/iio/adc/ad7606.h @@ -38,8 +38,19 @@ AD760X_CHANNEL(num, BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),\ 0, BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO)) =20 +enum ad7606_supported_device_ids { + ID_AD7605_4, + ID_AD7606_8, + ID_AD7606_6, + ID_AD7606_4, + ID_AD7606B, + ID_AD7616, +}; + /** * struct ad7606_chip_info - chip specific information + * @name device name + * @id device id * @channels: channel specification * @num_channels: number of channels * @oversampling_avail pointer to the array which stores the available @@ -50,6 +61,8 @@ * after a restart */ struct ad7606_chip_info { + enum ad7606_supported_device_ids id; + const char *name; const struct iio_chan_spec *channels; unsigned int num_channels; const unsigned int *oversampling_avail; @@ -150,19 +163,22 @@ struct ad7606_bus_ops { }; =20 int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, - const char *name, unsigned int id, + const struct ad7606_chip_info *info, const struct ad7606_bus_ops *bops); =20 int ad7606_reset(struct ad7606_state *st); =20 -enum ad7606_supported_device_ids { - ID_AD7605_4, - ID_AD7606_8, - ID_AD7606_6, - ID_AD7606_4, - ID_AD7606B, - ID_AD7616, -}; +extern const struct ad7606_chip_info ad7605_4_info; + +extern const struct ad7606_chip_info ad7606_8_info; + +extern const struct ad7606_chip_info ad7606_6_info; + +extern const struct ad7606_chip_info ad7606_4_info; + +extern const struct ad7606_chip_info ad7606b_info; + +extern const struct ad7606_chip_info ad7616_info; =20 #ifdef CONFIG_PM_SLEEP extern const struct dev_pm_ops ad7606_pm_ops; diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c index d651639c45eb..7bac39033955 100644 --- a/drivers/iio/adc/ad7606_par.c +++ b/drivers/iio/adc/ad7606_par.c @@ -11,6 +11,7 @@ #include #include #include +#include #include =20 #include @@ -89,12 +90,20 @@ static const struct ad7606_bus_ops ad7606_par8_bops =3D= { =20 static int ad7606_par_probe(struct platform_device *pdev) { - const struct platform_device_id *id =3D platform_get_device_id(pdev); + const struct ad7606_chip_info *chip_info; + const struct platform_device_id *id; struct resource *res; void __iomem *addr; resource_size_t remap_size; int irq; =20 + if (dev_fwnode(&pdev->dev)) { + chip_info =3D device_get_match_data(&pdev->dev); + } else { + id =3D platform_get_device_id(pdev); + chip_info =3D (const struct ad7606_chip_info *)id->driver_data; + } + irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; @@ -106,25 +115,25 @@ static int ad7606_par_probe(struct platform_device *p= dev) remap_size =3D resource_size(res); =20 return ad7606_probe(&pdev->dev, irq, addr, - id->name, id->driver_data, + chip_info, remap_size > 1 ? &ad7606_par16_bops : &ad7606_par8_bops); } =20 static const struct platform_device_id ad7606_driver_ids[] =3D { - { .name =3D "ad7605-4", .driver_data =3D ID_AD7605_4, }, - { .name =3D "ad7606-4", .driver_data =3D ID_AD7606_4, }, - { .name =3D "ad7606-6", .driver_data =3D ID_AD7606_6, }, - { .name =3D "ad7606-8", .driver_data =3D ID_AD7606_8, }, + { .name =3D "ad7605-4", .driver_data =3D (kernel_ulong_t)&ad7605_4_info, = }, + { .name =3D "ad7606-4", .driver_data =3D (kernel_ulong_t)&ad7606_4_info, = }, + { .name =3D "ad7606-6", .driver_data =3D (kernel_ulong_t)&ad7606_6_info, = }, + { .name =3D "ad7606-8", .driver_data =3D (kernel_ulong_t)&ad7606_8_info, = }, { } }; MODULE_DEVICE_TABLE(platform, ad7606_driver_ids); =20 static const struct of_device_id ad7606_of_match[] =3D { - { .compatible =3D "adi,ad7605-4" }, - { .compatible =3D "adi,ad7606-4" }, - { .compatible =3D "adi,ad7606-6" }, - { .compatible =3D "adi,ad7606-8" }, + { .compatible =3D "adi,ad7605-4", .data =3D &ad7605_4_info }, + { .compatible =3D "adi,ad7606-4", .data =3D &ad7606_4_info }, + { .compatible =3D "adi,ad7606-6", .data =3D &ad7606_6_info }, + { .compatible =3D "adi,ad7606-8", .data =3D &ad7606_8_info }, { } }; MODULE_DEVICE_TABLE(of, ad7606_of_match); diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c index d3fbc7c7a823..719f9e09a5f7 100644 --- a/drivers/iio/adc/ad7606_spi.c +++ b/drivers/iio/adc/ad7606_spi.c @@ -307,10 +307,10 @@ static const struct ad7606_bus_ops ad7606B_spi_bops = =3D { =20 static int ad7606_spi_probe(struct spi_device *spi) { - const struct spi_device_id *id =3D spi_get_device_id(spi); + const struct ad7606_chip_info *chip_info =3D spi_get_device_match_data(sp= i); const struct ad7606_bus_ops *bops; =20 - switch (id->driver_data) { + switch (chip_info->id) { case ID_AD7616: bops =3D &ad7616_spi_bops; break; @@ -323,28 +323,27 @@ static int ad7606_spi_probe(struct spi_device *spi) } =20 return ad7606_probe(&spi->dev, spi->irq, NULL, - id->name, id->driver_data, - bops); + chip_info, bops); } =20 static const struct spi_device_id ad7606_id_table[] =3D { - { "ad7605-4", ID_AD7605_4 }, - { "ad7606-4", ID_AD7606_4 }, - { "ad7606-6", ID_AD7606_6 }, - { "ad7606-8", ID_AD7606_8 }, - { "ad7606b", ID_AD7606B }, - { "ad7616", ID_AD7616 }, + { "ad7605-4", (kernel_ulong_t)&ad7605_4_info }, + { "ad7606-4", (kernel_ulong_t)&ad7606_4_info }, + { "ad7606-6", (kernel_ulong_t)&ad7606_6_info }, + { "ad7606-8", (kernel_ulong_t)&ad7606_8_info }, + { "ad7606b", (kernel_ulong_t)&ad7606b_info }, + { "ad7616", (kernel_ulong_t)&ad7616_info }, { } }; MODULE_DEVICE_TABLE(spi, ad7606_id_table); =20 static const struct of_device_id ad7606_of_match[] =3D { - { .compatible =3D "adi,ad7605-4" }, - { .compatible =3D "adi,ad7606-4" }, - { .compatible =3D "adi,ad7606-6" }, - { .compatible =3D "adi,ad7606-8" }, - { .compatible =3D "adi,ad7606b" }, - { .compatible =3D "adi,ad7616" }, + { .compatible =3D "adi,ad7605-4", &ad7605_4_info }, + { .compatible =3D "adi,ad7606-4", &ad7606_4_info }, + { .compatible =3D "adi,ad7606-6", &ad7606_6_info }, + { .compatible =3D "adi,ad7606-8", &ad7606_8_info }, + { .compatible =3D "adi,ad7606b", &ad7606b_info }, + { .compatible =3D "adi,ad7616", &ad7616_info }, { } }; MODULE_DEVICE_TABLE(of, ad7606_of_match); --=20 2.34.1