#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#define UDA1334_NUM_RATES …
struct uda1334_priv { … };
static const struct snd_soc_dapm_widget uda1334_dapm_widgets[] = …;
static const struct snd_soc_dapm_route uda1334_dapm_routes[] = …;
static int uda1334_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct uda1334_priv *uda1334 = snd_soc_component_get_drvdata(component);
int deemph = ucontrol->value.integer.value[0];
if (deemph > 1)
return -EINVAL;
gpiod_set_value_cansleep(uda1334->deemph, deemph);
return 0;
};
static int uda1334_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct uda1334_priv *uda1334 = snd_soc_component_get_drvdata(component);
int ret;
ret = gpiod_get_value_cansleep(uda1334->deemph);
if (ret < 0)
return -EINVAL;
ucontrol->value.integer.value[0] = ret;
return 0;
};
static const struct snd_kcontrol_new uda1334_snd_controls[] = …;
static const struct { … } lrclk_ratios[UDA1334_NUM_RATES] = …;
static int uda1334_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static void uda1334_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{ … }
static int uda1334_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{ … }
static int uda1334_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{ … }
static int uda1334_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{ … }
#define UDA1334_RATES …
#define UDA1334_FORMATS …
static const struct snd_soc_dai_ops uda1334_dai_ops = …;
static struct snd_soc_dai_driver uda1334_dai = …;
static int uda1334_probe(struct snd_soc_component *component)
{ … }
static const struct snd_soc_component_driver soc_component_dev_uda1334 = …;
static const struct of_device_id uda1334_of_match[] = …;
MODULE_DEVICE_TABLE(of, uda1334_of_match);
static int uda1334_codec_probe(struct platform_device *pdev)
{ … }
static struct platform_driver uda1334_codec_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_ALIAS(…) …;
MODULE_LICENSE(…) …;