From patchwork Fri Feb 3 11:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 651302 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1183EC61DA4 for ; Fri, 3 Feb 2023 11:15:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E8E9AEA; Fri, 3 Feb 2023 12:15:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E8E9AEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675422956; bh=mji/ytLc7tOYCEPwqs1EmgoUqcX+zNXR6koMZjD50wc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=JqB2jNXsRBvAkm49uTks/wphQs/GaTn5Ps3EcoFTpd25VeT+fogdIWgDriYo3HODv euqVwSmAC3vLU8UdxnAOJY8OQxevVeF2hUlYJaRxOdIvsgPbYqXfEkaYbqaEWyrHZC 945uVHJmpNM7k79Ld9WDPq9+Q5UgjILncGIx33d0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3A544F8047D; Fri, 3 Feb 2023 12:14:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC3BBF80519; Fri, 3 Feb 2023 12:14:38 +0100 (CET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2137EF80254 for ; Fri, 3 Feb 2023 12:14:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2137EF80254 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=UbXmpiwI Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 172631C001B; Fri, 3 Feb 2023 11:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675422875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ge7sHeo6XljC/uKf8NYIO4UCkI+QIvq5OQ52h7yZfUg=; b=UbXmpiwIu3ZB6+OqqIWbGfPOjGbwGfKL7KdYSW+SquC2V9jkSdxG2VQr36U0xLtXJiaCCk JPkt1o9C1KOTlid8qdIFFC9lY6wh1pRvaru66d2cKX+5TkWj3qZQ6N2tEYNwEHd+mSd4SD iBC8b8U7B4vjHQA75eRogPEumGJPiGirVL+jb0P60e1AomONNedYXVHEKDALaKTp0euAqb H1C5FQ68496XDVXAHxMPc9UM1pESp1GEtmm+BAtdjKXtRnW1FhttXF06RKqwPfVcybzDIt 241ZpWs6fGx78aYg6F0dDm0HSONM1ss1dtweSpC1wW848jNZ4ZRLNDSShXF8vg== From: Herve Codina To: Herve Codina , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai Subject: [PATCH 1/3] dt-bindings: sound: Add the Renesas X9250 potentiometers Date: Fri, 3 Feb 2023 12:14:20 +0100 Message-Id: <20230203111422.142479-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203111422.142479-1-herve.codina@bootlin.com> References: <20230203111422.142479-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Christophe Leroy Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The Renesas X9250 is a quad digitally controlled potentiometers. Signed-off-by: Herve Codina --- .../bindings/sound/renesas,x9250.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/renesas,x9250.yaml diff --git a/Documentation/devicetree/bindings/sound/renesas,x9250.yaml b/Documentation/devicetree/bindings/sound/renesas,x9250.yaml new file mode 100644 index 000000000000..ad29ef465a18 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/renesas,x9250.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/renesas,x9250.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas X9250 quad potentiometers + +maintainers: + - Herve Codina + +description: | + The Renesas X9250 is a quad digitally controlled potentiometers. + + In the audio path, it can be present on amplifiers designs and it can be used + in ALSA as an auxiliary audio device to control these amplifiers. + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml + - $ref: dai-common.yaml# + +properties: + compatible: + const: renesas,x9250 + + reg: + description: + SPI device address. + maxItems: 1 + + spi-max-frequency: + maximum: 2000000 + +patternProperties: + "^renesas,cmd[0-3]-invert$": + description: + The related command is inverted meaning that the minimum command value + set the wiper to Rh and the maximum command value set the wiper to Rl. + Without this property, the minimum command value set the wiper to Rl and + the maximum to Rh. + type: boolean + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + x9250@0 { + compatible = "renesas,x9250"; + reg = <0>; + spi-max-frequency = <2000000>; + renesas,cmd3-invert; + }; + }; From patchwork Fri Feb 3 11:14:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 650116 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58029C61DA4 for ; Fri, 3 Feb 2023 11:16:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 11BF8E0F; Fri, 3 Feb 2023 12:15:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 11BF8E0F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675422980; bh=Qo13RALk8k0yyHsB6s2Xpk+9yGvBq1fA3k200yGQ42Y=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=AoqmJyTTXsYNjLUDmaq3RU+4rUEC0xPyyHWn8eoHKkFfxaErV+ayeNZ6CMOjixivQ Md9ayqPnquuLKtL+gMqPI+B6QeatTxw69DJyiSWlwy7e4OxvQkBZDhP1ws+i+ii5Xy NMWrSTu0GZqzK65sKw4cHB7JREcyt35BHu/Vods0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1C2A3F80543; Fri, 3 Feb 2023 12:14:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4458F80544; Fri, 3 Feb 2023 12:14:42 +0100 (CET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9D51DF800E3 for ; Fri, 3 Feb 2023 12:14:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9D51DF800E3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=bJXqoxVt Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id ECB891C0018; Fri, 3 Feb 2023 11:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675422877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/B138WsRSYzV/E8WT0lEWOcdHSuB7G8fsLebv6AbPjI=; b=bJXqoxVtEdLVSsEfkNhCZgLZ2isvARJIOyyihsuwupTJ6KB+aEkxJIxjIGI2QrfAw9DWmE KP5g+KD2tOqoSA3apz5T9Bb4Fi5T0wWyKC4S5DJJS2rqWX2WvpIirFm0YqFSbZPJ4gUfkF DkM1K9t5nj3fbRBSFEMyKrVcL0XPtjJUWur6IuwtPd1PqEJM4G1fd3D2BWK4LSjxmVE+av BpoNUR3T+WFUuODVlZezKdb4MyYe53z2RHB3Dt1cuHmQeqg+CqDvWAHURxe+jRehMJ1rOr SVaLddTP83RMblqrMdu/NtKhTo9qqy9EBt/PCOLUDnrg6+DnMfuvIEBaMNSuOQ== From: Herve Codina To: Herve Codina , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai Subject: [PATCH 2/3] ASoC: codecs: Add support for the Renesas X9250 potentiometers Date: Fri, 3 Feb 2023 12:14:21 +0100 Message-Id: <20230203111422.142479-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203111422.142479-1-herve.codina@bootlin.com> References: <20230203111422.142479-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Christophe Leroy Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The Renesas X9250 is a quad digitally controlled potentiometers. Signed-off-by: Herve Codina --- sound/soc/codecs/Kconfig | 11 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/x9250.c | 276 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 sound/soc/codecs/x9250.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 5531bf8d4b3f..19afa0067305 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -314,6 +314,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_WM9713 imply SND_SOC_WSA881X imply SND_SOC_WSA883X + imply SND_SOC_X9250 imply SND_SOC_ZL38060 help Normally ASoC codec drivers are only built if a machine driver which @@ -2053,6 +2054,16 @@ config SND_SOC_WSA883X This enables support for Qualcomm WSA8830/WSA8835 Class-D Smart Speaker Amplifier. +config SND_SOC_X9250 + tristate "Renesas X9250 quad controlled potentiometers" + depends on SPI + help + Enable support for the Renesas X9250 quad controlled + potentiometers. + + To compile this driver as a module, choose M here: the module + will be called snd-soc-x9250. + config SND_SOC_ZL38060 tristate "Microsemi ZL38060 Connected Home Audio Processor" depends on SPI_MASTER diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index bcf95de654fd..a1d6de6a18f6 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -346,6 +346,7 @@ snd-soc-wm9713-objs := wm9713.o snd-soc-wm-hubs-objs := wm_hubs.o snd-soc-wsa881x-objs := wsa881x.o snd-soc-wsa883x-objs := wsa883x.o +snd-soc-x9250-objs := x9250.o snd-soc-zl38060-objs := zl38060.o # Amp snd-soc-max9877-objs := max9877.o @@ -708,6 +709,7 @@ obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o obj-$(CONFIG_SND_SOC_WSA881X) += snd-soc-wsa881x.o obj-$(CONFIG_SND_SOC_WSA883X) += snd-soc-wsa883x.o +obj-$(CONFIG_SND_SOC_X9250) += snd-soc-x9250.o obj-$(CONFIG_SND_SOC_ZL38060) += snd-soc-zl38060.o # Amp diff --git a/sound/soc/codecs/x9250.c b/sound/soc/codecs/x9250.c new file mode 100644 index 000000000000..14f80009f085 --- /dev/null +++ b/sound/soc/codecs/x9250.c @@ -0,0 +1,276 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// x9250.c -- Renesas X9250 ALSA SoC driver +// +// Copyright 2023 CS GROUP France +// +// Author: Herve Codina + +#include +#include +#include +#include +#include + +#define X9250_NB_CHANNEL 4 + +struct x9250 { + struct spi_device *spi; + u8 spi_tx_buf[3]; /* Cannot use stack area for SPI (dma-safe memory) */ + u8 spi_rx_buf[3]; /* Cannot use stack area for SPI (dma-safe memory) */ + int cmd_inv; +}; + +#define X9250_CMD_RD_WCR(_p) (0x90 | (_p)) +#define X9250_CMD_WR_WCR(_p) (0xa0 | (_p)) + +static int x9250_write8(struct x9250 *x9250, u8 cmd, u8 val) +{ + struct spi_transfer xfer = { + .tx_buf = &x9250->spi_tx_buf, + .len = 3, + }; + + BUILD_BUG_ON(sizeof(x9250->spi_tx_buf) < 3); + + x9250->spi_tx_buf[0] = 0x50; + x9250->spi_tx_buf[1] = cmd; + x9250->spi_tx_buf[2] = val; + + return spi_sync_transfer(x9250->spi, &xfer, 1); +} + +static int x9250_read8(struct x9250 *x9250, u8 cmd, u8 *val) +{ + struct spi_transfer xfer = { + .tx_buf = &x9250->spi_tx_buf, + .rx_buf = &x9250->spi_rx_buf, + .len = 3, + }; + int ret; + + BUILD_BUG_ON(sizeof(x9250->spi_tx_buf) < 3); + BUILD_BUG_ON(sizeof(x9250->spi_rx_buf) < 3); + + x9250->spi_tx_buf[0] = 0x50; + x9250->spi_tx_buf[1] = cmd; + + ret = spi_sync_transfer(x9250->spi, &xfer, 1); + if (ret) + return ret; + + *val = x9250->spi_rx_buf[2]; + return 0; +} + +static const struct snd_soc_dapm_widget x9250_dapm_widgets[] = { + SND_SOC_DAPM_INPUT("IN0"), + SND_SOC_DAPM_INPUT("IN1"), + SND_SOC_DAPM_INPUT("IN2"), + SND_SOC_DAPM_INPUT("IN3"), + + SND_SOC_DAPM_PGA("CH0 PGA", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("CH1 PGA", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("CH2 PGA", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("CH3 PGA", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_OUTPUT("OUT0"), + SND_SOC_DAPM_OUTPUT("OUT1"), + SND_SOC_DAPM_OUTPUT("OUT2"), + SND_SOC_DAPM_OUTPUT("OUT3"), +}; + +static const struct snd_soc_dapm_route x9250_dapm_routes[] = { + { "CH0 PGA", NULL, "IN0" }, + { "CH1 PGA", NULL, "IN1" }, + { "CH2 PGA", NULL, "IN2" }, + { "CH3 PGA", NULL, "IN3" }, + + { "OUT0", NULL, "CH0 PGA" }, + { "OUT1", NULL, "CH1 PGA" }, + { "OUT2", NULL, "CH2 PGA" }, + { "OUT3", NULL, "CH3 PGA" }, +}; + +static int x8250_kctrl_cmd_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct x9250 *x9250 = snd_soc_component_get_drvdata(component); + int min = mc->min; + int max = mc->max; + unsigned int mask = (1 << fls(max)) - 1; + unsigned int invert = mc->invert; + int ret; + u8 val; + u8 wcr; + + wcr = mc->reg; + if (wcr > 4) + return -EINVAL; + + ret = x9250_read8(x9250, X9250_CMD_RD_WCR(wcr), &val); + if (ret) + return ret; + + ucontrol->value.integer.value[0] = (val & mask) - min; + if (invert) + ucontrol->value.integer.value[0] = max - ucontrol->value.integer.value[0]; + + return 0; +} + +static int x8250_kctrl_cmd_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct x9250 *x9250 = snd_soc_component_get_drvdata(component); + int min = mc->min; + int max = mc->max; + unsigned int mask = (1 << fls(max)) - 1; + unsigned int invert = mc->invert; + unsigned int val; + int ret; + u8 wcr; + u8 tmp; + + wcr = mc->reg; + if (wcr > 4) + return -EINVAL; + + val = ucontrol->value.integer.value[0]; + if (val < 0) + return -EINVAL; + if (val > max - min) + return -EINVAL; + + val = (val + min) & mask; + if (invert) + val = max - val; + + ret = x9250_read8(x9250, X9250_CMD_RD_WCR(wcr), &tmp); + if (ret) + return ret; + + if (tmp == val) + return 0; + + ret = x9250_write8(x9250, X9250_CMD_WR_WCR(wcr), val); + if (ret) + return ret; + + return 1; /* The value changed */ +} + +static const struct snd_kcontrol_new x9250_controls_std[] = { + SOC_SINGLE_EXT("CMD0", 0, 0, 255, 0, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD1", 1, 0, 255, 0, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD2", 2, 0, 255, 0, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD3", 3, 0, 255, 0, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), +}; + +static const struct snd_kcontrol_new x9250_controls_inv[] = { + SOC_SINGLE_EXT("CMD0", 0, 0, 255, 1, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD1", 1, 0, 255, 1, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD2", 2, 0, 255, 1, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), + SOC_SINGLE_EXT("CMD3", 3, 0, 255, 1, x8250_kctrl_cmd_get, x8250_kctrl_cmd_put), +}; + +static int x9250_component_probe(struct snd_soc_component *component) +{ + struct x9250 *x9250 = snd_soc_component_get_drvdata(component); + struct snd_kcontrol_new control[X9250_NB_CHANNEL]; + int ret; + u8 wcr; + int i; + + /* Check arrays compatibility */ + BUILD_BUG_ON(ARRAY_SIZE(x9250_controls_std) != X9250_NB_CHANNEL); + BUILD_BUG_ON(ARRAY_SIZE(x9250_controls_inv) != X9250_NB_CHANNEL); + BUILD_BUG_ON(sizeof(control[0]) != sizeof(x9250_controls_std[0])); + BUILD_BUG_ON(sizeof(control[0]) != sizeof(x9250_controls_inv[0])); + + for (i = 0; i < X9250_NB_CHANNEL; i++) { + if (x9250->cmd_inv & (1 << i)) { + wcr = 0xff; + memcpy(&control[i], &x9250_controls_inv[i], sizeof(control[i])); + } else { + wcr = 0x00; + memcpy(&control[i], &x9250_controls_std[i], sizeof(control[i])); + } + ret = x9250_write8(x9250, X9250_CMD_WR_WCR(i), wcr); + if (ret) + return ret; + } + + return snd_soc_add_component_controls(component, control, ARRAY_SIZE(control)); +} + +static const struct snd_soc_component_driver x9250_component_driver = { + .probe = x9250_component_probe, + .dapm_widgets = x9250_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(x9250_dapm_widgets), + .dapm_routes = x9250_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(x9250_dapm_routes), +}; + +static int x9250_spi_probe(struct spi_device *spi) +{ + struct x9250 *x9250; + int ret; + + spi->bits_per_word = 8; + ret = spi_setup(spi); + if (ret < 0) + return ret; + + x9250 = devm_kzalloc(&spi->dev, sizeof(*x9250), GFP_KERNEL); + if (x9250 == NULL) + return -ENOMEM; + + x9250->spi = spi; + + x9250->cmd_inv = 0; + if (of_property_read_bool(spi->dev.of_node, "renesas,cmd0-invert")) + x9250->cmd_inv |= (1 << 0); + if (of_property_read_bool(spi->dev.of_node, "renesas,cmd1-invert")) + x9250->cmd_inv |= (1 << 1); + if (of_property_read_bool(spi->dev.of_node, "renesas,cmd2-invert")) + x9250->cmd_inv |= (1 << 2); + if (of_property_read_bool(spi->dev.of_node, "renesas,cmd3-invert")) + x9250->cmd_inv |= (1 << 3); + + spi_set_drvdata(spi, x9250); + + return devm_snd_soc_register_component(&spi->dev, &x9250_component_driver, + NULL, 0); +} + +static const struct of_device_id x9250_of_match[] = { + { .compatible = "renesas,x9250", }, + { } +}; +MODULE_DEVICE_TABLE(of, x9250_of_match); + +static const struct spi_device_id x9250_id_table[] = { + { "x9250", 0 }, + { } +}; +MODULE_DEVICE_TABLE(spi, x9250_id_table); + +static struct spi_driver x9250_spi_driver = { + .driver = { + .name = "x9250", + .of_match_table = x9250_of_match, + }, + .id_table = x9250_id_table, + .probe = x9250_spi_probe, +}; + +module_spi_driver(x9250_spi_driver); + +MODULE_AUTHOR("Herve Codina "); +MODULE_DESCRIPTION("X9250 ALSA SoC driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Feb 3 11:14:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 651301 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE36FC636CC for ; Fri, 3 Feb 2023 11:16:31 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D976BE76; Fri, 3 Feb 2023 12:15:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D976BE76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675422989; bh=R8Q1Ff68CwRW3LN5JEac1D6+Q5cJJY1O8qGsHnR7s3w=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=kIWXFlgVRC50TfFlNldMgjBO4ImOUK/BOraZQH5a2cHCNSqAWE92kYkPkHVjPjIid 4VIw/3/8WXHJDuVpy3LkdhpOhE58OsxTpblMGycP0GoavUIBdTaAqKRE3u/8GabBcq 0zrKBLqgKtcY70foHbFms3LsN0SO99HeTTDoC+c0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BCB8AF80549; Fri, 3 Feb 2023 12:14:45 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47D20F80551; Fri, 3 Feb 2023 12:14:44 +0100 (CET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 27577F80169 for ; Fri, 3 Feb 2023 12:14:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27577F80169 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=dUKST8CV Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 4ED591C0014; Fri, 3 Feb 2023 11:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675422878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W42MFx6suAptLaA0wWjwDvw0VhASANBKLIIJxJFCArs=; b=dUKST8CVaLqp2JzjKoME7qSaZpaytThUwJzR5CkybjwsmyII+N0Wgjo40ZqXHchEfutqu9 0w+4TVJTLzP9SjJVqDFv/9doCyaCC6PlbzhIM0jZqtvGxoZaK3WO8iZZPkTsq4eJNU8sJg 7My+8gqxxZxZewu8S8C7rlsdk/+cL23JpHEjbHAa+CgXOLSd7xXWu2Xpm4LKk7dI3H5AaS 3TCpEAhhD57fxMEgs1vKIaeDZT5Zm5DDcFQrm1cTkD5nuhgY2pm33i7/nBbrM5HAvd6C7m 0HFFgBF/aD3f5+AUVk8O1Dxbb4a9ff34a6JiUdHA2LfWEP6v6ygg/Ebny8fTDA== From: Herve Codina To: Herve Codina , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai Subject: [PATCH 3/3] MAINTAINERS: add the Renesas X9250 ASoC entry Date: Fri, 3 Feb 2023 12:14:22 +0100 Message-Id: <20230203111422.142479-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203111422.142479-1-herve.codina@bootlin.com> References: <20230203111422.142479-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Christophe Leroy Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" After contributing the driver, add myself as the maintainer for the Renesas X9250 ASoC driver. Signed-off-by: Herve Codina --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 31115a7e01c1..cd22e8e06561 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17905,6 +17905,13 @@ S: Maintained F: Documentation/devicetree/bindings/clock/renesas,versaclock7.yaml F: drivers/clk/clk-versaclock7.c +RENESAS X9250 ASoC DRIVER +M: Herve Codina +L: alsa-devel@alsa-project.org (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/sound/renesas,x9250.yaml +F: sound/soc/codecs/x9250.c + RESET CONTROLLER FRAMEWORK M: Philipp Zabel S: Maintained