From patchwork Thu Dec 19 11:39:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13914986 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 49BC722333F; Thu, 19 Dec 2024 11:39:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608362; cv=none; b=a8jbXoyR2RgFoS5XjfG9Fo/HQ71Bk115fk5HW+Uzv6IHRDOpMl0RtdWdeanYrlhBMpjBcm4S+tmD5tsgKek24/5gwGVTwVHHSLWlBwLArFuwnfpFMDi7Jf04ipp9chE9HKpJEbHdqnUBRr6ogTQgmJyoQUwd6HzGjhS7XPdOWLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608362; c=relaxed/simple; bh=l0IlVLAkN5yXM8TdTpl/M5HQwAIFuHAHi9RPBRHJdAs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qrbraDsQqa70k3bIgkPCCbSpWM86UllMZ7G4JTjvvxnlQ+5t37394sQj6BuE9tuAD/jmcF+Gb+yIQ/lBkpgAF179ZGzUsS6gx54T44HVSrPBE8MHy8ujwuwYEcmVTW9Hju24kwu/XQPhvRisqmIVvkOSt1EwiZTljbLqz/bqyko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J7zTvU1F; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J7zTvU1F" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53e3a227b82so572492e87.0; Thu, 19 Dec 2024 03:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734608356; x=1735213156; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=phIgK69RAEXPcDz3dpO+89wwhoyTuFBuPF479k215DY=; b=J7zTvU1FPLsiIRqE7lXVWf+n4MOaT4fKVVzOgUy2iDqNsftThtuJrOs1SI6VZyZ+DW AkhERQaLzEFnygd1npCRqn540PxXvuov7yFq0cS7Wyqep+f6eOYAtAt22pSODmQ3ZkBw p3YgiJpuS83vakkcXcNSGoDzsOK4GBpTCliVaEeJRrNAQF/l61qCRb+rB27h1WL+uvmB HdFLhM/u2SB9iod+Ph80na9FZumDTHVyqt34xQLxLO0nldGNCv2iQdiwwFyA7/4z+M1g FVC02OWWAErhm0yD4wdJLWns5JIk8lMVD4Az/D92iIo3PoUgzb1YQs1u+6tm2Po6J0RA jjJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734608356; x=1735213156; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=phIgK69RAEXPcDz3dpO+89wwhoyTuFBuPF479k215DY=; b=gIZ/PcFJhZ84g7hQFu/fsFn0yHIPRPr3PjWgaUBMtWorNVkH4Wjb9cU9K8gEKy8/4s wsOnELMYD5hPbhtx3iJ+vpl7hdE8VE9CefA9sN1kFyX+xwcqm3jd85r4fefqPegfneXh URrjGDDkSN1THq+517DHOuzGjak75BofVa9KfAmCtnQH2SN9RdiQCfcOq9bQemFA8aov DKKIMm3/A5dmuLG4t0+HeeVkt0s1dxTG9Z3ntbyGuI48+MTXWDCN/JzshEO9ChUVqKIc AESrsETZBySJKszMHPy3XzagDPNofzj67oYtXWa66Fu0Y0mVKQwdqIFW6ZY6kOhFbiBM eqaQ== X-Forwarded-Encrypted: i=1; AJvYcCVBbcu5IGMW13/6lSHg3oBVb1EaTo2tLzEUHz6c89PPD+bF7uGdhAhmZLJ93gIMAu8LqXK+o765gkFTozXR@vger.kernel.org, AJvYcCX7HTUBYlQLeKLdiR1HA20S0n5lA8JrhtqdCOfo/wKhOzmuo/X6fcaNsOV06Rj0YNnS/NaM7iH/bOwJ@vger.kernel.org, AJvYcCXUP0sI5GKZsWK6fc8nJi5YOYy8Dh1NSddGuO+vMH5PB+HiSlEIfVlYa2ee6f2derl7VVZrVF4pLe2i@vger.kernel.org X-Gm-Message-State: AOJu0YzV0CSdoutCSadRentazcKfE7RJj/zPmb17xxKdHkqFE4HuE+em S96jIPy5rSbjq8/w/nMMUsPKgjomNdmW2dVrjohwiGla20HA3XaS X-Gm-Gg: ASbGncuyn8Nh6wi87+BYxAqQ7v8+0ErjH/IvLyFP6vYKe7XfybWl7OsNo18gQPjlGvW 9Smt/YApmqZ4Pz1mGyxTW8RJElhFfmLNLHM/P0teO4obiETsMwzzlueZwKZqjXBI5gWApL/5Qas hT3twAsFi4oj23HYalLA23MD0TL06ADmuYFMz+kFDLT4Gt9k1G8O0ftRPEqbN/WKL9hkpcngvAw wCFyD+knw1B4zqwZGCaL39KEwdF5DMRIj2ziaLbsPX4NRuS63MZ4d974Jk= X-Google-Smtp-Source: AGHT+IGEVK5poKxbB63HZNpxWJ0TOq/vH32vHtcO5cLbMPftU+NGnE6tWAJzgOXbe6RkVzcZoCqROg== X-Received: by 2002:a05:6512:2807:b0:540:20b8:7341 with SMTP id 2adb3069b0e04-541e674453dmr2145347e87.8.1734608355899; Thu, 19 Dec 2024 03:39:15 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54223600596sm150514e87.92.2024.12.19.03.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 03:39:15 -0800 (PST) Date: Thu, 19 Dec 2024 13:39:11 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: Add ROHM BD79703 Message-ID: <51ed31c494ea7385940b59500e8592d12558e291.1734608215.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The ROHM BD79703 is a 8-bit, 6 channel DAC. Describe the dt-bindings. Signed-off-by: Matti Vaittinen Reviewed-by: Conor Dooley --- .../bindings/iio/dac/rohm,bd79703.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/dac/rohm,bd79703.yaml diff --git a/Documentation/devicetree/bindings/iio/dac/rohm,bd79703.yaml b/Documentation/devicetree/bindings/iio/dac/rohm,bd79703.yaml new file mode 100644 index 000000000000..c51b4037fd0d --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/rohm,bd79703.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2024 ROHM Semiconductor. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/dac/rohm,bd79703.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ROHM BD79703 DAC device driver + +maintainers: + - Matti Vaittinen + +description: | + The ROHM BD79703 is a 6 channel, 8-bit DAC. + Datasheet can be found here: + https://fscdn.rohm.com/en/products/databook/datasheet/ic/data_converter/dac/bd79702fv-lb_bd79703fv-lb-e.pdf + +properties: + compatible: + const: rohm,bd79703 + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 30000000 + + vfs-supply: + description: + The regulator to use as a full scale voltage. The voltage should be between 2.7V .. VCC + + vcc-supply: + description: + The regulator supplying the operating voltage. Should be between 2.7V ... 5.5V + +required: + - compatible + - reg + - spi-max-frequency + - vfs-supply + - vcc-supply + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +additionalProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + dac@0 { + compatible = "rohm,bd79703"; + reg = <0>; + spi-max-frequency = <30000000>; + vcc-supply = <&vcc>; + vfs-supply = <&vref>; + }; + }; +... From patchwork Thu Dec 19 11:39:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13914987 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 0B55A22333F; Thu, 19 Dec 2024 11:39:43 +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=1734608386; cv=none; b=Go5sruMXYG5LNOqx2AfM/z2fa6j9rFxlVIPWcyNwSn8G6789zl7T6b5PuWsQtJWqeeNGgui2TRYFG0SWtbztAFj1R3dBZE3v4ZLE3jiZZFyqgAxUk1JvW9Fw9pjXwicIqIQJUW9dE4sd1M1NeZBImlVPDALOMm7KyV2deyTn2/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608386; c=relaxed/simple; bh=BpvVk9RBybjIhBULLPFPLQZC6xFjt/iBacQP0svRC2Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Kz5PJi/Qnb8bkx8ylYY8FV/mtYcUWFlDaHVI/MZJth5+yehDubiyKtsNXEqNmC1sgl4OCBgrzzJHuQjC4fdOXgSs+9PXsr/V5EoPTACNcdvduhOJjwI7OrNVvJmInfP+HxWXnKmG6y5S9VhZAQnUC7iHriWcIeoXlCuOZCIu6M8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zn/F/f9r; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zn/F/f9r" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-3022c61557cso8695461fa.0; Thu, 19 Dec 2024 03:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734608382; x=1735213182; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tj7M2TYQwRqRjCdjgEUfmnNBUMXGglxvGoFiGkG4aIQ=; b=Zn/F/f9rQKA1eVA9cBFC8oSSl0GYiSweJjkv8B+rrMfeYu5+jA5eZLOd7lfaisolAb httDB7N3wwerSRmVBUBMi7n8If9SOWJXZWwhI1m3JAiBDglQVw5n5V1AzDRfOgmi78fp JWaZue1woDCgJRMb6wWrL1+HEhtuVinkn8AQ7px4UfpDJCX0IXUJRXRIerJvAxYim1Sy o9bDBaRBFCtoHYNUVlAQJHCHKsp/tikDTryUQ4FU7Dhz/E8zZrjI6XNiO0l4xKpOHqIS p1U8DrO2c7Gdgb+yipAJ3Rcy+CXesUMUIR0mM1n3yuh4efVfmtjnfpQHWnW0vRM3K7oV 82Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734608382; x=1735213182; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tj7M2TYQwRqRjCdjgEUfmnNBUMXGglxvGoFiGkG4aIQ=; b=lzvZBs2dNGgmprnmf6wui8tTgD+rVtLC9qvhmYwY8jteab1+hPZLQpVzHT1UlrkaGV OGLbhzasqbt1XD0RTuqc9d9322TfaHwGIb9QPmmwSCLqumdANJO8bKm0YvcuUBXaG8Mw 1/JDVKR2CZoDEKhB4CKUUKOJxgIJKA5A+KU7HezDUA554a7Eia8iTybFUfbn3ZiqWKoT rmXu44SJxVmNE8jCOq47n3OOlK92pZnNxp7iCRIgQin5gmCnERzc5ruJJsDXawX41Hsv equL2jVrWlsk3LE8CNIQP4IqtHRMkU9hZmkgHOxD3iRdgcEXXXS2A+4qrcLQuxsKgJy4 nFkw== X-Forwarded-Encrypted: i=1; AJvYcCURhfsK0lP0HSBWs7n8wDXCymoYi1k6JEAJiYu8gFH/UsPOeOOiDJAjUTvh4G50HCkeFt9DJEj9MsND@vger.kernel.org, AJvYcCV1m/CnzFy9H4AWqobTonXXkfQ/m3ESy0ys63ouS/yAgK948LyEDeqVcuIJ3Eum9b/WTJqE2d+d8xjo@vger.kernel.org, AJvYcCWSbY64iXWHMESQySMq8UOymfH4kDehkG5rSzM2SZ9R9MIAPq8AWBCfx18/ptGCwYw8YA5scxDyZtFw0HDv@vger.kernel.org X-Gm-Message-State: AOJu0Yz9gADXm1vAIlwBTIDwDU68GXesasgf64MZAopR7aXcun6bbfxq 7oBwJeGBFIEg0bfY8Vk5xmsUiiN0p3VoJal6p+ZFdF6jDVP8tZJpxUGu5w== X-Gm-Gg: ASbGncux9L937xA071Z+SuQIHpc7oJo2HIYDvmxsjom6QSTQtvnyLjQEZcSP7axMhzy 94DRQNi9WJYTyiX+NWdo0pj9NNiww61IvAuqDUVAM57z2SVf9EqasZyP8RVI6NPUhCi3UDUSoDa vKhlvyIpBz8PMEQX/Ud/Fe2Zi3mlnOFOHG/BwQpOEqwfxDN8MED875Qf/XO6kn1x/4JeaIc7i0a SL9L8CIQuIVSx3cdj9DW/6ofZzIFpYxXIHCBtE2NE5B7aEJZLYf9PAXGYw= X-Google-Smtp-Source: AGHT+IGWp8pRRpkvXuH/2iZ1kuJX/MLqsOFfNtHa9JdPgdKLsKhfJEIr/TRtQj9V/9r5kZdvU8WPBg== X-Received: by 2002:a05:6512:1315:b0:53e:398c:bf9e with SMTP id 2adb3069b0e04-54221031307mr861021e87.55.1734608381766; Thu, 19 Dec 2024 03:39:41 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238301fasm148867e87.242.2024.12.19.03.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 03:39:40 -0800 (PST) Date: Thu, 19 Dec 2024 13:39:37 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] iio: dac: Support ROHM BD79703 DAC Message-ID: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The ROHM BD79703 is a 6 channel digital to analog converter. Based on the data-sheet examples the hardware would support setting the DAC word without changing the actual output. The data-sheet is not too specific on how the enabling the output of new voltage set by DAC should be done - hence this is not implemented by the driver. The BD79703 would also support two specific "PULL_DOWN" modes. These aren't currently supported by the driver either. Add a very basic support for controlling the channel outputs one-by-one. Signed-off-by: Matti Vaittinen --- drivers/iio/dac/Kconfig | 8 ++ drivers/iio/dac/Makefile | 1 + drivers/iio/dac/rohm-bd79703.c | 162 +++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 drivers/iio/dac/rohm-bd79703.c diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index 4cde34e8c8e3..5690a37267d8 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -348,6 +348,14 @@ config AD8801 To compile this driver as a module choose M here: the module will be called ad8801. +config BD79703 + tristate "ROHM Semiconductor BD79703 DAC driver" + depends on SPI + select REGMAP_SPI + help + Say yes here to build support for ROHM Semiconductor BD79703 Digital + to Analog Converter (DAC). + config CIO_DAC tristate "Measurement Computing CIO-DAC IIO driver" depends on X86 && (ISA_BUS || PC104) diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile index 414c152be779..8dd6cce81ed1 100644 --- a/drivers/iio/dac/Makefile +++ b/drivers/iio/dac/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_AD8460) += ad8460.o obj-$(CONFIG_AD8801) += ad8801.o obj-$(CONFIG_AD9739A) += ad9739a.o obj-$(CONFIG_ADI_AXI_DAC) += adi-axi-dac.o +obj-$(CONFIG_BD79703) += rohm-bd79703.o obj-$(CONFIG_CIO_DAC) += cio-dac.o obj-$(CONFIG_DPOT_DAC) += dpot-dac.o obj-$(CONFIG_DS4424) += ds4424.o diff --git a/drivers/iio/dac/rohm-bd79703.c b/drivers/iio/dac/rohm-bd79703.c new file mode 100644 index 000000000000..a3df31d81b7c --- /dev/null +++ b/drivers/iio/dac/rohm-bd79703.c @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * BD79703 ROHM Digital to Analog converter + * + * Copyright (c) 2024, ROHM Semiconductor. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define BD79703_MAX_REGISTER 0xf +#define BD79703_DAC_BITS 8 +#define BD79703_REG_OUT_ALL GENMASK(2, 0) + +/* + * The BD79703 uses 12-bit SPI commands. First four bits (high bits) define + * channel(s) which are operated on, and also the mode. The mode can be to set + * a DAC word only, or set DAC word and output. The data-sheet is not very + * specific on how a previously set DAC word can be 'taken in to use'. Thus + * this driver only uses the 'set DAC and output it' -mode. + * + * The BD79703 latches last 12-bits when the chip-select is toggled. Thus we + * can use 16-bit transfers which should be widely supported. To simplify this + * further, we treat the last 8 bits as a value, and first 8 bits as an + * address. This allows us to separate channels/mode by address and treat the + * 8-bit register value as DAC word. The highest 4 bits of address will be + * discarded when the transfer is latched. + */ +static const struct regmap_config bd79703_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = BD79703_MAX_REGISTER, + .cache_type = REGCACHE_RBTREE, +}; + +struct bd79703_data { + struct regmap *regmap; + int vfs; +}; + +static int bd79703_read_raw(struct iio_dev *idev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct bd79703_data *data = iio_priv(idev); + + if (mask != IIO_CHAN_INFO_SCALE) + return -EINVAL; + + *val = data->vfs / 1000; + *val2 = BD79703_DAC_BITS; + + return IIO_VAL_FRACTIONAL_LOG2; +} + +static int bd79703_write_raw(struct iio_dev *idev, + struct iio_chan_spec const *chan, int val, + int val2, long mask) +{ + struct bd79703_data *data = iio_priv(idev); + + if (val < 0 || val >= 1 << BD79703_DAC_BITS) + return -EINVAL; + + return regmap_write(data->regmap, chan->channel + 1, val); +}; + +static const struct iio_info bd79703_info = { + .read_raw = bd79703_read_raw, + .write_raw = bd79703_write_raw, +}; + +#define BD79703_CHAN(_chan) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .output = 1, \ + .channel = (_chan), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + .address = (_chan), \ +} + +static const struct iio_chan_spec bd79703_channels[] = { + BD79703_CHAN(0), + BD79703_CHAN(1), + BD79703_CHAN(2), + BD79703_CHAN(3), + BD79703_CHAN(4), + BD79703_CHAN(5), +}; + +static int bd79703_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct bd79703_data *data; + struct iio_dev *idev; + int ret; + + idev = devm_iio_device_alloc(dev, sizeof(*data)); + if (!idev) + return -ENOMEM; + + data = iio_priv(idev); + + data->regmap = devm_regmap_init_spi(spi, &bd79703_regmap_config); + if (IS_ERR(data->regmap)) + return dev_err_probe(dev, PTR_ERR(data->regmap), + "Failed to initialize Regmap\n"); + + ret = devm_regulator_get_enable(dev, "vcc"); + if (ret) + return dev_err_probe(dev, ret, "Failed to enable VCC\n"); + + ret = devm_regulator_get_enable_read_voltage(dev, "vfs"); + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to get Vfs\n"); + + data->vfs = ret; + idev->channels = bd79703_channels; + idev->num_channels = ARRAY_SIZE(bd79703_channels); + idev->modes = INDIO_DIRECT_MODE; + idev->info = &bd79703_info; + idev->name = "bd79703"; + + /* Initialize all to output zero */ + ret = regmap_write(data->regmap, BD79703_REG_OUT_ALL, 0); + if (ret) + return ret; + + return devm_iio_device_register(dev, idev); +} + +static const struct spi_device_id bd79703_id[] = { + { "bd79703", }, + {} +}; +MODULE_DEVICE_TABLE(spi, bd79703_id); + +static const struct of_device_id bd79703_of_match[] = { + { .compatible = "rohm,bd79703", }, + { } +}; +MODULE_DEVICE_TABLE(of, bd79703_of_match); + +static struct spi_driver bd79703_driver = { + .driver = { + .name = "bd79703", + .of_match_table = bd79703_of_match, + }, + .probe = bd79703_probe, + .id_table = bd79703_id, +}; +module_spi_driver(bd79703_driver); + +MODULE_AUTHOR("Matti Vaittinen "); +MODULE_DESCRIPTION("ROHM BD79703 DAC driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Dec 19 11:39:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13914988 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.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 67DEF2236EB; Thu, 19 Dec 2024 11:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608405; cv=none; b=PGhF9rFhJS85iQtDR8NP7wZWXvhZDmqlmT7ELnwWqt+Rkh12JuHK95WeW7i5trYcWie2di+eaEZo46QjtNahrZ5lSBFGITZ73xoy6vWbw4/tnwyuI9cmsabcie7ca2Ez4z5Rj5h20xR+TtoZeKukLThQyROqs+L994+KZcVHNg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734608405; c=relaxed/simple; bh=GsWX0vVkkirrGEurGYJ73upRE090niXMZMeSM5m6kh8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pN20oFCJxjLrsB/GTHoT8oXDGrrpiOr6zbSJBWzAJjoOJ6+I+nmBhUZGXkCG5HOBkUyPqIUPFT98gcKZO6LIaFdEXqG5jHfbzd8Q3I9FoX95LxPiYiaBPMn5nKxMXisj0Nk3v2WUVR5wBpGMMdpsHBQIgB+93WEqSNter/KnSYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZX2hWVBe; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZX2hWVBe" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-53e3778bffdso692148e87.0; Thu, 19 Dec 2024 03:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734608401; x=1735213201; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=h6kur+fgYF8cqbUvJGhld4diSdQInsPI0wEyhGiq1Sg=; b=ZX2hWVBejCJsrs5SWZVzNmrMYfkTtyQbZEJWQ8j1AF5dam5xSey2S4FR54H+2mkCUz rJGsEjYUEIRD0PgUsXnsCBkyGm03VZt4d1FW1UnlFSoH0xV5X6dyiHOctDHTkvTrHv65 rM5Egz39MOvACztBi/PoBJqSry4rtIbmoeXuZ8YmNZkmChNiMQMz8AriqkYzDuCYwlO7 vx6Lyj/21SSljiEIWnjbWIUWSmq7UFhC1fFDy7tKvQrVYQ1xCTWsq8Y1nx0ARneW1ROk lYpot/qIpFvoZELLzKy7yIme4rXuUXfrM8z0Obop00gLvTMRVH0VvMAIvbKmVwFv5sF3 mLRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734608401; x=1735213201; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h6kur+fgYF8cqbUvJGhld4diSdQInsPI0wEyhGiq1Sg=; b=sTfX6t+ICsBBi6mNkoSpBOUr5mH/2TGfetEOQawNv5A8PaLGCjZETSUoI9rTi68g1r gLMoSbCaXb7KuppcG3b4z9o998UrCJJlMT6IVPmAT6NTjr44rlAdTcbkDmL1Q/RRIAlW 9iGjfS//fSQ8qyR5Qxq+SIbo6nIBoxLkGtRgnwY6Z5q3hnYR8wbWxSKUgzYibCu0dX/S EpUWHWlPrtc1D8BhknoOhc8HWrBTyd7xJYgFdwAnrpBT+d4Q4TuXvmihheMdg0Et2nun 4jAKSuLcVSyQnpqJwwhxTNmF3XaEVXq0XB2+1gicHwULeyGS2lO7jC4KPxYtgleGXOc/ kSyA== X-Forwarded-Encrypted: i=1; AJvYcCU8KKDKxv70Dh02uOnuJW6uI9bQTju7LP3J6aXOoEtY2VRZT8XChcBGkU8zoYeai1iG2Me985NUaz2n@vger.kernel.org, AJvYcCVZD2QpXvdtWR1e+41M5lmRT+sDD+9F7PQEKp7wixuMeU6dVUv7avWqW0mplQ4HOGjaH36whuqQUQT6@vger.kernel.org, AJvYcCWxGORktWbtXADtFB4g2G0UT9OExfnh7QGHiFTzBPOWim5EsOdnoPa5jKlk7EKTJGJIRTYcQpGcTF0O+5aG@vger.kernel.org X-Gm-Message-State: AOJu0YwsvzmBow2Y4PWlgpRJDTYa1lx1f4F+5SUgJxiX1Y874Ad0ui1f 3w6YgGFIC0qLdv/U3jML2BciAkt3eJxUbZLGaSqTybkbqD8g8QA4 X-Gm-Gg: ASbGncvLSOiiZFp6xgynRNqLaIoujHot15eyKpZnBeypUtOZh0MZ7inLgmA6qJ+pLmv rYoehSDwLEtLPrP25pIOK3UJF90i/qjOg81uQcahLIV4cdqu0O1xfXNvv9NTYiZ4E7XI9t2DMc9 4HrTJechnLQUqD9C05+TcH5qkXB2ZSVtm6bCCutNma26iveajKpaXuDOKMX5M5Vh9q9CzP48+qy HxSO++pvq9qLSnd6DHyfUf+gesRwWQlnh7UmUKZsSrDI/Q/HOR2EzBdvZw= X-Google-Smtp-Source: AGHT+IEjjBezRcljXDPG5A4unoJxUR/ijpAt9XHxlqsVSoLPsvSc5YtkKgIxlBOQkA4qy7BdPW6yvQ== X-Received: by 2002:a05:6512:224a:b0:542:24c8:e072 with SMTP id 2adb3069b0e04-54224c8e0e8mr488352e87.18.1734608401260; Thu, 19 Dec 2024 03:40:01 -0800 (PST) Received: from mva-rohm ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238217f9sm146250e87.211.2024.12.19.03.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 03:40:00 -0800 (PST) Date: Thu, 19 Dec 2024 13:39:55 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] MAINTAINERS: Add maintainer for ROHM BD79703 Message-ID: <5e99d4153b61a0d62174b8bde2ba6ae49da1e970.1734608215.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Add undersigned as a maintainer for the ROHM BD79703 DAC driver. Signed-off-by: Matti Vaittinen --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8e5167443cea..98a3c1e46311 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20286,6 +20286,11 @@ L: linux-serial@vger.kernel.org S: Odd Fixes F: drivers/tty/serial/rp2.* +ROHM BD79703 DAC +M: Matti Vaittinen +S: Supported +F: drivers/iio/dac/rohm-bd79703.c + ROHM BD99954 CHARGER IC M: Matti Vaittinen S: Supported