[alsa-devel] [PATCH v3 0/4] ASoC davinci/tlv320aic3x updates, fixes & DT support
1. Convert tlv320aic3x mic bias to a supply widget and related machine driver 2. Add DT support for Davinci machine platform 3. remove __dev* attributes
This patch-set is tested on Davinci platform (DA850 EVM). This series applies on top of tag next-20130128 git tree https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
These patches cannot be tested directly on mainline kernel (DT based). This is because dma is not yet completely ported to Davinci ASoC. I had to add few hacks to get Audio working on Davinci DA850 platform.
For reference, I have placed the entire working tree @ Tree : https://github.com/ghebbar/linux.git Branch : dev_next-20130128_davinci_asoc_dt_v3
changes in v3 - drop mcasp pinctrl handler patch from seried as it is now handled centrally. - Convert tlv320aic3x mic bias to a supply widget and related machine driver - remove __dev* attributes
Changes in V2 - Remove reference to Linux & software details from DT binding
Hebbar Gururaja (3): ASoC: tlv320aic3x: Convert mic bias to a supply widget ASoC: davinci: update machine driver dapm routes ASoC: davinci: remove __dev* attributes
Hebbar, Gururaja (1): ASoC: davinci: machine: Add device tree binding
.../bindings/sound/davinci-evm-audio.txt | 53 ++++++ .../devicetree/bindings/sound/tlv320aic3x.txt | 6 + include/sound/tlv320aic3x.h | 10 ++ sound/soc/codecs/tlv320aic3x.c | 83 ++++++++- sound/soc/codecs/tlv320aic3x.h | 4 + sound/soc/davinci/davinci-evm.c | 185 +++++++++++++++++--- 6 files changed, 312 insertions(+), 29 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
Convert MicBias widgets to supply widget.
On tlv320aic3x, Mic bias power on/off shares the same register bits with output mic bias voltage. So, when power on mic bias, we need reclaim it to voltage value.
Provide a new platform data so that the micbias voltage can be sent according to board requirement. Now since tlc320aic3x codec driver is DT aware, update dt files and functions to handle this new "micbias-vg" platform data.
Because of sharing of bits, when enabling the micbias, voltage also needs to be updated. So use SND_SOC_DAPM_POST_PMU & SND_SOC_DAPM_PRE_PMD macro to create an event to handle this.
Signed-off-by: Hebbar Gururaja gururaja.hebbar@ti.com --- Changes in v3 - New patch
:100644 100644 e7b98f4... f47c3f5... M Documentation/devicetree/bindings/sound/tlv320aic3x.txt :100644 100644 ffd9bc7... 9407fd0... M include/sound/tlv320aic3x.h :100644 100644 4989143... 65d09d6... M sound/soc/codecs/tlv320aic3x.c :100644 100644 6db3c41... e521ac3... M sound/soc/codecs/tlv320aic3x.h .../devicetree/bindings/sound/tlv320aic3x.txt | 6 ++ include/sound/tlv320aic3x.h | 10 +++ sound/soc/codecs/tlv320aic3x.c | 83 ++++++++++++++++++-- sound/soc/codecs/tlv320aic3x.h | 4 + 4 files changed, 97 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index e7b98f4..f47c3f5 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt @@ -11,6 +11,12 @@ Optional properties:
- gpio-reset - gpio pin number used for codec reset - ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality +- ai3x-micbias-vg - MicBias Voltage required. + 1 - MICBIAS output is powered to 2.0V, + 2 - MICBIAS output is powered to 2.5V, + 3 - MICBIAS output is connected to AVDD, + If this node is not mentioned or if the value is incorrect, then MicBias + is powered down.
Example:
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h index ffd9bc7..9407fd0 100644 --- a/include/sound/tlv320aic3x.h +++ b/include/sound/tlv320aic3x.h @@ -46,6 +46,13 @@ enum { AIC3X_GPIO2_FUNC_BUTTON_PRESS_IRQ = 15 };
+enum aic3x_micbias_voltage { + AIC3X_MICBIAS_OFF = 0, + AIC3X_MICBIAS_2_0V = 1, + AIC3X_MICBIAS_2_5V = 2, + AIC3X_MICBIAS_AVDDV = 3, +}; + struct aic3x_setup_data { unsigned int gpio_func[2]; }; @@ -53,6 +60,9 @@ struct aic3x_setup_data { struct aic3x_pdata { int gpio_reset; /* < 0 if not used */ struct aic3x_setup_data *setup; + + /* Selects the micbias voltage */ + enum aic3x_micbias_voltage micbias_vg; };
#endif diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 4989143..65d09d6 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -85,6 +85,9 @@ struct aic3x_priv { #define AIC3X_MODEL_33 1 #define AIC3X_MODEL_3007 2 u16 model; + + /* Selects the micbias voltage */ + enum aic3x_micbias_voltage micbias_vg; };
/* @@ -195,6 +198,37 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, return ret; }
+/* + * mic bias power on/off share the same register bits with + * output voltage of mic bias. when power on mic bias, we + * need reclaim it to voltage value. + * 0x0 = Powered off + * 0x1 = MICBIAS output is powered to 2.0V, + * 0x2 = MICBIAS output is powered to 2.5V + * 0x3 = MICBIAS output is connected to AVDD + */ +static int mic_bias_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_codec *codec = w->codec; + struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); + + switch (event) { + case SND_SOC_DAPM_POST_PMU: + /* change mic bias voltage to user defined */ + snd_soc_update_bits(codec, MICBIAS_CTRL, + MICBIAS_LEVEL_MASK, + aic3x->micbias_vg << MICBIAS_LEVEL_SHIFT); + break; + + case SND_SOC_DAPM_PRE_PMD: + snd_soc_update_bits(codec, MICBIAS_CTRL, + MICBIAS_LEVEL_MASK, 0); + break; + } + return 0; +} + static const char *aic3x_left_dac_mux[] = { "DAC_L1", "DAC_L3", "DAC_L2" }; static const char *aic3x_right_dac_mux[] = { "DAC_R1", "DAC_R3", "DAC_R2" }; static const char *aic3x_left_hpcom_mux[] = @@ -596,12 +630,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { AIC3X_ASD_INTF_CTRLA, 0, 3, 3, 0),
/* Mic Bias */ - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2V", - MICBIAS_CTRL, 6, 3, 1, 0), - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2.5V", - MICBIAS_CTRL, 6, 3, 2, 0), - SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias AVDD", - MICBIAS_CTRL, 6, 3, 3, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", MICBIAS_CTRL, 6, 0, + mic_bias_event, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
/* Output mixers */ SND_SOC_DAPM_MIXER("Left Line Mixer", SND_SOC_NOPM, 0, 0, @@ -1386,6 +1417,24 @@ static int aic3x_probe(struct snd_soc_codec *codec) if (aic3x->model == AIC3X_MODEL_3007) snd_soc_add_codec_controls(codec, &aic3x_classd_amp_gain_ctrl, 1);
+ /* set mic bias voltage */ + switch (aic3x->micbias_vg) { + case AIC3X_MICBIAS_2_0V: + case AIC3X_MICBIAS_2_5V: + case AIC3X_MICBIAS_AVDDV: + snd_soc_update_bits(codec, MICBIAS_CTRL, + MICBIAS_LEVEL_MASK, + (aic3x->micbias_vg) << MICBIAS_LEVEL_SHIFT); + break; + case AIC3X_MICBIAS_OFF: + /* + * noting to do. target won't enter here. This is just to avoid + * compile time warning "warning: enumeration value + * 'AIC3X_MICBIAS_OFF' not handled in switch" + */ + break; + } + aic3x_add_widgets(codec); list_add(&aic3x->list, &reset_list);
@@ -1461,6 +1510,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, struct aic3x_setup_data *ai3x_setup; struct device_node *np = i2c->dev.of_node; int ret; + u32 value;
aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL); if (aic3x == NULL) { @@ -1474,6 +1524,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, if (pdata) { aic3x->gpio_reset = pdata->gpio_reset; aic3x->setup = pdata->setup; + aic3x->micbias_vg = pdata->micbias_vg; } else if (np) { ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup), GFP_KERNEL); @@ -1493,6 +1544,26 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, aic3x->setup = ai3x_setup; }
+ if (!of_property_read_u32(np, "ai3x-micbias-vg", &value)) { + switch (value) { + case 1 : + aic3x->micbias_vg = AIC3X_MICBIAS_2_0V; + break; + case 2 : + aic3x->micbias_vg = AIC3X_MICBIAS_2_5V; + break; + case 3 : + aic3x->micbias_vg = AIC3X_MICBIAS_AVDDV; + break; + default : + aic3x->micbias_vg = AIC3X_MICBIAS_OFF; + dev_err(&i2c->dev, "Unsuitable MicBias voltage " + "found in DT\n"); + } + } else { + aic3x->micbias_vg = AIC3X_MICBIAS_OFF; + } + } else { aic3x->gpio_reset = -1; } diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h index 6db3c41..e521ac3 100644 --- a/sound/soc/codecs/tlv320aic3x.h +++ b/sound/soc/codecs/tlv320aic3x.h @@ -238,6 +238,10 @@ /* Default input volume */ #define DEFAULT_GAIN 0x20
+/* MICBIAS Control Register */ +#define MICBIAS_LEVEL_SHIFT (6) +#define MICBIAS_LEVEL_MASK (3 << 6) + /* headset detection / button API */
/* The AIC3x supports detection of stereo headsets (GND + left + right signal)
On Thu, Jan 31, 2013 at 04:53:10PM +0530, Hebbar Gururaja wrote:
:100644 100644 e7b98f4... f47c3f5... M Documentation/devicetree/bindings/sound/tlv320aic3x.txt :100644 100644 ffd9bc7... 9407fd0... M include/sound/tlv320aic3x.h :100644 100644 4989143... 65d09d6... M sound/soc/codecs/tlv320aic3x.c :100644 100644 6db3c41... e521ac3... M sound/soc/codecs/tlv320aic3x.h
As mentioned when you posted this before this patch needs to update the machine drivers using the device too.
On Thu, Jan 31, 2013 at 16:54:16, Mark Brown wrote:
On Thu, Jan 31, 2013 at 04:53:10PM +0530, Hebbar Gururaja wrote:
:100644 100644 e7b98f4... f47c3f5... M Documentation/devicetree/bindings/sound/tlv320aic3x.txt :100644 100644 ffd9bc7... 9407fd0... M include/sound/tlv320aic3x.h :100644 100644 4989143... 65d09d6... M sound/soc/codecs/tlv320aic3x.c :100644 100644 6db3c41... e521ac3... M sound/soc/codecs/tlv320aic3x.h
As mentioned when you posted this before this patch needs to update the machine drivers using the device too.
The patch-set 2/4 does the same thing. Since I have da850-evm at my end, I have modified that machine driver and sent-it as 2/4.
Regards, Gururaja
On Thu, Jan 31, 2013 at 11:27:07AM +0000, Hebbar, Gururaja wrote:
On Thu, Jan 31, 2013 at 16:54:16, Mark Brown wrote:
As mentioned when you posted this before this patch needs to update the machine drivers using the device too.
The patch-set 2/4 does the same thing. Since I have da850-evm at my end, I have modified that machine driver and sent-it as 2/4.
Two problems here. One is that the update should be done in the same patch and the other is that you need to update *all* the machine drivers using the device, not just one of them.
On Thu, Jan 31, 2013 at 17:00:38, Mark Brown wrote:
On Thu, Jan 31, 2013 at 11:27:07AM +0000, Hebbar, Gururaja wrote:
On Thu, Jan 31, 2013 at 16:54:16, Mark Brown wrote:
As mentioned when you posted this before this patch needs to update the machine drivers using the device too.
The patch-set 2/4 does the same thing. Since I have da850-evm at my end, I have modified that machine driver and sent-it as 2/4.
Two problems here. One is that the update should be done in the same patch and the other is that you need to update *all* the machine drivers using the device, not just one of them.
Ok, I will send the updated version now.
Regards, Gururaja
Now since micbias is converted to supply widget, updated machine driver as well.
Signed-off-by: Hebbar Gururaja gururaja.hebbar@ti.com --- Changes in v3 - New patch
:100644 100644 d55e647... 484b22c... M sound/soc/davinci/davinci-evm.c sound/soc/davinci/davinci-evm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index d55e647..484b22c 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -116,9 +116,9 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Line Out", NULL, "RLOUT"},
/* Mic connected to (MIC3L | MIC3R) */ - {"MIC3L", NULL, "Mic Bias 2V"}, - {"MIC3R", NULL, "Mic Bias 2V"}, - {"Mic Bias 2V", NULL, "Mic Jack"}, + {"MIC3L", NULL, "Mic Bias"}, + {"MIC3R", NULL, "Mic Bias"}, + {"Mic Bias", NULL, "Mic Jack"},
/* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */ {"LINE1L", NULL, "Line In"},
From: "Hebbar, Gururaja" gururaja.hebbar@ti.com
Device tree support for Davinci Machine driver
When the board boots with device tree, the driver will receive card, codec, dai interface details (like the card name, DAPM routing map, phandle for the audio components described in the dts file, codec mclk speed). The card will be set up based on this information. Since the routing is provided via DT we can mark the card fully routed so core can take care of disconnecting the unused pins.
Signed-off-by: Hebbar, Gururaja gururaja.hebbar@ti.com --- Changes in v3 - New patch
Changes in v2 - Remove reference to Linux & software details from DT binding
:000000 100644 0000000... 92ad4c7... A Documentation/devicetree/bindings/sound/davinci-evm-audio.txt :100644 100644 484b22c... e6009a4... M sound/soc/davinci/davinci-evm.c .../bindings/sound/davinci-evm-audio.txt | 53 ++++++ sound/soc/davinci/davinci-evm.c | 179 +++++++++++++++++--- 2 files changed, 212 insertions(+), 20 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt new file mode 100644 index 0000000..92ad4c7 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt @@ -0,0 +1,53 @@ +* Texas Instruments SoC audio setups with TLV320AIC3X Codec + +Required properties: +- compatible : + "ti,dm365-voice-codec-audio" : for DM365 platforms with Voice Codec + "ti,da830-evm-audio" : for DM365/DA8xx/OMAPL1x/AM33xx + +- ti,model : The user-visible name of this sound complex. +- ti,audio-codec : The phandle of the TLV320AIC3x audio codec +- ti,mcasp-controller : The phandle of the McASP controller +- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec +- ti,audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the connection's sink, + the second being the connection's source. Valid names for sources and + sinks are the codec's pins, and the jacks on the board: + + Codec pins: + + * MIC3L + * MIC3R + * LINE1L + * LINE2L + * LINE1R + * LINE2R + + Board connectors: + + * Headphone Jack + * Line Out + * Mic Jack + + +Example: + +sound { + compatible = "ti,da830-evm-audio"; + ti,model = "DA830 EVM"; + ti,audio-codec = <&tlv320aic3x>; + ti,mcasp-controller = <&mcasp1>; + ti,codec-clock-rate = <12000000>; + ti,audio-routing = + "Headphone Jack", "HPLOUT", + "Headphone Jack", "HPROUT", + "Line Out", "LLOUT", + "Line Out", "RLOUT", + "MIC3L", "Mic Bias", + "MIC3R", "Mic Bias", + "Mic Bias", "Mic Jack", + "LINE1L", "Line In", + "LINE2L", "Line In", + "LINE1R", "Line In", + "LINE2R", "Line In"; +}; diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 484b22c..e6009a4 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -15,6 +15,7 @@ #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/i2c.h> +#include <linux/of_platform.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> @@ -34,27 +35,38 @@ static int evm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_card *soc_card = codec->card; + struct device_node *np = soc_card->dev->of_node; int ret = 0; unsigned sysclk;
- /* ASP1 on DM355 EVM is clocked by an external oscillator */ - if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() || - machine_is_davinci_dm365_evm()) - sysclk = 27000000; - - /* ASP0 in DM6446 EVM is clocked by U55, as configured by - * board-dm644x-evm.c using GPIOs from U18. There are six - * options; here we "know" we use a 48 KHz sample rate. - */ - else if (machine_is_davinci_evm()) - sysclk = 12288000; - - else if (machine_is_davinci_da830_evm() || - machine_is_davinci_da850_evm()) - sysclk = 24576000; - - else - return -EINVAL; + if (np) { + ret = of_property_read_u32(np, "ti,codec-clock-rate", &sysclk); + if (ret < 0) + return ret; + } else { + /* ASP1 on DM355 EVM is clocked by an external oscillator */ + if (machine_is_davinci_dm355_evm() || + machine_is_davinci_dm6467_evm() || + machine_is_davinci_dm365_evm()) + sysclk = 27000000; + + /* + * ASP0 in DM6446 EVM is clocked by U55, as configured by + * board-dm644x-evm.c using GPIOs from U18. There are six + * options; here we "know" we use a 48 KHz sample rate. + */ + else if (machine_is_davinci_evm()) + sysclk = 12288000; + + else if (machine_is_davinci_da830_evm() || + machine_is_davinci_da850_evm()) + sysclk = 24576000; + + else + return -EINVAL; + }
/* set codec DAI configuration */ ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT); @@ -132,13 +144,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; + struct device_node *np = codec->card->dev->of_node; + int ret;
/* Add davinci-evm specific widgets */ snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets, ARRAY_SIZE(aic3x_dapm_widgets));
- /* Set up davinci-evm specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + if (np) { + ret = snd_soc_of_parse_audio_routing(codec->card, + "ti,audio-routing"); + if (ret) + return ret; + } else { + /* Set up davinci-evm specific audio path audio_map */ + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + }
/* not connected */ snd_soc_dapm_disable_pin(dapm, "MONO_LOUT"); @@ -287,6 +308,108 @@ static struct snd_soc_card da850_snd_soc_card = { .num_links = 1, };
+#if defined(CONFIG_OF) + +enum { + MACHINE_VERSION_1 = 0, /* DM365 with Voice Codec */ + MACHINE_VERSION_2, /* DM365/DA8xx/OMAPL1x/AM33xx */ +}; + +static const struct of_device_id davinci_evm_dt_ids[] = { + { + .compatible = "ti,dm365-voice-codec-audio", + .data = (void *)MACHINE_VERSION_1, + }, + { + .compatible = "ti,da830-evm-audio", + .data = (void *)MACHINE_VERSION_2, + }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, davinci_mcasp_dt_ids); + +/* + * This struct is just used as place holder. It will be filled with + * data from dt node + */ +static struct snd_soc_dai_link evm_dai = { + .name = "TLV320AIC3X", + .stream_name = "AIC3X", + .codec_dai_name = "tlv320aic3x-hifi", +}; + +/* davinci evm audio machine driver */ +static struct snd_soc_card evm_soc_card = { + .owner = THIS_MODULE, + .dai_link = &evm_dai, + .num_links = 1, +}; + +static int davinci_evm_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + const struct of_device_id *match = + of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); + u32 machine_ver; + int ret = 0; + + machine_ver = (u32)match->data; + switch (machine_ver) { + case MACHINE_VERSION_1: + evm_dai.name = "Voice Codec - CQ93VC"; + evm_dai.stream_name = "CQ93"; + evm_dai.codec_dai_name = "cq93vc-hifi"; + break; + + case MACHINE_VERSION_2: + evm_dai.ops = &evm_ops; + evm_dai.init = evm_aic3x_init; + break; + } + + evm_dai.codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); + if (!evm_dai.codec_of_node) + return -EINVAL; + + evm_dai.cpu_of_node = of_parse_phandle(np, + "ti,mcasp-controller", 0); + if (!evm_dai.cpu_of_node) + return -EINVAL; + + evm_dai.platform_of_node = evm_dai.cpu_of_node; + + evm_soc_card.dev = &pdev->dev; + ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model"); + if (ret) + return ret; + + ret = snd_soc_register_card(&evm_soc_card); + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); + + return ret; +} + +static int __devexit davinci_evm_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver davinci_evm_driver = { + .probe = davinci_evm_probe, + .remove = __devexit_p(davinci_evm_remove), + .driver = { + .name = "davinci_evm", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(davinci_evm_dt_ids), + }, +}; +#endif + static struct platform_device *evm_snd_device;
static int __init evm_init(void) @@ -295,6 +418,15 @@ static int __init evm_init(void) int index; int ret;
+#if defined(CONFIG_OF) + /* + * If dtb is there, the devices will be created dynamically. + * Only register platfrom driver structure. + */ + if (of_have_populated_dt()) + return platform_driver_register(&davinci_evm_driver); +#endif + if (machine_is_davinci_evm()) { evm_snd_dev_data = &dm6446_snd_soc_card_evm; index = 0; @@ -330,6 +462,13 @@ static int __init evm_init(void)
static void __exit evm_exit(void) { +#if defined(CONFIG_OF) + if (of_have_populated_dt()) { + platform_driver_unregister(&davinci_evm_driver); + return; + } +#endif + platform_device_unregister(evm_snd_device); }
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away.
Remove use of __devexit_p and __devexit.
Signed-off-by: Hebbar Gururaja gururaja.hebbar@ti.com --- Changes in v3 - New patch
:100644 100644 e6009a4... 37b8e78... M sound/soc/davinci/davinci-evm.c sound/soc/davinci/davinci-evm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index e6009a4..37b8e78 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -390,7 +390,7 @@ static int davinci_evm_probe(struct platform_device *pdev) return ret; }
-static int __devexit davinci_evm_remove(struct platform_device *pdev) +static int davinci_evm_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev);
@@ -401,7 +401,7 @@ static int __devexit davinci_evm_remove(struct platform_device *pdev)
static struct platform_driver davinci_evm_driver = { .probe = davinci_evm_probe, - .remove = __devexit_p(davinci_evm_remove), + .remove = davinci_evm_remove, .driver = { .name = "davinci_evm", .owner = THIS_MODULE,
participants (3)
-
Hebbar Gururaja
-
Hebbar, Gururaja
-
Mark Brown