From nobody Wed Dec 31 00:38:28 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6186C4332F for ; Mon, 13 Nov 2023 10:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbjKMK0Z (ORCPT ); Mon, 13 Nov 2023 05:26:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjKMK0W (ORCPT ); Mon, 13 Nov 2023 05:26:22 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0B7D75; Mon, 13 Nov 2023 02:26:18 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-53dfc28a2afso6454106a12.1; Mon, 13 Nov 2023 02:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699871177; x=1700475977; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=676mWdBEBZG3vlmSr/WlK77gM7Ih8+1VUmGPee+ETx8=; b=YTwNxixhrtHlFCXPMfPOUn2b9JNQlry7q8YuKQru2xTYi1ELtEGFQs+P3Uvh52sZLN MCYSJFM//zvcQ6nKjvJFMhB2yaYv7TbTpch7e9JdLEmRb3yeKLuoTXkYEMlA7m5SYKKW 7J6AtiO27HRy+4ru9CHLtNULx4qwn8no1Z34SdrQN9rOZMbcTvF5RlOWltubOMuoba3w OErOyRP9CLnzHARfUGYyF6u3V1Qw8j9rTzgeoDJNYe91YZJQASXEaqivJ1s5iEDJ6IOQ SGJuTqBLUOYrRMQ66byb4Z0/UQKNnL6BNMC0e9q0x59C1IgvQdg1f8i+IBeVaiV04aNo sRIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699871177; x=1700475977; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=676mWdBEBZG3vlmSr/WlK77gM7Ih8+1VUmGPee+ETx8=; b=chOya3VfCYASi47aTEyS6UbF3TQLx1pc0oza07fV8SZGgfxaCBHF31h/jhKrAtPhI8 5YEATKL+MQnKa4Olg+SbgW2f7+LhrhqhGZ3mZoYu7L6Xi9DEOj4wAjlVRevwv5AD7FUG M7d5KAAtI2y0x0IQJDDLFBST2nPLO93RdI0o5MCd6oUB/982wlA75PBw1Wad5b+l2ClN Kk7UXR8ADhge5fjW/UyS8GxlUjn0m6Xp+jFOFQ8pekAYfRFGGBKOLm4IB+pCZeRBgJWF qpJZUHPljv/zZIgEJpZJksHoMrD2c8o7k68t8W7mgtzHfg/1ab+rF4f3jzZPvoODZWiy mdkQ== X-Gm-Message-State: AOJu0YxdpjF2kRAd8PCoxkOe9aDGPAqa0fWjNa0gPjArsaNth0Q7IBmo HicITS+bbDTHSEEcndgUGMo= X-Google-Smtp-Source: AGHT+IFiZGKPzSFocHuDLjkWopzGMcOQPUsdzIQhbStIxp43/mukSS2Iq5M1Yct5ueZmbbTPEhh3SA== X-Received: by 2002:a05:6402:4c6:b0:540:54ef:43fd with SMTP id n6-20020a05640204c600b0054054ef43fdmr4329941edw.34.1699871176923; Mon, 13 Nov 2023 02:26:16 -0800 (PST) Received: from ubuntu.. ([188.24.51.27]) by smtp.gmail.com with ESMTPSA id r20-20020aa7cfd4000000b005435c317fedsm3464940edy.80.2023.11.13.02.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 02:26:16 -0800 (PST) From: Ana-Maria Cusco To: Ana-Maria Cusco Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] iio: amplifiers: hmc425a: add support for ADRF5740 Attenuator Date: Mon, 13 Nov 2023 12:25:34 +0200 Message-Id: <20231113102535.51074-2-anamaria.cuscoo@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113102535.51074-1-anamaria.cuscoo@gmail.com> References: <20231113102535.51074-1-anamaria.cuscoo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ana-Maria Cusco This adds support for the Analog Devices ADRF5740 2 dB LSB, 4-Bit, Silicon Digital Attenuator, 10 MHz to 60 GHz. The default (maximum) gain is also set at probe time, with GPIO lines driven high to achieve maximum gain, in contrast to other devices where GPIOs need to be driven low. Signed-off-by: Ana-Maria Cusco --- drivers/iio/amplifiers/hmc425a.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc4= 25a.c index e87d35d50a95..ed4d72922696 100644 --- a/drivers/iio/amplifiers/hmc425a.c +++ b/drivers/iio/amplifiers/hmc425a.c @@ -5,6 +5,7 @@ * Copyright 2020 Analog Devices Inc. */ =20 +#include #include #include #include @@ -22,6 +23,7 @@ enum hmc425a_type { ID_HMC425A, ID_HMC540S, + ID_ADRF5740 }; =20 struct hmc425a_chip_info { @@ -74,6 +76,10 @@ static int hmc425a_read_raw(struct iio_dev *indio_dev, case ID_HMC540S: gain =3D ~code * -1000; break; + case ID_ADRF5740: + code =3D code & BIT(3) ? code & ~BIT(2) : code; + gain =3D code * -2000; + break; } =20 *val =3D gain / 1000; @@ -113,6 +119,10 @@ static int hmc425a_write_raw(struct iio_dev *indio_dev, case ID_HMC540S: code =3D ~((abs(gain) / 1000) & 0xF); break; + case ID_ADRF5740: + code =3D (abs(gain) / 2000) & 0xF; + code =3D code & BIT(3) ? code | BIT(2) : code; + break; } =20 mutex_lock(&st->lock); @@ -165,6 +175,7 @@ static const struct iio_chan_spec hmc425a_channels[] = =3D { static const struct of_device_id hmc425a_of_match[] =3D { { .compatible =3D "adi,hmc425a", .data =3D (void *)ID_HMC425A }, { .compatible =3D "adi,hmc540s", .data =3D (void *)ID_HMC540S }, + { .compatible =3D "adi,adrf5740", .data =3D (void *)ID_ADRF5740 }, {}, }; MODULE_DEVICE_TABLE(of, hmc425a_of_match); @@ -188,6 +199,15 @@ static struct hmc425a_chip_info hmc425a_chip_info_tbl[= ] =3D { .gain_max =3D 0, .default_gain =3D -0x10, /* set default gain -15.0db*/ }, + [ID_ADRF5740] =3D { + .name =3D "adrf5740", + .channels =3D hmc425a_channels, + .num_channels =3D ARRAY_SIZE(hmc425a_channels), + .num_gpios =3D 4, + .gain_min =3D -22000, + .gain_max =3D 0, + .default_gain =3D 0xF, /* set default gain -22.0db*/ + }, }; =20 static int hmc425a_probe(struct platform_device *pdev) @@ -229,6 +249,9 @@ static int hmc425a_probe(struct platform_device *pdev) indio_dev->info =3D &hmc425a_info; indio_dev->modes =3D INDIO_DIRECT_MODE; =20 + /* Set default gain */ + hmc425a_write(indio_dev, st->gain); + return devm_iio_device_register(&pdev->dev, indio_dev); } =20 --=20 2.34.1 From nobody Wed Dec 31 00:38:28 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A7C1C4332F for ; Mon, 13 Nov 2023 10:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbjKMK01 (ORCPT ); Mon, 13 Nov 2023 05:26:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjKMK0Y (ORCPT ); Mon, 13 Nov 2023 05:26:24 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B638135; Mon, 13 Nov 2023 02:26:21 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5441305cbd1so6550450a12.2; Mon, 13 Nov 2023 02:26:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699871180; x=1700475980; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BkcBjw6N38nWpcH98Wo6zXUMJseV8oYDmiwD9ic+Q3E=; b=acRHr70QJM5KDZTyQBBD9pXNi7yJC2HVA7FswhERM6elk9wCP9DoKRcHDA2FCjFU87 ueuV9qBzegcvzsl3C43i7mN26Qm/MzyE+2Jbh/mmWbv77+SOjZKnUASkORqU5PhGuVHL pKTt05W5hm22E9/a2bgnqcCOfxClHjLPt2MxMNdTzruUFQPN3nQkkRho06xrU8IqOt6V fehToEeFTcUoO1OfdDcQqp1xFzgN/E8tdX9id7Ly/dBYcRSdNIFSi3jqabxD4m1S5fuM x1ZLocKULFLIxCvEtHw/ZDz2YwL5kSJlrEVBvQo3xh9Ux9ldEt40mzX0pWxhpl/OjEEY iDvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699871180; x=1700475980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BkcBjw6N38nWpcH98Wo6zXUMJseV8oYDmiwD9ic+Q3E=; b=P8MdAxFm/s7E/hIYxm4gQtcybpHGsnNnMqDI6MQMJrzDfsjKSpJswkANv8BckQwHCu NI/rGyamOwjn34YRfLXH8rwuX9Nk8HQlwGX179FN5iJuyUUXNezJYL4twbLST+/zW9hM FqIGjWbHCsMWEMpZLoKzBornyZNjzlZVLboUQGax+kqVt7LPcgwYFKHsPDDKFj2v/adI PLfprdj+xX0sHq1wyGzdQAKyItrWjydRppdZrE2OpaYDnAMvTh4CbD9MHFSK0mGLO90U BDh8DBDzkjfpA9H/YgM1yqFKOxdV/aHRajZqT0x/ZpvT6KthlVI33VcwszMK6UdcBx4Y xrrQ== X-Gm-Message-State: AOJu0YyeQO0bDVMonzU5Ix0YeIKRvAXRQTOUUsLmhYOm5y1igHez4mU1 jlkB/ZghYwL1u6tmReJwkBM= X-Google-Smtp-Source: AGHT+IGqMHl8CJUMaVmkecdE6R78s9cUlTa5VTP87qqME7+hLOPi1TAewDP0fF0bv9D3ef3BJ+pqvQ== X-Received: by 2002:aa7:d449:0:b0:547:4d23:3b2 with SMTP id q9-20020aa7d449000000b005474d2303b2mr1406389edr.17.1699871179578; Mon, 13 Nov 2023 02:26:19 -0800 (PST) Received: from ubuntu.. ([188.24.51.27]) by smtp.gmail.com with ESMTPSA id r20-20020aa7cfd4000000b005435c317fedsm3464940edy.80.2023.11.13.02.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 02:26:19 -0800 (PST) From: Ana-Maria Cusco To: Ana-Maria Cusco Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] dt-bindings: iio: hmc425a: add entry for ADRF5740 Attenuator Date: Mon, 13 Nov 2023 12:25:35 +0200 Message-Id: <20231113102535.51074-3-anamaria.cuscoo@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231113102535.51074-1-anamaria.cuscoo@gmail.com> References: <20231113102535.51074-1-anamaria.cuscoo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ana-Maria Cusco The ADRF5740 is a silicon, 4-bit digital attenuator with 22 dB attenuation control range in 2 dB steps. Signed-off-by: Ana-Maria Cusco Acked-by: Conor Dooley --- .../devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.y= aml b/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml index 2ee6080deac7..67de9d4e3a1d 100644 --- a/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml +++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml @@ -12,6 +12,9 @@ maintainers: description: | Digital Step Attenuator IIO devices with gpio interface. Offer various frequency and attenuation ranges. + ADRF5750 2 dB LSB, 4-Bit, Silicon Digital Attenuator, 10 MHz to 60 GHz + https://www.analog.com/media/en/technical-documentation/data-sheets/ad= rf5740.pdf + HMC425A 0.5 dB LSB GaAs MMIC 6-BIT DIGITAL POSITIVE CONTROL ATTENUATOR, = 2.2 - 8.0 GHz https://www.analog.com/media/en/technical-documentation/data-sheets/hm= c425A.pdf =20 @@ -22,6 +25,7 @@ description: | properties: compatible: enum: + - adi,adrf5740 - adi,hmc425a - adi,hmc540s =20 --=20 2.34.1