From patchwork Wed Jul 17 09:30:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoniu Miclaus X-Patchwork-Id: 13735250 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8EAA224FA; Wed, 17 Jul 2024 09:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721208689; cv=none; b=m0ve3vZHFOdcj3z0pSbykpTTSelaOzjAPHbiBFsQAxsQIx1OaDzi0H+0Jv9Afusshb8Z5P7+GjaEmiNmi8iVuMoWivi6aIy0ZXGIZcDqoRt6GavJ0ZpR5ewLDufo8wqK3RIZiws9+gKlnXMaSHJxitrtodElwTiaD8oQ2G72vBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721208689; c=relaxed/simple; bh=gAazFzqaZ490cAM+4rusqktMnOGrVW3syFYMSlYhewY=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Z8g0rD+Gr8KkiE2uChuB/KpcLRjHMK6F8ZJm/OE1DOkFsJcMjT5fClGjX/+Le+HDHPOhxKlzQE4t+9ZVxm51jhhELzjXM6sJ6F4npOx2AuO/VJwerdZtfbHol1uCvtGv6zmnFc2LHmYEC6BicDgyjzDECkf2YwAYD7ChFVlyBmw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=G0A/Cn4H; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="G0A/Cn4H" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46H7Fdtd016944; Wed, 17 Jul 2024 05:31:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=DKIM; bh=iTbjNWS7Men/pAjIpZVN9E5gy4p NyB3vaVa0VE0do4k=; b=G0A/Cn4HGu3fpcXBlBRlEa26lSdR0RrfrYb5yhcXbr/ /VTC23cRi/VuRtyTW8lzULdpEQSz28fRYq1Xx0OX+DA8i8F+Et0Au/EHnlN6pknl rmCQRgH8D1aDNb5vfQd31LOGxG4UsdntRaKRxgzRx3txx0aN7M89VK9A4MQR6qWN /0TFYafTzAEMeiw1dIAVKL9cgFQjZLAUucblC9Nam6oDNJ+jbDSA+Uztn9gN9rDd mcvRfJL6Td75RVMTDu+WiWxOshRMTpww4uZnujAcx7imJeYzjPIWZj5E+K0VV+yE XolJg5emh+tPebu+7SAIemNlZvgyOdGBbFgm53krp7g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 40e9dngd3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2024 05:31:06 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 46H9V5CD039713 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jul 2024 05:31:05 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 17 Jul 2024 05:31:04 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Wed, 17 Jul 2024 05:31:04 -0400 Received: from amiclaus-VirtualBox.ad.analog.com (AMICLAUS-L02.ad.analog.com [10.48.65.170]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 46H9Upnt010792; Wed, 17 Jul 2024 05:30:53 -0400 From: Antoniu Miclaus To: Lars-Peter Clausen , Michael Hennerich , Antoniu Miclaus , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dragos Bogdan , , , Subject: [PATCH 1/2] dt-bindings: iio: adf4377: add adf4378 link Date: Wed, 17 Jul 2024 12:30:31 +0300 Message-ID: <20240717093034.9221-1-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: C69jKqTsphyNsIWyvVxZeR5zReWC5g_i X-Proofpoint-GUID: C69jKqTsphyNsIWyvVxZeR5zReWC5g_i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-17_06,2024-07-16_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 spamscore=0 priorityscore=1501 phishscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2407170072 Add product link for the adf4378 part. Signed-off-by: Antoniu Miclaus --- Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml b/Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml index aa6a3193b4e0..902081b83447 100644 --- a/Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml +++ b/Documentation/devicetree/bindings/iio/frequency/adi,adf4377.yaml @@ -17,6 +17,7 @@ description: | applications. https://www.analog.com/en/products/adf4377.html + https://www.analog.com/en/products/adf4378.html properties: compatible: From patchwork Wed Jul 17 09:30:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoniu Miclaus X-Patchwork-Id: 13735251 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92D7C45BEF; Wed, 17 Jul 2024 09:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721208691; cv=none; b=qjZ3MM0WbXQBPDVivz6vm1E70R9GHM07khC7DWXbn3SLkNcWjwosJzk114fcuibGclrL1cbR+G36I4Uw1cpgWJ7V2FIGq0s7wiSk61zlaD/mxCz4Opd1Z9UzqRz3DTwM1yr2ZoWLzsmisBoNjPEO/pn0Kq3KCluxJNeKCYap4Y0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721208691; c=relaxed/simple; bh=WSdYPYouR8KY7V5bnXs9tlXYukaGhxhDOfiqHrBTS54=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UDNJGC+IVj9gaZju+sVcv5Bomnr8pm9UoT4uk5KczBoU9kfD85uO95pYxTlAAS4r5C2yIPPmkHBQxtQnvF/jo7iKQ7VFxK8ELmMkjGxynrRIgrjtXDz6WUDY7MEUjpF0NaOUDGeo4MH932Tt+LuNe1E8UPSaGjmVAesQ/COkKt8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=O56nTSQf; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="O56nTSQf" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46H75J9H023192; Wed, 17 Jul 2024 05:31:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=Uj2Y5 4xiOPizy8MH0a9JbpiMvt64IFo2hB+OSN8aojE=; b=O56nTSQf5ItXHKfQ1rghE 19a44wMaNee9oWWemBhiE16eSIiiCLDHxc1f7QexYV3AJyU2kbn/tqyE6mV9J6Ej nO3eX002Oh8h8NMblB0hSYfcTQyoKEw15daIH0Y+oDI38oVcL9gpJmBZatMnSbZ1 /Ao4X31QBl9Mpul2VPD2wz83GW4Os9MiZ87ceb609GIKADIh5OMfpplqsfA5gRPp qtLqsP1M8D3MH0hVDY69xe6yFxKZUMqNa1CLLfNgZSI9Tluc8Qz3KgAygQITQGCg 4G2IBslrl8sRNibVAPNkcRPOp/WUXdV0dtOXqkDaCnpFX+e0Vgy6I2SFlWqt6A/l A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 40dwer2ma1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2024 05:31:11 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 46H9V9di039722 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 17 Jul 2024 05:31:09 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 17 Jul 2024 05:31:09 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Wed, 17 Jul 2024 05:31:08 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Wed, 17 Jul 2024 05:31:08 -0400 Received: from amiclaus-VirtualBox.ad.analog.com (AMICLAUS-L02.ad.analog.com [10.48.65.170]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 46H9Upnu010792; Wed, 17 Jul 2024 05:30:58 -0400 From: Antoniu Miclaus To: Lars-Peter Clausen , Michael Hennerich , Antoniu Miclaus , Jonathan Cameron , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Dragos Bogdan" , , , Subject: [PATCH 2/2] iio: frequency: adf4377: add adf4378 support Date: Wed, 17 Jul 2024 12:30:32 +0300 Message-ID: <20240717093034.9221-2-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240717093034.9221-1-antoniu.miclaus@analog.com> References: <20240717093034.9221-1-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: dVMkNFMqtPxCVbPwAc1xRvlQaQivyF-w X-Proofpoint-ORIG-GUID: dVMkNFMqtPxCVbPwAc1xRvlQaQivyF-w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-17_06,2024-07-16_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 clxscore=1015 suspectscore=0 mlxscore=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2407170072 Add separate handling for adf4378 within the driver. The main difference between adf4377 and adf4378 is that adf4378 has only one output which is handled by only one gpio. Signed-off-by: Antoniu Miclaus --- drivers/iio/frequency/adf4377.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/iio/frequency/adf4377.c b/drivers/iio/frequency/adf4377.c index 9284c13f1abb..e02298a8b47f 100644 --- a/drivers/iio/frequency/adf4377.c +++ b/drivers/iio/frequency/adf4377.c @@ -387,6 +387,11 @@ #define ADF4377_FREQ_PFD_250MHZ (250 * HZ_PER_MHZ) #define ADF4377_FREQ_PFD_320MHZ (320 * HZ_PER_MHZ) +enum adf4377_dev_type { + ADF4377, + ADF4378, +}; + enum { ADF4377_FREQ, }; @@ -402,6 +407,7 @@ enum muxout_select_mode { struct adf4377_state { struct spi_device *spi; + enum adf4377_dev_type type; struct regmap *regmap; struct clk *clkin; /* Protect against concurrent accesses to the device and data content */ @@ -687,7 +693,7 @@ static void adf4377_gpio_init(struct adf4377_state *st) if (st->gpio_enclk1) gpiod_set_value(st->gpio_enclk1, 1); - if (st->gpio_enclk2) + if (st->gpio_enclk2 && st->type == ADF4377) gpiod_set_value(st->gpio_enclk2, 1); } @@ -889,11 +895,13 @@ static int adf4377_properties_parse(struct adf4377_state *st) return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk1), "failed to get the CE GPIO\n"); - st->gpio_enclk2 = devm_gpiod_get_optional(&st->spi->dev, "clk2-enable", - GPIOD_OUT_LOW); - if (IS_ERR(st->gpio_enclk2)) - return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2), - "failed to get the CE GPIO\n"); + if (st->type == ADF4377) { + st->gpio_enclk2 = devm_gpiod_get_optional(&st->spi->dev, "clk2-enable", + GPIOD_OUT_LOW); + if (IS_ERR(st->gpio_enclk2)) + return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2), + "failed to get the CE GPIO\n"); + } ret = device_property_match_property_string(&spi->dev, "adi,muxout-select", adf4377_muxout_modes, @@ -945,6 +953,7 @@ static int adf4377_probe(struct spi_device *spi) st->regmap = regmap; st->spi = spi; + st->type = spi_get_device_id(spi)->driver_data; mutex_init(&st->lock); ret = adf4377_properties_parse(st); @@ -964,13 +973,15 @@ static int adf4377_probe(struct spi_device *spi) } static const struct spi_device_id adf4377_id[] = { - { "adf4377", 0 }, + { "adf4377", ADF4377 }, + { "adf4378", ADF4378 }, {} }; MODULE_DEVICE_TABLE(spi, adf4377_id); static const struct of_device_id adf4377_of_match[] = { { .compatible = "adi,adf4377" }, + { .compatible = "adi,adf4378" }, {} }; MODULE_DEVICE_TABLE(of, adf4377_of_match);