From: Hans de Goede <hdegoede@redhat.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Jie Yang <yang.jie@linux.intel.com>,
Mark Brown <broonie@kernel.org>,
Oder Chiou <oder_chiou@realtek.com>
Cc: Hans de Goede <hdegoede@redhat.com>, alsa-devel@alsa-project.org
Subject: [PATCH 5/6] ASoC: rt5670: Remove struct rt5670_platform_data
Date: Sun, 28 Jun 2020 17:52:30 +0200 [thread overview]
Message-ID: <20200628155231.71089-6-hdegoede@redhat.com> (raw)
In-Reply-To: <20200628155231.71089-1-hdegoede@redhat.com>
platform_data is an obsolete concept, instead device_properties,
set through e.g. device-tree, should be used.
struct rt5670_platform_data is only used internally by the rt5670 codec
driver, so lets remove it before someone starts relying on it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
include/sound/rt5670.h | 26 ------------------
sound/soc/codecs/rt5670.c | 55 ++++++++++++++++++---------------------
sound/soc/codecs/rt5670.h | 16 +++++++++---
3 files changed, 38 insertions(+), 59 deletions(-)
delete mode 100644 include/sound/rt5670.h
diff --git a/include/sound/rt5670.h b/include/sound/rt5670.h
deleted file mode 100644
index 02e1d7778354..000000000000
--- a/include/sound/rt5670.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/rt5670.h -- Platform data for RT5670
- *
- * Copyright 2014 Realtek Microelectronics
- */
-
-#ifndef __LINUX_SND_RT5670_H
-#define __LINUX_SND_RT5670_H
-
-struct rt5670_platform_data {
- int jd_mode;
- bool in2_diff;
- bool dev_gpio;
- bool gpio1_is_ext_spk_en;
-
- bool dmic_en;
- unsigned int dmic1_data_pin;
- /* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
- unsigned int dmic2_data_pin;
- /* 0 = GPIO8; 1 = IN3N; */
- unsigned int dmic3_data_pin;
- /* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
-};
-
-#endif
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index dfbc0ca38ff7..515ab60bfe9c 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -25,7 +25,6 @@
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
-#include <sound/rt5670.h>
#include "rl6231.h"
#include "rt5670.h"
@@ -518,7 +517,7 @@ static int rt5670_irq_detection(void *data)
struct snd_soc_jack *jack = rt5670->jack;
int val, btn_type, report = jack->status;
- if (rt5670->pdata.jd_mode == 1) /* 2 port */
+ if (rt5670->jd_mode == 1) /* 2 port */
val = snd_soc_component_read32(rt5670->component, RT5670_A_JD_CTRL1) & 0x0070;
else
val = snd_soc_component_read32(rt5670->component, RT5670_A_JD_CTRL1) & 0x0020;
@@ -1454,7 +1453,7 @@ static int rt5670_spk_event(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
- if (!rt5670->pdata.gpio1_is_ext_spk_en)
+ if (!rt5670->gpio1_is_ext_spk_en)
return 0;
switch (event) {
@@ -2624,7 +2623,7 @@ static int rt5670_set_bias_level(struct snd_soc_component *component,
RT5670_LDO_SEL_MASK, 0x3);
break;
case SND_SOC_BIAS_OFF:
- if (rt5670->pdata.jd_mode)
+ if (rt5670->jd_mode)
snd_soc_component_update_bits(component, RT5670_PWR_ANLG1,
RT5670_PWR_VREF1 | RT5670_PWR_MB |
RT5670_PWR_BG | RT5670_PWR_VREF2 |
@@ -2927,7 +2926,6 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
static int rt5670_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
- struct rt5670_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct rt5670_priv *rt5670;
int ret;
unsigned int val;
@@ -2940,9 +2938,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, rt5670);
- if (pdata)
- rt5670->pdata = *pdata;
-
dmi_check_system(dmi_platform_intel_quirks);
if (quirk_override) {
dev_info(&i2c->dev, "Overriding quirk 0x%x => 0x%x\n",
@@ -2951,56 +2946,56 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
}
if (rt5670_quirk & RT5670_DEV_GPIO) {
- rt5670->pdata.dev_gpio = true;
+ rt5670->dev_gpio = true;
dev_info(&i2c->dev, "quirk dev_gpio\n");
}
if (rt5670_quirk & RT5670_GPIO1_IS_EXT_SPK_EN) {
- rt5670->pdata.gpio1_is_ext_spk_en = true;
+ rt5670->gpio1_is_ext_spk_en = true;
dev_info(&i2c->dev, "quirk GPIO1 is external speaker enable\n");
}
if (rt5670_quirk & RT5670_IN2_DIFF) {
- rt5670->pdata.in2_diff = true;
+ rt5670->in2_diff = true;
dev_info(&i2c->dev, "quirk IN2_DIFF\n");
}
if (rt5670_quirk & RT5670_DMIC_EN) {
- rt5670->pdata.dmic_en = true;
+ rt5670->dmic_en = true;
dev_info(&i2c->dev, "quirk DMIC enabled\n");
}
if (rt5670_quirk & RT5670_DMIC1_IN2P) {
- rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
+ rt5670->dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
dev_info(&i2c->dev, "quirk DMIC1 on IN2P pin\n");
}
if (rt5670_quirk & RT5670_DMIC1_GPIO6) {
- rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_GPIO6;
+ rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO6;
dev_info(&i2c->dev, "quirk DMIC1 on GPIO6 pin\n");
}
if (rt5670_quirk & RT5670_DMIC1_GPIO7) {
- rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_GPIO7;
+ rt5670->dmic1_data_pin = RT5670_DMIC_DATA_GPIO7;
dev_info(&i2c->dev, "quirk DMIC1 on GPIO7 pin\n");
}
if (rt5670_quirk & RT5670_DMIC2_INR) {
- rt5670->pdata.dmic2_data_pin = RT5670_DMIC_DATA_IN3N;
+ rt5670->dmic2_data_pin = RT5670_DMIC_DATA_IN3N;
dev_info(&i2c->dev, "quirk DMIC2 on INR pin\n");
}
if (rt5670_quirk & RT5670_DMIC2_GPIO8) {
- rt5670->pdata.dmic2_data_pin = RT5670_DMIC_DATA_GPIO8;
+ rt5670->dmic2_data_pin = RT5670_DMIC_DATA_GPIO8;
dev_info(&i2c->dev, "quirk DMIC2 on GPIO8 pin\n");
}
if (rt5670_quirk & RT5670_DMIC3_GPIO5) {
- rt5670->pdata.dmic3_data_pin = RT5670_DMIC_DATA_GPIO5;
+ rt5670->dmic3_data_pin = RT5670_DMIC_DATA_GPIO5;
dev_info(&i2c->dev, "quirk DMIC3 on GPIO5 pin\n");
}
if (rt5670_quirk & RT5670_JD_MODE1) {
- rt5670->pdata.jd_mode = 1;
+ rt5670->jd_mode = 1;
dev_info(&i2c->dev, "quirk JD mode 1\n");
}
if (rt5670_quirk & RT5670_JD_MODE2) {
- rt5670->pdata.jd_mode = 2;
+ rt5670->jd_mode = 2;
dev_info(&i2c->dev, "quirk JD mode 2\n");
}
if (rt5670_quirk & RT5670_JD_MODE3) {
- rt5670->pdata.jd_mode = 3;
+ rt5670->jd_mode = 3;
dev_info(&i2c->dev, "quirk JD mode 3\n");
}
@@ -3041,11 +3036,11 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
regmap_update_bits(rt5670->regmap, RT5670_DIG_MISC,
RT5670_MCLK_DET, RT5670_MCLK_DET);
- if (rt5670->pdata.in2_diff)
+ if (rt5670->in2_diff)
regmap_update_bits(rt5670->regmap, RT5670_IN2,
RT5670_IN_DF2, RT5670_IN_DF2);
- if (rt5670->pdata.dev_gpio) {
+ if (rt5670->dev_gpio) {
/* for push button */
regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000);
regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010);
@@ -3057,14 +3052,14 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
RT5670_GP1_PF_MASK, RT5670_GP1_PF_OUT);
}
- if (rt5670->pdata.gpio1_is_ext_spk_en) {
+ if (rt5670->gpio1_is_ext_spk_en) {
regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1,
RT5670_GP1_PIN_MASK, RT5670_GP1_PIN_GPIO1);
regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL2,
RT5670_GP1_PF_MASK, RT5670_GP1_PF_OUT);
}
- if (rt5670->pdata.jd_mode) {
+ if (rt5670->jd_mode) {
regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK,
RT5670_SCLK_SRC_MASK, RT5670_SCLK_SRC_RCCLK);
rt5670->sysclk = 0;
@@ -3079,7 +3074,7 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
RT5670_JD_TRI_CBJ_SEL_MASK |
RT5670_JD_TRI_HPO_SEL_MASK,
RT5670_JD_CBJ_JD1_1 | RT5670_JD_HPO_JD1_1);
- switch (rt5670->pdata.jd_mode) {
+ switch (rt5670->jd_mode) {
case 1:
regmap_update_bits(rt5670->regmap, RT5670_A_JD_CTRL1,
RT5670_JD1_MODE_MASK,
@@ -3100,12 +3095,12 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
}
}
- if (rt5670->pdata.dmic_en) {
+ if (rt5670->dmic_en) {
regmap_update_bits(rt5670->regmap, RT5670_GPIO_CTRL1,
RT5670_GP2_PIN_MASK,
RT5670_GP2_PIN_DMIC1_SCL);
- switch (rt5670->pdata.dmic1_data_pin) {
+ switch (rt5670->dmic1_data_pin) {
case RT5670_DMIC_DATA_IN2P:
regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1,
RT5670_DMIC_1_DP_MASK,
@@ -3134,7 +3129,7 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
break;
}
- switch (rt5670->pdata.dmic2_data_pin) {
+ switch (rt5670->dmic2_data_pin) {
case RT5670_DMIC_DATA_IN3N:
regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL1,
RT5670_DMIC_2_DP_MASK,
@@ -3154,7 +3149,7 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
break;
}
- switch (rt5670->pdata.dmic3_data_pin) {
+ switch (rt5670->dmic3_data_pin) {
case RT5670_DMIC_DATA_GPIO5:
regmap_update_bits(rt5670->regmap, RT5670_DMIC_CTRL2,
RT5670_DMIC_3_DP_MASK,
diff --git a/sound/soc/codecs/rt5670.h b/sound/soc/codecs/rt5670.h
index de0203369b7c..657420805918 100644
--- a/sound/soc/codecs/rt5670.h
+++ b/sound/soc/codecs/rt5670.h
@@ -9,8 +9,6 @@
#ifndef __RT5670_H__
#define __RT5670_H__
-#include <sound/rt5670.h>
-
/* Info */
#define RT5670_RESET 0x00
#define RT5670_VENDOR_ID 0xfd
@@ -1988,11 +1986,23 @@ int rt5670_sel_asrc_clk_src(struct snd_soc_component *component,
struct rt5670_priv {
struct snd_soc_component *component;
- struct rt5670_platform_data pdata;
struct regmap *regmap;
struct snd_soc_jack *jack;
struct snd_soc_jack_gpio hp_gpio;
+ int jd_mode;
+ bool in2_diff;
+ bool dev_gpio;
+ bool gpio1_is_ext_spk_en;
+
+ bool dmic_en;
+ unsigned int dmic1_data_pin;
+ /* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
+ unsigned int dmic2_data_pin;
+ /* 0 = GPIO8; 1 = IN3N; */
+ unsigned int dmic3_data_pin;
+ /* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
+
int sysclk;
int sysclk_src;
int lrck[RT5670_AIFS];
--
2.26.2
next prev parent reply other threads:[~2020-06-28 15:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-28 15:52 ASoC: rt5670/cht_bsw_rt5672: Some bugfixes and cleanups Hans de Goede
2020-06-28 15:52 ` [PATCH 1/6] ASoC: Intel: cht_bsw_rt5672: Change bus format to I2S 2 channel Hans de Goede
2020-06-29 15:06 ` Pierre-Louis Bossart
2020-06-29 19:38 ` Mark Brown
2020-07-01 19:33 ` Sasha Levin
2020-07-01 19:46 ` Pierre-Louis Bossart
2020-07-03 8:28 ` Hans de Goede
2020-07-03 17:03 ` Mark Brown
2020-07-10 14:02 ` Sasha Levin
2020-06-28 15:52 ` [PATCH 2/6] ASoC: rt5670: Correct RT5670_LDO_SEL_MASK Hans de Goede
2020-06-28 15:52 ` [PATCH 3/6] ASoC: rt5670: Add new gpio1_is_ext_spk_en quirk and enable it on the Lenovo Miix 2 10 Hans de Goede
2020-06-28 15:52 ` [PATCH 4/6] ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10 Hans de Goede
2020-06-29 15:10 ` Pierre-Louis Bossart
2020-06-28 15:52 ` Hans de Goede [this message]
2020-06-29 20:09 ` [PATCH 5/6] ASoC: rt5670: Remove struct rt5670_platform_data Mark Brown
2020-06-29 20:24 ` Hans de Goede
2020-06-29 21:01 ` Mark Brown
2020-06-28 15:52 ` [PATCH 6/6] ASoC: rt5670: Rename dev_gpio to gpio1_is_irq Hans de Goede
2020-06-29 15:14 ` ASoC: rt5670/cht_bsw_rt5672: Some bugfixes and cleanups Pierre-Louis Bossart
2020-06-29 20:02 ` Hans de Goede
2020-06-29 20:07 ` Mark Brown
2020-06-29 20:19 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200628155231.71089-6-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=oder_chiou@realtek.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=yang.jie@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).