From patchwork Wed May 22 15:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670917 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 177A71CFA0 for ; Wed, 22 May 2024 15:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390172; cv=none; b=K3JaU7k3dWdyIWTZnCLvy5CEprWODx5Q/gRYGhQcW0z7yxesEyQiC0p2qOdpfhVyHY7zLtJxtuo88iakZdWl+NVnLcv/WgpiXCJ2vRWfSc1Q0RTlnOhHq0q+iZKZzdGMx//FG8OT/QRQ2n5E8/AM+UxLFQ7mSaoTsaVWCjP7Q08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390172; c=relaxed/simple; bh=4we0BntgDjersaBwZSM/3LAXtNM+Jj31lyXstVZv+Zs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KN9lSqVhBK1ah1GwvDKNIDnpf1ytx36e9nOEliN0xsIOqJw7nUCuKde+e7l5fQIFsZ2i+BHofLhe7QTvh5y6D+EtFJIo96AngNHqxeFG4oSr0jURqwymyENhL7P8rm0Fo6gAbWW4/NXGjiG47TBQliP1cZCRtP9ojRINXJwdKbI= 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=NoB6c9//; arc=none smtp.client-ip=209.85.208.179 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="NoB6c9//" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2e72b8931caso38420071fa.0 for ; Wed, 22 May 2024 08:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390169; x=1716994969; 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=IwxcKi7+xm82BPDKKU7Mvqu+uOCUtLvBD3WA1VqqvxI=; b=NoB6c9//ZXCMaYDfIXlEZ5xUW37Fl2vA9RHxaEjQk0GWEWNJpWtNTLVAf+iDJsEfmj +4GxwLmNUCCJfZ+GqmyRxOlnLj3W0bqf5uWTDmJ/qAFTGIKMy9qtlNy6NQYSuQKQz7sG UFY4JgzkHTGF6BtzvnJzr2kPmMv/jkLjLV53A7+Fw/mNfzSZ6ZSF5scYHjeH50tgQWGI ycTQeLvwirZDcd1N+e4/kss8rf7UPD3kdl1ApyJ9jeLwzvvr97tPtbiQZ/N1CtKADfq2 po/sQaZg40XSsN+EWjBnOR0Vd/YdAQVgl1nxj8+BmylH/o/uWZORp7Shy3q0xVKlgOJb 6eGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390169; x=1716994969; 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=IwxcKi7+xm82BPDKKU7Mvqu+uOCUtLvBD3WA1VqqvxI=; b=WZpM7htmqbEPF5nGzUm+tgfniDtVlcNBElYfdHnUmWkWkJJ8UjSR0Bm8FOXgGd4mWH QMex+xceUFuP/DpEPKYubLMutmjR7Cs06HaPt8crWpasTsz0Bn3U/TAtImbNqUZzIhC+ EMujyIQ6AqUla3MndK/okMjykvkYzoUHE1273HafgzGVMay80tQ9/grAxKQFfoQLuyj9 R6T0r9VDuJrhlUZP/bjDSBPNz3lCaLqumdQC+J6QyvE9U8tCS7lL4gQes1hSJc6PAadS 6XuFkQFkaf058CjzkAJ3twxeM+sPfS1yfRw6XzJF7TBTZnGluOj9Evo3VFLmRQFFgxN8 Yb7g== X-Forwarded-Encrypted: i=1; AJvYcCUZ6GjXuaLWh4gSJ3kLkaJX27ZdfnUL5QYb0a2yP4X2pqA2Pi+EfCfoPuQRvPDQ3E8Lt8Z/4zsSMnQOGRK2oOx+FNPKsWfEIZI8 X-Gm-Message-State: AOJu0YyJACQ9ZAmUY3m0z8VddgyDbJ0Hkf5Y0Mgs0Jlb/vVwmuLhx5uo WkzYAfiYN+S40oiYu+9OQ5PIrT1n7Bv1Sl6ZaSUvvaSrYO+134Lnu653nluoBNU= X-Google-Smtp-Source: AGHT+IG3WCmhuD7axwgUgN8Pr1g/pdtpLYUfSMpi46cHuDX05+j2SRu2u02TGF9GsDOzIRCKt5jPXA== X-Received: by 2002:a2e:8404:0:b0:2df:c1e7:ab65 with SMTP id 38308e7fff4ca-2e949574737mr11287421fa.26.1716390169219; Wed, 22 May 2024 08:02:49 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:48 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 1/6] dt-bindings: iio: dac: fix ad3552r gain parameter names Date: Wed, 22 May 2024 17:01:36 +0200 Message-ID: <20240522150141.1776196-2-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello The adi,gain-scaling-p/n values are an inverted log2, so initial naming was set correctly, but the driver uses just adi,gain-scaling-p/n, and if fdt is created accordingly with the fdt bindings documentation, driver fails the probe. Observing that: - the Linux driver is the only consumer, - there are no upstreamed dts nodes related to ad3552r, the fix to the documentation side is preferred and less-risk. Fixes: b0a96c5f599e ("dt-bindings: iio: dac: Add adi,ad3552r.yaml") Signed-off-by: Angelo Dureghello Reviewed-by: Krzysztof Kozlowski --- Changes for v2: - better explanation in the commit notes --- .../devicetree/bindings/iio/dac/adi,ad3552r.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml index 8265d709094d..4e9f80445405 100644 --- a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml @@ -92,13 +92,13 @@ patternProperties: maximum: 511 minimum: -511 - adi,gain-scaling-p-inv-log2: - description: GainP = 1 / ( 2 ^ adi,gain-scaling-p-inv-log2) + adi,gain-scaling-p: + description: GainP = 1 / ( 2 ^ adi,gain-scaling-p) $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1, 2, 3] - adi,gain-scaling-n-inv-log2: - description: GainN = 1 / ( 2 ^ adi,gain-scaling-n-inv-log2) + adi,gain-scaling-n: + description: GainN = 1 / ( 2 ^ adi,gain-scaling-n) $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1, 2, 3] @@ -107,8 +107,8 @@ patternProperties: required: - adi,gain-offset - - adi,gain-scaling-p-inv-log2 - - adi,gain-scaling-n-inv-log2 + - adi,gain-scaling-p + - adi,gain-scaling-n - adi,rfb-ohms required: @@ -208,8 +208,8 @@ examples: reg = <1>; custom-output-range-config { adi,gain-offset = <5>; - adi,gain-scaling-p-inv-log2 = <1>; - adi,gain-scaling-n-inv-log2 = <2>; + adi,gain-scaling-p = <1>; + adi,gain-scaling-n = <2>; adi,rfb-ohms = <1>; }; }; From patchwork Wed May 22 15:01:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670918 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 75F1BAD23 for ; Wed, 22 May 2024 15:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390174; cv=none; b=FqEGxvroc3C/tGGi6u6dudFH48HlF8PnxmGcUo5LquxVeZQjI5befhIhdIwN7M+8r/ymY+7+xbeNxp2iU7Ijz8VHh8tkEjS57tBW3GFmkqgs+AMk5tGN9uvvRMVrZW2aTQ05UZ14iuISgnxoDsDQCldD7KOkRjuPfA0uN5vfWDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390174; c=relaxed/simple; bh=Oyivc8v0nPgyt25Ej8yA93bFsXe74OIpIMbFcFJaQZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRdulwvS6iA/oipC4NMOHblszkr5Vj9pC9fkm1xsQFnxDw6j8azu14xXK7KCW4fkTQiF5jk6z6c4A4Uuy9jikxdOE8cYN4PACz2L3qq5Dw0Cq70uTKa93zCVoA3qXmjCjF+wkW1jB5EpnGMXj2lEwiHYXogjziqxaPV+YN57LzA= 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=LckNCFsD; arc=none smtp.client-ip=209.85.208.171 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="LckNCFsD" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2e27277d2c1so87652441fa.2 for ; Wed, 22 May 2024 08:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390171; x=1716994971; 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=TB4aFrxJGRpEFoDCF3w8d3C8gCv5YBGExDQ2YOzvshA=; b=LckNCFsDKH+aWSA8Li2pAvIW5abUE0UIKW3jCXJNPgpjHu0T68hIF7DRduCkbWTUUv fk791piCxcn7hhgSZt1aPt+XTw6aoTBWZ7s6qDUrZba80Be83EBBNo0gazwE+0PlZhJC qCMUGYgshQV+OlUkEjWwMe/uZOtGvzkuBluGiA8kn/eWzCEjq8t6tcg0cBXAp4iy1bSG glrVRH0LoZRvLC2gO7lIWeicakvlSIKidLYX09sOeYiluQdp6dAfk47xqnBdfdnNochA xsrdwHET0P4TaPCFXnHmBSZEOV1sG9xofKdxQPFbFYsJUOqQajuHZvOLpSA8Hdnd+ZmX MNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390171; x=1716994971; 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=TB4aFrxJGRpEFoDCF3w8d3C8gCv5YBGExDQ2YOzvshA=; b=Ii42m9gTj1HHlsgPtDUOLBd8md+tVdw5BKZ06z/CEENTj8gOJV1eCr31Jbc1fRIVCE DxtWwqQ96LTtzjip3OQYaMAE3u1zsASJXHyJDV7F5dhwrJSAtDOnJftrEDEVT8JuhU3g nMn4ucPsxPhIFwcNlZdwuihOGtMGxo02nXCkCIMLsmpX3aYHNE+o/36+/re3rClCdwxo Bs8r+j/3F2TKUK7xGWKiHt+RfM8V9p4iRpyseZAPOaLNDKFk1wpUofvgWPKhLMNpS4Xf zni4mQObuFuphdOkJs8E46bVasQmYdgjoI6Juhcd0uhNpBFZd37YMgUzLfzm2BxeYJ34 1CKA== X-Forwarded-Encrypted: i=1; AJvYcCVGk3LQRZtrpXKC4pC4wpBL0Y6l6bNNqu24OELN2ix98tyuUrYV+YVJ2SRp2izIslh0HptXoyJqTL6Ftxs6eLVGZkQiWCSDTHmO X-Gm-Message-State: AOJu0Yzk67+ppdy1MYHdCPyHCYjgl+vDxgU3T/wD8zB8o7V/IM7lJ1sC CjXzhAeTOrHIRxZdSNY9L/TMek6xRS58bR1uPcElt6PWat3Mun53TIjRzHm/m0Q= X-Google-Smtp-Source: AGHT+IGlikuVJrqPYvrWxSHDc7Uj9hjg+XjhYNt1RjMzI7JQOL8qSiKK1w02HqMK2osgyUdoEB1T/w== X-Received: by 2002:a2e:720c:0:b0:2e4:f8e:3a64 with SMTP id 38308e7fff4ca-2e949518e3emr15052791fa.30.1716390170644; Wed, 22 May 2024 08:02:50 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:50 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 2/6] dt-bindings: iio: dac: add ad35xxr single output variants Date: Wed, 22 May 2024 17:01:37 +0200 Message-ID: <20240522150141.1776196-3-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello Add support for ad3541r and ad3551r single output variants. Signed-off-by: Angelo Dureghello Reviewed-by: Krzysztof Kozlowski --- Changes for v2: - bounds reg value to 0 and channel nodes for the 1-channel models. --- .../bindings/iio/dac/adi,ad3552r.yaml | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml index 4e9f80445405..fc8b97f82077 100644 --- a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml @@ -13,13 +13,17 @@ maintainers: description: | Bindings for the Analog Devices AD3552R DAC device and similar. Datasheet can be found here: + https://www.analog.com/media/en/technical-documentation/data-sheets/ad3541r.pdf https://www.analog.com/media/en/technical-documentation/data-sheets/ad3542r.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ad3551r.pdf https://www.analog.com/media/en/technical-documentation/data-sheets/ad3552r.pdf properties: compatible: enum: + - adi,ad3541r - adi,ad3542r + - adi,ad3551r - adi,ad3552r reg: @@ -128,7 +132,9 @@ allOf: properties: compatible: contains: - const: adi,ad3542r + enum: + - adi,ad3541r + - adi,ad3542r then: patternProperties: "^channel@([0-1])$": @@ -158,7 +164,9 @@ allOf: properties: compatible: contains: - const: adi,ad3552r + enum: + - adi,ad3551r + - adi,ad3552r then: patternProperties: "^channel@([0-1])$": @@ -182,6 +190,21 @@ allOf: - const: -10000000 - const: 10000000 + - if: + properties: + compatible: + contains: + enum: + - adi,ad3541r + - adi,ad3551r + then: + properties: + channel@1: false + channel@0: + properties: + reg: + const: 0 + required: - compatible - reg From patchwork Wed May 22 15:01:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670919 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 9E9022940B for ; Wed, 22 May 2024 15:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390175; cv=none; b=tRGzT4uX4qZZcMbcah+faZibYAbWNAPzucMjTXmiHVLZa6x3a9wNTObvp22mqHBjiI555Q2ssdpw7c+AadzBoXj5J6c6d7tCSkIqEizumwoqm1xpBRnviWFvkxgY46CluzZmBjr6nk4gJ3MgjIdnLayjnTZh01ffthyefN99+q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390175; c=relaxed/simple; bh=JkVbE4Y3WkBnzc/N2Xv7o2O7qEwpm7OELDM+ScIxCWM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hj4Sg8ql2qornjEGOPFmGKNLyqD0fbdtLwl/O50l3Qm4ZdhG4suRlm9RaQSeX0deDSoY9vbiagCNRd0yuJESmG5kx+lAxts+fN2Z9zCkpthxKaq71Tz3Nc6YND83Yby3c8Q/wABIVZAwxT6CMzd0HzY3ouzBOyPqy8cJkvlyNik= 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=mh1NEQPS; arc=none smtp.client-ip=209.85.128.49 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="mh1NEQPS" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-42011507a57so44922385e9.1 for ; Wed, 22 May 2024 08:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390172; x=1716994972; 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=7hVNU4a78SiOOCC9kV1Z6zz+W5lUlkPH0msGia4TH6k=; b=mh1NEQPSJT7edR1mUFG6jXxxfmYkx5PQ1gyJ/6ZxnfTVsM0mUne63V+z6txuYfvcMH slV93Hum6nzf6Me3wRtEE8B/LRnNO0wiyMsRKRF3lMnwl7gM2e9TYnMT3Y6eXkxqy/i6 JMT4fCAFzFSlhsCjwII3oDGZXYscln2F5Enf24tQpJVx62Ric12YeIbiHyQoHI7NBSWL /ioQSjLwulomN92/t/B1Y1N1K/L606Ii6U0sfEDcpzndMf8IQgOMCFohgU2QxlPlqRIA QlnNKuAWpuzLn9nAO3RqdoVVy9sRSEmcgzlfQhIWD8T/D/PRyl1grNBUat23rNKPw9Pp T5TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390172; x=1716994972; 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=7hVNU4a78SiOOCC9kV1Z6zz+W5lUlkPH0msGia4TH6k=; b=hLMIIkaW/VZwXta4OfwyGG2HrlMcUo8vU0ZrRAZfwbRj+kJIasnIWV0xBJ6QJms/N0 WRJqczSjl25BPlnsOzUkNhy2ADwA+OLrH3ORfzDIDyhQT3illMBMxBPaZTJo+WrkS6yA w8844/9mMuTn/etCpI+VXGxWFwPmsqRBURJlg6YY1dp3UWniLRbfHmtjpUcj+8RqGZ6z ryVOCZ7/mEcFs1skuAlhlwGt3vVr0qclavhDEhr0kVaUEGAhl+94xMNm5iaJdzHtdaGV 6f4lKm9JSDPtEgkyds1cibP8L043jMYSP6/2roMoHqZb2Iv0cIGPrMkBW3eT917mUbII 4yhg== X-Forwarded-Encrypted: i=1; AJvYcCUiEDS8UYbXMVGVy1tQrJIv6qygKwhjZZvucQPmds25grusgBZLGwk/Xm1QeQRRa2YIt/WwqZl+G4XgjiEhWmFaok0cCbVRf+8J X-Gm-Message-State: AOJu0YwuH5CABgLbKFnNx64ofB9uYrSPyV6uiaksN+5xddHSjSHBlhQF 02XADtbYbod/56J1nPcI0Zplb5NuTZiR3VJfoQNI/EZb7eAl5X+sBTpkGL/vNk0= X-Google-Smtp-Source: AGHT+IF27wX7armSFJqEp/cFvKhhk93XUz8Ir9vmAoGFDVZiERrS9gpV1gcC/aNyMjhDab9+ifJTVA== X-Received: by 2002:a05:600c:2108:b0:420:ef93:cd2f with SMTP id 5b1f17b1804b1-420fd321a7dmr18341595e9.21.1716390171912; Wed, 22 May 2024 08:02:51 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:51 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 3/6] iio: dac: ad3552r: add model data structure Date: Wed, 22 May 2024 17:01:38 +0200 Message-ID: <20240522150141.1776196-4-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello Add a "model data" structure to keep useful hardware-related information as from datasheet, avoiding id-based conditional choices later on. Removed id-based checks and filled model-specific structures with device specific features, In particular, num_hw_channels is introduced to keep the number of hardware implemented channels, since 1-channel versions of the DACs are added in this same patchset. Signed-off-by: Angelo Dureghello --- Changes for v2: - patch added in v2 --- drivers/iio/dac/ad3552r.c | 98 +++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c index a492e8f2fc0f..6a40c7eece1f 100644 --- a/drivers/iio/dac/ad3552r.c +++ b/drivers/iio/dac/ad3552r.c @@ -261,7 +261,17 @@ struct ad3552r_ch_data { bool range_override; }; +struct ad3552r_model_data { + const char *model_name; + enum ad3542r_id chip_id; + unsigned int num_hw_channels; + const s32 (*ranges_table)[2]; + int num_ranges; + bool requires_output_range; +}; + struct ad3552r_desc { + const struct ad3552r_model_data *model_data; /* Used to look the spi bus for atomic operations where needed */ struct mutex lock; struct gpio_desc *gpio_reset; @@ -271,7 +281,6 @@ struct ad3552r_desc { struct iio_chan_spec channels[AD3552R_NUM_CH + 1]; unsigned long enabled_ch; unsigned int num_ch; - enum ad3542r_id chip_id; }; static const u16 addr_mask_map[][2] = { @@ -745,13 +754,8 @@ static void ad3552r_calc_gain_and_offset(struct ad3552r_desc *dac, s32 ch) } else { /* Normal range */ idx = dac->ch_data[ch].range; - if (dac->chip_id == AD3542R_ID) { - v_min = ad3542r_ch_ranges[idx][0]; - v_max = ad3542r_ch_ranges[idx][1]; - } else { - v_min = ad3552r_ch_ranges[idx][0]; - v_max = ad3552r_ch_ranges[idx][1]; - } + v_min = dac->model_data->ranges_table[idx][0]; + v_max = dac->model_data->ranges_table[idx][1]; } /* @@ -775,22 +779,14 @@ static void ad3552r_calc_gain_and_offset(struct ad3552r_desc *dac, s32 ch) dac->ch_data[ch].offset_dec = div_s64(tmp, span); } -static int ad3552r_find_range(u16 id, s32 *vals) +static int ad3552r_find_range(const struct ad3552r_model_data *model_data, + s32 *vals) { - int i, len; - const s32 (*ranges)[2]; + int i; - if (id == AD3542R_ID) { - len = ARRAY_SIZE(ad3542r_ch_ranges); - ranges = ad3542r_ch_ranges; - } else { - len = ARRAY_SIZE(ad3552r_ch_ranges); - ranges = ad3552r_ch_ranges; - } - - for (i = 0; i < len; i++) - if (vals[0] == ranges[i][0] * 1000 && - vals[1] == ranges[i][1] * 1000) + for (i = 0; i < model_data->num_ranges; i++) + if (vals[0] == model_data->ranges_table[i][0] * 1000 && + vals[1] == model_data->ranges_table[i][1] * 1000) return i; return -EINVAL; @@ -955,9 +951,9 @@ static int ad3552r_configure_device(struct ad3552r_desc *dac) dev_err(dev, "mandatory reg property missing\n"); goto put_child; } - if (ch >= AD3552R_NUM_CH) { + if (ch >= dac->model_data->num_hw_channels) { dev_err(dev, "reg must be less than %d\n", - AD3552R_NUM_CH); + dac->model_data->num_hw_channels); err = -EINVAL; goto put_child; } @@ -973,7 +969,7 @@ static int ad3552r_configure_device(struct ad3552r_desc *dac) goto put_child; } - err = ad3552r_find_range(dac->chip_id, vals); + err = ad3552r_find_range(dac->model_data, vals); if (err < 0) { dev_err(dev, "Invalid adi,output-range-microvolt value\n"); @@ -987,9 +983,10 @@ static int ad3552r_configure_device(struct ad3552r_desc *dac) goto put_child; dac->ch_data[ch].range = val; - } else if (dac->chip_id == AD3542R_ID) { + } else if (dac->model_data->requires_output_range) { dev_err(dev, - "adi,output-range-microvolt is required for ad3542r\n"); + "adi,output-range-microvolt is required for %s\n", + dac->model_data->model_name); err = -EINVAL; goto put_child; } else { @@ -1011,7 +1008,8 @@ static int ad3552r_configure_device(struct ad3552r_desc *dac) } /* Disable unused channels */ - for_each_clear_bit(ch, &dac->enabled_ch, AD3552R_NUM_CH) { + for_each_clear_bit(ch, &dac->enabled_ch, + dac->model_data->num_hw_channels) { err = ad3552r_set_ch_value(dac, AD3552R_CH_AMPLIFIER_POWERDOWN, ch, 1); if (err) @@ -1058,7 +1056,7 @@ static int ad3552r_init(struct ad3552r_desc *dac) } id |= val << 8; - if (id != dac->chip_id) { + if (id != dac->model_data->chip_id) { dev_err(&dac->spi->dev, "Product id not matching\n"); return -ENODEV; } @@ -1068,7 +1066,6 @@ static int ad3552r_init(struct ad3552r_desc *dac) static int ad3552r_probe(struct spi_device *spi) { - const struct spi_device_id *id = spi_get_device_id(spi); struct ad3552r_desc *dac; struct iio_dev *indio_dev; int err; @@ -1079,7 +1076,9 @@ static int ad3552r_probe(struct spi_device *spi) dac = iio_priv(indio_dev); dac->spi = spi; - dac->chip_id = id->driver_data; + dac->model_data = spi_get_device_match_data(spi); + if (!dac->model_data) + return -EINVAL; mutex_init(&dac->lock); @@ -1088,10 +1087,7 @@ static int ad3552r_probe(struct spi_device *spi) return err; /* Config triggered buffer device */ - if (dac->chip_id == AD3552R_ID) - indio_dev->name = "ad3552r"; - else - indio_dev->name = "ad3542r"; + indio_dev->name = dac->model_data->model_name; indio_dev->dev.parent = &spi->dev; indio_dev->info = &ad3552r_iio_info; indio_dev->num_channels = dac->num_ch; @@ -1109,16 +1105,40 @@ static int ad3552r_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } +static const struct ad3552r_model_data ad3542r_model_data = { + .model_name = "ad3542r", + .chip_id = AD3542R_ID, + .num_hw_channels = 2, + .ranges_table = ad3542r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), + .requires_output_range = true, +}; + +static const struct ad3552r_model_data ad3552r_model_data = { + .model_name = "ad3552r", + .chip_id = AD3552R_ID, + .num_hw_channels = 2, + .ranges_table = ad3552r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), + .requires_output_range = false, +}; + static const struct spi_device_id ad3552r_id[] = { - { "ad3542r", AD3542R_ID }, - { "ad3552r", AD3552R_ID }, + { + .name = "ad3542r", + .driver_data = (kernel_ulong_t)&ad3542r_model_data + }, + { + .name = "ad3552r", + .driver_data = (kernel_ulong_t)&ad3552r_model_data + }, { } }; MODULE_DEVICE_TABLE(spi, ad3552r_id); static const struct of_device_id ad3552r_of_match[] = { - { .compatible = "adi,ad3542r"}, - { .compatible = "adi,ad3552r"}, + { .compatible = "adi,ad3542r", .data = &ad3542r_model_data }, + { .compatible = "adi,ad3552r", .data = &ad3552r_model_data }, { } }; MODULE_DEVICE_TABLE(of, ad3552r_of_match); From patchwork Wed May 22 15:01:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670920 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 A9387219F3 for ; Wed, 22 May 2024 15:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390176; cv=none; b=Wr6ngprWUA872YdGURRcEgKFy6O7RFUOSikxHsBTn1ac3wKefUtoyXeOce8VLk2wwnj6g6WYdF1h6B8YgyYBoTOCJHIOeEVH4tBwR6+VIiYk1Cjw7hBB4E8PXAypWZM+I9gHisI1Py1lpPAkYZxamvPiUmYhK29MyGwmebahiBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390176; c=relaxed/simple; bh=Py0dfBh0rk9cPcnRmp0ehNdFKbMfxplFlghi6OJqfoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vgvvhamg3M5XrM3NmDKyc3lUZe4P4zZ/FFhuhYcpfb0d760GC88aX1yIqrodbrpc9vy8k/hcMAYdEyJMBrL8HJg2LxO52BCMS02/rf3Oi/2DlAnkTZgMZp4usMCbAgRmIjvRtjkeyxa+0MQZX75kwt/5TczdvHR8EecPgGlUq7I= 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=L5rWursz; arc=none smtp.client-ip=209.85.128.51 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="L5rWursz" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4202cea98daso8856165e9.0 for ; Wed, 22 May 2024 08:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390173; x=1716994973; 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=GgUsIx8ed6TkRFD72RRzx4QHPjFX183C6Bw53EkwCkQ=; b=L5rWurszqzxYQwhes2g9I1RNhiaxxtLds2nsxBjFKwsHHWaJbRlMpIVF2IwPbdTKT3 6thZaFKx533JoaLrRRSpmr/lDEWJYEK2Z4tJMiXJEh2oSCeZNNJWNdWYKz/uVO2qsDHO Nc/F6P0Yuk2/nUkzqhNuvHjeFiKRqUno8xYm3qBbpofsErcJ+oclwQZBOnIxGec0r9T2 Qg3aUgWmLoqIAewNBvZhnQsRQkG5wtP7SUXmDUoB0qgfeLbw8gMCeyoDbAg8pcYBnCjg PzIC7R7e4XmWiXq93I7drPducJN2AHtxumERzV8GUCIS3DKh+ggTENCAuJA4Hd7njY4i 8E8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390173; x=1716994973; 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=GgUsIx8ed6TkRFD72RRzx4QHPjFX183C6Bw53EkwCkQ=; b=fEmMF5la4p1Pa0x8wde5S2gdfF2bQO6hrWHIG52recmOffzvE1fe0dVhMwj6wB3nuw bvbIiMkZya+TcJCj5kDt8+lKg5KH5oWA3XthD+m4t5FN9BBIGbymDmW2hJrGdNQdExiV FJSKCMsZ6pFxVgbte2Zlm0HEpTE0OX7BHaYn36ue0H7HKgJsKnbGWfULakTSHMNKU0hx BUl6pUrVJCzoN7WbcFfhHUBjNgTbw5bDwBMRaagn2JypqVHAcXPq8qvqgm34HO6gvQtT 0/phTfyuhgdJS1/v4syrKHPgObLlIL0JiFQozsJ5gFQXVBKf9wvHciiTxfMvOfQtC0QV 5HOQ== X-Forwarded-Encrypted: i=1; AJvYcCWtH9A4KBwIE50O89m/vsRo7jh+kwqUz9LAFfNeqjHquRP2nnnP/nukrwdYx3nynGLu5NBqnrLH60UIBQQ1upeavAW4K1dR1Qnr X-Gm-Message-State: AOJu0YxG0GdllRiv9x9BbVLL3iegw0vEJu+QAdPXt2zeZ4482qeQEfpK g3/Q99SvdSK8zLw59YTMza/Oz6wFIaTEwdAVpGGC0osv+FdgSkQsjHU2mKUyLKU= X-Google-Smtp-Source: AGHT+IHyCHYYNmWWzpXhjpvsTTR8VSofZM1SnOjDCgrzbQXarHAbXHu4Sn+m+jj6ZJiPmf0ndNgQ8Q== X-Received: by 2002:a7b:cb44:0:b0:41b:8660:c530 with SMTP id 5b1f17b1804b1-420fd2d9c25mr16731045e9.5.1716390173171; Wed, 22 May 2024 08:02:53 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:52 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 4/6] iio: dac: ad3552r: add support for ad3541r and ad3551r Date: Wed, 22 May 2024 17:01:39 +0200 Message-ID: <20240522150141.1776196-5-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello Add support for single-output DAC variants. Signed-off-by: Angelo Dureghello --- Changes for v2: - adding new models using model data structure. --- drivers/iio/dac/ad3552r.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c index 6a40c7eece1f..b4630fb89334 100644 --- a/drivers/iio/dac/ad3552r.c +++ b/drivers/iio/dac/ad3552r.c @@ -140,7 +140,9 @@ enum ad3552r_ch_vref_select { }; enum ad3542r_id { + AD3541R_ID = 0x400b, AD3542R_ID = 0x4009, + AD3551R_ID = 0x400a, AD3552R_ID = 0x4008, }; @@ -1105,6 +1107,15 @@ static int ad3552r_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } +static const struct ad3552r_model_data ad3541r_model_data = { + .model_name = "ad3541r", + .chip_id = AD3541R_ID, + .num_hw_channels = 1, + .ranges_table = ad3542r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), + .requires_output_range = true, +}; + static const struct ad3552r_model_data ad3542r_model_data = { .model_name = "ad3542r", .chip_id = AD3542R_ID, @@ -1114,6 +1125,15 @@ static const struct ad3552r_model_data ad3542r_model_data = { .requires_output_range = true, }; +static const struct ad3552r_model_data ad3551r_model_data = { + .model_name = "ad3551r", + .chip_id = AD3551R_ID, + .num_hw_channels = 1, + .ranges_table = ad3552r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), + .requires_output_range = false, +}; + static const struct ad3552r_model_data ad3552r_model_data = { .model_name = "ad3552r", .chip_id = AD3552R_ID, @@ -1124,10 +1144,18 @@ static const struct ad3552r_model_data ad3552r_model_data = { }; static const struct spi_device_id ad3552r_id[] = { + { + .name = "ad3541r", + .driver_data = (kernel_ulong_t)&ad3541r_model_data + }, { .name = "ad3542r", .driver_data = (kernel_ulong_t)&ad3542r_model_data }, + { + .name = "ad3551r", + .driver_data = (kernel_ulong_t)&ad3551r_model_data + }, { .name = "ad3552r", .driver_data = (kernel_ulong_t)&ad3552r_model_data @@ -1137,7 +1165,9 @@ static const struct spi_device_id ad3552r_id[] = { MODULE_DEVICE_TABLE(spi, ad3552r_id); static const struct of_device_id ad3552r_of_match[] = { + { .compatible = "adi,ad3541r", .data = &ad3541r_model_data }, { .compatible = "adi,ad3542r", .data = &ad3542r_model_data }, + { .compatible = "adi,ad3551r", .data = &ad3551r_model_data }, { .compatible = "adi,ad3552r", .data = &ad3552r_model_data }, { } }; From patchwork Wed May 22 15:01:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670921 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 1730E52F9B for ; Wed, 22 May 2024 15:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390177; cv=none; b=NDhMesCk4f95lztYrqQrH5WOkgykRHnhbhuJCPkmWa3LkyGn7pci9Hs2QFwehnfOSRudufl4Bv5gVFhnD4h4haZ6lfjtZq4coPOC+EtcX+Ki/rMq+/lqUo5Am3xduRr/xnbtME58WiM3whD3dpomhoRNeu3d2LsfEjpVeTXw4BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390177; c=relaxed/simple; bh=Nl4giAAtfP1wgG/NEvZwNNNg55OtAUvdLhvjiOoMMiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c1065tNWxB2oIbVpXhJIBw0IDBUaPssnUy7si5NGqxf4vLWeEfhqZMHN7Kk1YGzx+dwLLtVqxd7vLmOHqG02T/ssK1nqHHkx5MTwiIOD60OP/2WkxD5wDPNLz3Vf4m2VjIrlBOblA5tw6D/PqFmGJFjmE1JHcbPqc1dHuwYevjs= 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=lOsOaVwT; arc=none smtp.client-ip=209.85.208.181 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="lOsOaVwT" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2e72b8931caso38421511fa.0 for ; Wed, 22 May 2024 08:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390174; x=1716994974; 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=7D6fFRwhN0Zkm+pAkm+qmc7n3e4Gjj3CxdaCMG+7qFE=; b=lOsOaVwTjbL3/MMOYpC+33vZF3ehhPbbX7OoGEGfu4alEbUs8E7wI0HlMsY5mmuncI pL85DjfL/tPF8YSeQtIOVWKCMxtNKeiK9lmgk85V8TPoj6U5Nir7lDYj1R98QmUa622J uEXS+VnwBAoOp3zSxP7yHt9+xHPnAgvZye+MANa3TazzkMEhrwOjf1R9JESiWCPGjydN tLi1gb2m88GmFpj5/j5K6BpybXZrO6cLOd6tFF1GKoT8J1YiyXO7jX7DwilRyGBYq8Tc oyuFh0rjJIfgjT0j45tqBHBIZShjqVhTN+W+nHAwFe1xJ+GauGMltb3tcnFGjIy2mSsd mcPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390174; x=1716994974; 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=7D6fFRwhN0Zkm+pAkm+qmc7n3e4Gjj3CxdaCMG+7qFE=; b=Ci8PRdlw8olfeOqX5yMlJJ7w2UaaGeB7bgDQU5P3UDHlg/o6y9PiIA8evs/xfonR1J KHxepzwH3FTDSfi/chO1m0TBhYL2WTntBBv6V4MxW57WRp6mjldyjo8IH0vmaYY4UXFE UA6hO04/e6Bx5tcV9O3ccR6pWxHH1XCyHvbIrZLhyo21fniwljSRCOOFEN4wdyZY+0A0 IFs2RgG9yfRfmhtBawHgNLigPDqSK2wJyX0toVkmK3s2LEBQiiwqII7iuFRnLK0M4xYJ ipohpCI5GHBUr3zWXBTR0oIHbE+6m7tDvxJktv2oCuTx1Bk4ugOcIo1ICukIu4iIRkhb eYgQ== X-Forwarded-Encrypted: i=1; AJvYcCX3QRSjzCKZoejRKXhLlWpJ3QK6ABd8rSUR5KSQATsneti/KIBpjMs+LtQKlrGZnJk1sPKU9YPjV8cIHhCBFwVQHcL4qw1scWnS X-Gm-Message-State: AOJu0Yx6SJBP94p/iDHEvaLC2UGZx85OHV1hXGtpFB4SmFfcqCS3qhCM EuOeQNOCffl0mJkussoKaXNRPCF28G6xa4P8bRlbqxNC4QAvNupCTJs5rgL2WNE= X-Google-Smtp-Source: AGHT+IGD/2vp9GYsoEwJ7/JTNdx/B3p8YYiryw+V1L9SZyquSNzerQr26Dr671cNpJ9rq5Cile52Dg== X-Received: by 2002:a2e:9dc1:0:b0:2e0:69b4:d655 with SMTP id 38308e7fff4ca-2e949501a7emr12417751fa.3.1716390174350; Wed, 22 May 2024 08:02:54 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:54 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 5/6] iio: dac: ad3552r: change AD3552R_NUM_CH define name Date: Wed, 22 May 2024 17:01:40 +0200 Message-ID: <20240522150141.1776196-6-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello After model data and num_hw_channles introduction, we have: ad3552r_desc, num_ch: used to keep channel number set in fdt, ad35xxr_model_data, num_hw_channels: for max channel checks, AD3552R_NUM_CH: just actually used to define the max array size on allocated arrays. Renaming AD3552R_NUM_CH to a more consistent name, as AD3552R_MAX_CH. Signed-off-by: Angelo Dureghello --- Changes for v2: - patch added in v2 --- drivers/iio/dac/ad3552r.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c index b4630fb89334..b8bdbfed22e3 100644 --- a/drivers/iio/dac/ad3552r.c +++ b/drivers/iio/dac/ad3552r.c @@ -117,7 +117,7 @@ #define AD3552R_REG_ADDR_CH_INPUT_24B(ch) (0x4B - (1 - ch) * 3) /* Useful defines */ -#define AD3552R_NUM_CH 2 +#define AD3552R_MAX_CH 2 #define AD3552R_MASK_CH(ch) BIT(ch) #define AD3552R_MASK_ALL_CH GENMASK(1, 0) #define AD3552R_MAX_REG_SIZE 3 @@ -279,8 +279,8 @@ struct ad3552r_desc { struct gpio_desc *gpio_reset; struct gpio_desc *gpio_ldac; struct spi_device *spi; - struct ad3552r_ch_data ch_data[AD3552R_NUM_CH]; - struct iio_chan_spec channels[AD3552R_NUM_CH + 1]; + struct ad3552r_ch_data ch_data[AD3552R_MAX_CH]; + struct iio_chan_spec channels[AD3552R_MAX_CH + 1]; unsigned long enabled_ch; unsigned int num_ch; }; @@ -539,7 +539,7 @@ static int32_t ad3552r_trigger_hw_ldac(struct gpio_desc *ldac) static int ad3552r_write_all_channels(struct ad3552r_desc *dac, u8 *data) { int err, len; - u8 addr, buff[AD3552R_NUM_CH * AD3552R_MAX_REG_SIZE + 1]; + u8 addr, buff[AD3552R_MAX_CH * AD3552R_MAX_REG_SIZE + 1]; addr = AD3552R_REG_ADDR_CH_INPUT_24B(1); /* CH1 */ @@ -597,7 +597,7 @@ static irqreturn_t ad3552r_trigger_handler(int irq, void *p) struct iio_buffer *buf = indio_dev->buffer; struct ad3552r_desc *dac = iio_priv(indio_dev); /* Maximum size of a scan */ - u8 buff[AD3552R_NUM_CH * AD3552R_MAX_REG_SIZE]; + u8 buff[AD3552R_MAX_CH * AD3552R_MAX_REG_SIZE]; int err; memset(buff, 0, sizeof(buff)); From patchwork Wed May 22 15:01:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13670922 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 2DD087CF16 for ; Wed, 22 May 2024 15:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390178; cv=none; b=i6Hk793wRVMdKYvUVfzrt7PrL3A1nztqAfxsskTdMjiqiPpuJCGkscwnxs9RS2KcpLLQz/JyJpgQccaEd/XIVab7nojYT+pp0I9SrqtVpwj8AEbE0UrgwmjedftcY5+p6dr66u4eqzzgdEgRV59ZgTS5YfsR0IYK1JOH5wDlWEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716390178; c=relaxed/simple; bh=pVh87fVqPqfQKJqqcDbSMFn+FcTBzRpmEsaCLIFq0AA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mV+Pk7wvbM5jcg2XEIGc+EtZ0L6Uon6nDsnKp1sNghxeNikfNjOk03y/FIMJc6eQVMwaI9GlE7f6vw7n6qY5cF2MLdi3IuXn5YLvwYw5NoZPeKd0L2Fj3Ag/J0q5I/63ywynJGEL0oard60Xh5b1bc3tPOKg+k/MtouF6248+ko= 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=J6Z3qU5V; arc=none smtp.client-ip=209.85.208.176 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="J6Z3qU5V" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e3b1b6e9d1so78074701fa.2 for ; Wed, 22 May 2024 08:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716390175; x=1716994975; 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=3jsqIIhfmiwTRQW5T/GGVz9A/caM/qGXeRU8xHOLSg0=; b=J6Z3qU5VeCfmizfMpuuKDk8Tr+51wldm0CshacVsxrmUiCdjjraP71SQfvnwiQaykq N1t2RjOw6OAXKyezl6O8kKGI5kuwzBfvKV2F773FvlFrv8Fn5h07WfGn7wgrzRDTkQde k9cPYPNNcCaqsLwLxb7rAtf9RPj73ofxdZr1wXNqySPud0l6Cp4JAHrwZhDnYZpfT0v8 lIkGjCxd6BPSp/G9NIar5ZcMN7DH2+wzgVlCy0eE0Gpk+w1P9DHEGUZGFs+B+L96RJed qxXlhV73fYCT/WfEZtqJwvEPMR7R/uweuulx9ZheyjhKQzvkAt38GL8E+7AI48YOs7TH pTdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716390175; x=1716994975; 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=3jsqIIhfmiwTRQW5T/GGVz9A/caM/qGXeRU8xHOLSg0=; b=cnlyRh292uPrfQ+dZMLYIvoyr+3MYVyw2DaT8W10XmgCRZ0b/wfzaZ8ojZ04vTy6aA mMG0pNegXR/0H6eSCOr7KbzKhUtlc4Ng/lpb4+KaE9h9xEZOKLs++FhUYgXZtcDMmhsq ovnpCqorszff53HER4MLbjzpl/MlJrtICXzED1ZeG7ft5eLDNl+gxHcUoTnwB8iUEAyG LLL2FET2iqlgUP9pYkW1bhuJle83FbXfA/V7IvM+H9804w3cNiWoLq/MYNDzj917sYFB v2czbliE+xc2fhGoSu1+ee9t0RGKMhub69naPTMjdmP4i0G2IyrarWItGNifnYa4epIQ E18g== X-Forwarded-Encrypted: i=1; AJvYcCXxDo6wbL7Y0ATAvbfJF/4rs+GsLxyYhHWmGUBhyZX0FYu57Ww7X5vcdoXMmf04PZzRSwDCRZ1gSkMuBHohByHku69Be54wHrx5 X-Gm-Message-State: AOJu0Yz3LjLj8Fq9f6maQi+Jjj9F3piBQO3+toIgCkFLBSQP04zlfEnS ekPg7KzBtINQ+fqdaKRmnFPnAGuzVrsm8WKstNTyX6E/+YIpMndNOpHVTcwx4KA= X-Google-Smtp-Source: AGHT+IFO99+pk7LErl0507i4+6glcqOJj5k3VvjWUKfZyuG4ISlN/d5VATvuxSfbiyh00Qg47KZK8Q== X-Received: by 2002:a2e:9d02:0:b0:2e4:7996:f9f0 with SMTP id 38308e7fff4ca-2e94946d417mr14305091fa.17.1716390175584; Wed, 22 May 2024 08:02:55 -0700 (PDT) Received: from localhost.localdomain (host-79-16-6-145.retail.telecomitalia.it. [79.16.6.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fa90e93absm531370515e9.9.2024.05.22.08.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 08:02:55 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello To: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: nuno.sa@analog.com, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello Subject: [PATCH v2 6/6] iio: dac: ad3552r: uniform structure names Date: Wed, 22 May 2024 17:01:41 +0200 Message-ID: <20240522150141.1776196-7-adureghello@baylibre.org> X-Mailer: git-send-email 2.45.0.rc1 In-Reply-To: <20240522150141.1776196-1-adureghello@baylibre.org> References: <20240522150141.1776196-1-adureghello@baylibre.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Angelo Dureghello Use same driver file name (ad3552r) for structure names used for all variants. Signed-off-by: Angelo Dureghello --- Changes for v2: - patch added in v2 --- drivers/iio/dac/ad3552r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c index b8bdbfed22e3..b060cdbc715d 100644 --- a/drivers/iio/dac/ad3552r.c +++ b/drivers/iio/dac/ad3552r.c @@ -139,7 +139,7 @@ enum ad3552r_ch_vref_select { AD3552R_EXTERNAL_VREF_PIN_INPUT }; -enum ad3542r_id { +enum ad3552r_id { AD3541R_ID = 0x400b, AD3542R_ID = 0x4009, AD3551R_ID = 0x400a, @@ -265,7 +265,7 @@ struct ad3552r_ch_data { struct ad3552r_model_data { const char *model_name; - enum ad3542r_id chip_id; + enum ad3552r_id chip_id; unsigned int num_hw_channels; const s32 (*ranges_table)[2]; int num_ranges;