2022-06-16 15:47:16

by Péter Ujfalusi

[permalink] [raw]
Subject: [PATCH] mfd: twl4030-audio: Drop legacy, non DT boot support

Legacy or non DT boot is no longer possible on systems where the
tw4030/5030 is used.

Drop the support for handling legacy pdata.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
drivers/mfd/twl4030-audio.c | 29 ++++++-----------------------
1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index 4536d829b43e..c61da99e9681 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -144,14 +144,10 @@ unsigned int twl4030_audio_get_mclk(void)
}
EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);

-static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
- struct device_node *parent)
+static bool twl4030_audio_has_codec(struct device_node *parent)
{
struct device_node *node;

- if (pdata && pdata->codec)
- return true;
-
node = of_get_child_by_name(parent, "codec");
if (node) {
of_node_put(node);
@@ -161,14 +157,10 @@ static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
return false;
}

-static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
- struct device_node *node)
+static bool twl4030_audio_has_vibra(struct device_node *node)
{
int vibra;

- if (pdata && pdata->vibra)
- return true;
-
if (!of_property_read_u32(node, "ti,enable-vibra", &vibra) && vibra)
return true;

@@ -178,14 +170,13 @@ static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
static int twl4030_audio_probe(struct platform_device *pdev)
{
struct twl4030_audio *audio;
- struct twl4030_audio_data *pdata = dev_get_platdata(&pdev->dev);
struct device_node *node = pdev->dev.of_node;
struct mfd_cell *cell = NULL;
int ret, childs = 0;
u8 val;

- if (!pdata && !node) {
- dev_err(&pdev->dev, "Platform data is missing\n");
+ if (!node) {
+ dev_err(&pdev->dev, "Only DT boot si supported\n");
return -EINVAL;
}

@@ -222,22 +213,14 @@ static int twl4030_audio_probe(struct platform_device *pdev)
audio->resource[TWL4030_AUDIO_RES_APLL].reg = TWL4030_REG_APLL_CTL;
audio->resource[TWL4030_AUDIO_RES_APLL].mask = TWL4030_APLL_EN;

- if (twl4030_audio_has_codec(pdata, node)) {
+ if (twl4030_audio_has_codec(node)) {
cell = &audio->cells[childs];
cell->name = "twl4030-codec";
- if (pdata) {
- cell->platform_data = pdata->codec;
- cell->pdata_size = sizeof(*pdata->codec);
- }
childs++;
}
- if (twl4030_audio_has_vibra(pdata, node)) {
+ if (twl4030_audio_has_vibra(node)) {
cell = &audio->cells[childs];
cell->name = "twl4030-vibra";
- if (pdata) {
- cell->platform_data = pdata->vibra;
- cell->pdata_size = sizeof(*pdata->vibra);
- }
childs++;
}

--
2.36.1


2022-06-27 08:58:16

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH] mfd: twl4030-audio: Drop legacy, non DT boot support

On Thu, 16 Jun 2022, Peter Ujfalusi wrote:

> Legacy or non DT boot is no longer possible on systems where the
> tw4030/5030 is used.
>
> Drop the support for handling legacy pdata.
>
> Signed-off-by: Peter Ujfalusi <[email protected]>
> ---
> drivers/mfd/twl4030-audio.c | 29 ++++++-----------------------
> 1 file changed, 6 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
> index 4536d829b43e..c61da99e9681 100644
> --- a/drivers/mfd/twl4030-audio.c
> +++ b/drivers/mfd/twl4030-audio.c
> @@ -144,14 +144,10 @@ unsigned int twl4030_audio_get_mclk(void)
> }
> EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
>
> -static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
> - struct device_node *parent)
> +static bool twl4030_audio_has_codec(struct device_node *parent)
> {
> struct device_node *node;
>
> - if (pdata && pdata->codec)
> - return true;
> -
> node = of_get_child_by_name(parent, "codec");
> if (node) {
> of_node_put(node);
> @@ -161,14 +157,10 @@ static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata,
> return false;
> }
>
> -static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
> - struct device_node *node)
> +static bool twl4030_audio_has_vibra(struct device_node *node)
> {
> int vibra;
>
> - if (pdata && pdata->vibra)
> - return true;
> -
> if (!of_property_read_u32(node, "ti,enable-vibra", &vibra) && vibra)
> return true;
>
> @@ -178,14 +170,13 @@ static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata,
> static int twl4030_audio_probe(struct platform_device *pdev)
> {
> struct twl4030_audio *audio;
> - struct twl4030_audio_data *pdata = dev_get_platdata(&pdev->dev);
> struct device_node *node = pdev->dev.of_node;
> struct mfd_cell *cell = NULL;
> int ret, childs = 0;
> u8 val;
>
> - if (!pdata && !node) {
> - dev_err(&pdev->dev, "Platform data is missing\n");
> + if (!node) {

Is this check required at all?

How else would be get here?

> + dev_err(&pdev->dev, "Only DT boot si supported\n");

Spell check.

> return -EINVAL;
> }
>
> @@ -222,22 +213,14 @@ static int twl4030_audio_probe(struct platform_device *pdev)
> audio->resource[TWL4030_AUDIO_RES_APLL].reg = TWL4030_REG_APLL_CTL;
> audio->resource[TWL4030_AUDIO_RES_APLL].mask = TWL4030_APLL_EN;
>
> - if (twl4030_audio_has_codec(pdata, node)) {
> + if (twl4030_audio_has_codec(node)) {
> cell = &audio->cells[childs];
> cell->name = "twl4030-codec";
> - if (pdata) {
> - cell->platform_data = pdata->codec;
> - cell->pdata_size = sizeof(*pdata->codec);
> - }
> childs++;
> }
> - if (twl4030_audio_has_vibra(pdata, node)) {
> + if (twl4030_audio_has_vibra(node)) {
> cell = &audio->cells[childs];
> cell->name = "twl4030-vibra";
> - if (pdata) {
> - cell->platform_data = pdata->vibra;
> - cell->pdata_size = sizeof(*pdata->vibra);
> - }
> childs++;
> }
>

--
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog