* [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver
@ 2023-09-04 9:07 Shenghao Ding
2023-09-04 10:32 ` Andy Shevchenko
2023-09-04 10:53 ` Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Shenghao Ding @ 2023-09-04 9:07 UTC (permalink / raw)
To: tiwai
Cc: robh+dt, andriy.shevchenko, lgirdwood, perex,
pierre-louis.bossart, kevin-lu, 13916275206, alsa-devel,
linux-kernel, liam.r.girdwood, mengdong.lin, baojun.xu,
thomas.gfeller, peeyush, navada, broonie, gentuser, Shenghao Ding
Revert structure cs35l41_dev_name and redefine tas2781_generic_fixup.
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
---
Changes in v1:
- Redefine tas2781_generic_fixup, remove hid param
- revert from scodec_dev_name back to cs35l41_dev_name, it is unnecessary
for tas2781
---
sound/pci/hda/patch_realtek.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index a07df6f929..c3e410152b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6745,7 +6745,7 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_
}
}
-struct scodec_dev_name {
+struct cs35l41_dev_name {
const char *bus;
const char *hid;
int index;
@@ -6754,7 +6754,7 @@ struct scodec_dev_name {
/* match the device name in a slightly relaxed manner */
static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
{
- struct scodec_dev_name *p = data;
+ struct cs35l41_dev_name *p = data;
const char *d = dev_name(dev);
int n = strlen(p->bus);
char tmp[32];
@@ -6773,19 +6773,19 @@ static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
static int comp_match_tas2781_dev_name(struct device *dev,
void *data)
{
- struct scodec_dev_name *p = data;
+ const char *bus = data;
const char *d = dev_name(dev);
- int n = strlen(p->bus);
+ int n = strlen(bus);
char tmp[32];
/* check the bus name */
- if (strncmp(d, p->bus, n))
+ if (strncmp(d, bus, n))
return 0;
/* skip the bus number */
if (isdigit(d[n]))
n++;
/* the rest must be exact matching */
- snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
+ snprintf(tmp, sizeof(tmp), "-%s:00", "TIAS2781");
return !strcmp(d + n, tmp);
}
@@ -6795,7 +6795,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char
{
struct device *dev = hda_codec_dev(cdc);
struct alc_spec *spec = cdc->spec;
- struct scodec_dev_name *rec;
+ struct cs35l41_dev_name *rec;
int ret, i;
switch (action) {
@@ -6824,24 +6824,17 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char
}
static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
- const char *bus, const char *hid)
+ const char *bus)
{
struct device *dev = hda_codec_dev(cdc);
struct alc_spec *spec = cdc->spec;
- struct scodec_dev_name *rec;
int ret;
switch (action) {
case HDA_FIXUP_ACT_PRE_PROBE:
- rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
- if (!rec)
- return;
- rec->bus = bus;
- rec->hid = hid;
- rec->index = 0;
spec->comps[0].codec = cdc;
component_match_add(dev, &spec->match,
- comp_match_tas2781_dev_name, rec);
+ comp_match_tas2781_dev_name, (void *)bus);
ret = component_master_add_with_match(dev, &comp_master_ops,
spec->match);
if (ret)
@@ -6888,7 +6881,7 @@ static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const st
static void tas2781_fixup_i2c(struct hda_codec *cdc,
const struct hda_fixup *fix, int action)
{
- tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
+ tas2781_generic_fixup(cdc, action, "i2c");
}
/* for alc295_fixup_hp_top_speakers */
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver
2023-09-04 9:07 [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver Shenghao Ding
@ 2023-09-04 10:32 ` Andy Shevchenko
2023-09-04 10:53 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2023-09-04 10:32 UTC (permalink / raw)
To: Shenghao Ding
Cc: tiwai, robh+dt, lgirdwood, perex, pierre-louis.bossart, kevin-lu,
13916275206, alsa-devel, linux-kernel, liam.r.girdwood,
mengdong.lin, baojun.xu, thomas.gfeller, peeyush, navada, broonie,
gentuser
On Mon, Sep 04, 2023 at 05:07:24PM +0800, Shenghao Ding wrote:
> Revert structure cs35l41_dev_name and redefine tas2781_generic_fixup.
...
> /* check the bus name */
> - if (strncmp(d, p->bus, n))
> + if (strncmp(d, bus, n))
> return 0;
> /* skip the bus number */
> if (isdigit(d[n]))
> n++;
> /* the rest must be exact matching */
> - snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
> + snprintf(tmp, sizeof(tmp), "-%s:00", "TIAS2781");
>
> return !strcmp(d + n, tmp);
Try to use one of the respectve acpi_*_match*() APIs.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver
2023-09-04 9:07 [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver Shenghao Ding
2023-09-04 10:32 ` Andy Shevchenko
@ 2023-09-04 10:53 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-09-04 10:53 UTC (permalink / raw)
To: Shenghao Ding
Cc: robh+dt, andriy.shevchenko, lgirdwood, perex,
pierre-louis.bossart, kevin-lu, 13916275206, alsa-devel,
linux-kernel, liam.r.girdwood, mengdong.lin, baojun.xu,
thomas.gfeller, peeyush, navada, broonie, gentuser
On Mon, 04 Sep 2023 11:07:24 +0200,
Shenghao Ding wrote:
>
> Revert structure cs35l41_dev_name and redefine tas2781_generic_fixup.
>
> Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Now the patches are better split. But, a few fundamental things are
still missing:
- Please describe the reason why this is needed;
it's often more important than describing the change itself.
- Give more proper subject for each patch;
"Update tas2781 HDA driver" tells nothing really what and why.
thanks,
Takashi
> ---
> Changes in v1:
> - Redefine tas2781_generic_fixup, remove hid param
> - revert from scodec_dev_name back to cs35l41_dev_name, it is unnecessary
> for tas2781
> ---
> sound/pci/hda/patch_realtek.c | 27 ++++++++++-----------------
> 1 file changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index a07df6f929..c3e410152b 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -6745,7 +6745,7 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_
> }
> }
>
> -struct scodec_dev_name {
> +struct cs35l41_dev_name {
> const char *bus;
> const char *hid;
> int index;
> @@ -6754,7 +6754,7 @@ struct scodec_dev_name {
> /* match the device name in a slightly relaxed manner */
> static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
> {
> - struct scodec_dev_name *p = data;
> + struct cs35l41_dev_name *p = data;
> const char *d = dev_name(dev);
> int n = strlen(p->bus);
> char tmp[32];
> @@ -6773,19 +6773,19 @@ static int comp_match_cs35l41_dev_name(struct device *dev, void *data)
> static int comp_match_tas2781_dev_name(struct device *dev,
> void *data)
> {
> - struct scodec_dev_name *p = data;
> + const char *bus = data;
> const char *d = dev_name(dev);
> - int n = strlen(p->bus);
> + int n = strlen(bus);
> char tmp[32];
>
> /* check the bus name */
> - if (strncmp(d, p->bus, n))
> + if (strncmp(d, bus, n))
> return 0;
> /* skip the bus number */
> if (isdigit(d[n]))
> n++;
> /* the rest must be exact matching */
> - snprintf(tmp, sizeof(tmp), "-%s:00", p->hid);
> + snprintf(tmp, sizeof(tmp), "-%s:00", "TIAS2781");
>
> return !strcmp(d + n, tmp);
> }
> @@ -6795,7 +6795,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char
> {
> struct device *dev = hda_codec_dev(cdc);
> struct alc_spec *spec = cdc->spec;
> - struct scodec_dev_name *rec;
> + struct cs35l41_dev_name *rec;
> int ret, i;
>
> switch (action) {
> @@ -6824,24 +6824,17 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char
> }
>
> static void tas2781_generic_fixup(struct hda_codec *cdc, int action,
> - const char *bus, const char *hid)
> + const char *bus)
> {
> struct device *dev = hda_codec_dev(cdc);
> struct alc_spec *spec = cdc->spec;
> - struct scodec_dev_name *rec;
> int ret;
>
> switch (action) {
> case HDA_FIXUP_ACT_PRE_PROBE:
> - rec = devm_kmalloc(dev, sizeof(*rec), GFP_KERNEL);
> - if (!rec)
> - return;
> - rec->bus = bus;
> - rec->hid = hid;
> - rec->index = 0;
> spec->comps[0].codec = cdc;
> component_match_add(dev, &spec->match,
> - comp_match_tas2781_dev_name, rec);
> + comp_match_tas2781_dev_name, (void *)bus);
> ret = component_master_add_with_match(dev, &comp_master_ops,
> spec->match);
> if (ret)
> @@ -6888,7 +6881,7 @@ static void alc287_fixup_legion_16ithg6_speakers(struct hda_codec *cdc, const st
> static void tas2781_fixup_i2c(struct hda_codec *cdc,
> const struct hda_fixup *fix, int action)
> {
> - tas2781_generic_fixup(cdc, action, "i2c", "TIAS2781");
> + tas2781_generic_fixup(cdc, action, "i2c");
> }
>
> /* for alc295_fixup_hp_top_speakers */
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-04 10:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 9:07 [PATCH v1] ALSA: hda/tas2781: Update tas2781 HDA driver Shenghao Ding
2023-09-04 10:32 ` Andy Shevchenko
2023-09-04 10:53 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox