Unverified Commit f6272b59 authored by Mark Brown's avatar Mark Brown
Browse files

Cirrus Logic Family of ADCs

Merge series from Paul Handrigan <paulha@opensource.cirrus.com>:

This patchset provides ASoC support for the latest family
of Cirrus Logic multichannel, high performance audio ADCs.
The devices that are supported are CS5302 (2 channel ADC),
CS5304 (4 channel ADC), and CS5308 (8 channel ADC).
parents 3722873d 2884c291
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/cirrus,cs530x.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Cirrus Logic cs530x family of audio ADCs

maintainers:
  - Paul Handrigan <paulha@opensource.cirrus.com>
  - patches@opensource.cirrus.com

description:
  The CS530X devices are a family of high performance audio ADCs.

allOf:
  - $ref: dai-common.yaml#

properties:
  compatible:
    enum:
      - cirrus,cs5302
      - cirrus,cs5304
      - cirrus,cs5308

  reg:
    maxItems: 1

  '#sound-dai-cells':
    const: 1

  reset-gpios:
    maxItems: 1

  vdd-a-supply:
    description: Analog power supply

  vdd-io-supply:
    description: Digital IO power supply

  cirrus,in-hiz-pin12:
    description:
      Sets input channels one and two to high impedance.
    type: boolean

  cirrus,in-hiz-pin34:
    description:
      Sets input channels three and four to high impedance.
    type: boolean

  cirrus,in-hiz-pin56:
    description:
      Sets input channels five and six to high impedance.
    type: boolean

  cirrus,in-hiz-pin78:
    description:
      Sets input channels seven and eight to high impedance.
    type: boolean

required:
  - compatible
  - reg
  - "#sound-dai-cells"

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>

    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        cs5304: adc@48 {
            compatible = "cirrus,cs5304";
            reg = <0x48>;
            #sound-dai-cells = <1>;
            reset-gpios = <&gpio 110 GPIO_ACTIVE_LOW>;
            vdd-a-supply = <&vreg>;
            vdd-io-supply = <&vreg>;
            cirrus,in-hiz-pin34;
        };
    };
+14 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ config SND_SOC_ALL_CODECS
	imply SND_SOC_CS47L90
	imply SND_SOC_CS47L92
	imply SND_SOC_CS53L30
	imply SND_SOC_CS530X_I2C
	imply SND_SOC_CX20442
	imply SND_SOC_CX2072X
	imply SND_SOC_DA7210
@@ -1000,6 +1001,19 @@ config SND_SOC_CS53L30
	tristate "Cirrus Logic CS53L30 CODEC"
	depends on I2C

config SND_SOC_CS530X
	tristate

config SND_SOC_CS530X_I2C
	tristate "Cirrus Logic CS530x ADCs (I2C)"
	depends on I2C
	select REGMAP
	select REGMAP_I2C
	select SND_SOC_CS530X
	help
	  Enable support for Cirrus Logic CS530X ADCs
	  with I2C control.

config SND_SOC_CX20442
	tristate
	depends on TTY
+4 −0
Original line number Diff line number Diff line
@@ -107,6 +107,8 @@ snd-soc-cs47l85-y := cs47l85.o
snd-soc-cs47l90-y := cs47l90.o
snd-soc-cs47l92-y := cs47l92.o
snd-soc-cs53l30-y := cs53l30.o
snd-soc-cs530x-y := cs530x.o
snd-soc-cs530x-i2c-y := cs530x-i2c.o
snd-soc-cx20442-y := cx20442.o
snd-soc-cx2072x-y := cx2072x.o
snd-soc-da7210-y := da7210.o
@@ -509,6 +511,8 @@ obj-$(CONFIG_SND_SOC_CS47L85) += snd-soc-cs47l85.o
obj-$(CONFIG_SND_SOC_CS47L90)	+= snd-soc-cs47l90.o
obj-$(CONFIG_SND_SOC_CS47L92)	+= snd-soc-cs47l92.o
obj-$(CONFIG_SND_SOC_CS53L30)	+= snd-soc-cs53l30.o
obj-$(CONFIG_SND_SOC_CS530X)	+= snd-soc-cs530x.o
obj-$(CONFIG_SND_SOC_CS530X_I2C)	+= snd-soc-cs530x-i2c.o
obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
obj-$(CONFIG_SND_SOC_CX2072X)	+= snd-soc-cx2072x.o
obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
+72 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// CS530x CODEC driver
//
// Copyright (C) 2024 Cirrus Logic, Inc. and
//                    Cirrus Logic International Semiconductor Ltd.

#include <linux/device.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/regmap.h>

#include "cs530x.h"

static const struct of_device_id cs530x_of_match[] = {
	{
		.compatible = "cirrus,cs5302",
		.data = (void *)CS5302,
	}, {
		.compatible = "cirrus,cs5304",
		.data = (void *)CS5304,
	}, {
		.compatible = "cirrus,cs5308",
		.data = (void *)CS5308,
	},
	{}
};
MODULE_DEVICE_TABLE(of, cs530x_of_match);

static const struct i2c_device_id cs530x_i2c_id[] = {
	{ "cs5302", CS5302 },
	{ "cs5304", CS5304 },
	{ "cs5308", CS5308 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, cs530x_i2c_id);

static int cs530x_i2c_probe(struct i2c_client *client)
{
	struct cs530x_priv *cs530x;

	cs530x = devm_kzalloc(&client->dev, sizeof(*cs530x), GFP_KERNEL);
	if (!cs530x)
		return -ENOMEM;

	i2c_set_clientdata(client, cs530x);

	cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap);
	if (IS_ERR(cs530x->regmap))
		return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap),
			      "Failed to allocate register map\n");

	cs530x->devtype = (uintptr_t)i2c_get_match_data(client);
	cs530x->dev = &client->dev;

	return cs530x_probe(cs530x);
}

static struct i2c_driver cs530x_i2c_driver = {
	.driver = {
		.name = "cs530x",
		.of_match_table = cs530x_of_match,
	},
	.probe = cs530x_i2c_probe,
	.id_table = cs530x_i2c_id,
};
module_i2c_driver(cs530x_i2c_driver);

MODULE_DESCRIPTION("I2C CS530X driver");
MODULE_IMPORT_NS(SND_SOC_CS530X);
MODULE_AUTHOR("Paul Handrigan, Cirrus Logic Inc, <paulha@opensource.cirrus.com>");
MODULE_LICENSE("GPL");
+966 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading