Anil Kumar K has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: [WIP] drivers/soundwire/alc711 : Add RT711 soundwire device ......................................................................
[WIP] drivers/soundwire/alc711 : Add RT711 soundwire device
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 165 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/1
diff --git a/src/drivers/soundwire/alc711/Kconfig b/src/drivers/soundwire/alc711/Kconfig new file mode 100644 index 0000000..bdc02a9 --- /dev/null +++ b/src/drivers/soundwire/alc711/Kconfig @@ -0,0 +1,2 @@ +config DRIVERS_SOUNDWIRE_ALC711 + bool diff --git a/src/drivers/soundwire/alc711/Makefile.inc b/src/drivers/soundwire/alc711/Makefile.inc new file mode 100644 index 0000000..78e4d1b --- /dev/null +++ b/src/drivers/soundwire/alc711/Makefile.inc @@ -0,0 +1 @@ +ramstage-$(CONFIG_DRIVERS_SOUNDWIRE_ALC711) += alc711.c diff --git a/src/drivers/soundwire/alc711/alc711.c b/src/drivers/soundwire/alc711/alc711.c new file mode 100644 index 0000000..bbe0ae0 --- /dev/null +++ b/src/drivers/soundwire/alc711/alc711.c @@ -0,0 +1,150 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <acpi/acpigen.h> +#include <acpi/acpi_device.h> +#include <acpi/acpi_soundwire.h> +#include <device/device.h> +#include <device/path.h> +#include <device/mipi_ids.h> +#include <device/soundwire.h> +#include <stdio.h> + +#include "chip.h" + +static struct soundwire_address alc711_address = { + .version = SOUNDWIRE_VERSION_1_1, + .manufacturer_id = MIPI_MFG_ID_REALTEK, + .part_id = MIPI_DEV_ID_REALTEK_ALC711, + .class = MIPI_CLASS_NONE +}; + +static struct soundwire_slave alc711_slave = { + .wake_up_unavailable = false, + .test_mode_supported = false, + .clock_stop_mode1_supported = true, + .simplified_clockstopprepare_sm_supported = true, + .clockstopprepare_hard_reset_behavior = false, + .highPHY_capable = false, + .paging_supported = false, + .bank_delay_supported = false, + .port15_read_behavior = false, + .source_port_list = SOUNDWIRE_PORT(2), + .sink_port_list = SOUNDWIRE_PORT(1), +}; + +static struct soundwire_audio_mode alc711_audio_mode = { + /* Bus frequency must be 1/2/4/8 divider of + supported input frequencies. */ + .bus_frequency_configs_count = 12, + .bus_frequency_configs = { + 9600 * KHz, 4800 * KHz, 2400 * KHz, 1200 * KHz, /* 9.6 MHz */ + 12000 * KHz, 6000 * KHz, 3000 * KHz, 1500 * KHz, /* 12 MHz */ + 12288 * KHz, 6144 * KHz, 3072 * KHz, 1536 * KHz /* 12.28 MHz */ + }, + /* Support 16 KHz to 96 KHz sampling frequency */ + .sampling_frequency_configs_count = 8, + .sampling_frequency_configs = { + 16 * KHz, + 22.05 * KHz, + 24 * KHz, + 32 * KHz, + 44.1 * KHz, + 48 * KHz, + 88.2 * KHz, + 96 * KHz, + }, + .prepare_channel_behavior = CHANNEL_PREPARE_ANY_FREQUENCY +}; + +static struct soundwire_dpn alc711_dp1 = { + .port_wordlength_configs_count = 1, + .port_wordlength_configs = { 32 }, + .data_port_type = FULL_DATA_PORT, + .max_grouping_supported = BLOCK_GROUP_COUNT_1, + .simplified_channelprepare_sm = false, + .imp_def_dpn_interrupts_supported = 0, + .min_channel_number = 1, + .max_channel_number = 2, + .modes_supported = MODE_ISOCHRONOUS | MODE_TX_CONTROLLED | + MODE_RX_CONTROLLED | MODE_FULL_ASYNCHRONOUS, + .block_packing_mode = true, + .port_audio_mode_count = 1, + .port_audio_mode_list = { 0 } +}; + +static const struct soundwire_codec alc711_codec = { + .slave = &alc711_slave, + .audio_mode = { &alc711_audio_mode }, + .dpn = { + { + + /* Data Input for Speaker Path */ + .port = 1, + .sink = &alc711_dp1 + }, + { + + /* Data Input for Speaker Path */ + .port = 1, + .source = &alc711_dp1 + } + } + +}; + +static void soundwire_alc711_fill_ssdt(const struct device *dev) +{ + struct drivers_soundwire_alc711_config *config = dev->chip_info; + const char *scope = acpi_device_scope(dev); + struct acpi_dp *dsd; + + if (!dev->enabled || !scope) + return; + + acpigen_write_scope(scope); + acpigen_write_device(acpi_device_name(dev)); + + /* Set codec address IDs. */ + alc711_address.link_id = dev->path.generic.id; + alc711_address.unique_id = dev->path.generic.subid; + + acpigen_write_ADR_soundwire_device(&alc711_address); + acpigen_write_name_string("_DDN", config->desc ? : dev->chip_ops->name); + acpigen_write_STA(acpi_device_status(dev)); + + dsd = acpi_dp_new_table("_DSD"); + soundwire_gen_codec(dsd, &alc711_codec, NULL); + acpi_dp_write(dsd); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} + +static const char *soundwire_alc711_acpi_name(const struct device *dev) +{ + struct drivers_soundwire_alc711_config *config = dev->chip_info; + static char name[5]; + + if (config->name) + return config->name; + snprintf(name, sizeof(name), "SW%1X%1X", dev->path.generic.id, \ + dev->path.generic.subid); + return name; +} + +static struct device_operations soundwire_alc711_ops = { + .read_resources = noop_read_resources, + .set_resources = noop_set_resources, + .acpi_name = soundwire_alc711_acpi_name, + .acpi_fill_ssdt = soundwire_alc711_fill_ssdt, +}; + +static void soundwire_alc711_enable(struct device *dev) +{ + dev->ops = &soundwire_alc711_ops; +} + +struct chip_operations drivers_soundwire_alc711_ops = { + CHIP_NAME("Realtek ALC711 SoundWire Codec") + .enable_dev = soundwire_alc711_enable +}; diff --git a/src/drivers/soundwire/alc711/chip.h b/src/drivers/soundwire/alc711/chip.h new file mode 100644 index 0000000..6d317fd --- /dev/null +++ b/src/drivers/soundwire/alc711/chip.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ +#define __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ + +struct drivers_soundwire_alc711_config { + const char *name; + const char *desc; +}; + +#endif /* __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ */ diff --git a/src/include/device/mipi_ids.h b/src/include/device/mipi_ids.h index 86b5116..cfbf3dd 100644 --- a/src/include/device/mipi_ids.h +++ b/src/include/device/mipi_ids.h @@ -20,6 +20,7 @@ /* Contributing Members */ #define MIPI_MFG_ID_REALTEK 0x025d #define MIPI_DEV_ID_REALTEK_ALC5682 0x5682 +#define MIPI_DEV_ID_REALTEK_ALC711 0x0711
#define MIPI_MFG_ID_MAXIM 0x019f #define MIPI_DEV_ID_MAXIM_MAX98373 0x8373
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: [WIP] drivers/soundwire/alc711 : Add RT711 soundwire device ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/1/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/1/src/drivers/soundwire/alc71... PS1, Line 130: snprintf(name, sizeof(name), "SW%1X%1X", dev->path.generic.id, \ Avoid unnecessary line continuations
Sathyanarayana Nujella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: [WIP] drivers/soundwire/alc711 : Add RT711 soundwire device ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46303/1//COMMIT_MSG@7 PS1, Line 7: Add RT711 s please use same in code and here: either RT711 or ALC711
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46303
to look at the new patch set (#2).
Change subject: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT . Checked sound card binding works and soundwire drivers are enabled in kernel
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 165 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/2
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46303
to look at the new patch set (#3).
Change subject: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 165 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/3
Anil Kumar K has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device ......................................................................
Patch Set 3: Code-Review+1
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device ......................................................................
Patch Set 3:
(4 comments)
https://review.coreboot.org/c/coreboot/+/46303/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46303/3//COMMIT_MSG@7 PS3, Line 7: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device Please remove the space before the colon.
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 40: 9600 * KHz, 4800 * KHz, 2400 * KHz, 1200 * KHz, /* 9.6 MHz */ Add the space before the 9600?
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 80: Please remove the blank line.
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 86: Please remove the blank line.
Hello Sathyanarayana Nujella, build bot (Jenkins), Patrick Georgi, Martin Roth, Sridhar Siricilla,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46303
to look at the new patch set (#4).
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711: Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 163 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/4
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 128: snprintf(name, sizeof(name), "SW%1X%1X", dev->path.generic.id, \ Avoid unnecessary line continuations
Anil Kumar K has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 4: Code-Review+1
(5 comments)
https://review.coreboot.org/c/coreboot/+/46303/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46303/1//COMMIT_MSG@7 PS1, Line 7: Add RT711 s
please use same in code and here: either RT711 or ALC711
Done
https://review.coreboot.org/c/coreboot/+/46303/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46303/3//COMMIT_MSG@7 PS3, Line 7: drivers/soundwire/alc711 : Add Realtek ALC711 soundwire device
Please remove the space before the colon.
Done
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 40: 9600 * KHz, 4800 * KHz, 2400 * KHz, 1200 * KHz, /* 9.6 MHz */
Add the space before the 9600?
i used the format from other patchsets ex. https://review.coreboot.org/c/coreboot/+/40890 can we retain it this way ?
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 80:
Please remove the blank line.
Done
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 86:
Please remove the blank line.
Done
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 4:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 36: /* Bus frequency must be 1/2/4/8 divider of : supported input frequencies. */ can go to 96 chars so probably don't need to break this line
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 84: { : /* Data Input for Speaker Path */ : .port = 1, : .source = &alc711_dp1 : } : } seems duplicated? Is there a second port for output?
these should match what is reported in alc711_slave.{sink,source}_port_list
Hello Sathyanarayana Nujella, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth, Duncan Laurie, Subrata Banik, Sridhar Siricilla,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46303
to look at the new patch set (#5).
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711: Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 163 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/5
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... PS5, Line 128: snprintf(name, sizeof(name), "SW%1X%1X", dev->path.generic.id, \ Avoid unnecessary line continuations
Anil Kumar K has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 5: Code-Review+1
(2 comments)
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 36: /* Bus frequency must be 1/2/4/8 divider of : supported input frequencies. */
can go to 96 chars so probably don't need to break this line
Done
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 84: { : /* Data Input for Speaker Path */ : .port = 1, : .source = &alc711_dp1 : } : }
seems duplicated? Is there a second port for output? […]
ACK. Hi Duncan. I updated the port info as per my understanding from datasheet. Did some basic testing - headphone jack detection and playback on headset
Sathyanarayana Nujella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/5/src/include/device/mipi_ids... File src/include/device/mipi_ids.h:
https://review.coreboot.org/c/coreboot/+/46303/5/src/include/device/mipi_ids... PS5, Line 23: 0x0711 Nit:
use tab here..
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... PS5, Line 59: dp1 nit: might just name this 'dp' since it is being applied to both dp1 and dp2.
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... PS5, Line 128: \ should be able to just remove the \ here
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/4/src/drivers/soundwire/alc71... PS4, Line 84: { : /* Data Input for Speaker Path */ : .port = 1, : .source = &alc711_dp1 : } : }
ACK. Hi Duncan. I updated the port info as per my understanding from datasheet. […]
these datasheets really don't make it easy sometimes...
Hello Sathyanarayana Nujella, build bot (Jenkins), Furquan Shaikh, Patrick Georgi, Martin Roth, Duncan Laurie, Subrata Banik, Sridhar Siricilla,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46303
to look at the new patch set (#6).
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711: Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 162 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/6
Anil Kumar K has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6: Code-Review+1
(3 comments)
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... PS5, Line 59: dp1
nit: might just name this 'dp' since it is being applied to both dp1 and dp2.
Done
https://review.coreboot.org/c/coreboot/+/46303/5/src/drivers/soundwire/alc71... PS5, Line 128: \
should be able to just remove the \ here
Done
https://review.coreboot.org/c/coreboot/+/46303/5/src/include/device/mipi_ids... File src/include/device/mipi_ids.h:
https://review.coreboot.org/c/coreboot/+/46303/5/src/include/device/mipi_ids... PS5, Line 23: 0x0711
Nit: […]
Done
Sathyanarayana Nujella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6: Code-Review+1
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6: Code-Review+2
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6: Code-Review+2
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 40: 9600 * KHz, 4800 * KHz, 2400 * KHz, 1200 * KHz, /* 9.6 MHz */
i used the format from other patchsets ex. https://review.coreboot.org/c/coreboot/+/40890 […]
@Paul, can you please help here. We need this CL for ADL work as well.
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 6:
HI Patrick, can you please help here, what we can do to get this CL in ?
Subrata Banik has uploaded a new patch set (#7) to the change originally created by Anil Kumar K. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711: Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 171 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46303/7
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... File src/drivers/soundwire/alc711/alc711.c:
https://review.coreboot.org/c/coreboot/+/46303/3/src/drivers/soundwire/alc71... PS3, Line 40: 9600 * KHz, 4800 * KHz, 2400 * KHz, 1200 * KHz, /* 9.6 MHz */
@Paul, can you please help here. We need this CL for ADL work as well.
Ack
Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 7:
Please help to review once, address all review comments
Sathyanarayana Nujella has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 7: Code-Review+1
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
Patch Set 7: Code-Review+2
Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46303 )
Change subject: drivers/soundwire/alc711: Add Realtek ALC711 soundwire device ......................................................................
drivers/soundwire/alc711: Add Realtek ALC711 soundwire device
Bug=None Test=Enabled the device on TGLY RVP and tested that the codec is reflected in SSDT. Checked sound card binding works and soundwire drivers are enabled in kernel.
Signed-off-by: Anil Kumar anil.kumar.k@intel.com Change-Id: Ia7358927fe8531e609ebe070bef259a2bbc09093 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46303 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Sathyanarayana Nujella sathyanarayana.nujella@intel.com Reviewed-by: Duncan Laurie dlaurie@chromium.org --- A src/drivers/soundwire/alc711/Kconfig A src/drivers/soundwire/alc711/Makefile.inc A src/drivers/soundwire/alc711/alc711.c A src/drivers/soundwire/alc711/chip.h M src/include/device/mipi_ids.h 5 files changed, 171 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved Sathyanarayana Nujella: Looks good to me, but someone else must approve
diff --git a/src/drivers/soundwire/alc711/Kconfig b/src/drivers/soundwire/alc711/Kconfig new file mode 100644 index 0000000..bdc02a9 --- /dev/null +++ b/src/drivers/soundwire/alc711/Kconfig @@ -0,0 +1,2 @@ +config DRIVERS_SOUNDWIRE_ALC711 + bool diff --git a/src/drivers/soundwire/alc711/Makefile.inc b/src/drivers/soundwire/alc711/Makefile.inc new file mode 100644 index 0000000..78e4d1b --- /dev/null +++ b/src/drivers/soundwire/alc711/Makefile.inc @@ -0,0 +1 @@ +ramstage-$(CONFIG_DRIVERS_SOUNDWIRE_ALC711) += alc711.c diff --git a/src/drivers/soundwire/alc711/alc711.c b/src/drivers/soundwire/alc711/alc711.c new file mode 100644 index 0000000..8382fc9 --- /dev/null +++ b/src/drivers/soundwire/alc711/alc711.c @@ -0,0 +1,156 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <acpi/acpigen.h> +#include <acpi/acpi_device.h> +#include <acpi/acpi_soundwire.h> +#include <device/device.h> +#include <device/path.h> +#include <device/mipi_ids.h> +#include <device/soundwire.h> +#include <stdio.h> + +#include "chip.h" + +static struct soundwire_address alc711_address = { + .version = SOUNDWIRE_VERSION_1_1, + .manufacturer_id = MIPI_MFG_ID_REALTEK, + .part_id = MIPI_DEV_ID_REALTEK_ALC711, + .class = MIPI_CLASS_NONE +}; + +static struct soundwire_slave alc711_slave = { + .wake_up_unavailable = false, + .test_mode_supported = false, + .clock_stop_mode1_supported = true, + .simplified_clockstopprepare_sm_supported = true, + .clockstopprepare_hard_reset_behavior = false, + .highPHY_capable = false, + .paging_supported = false, + .bank_delay_supported = false, + .port15_read_behavior = false, + .source_port_list = SOUNDWIRE_PORT(2), + .sink_port_list = SOUNDWIRE_PORT(1), +}; + +static struct soundwire_audio_mode alc711_audio_mode = { + /* Bus frequency must be 1/2/4/8 divider of supported input frequencies. */ + .bus_frequency_configs_count = 12, + .bus_frequency_configs = { + 9600 * KHz, + 4800 * KHz, + 2400 * KHz, + 1200 * KHz, + 12000 * KHz, + 6000 * KHz, + 3000 * KHz, + 1500 * KHz, + 12288 * KHz, + 6144 * KHz, + 3072 * KHz, + 1536 * KHz + }, + /* Support 16 KHz to 192 KHz sampling frequency */ + .sampling_frequency_configs_count = 9, + .sampling_frequency_configs = { + 16 * KHz, + 22.05 * KHz, + 24 * KHz, + 32 * KHz, + 44.1 * KHz, + 48 * KHz, + 88.2 * KHz, + 96 * KHz, + 192 * KHz + }, + .prepare_channel_behavior = CHANNEL_PREPARE_ANY_FREQUENCY +}; + +static struct soundwire_dpn alc711_dp = { + .port_wordlength_configs_count = 1, + .port_wordlength_configs = { 32 }, + .data_port_type = FULL_DATA_PORT, + .max_grouping_supported = BLOCK_GROUP_COUNT_1, + .simplified_channelprepare_sm = false, + .imp_def_dpn_interrupts_supported = 0, + .min_channel_number = 1, + .max_channel_number = 2, + .modes_supported = MODE_ISOCHRONOUS | MODE_TX_CONTROLLED | + MODE_RX_CONTROLLED | MODE_FULL_ASYNCHRONOUS, + .block_packing_mode = true, + .port_audio_mode_count = 1, + .port_audio_mode_list = { 0 } +}; + +static const struct soundwire_codec alc711_codec = { + .slave = &alc711_slave, + .audio_mode = { &alc711_audio_mode }, + .dpn = { + { + /* Data Input for Speaker Path */ + .port = 1, + .sink = &alc711_dp + }, + { + /* Data Output for DSP Path */ + .port = 2, + .source = &alc711_dp + } + } + +}; + +static void soundwire_alc711_fill_ssdt(const struct device *dev) +{ + struct drivers_soundwire_alc711_config *config = dev->chip_info; + const char *scope = acpi_device_scope(dev); + struct acpi_dp *dsd; + + if (!dev->enabled || !scope) + return; + + acpigen_write_scope(scope); + acpigen_write_device(acpi_device_name(dev)); + + /* Set codec address IDs. */ + alc711_address.link_id = dev->path.generic.id; + alc711_address.unique_id = dev->path.generic.subid; + + acpigen_write_ADR_soundwire_device(&alc711_address); + acpigen_write_name_string("_DDN", config->desc ? : dev->chip_ops->name); + acpigen_write_STA(acpi_device_status(dev)); + + dsd = acpi_dp_new_table("_DSD"); + soundwire_gen_codec(dsd, &alc711_codec, NULL); + acpi_dp_write(dsd); + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} + +static const char *soundwire_alc711_acpi_name(const struct device *dev) +{ + struct drivers_soundwire_alc711_config *config = dev->chip_info; + static char name[5]; + + if (config->name) + return config->name; + snprintf(name, sizeof(name), "SW%1X%1X", dev->path.generic.id, dev->path.generic.subid); + return name; +} + +static struct device_operations soundwire_alc711_ops = { + .read_resources = noop_read_resources, + .set_resources = noop_set_resources, + .acpi_name = soundwire_alc711_acpi_name, + .acpi_fill_ssdt = soundwire_alc711_fill_ssdt, +}; + +static void soundwire_alc711_enable(struct device *dev) +{ + dev->ops = &soundwire_alc711_ops; +} + +struct chip_operations drivers_soundwire_alc711_ops = { + CHIP_NAME("Realtek ALC711 SoundWire Codec") + .enable_dev = soundwire_alc711_enable +}; diff --git a/src/drivers/soundwire/alc711/chip.h b/src/drivers/soundwire/alc711/chip.h new file mode 100644 index 0000000..6d317fd --- /dev/null +++ b/src/drivers/soundwire/alc711/chip.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ +#define __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ + +struct drivers_soundwire_alc711_config { + const char *name; + const char *desc; +}; + +#endif /* __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ */ diff --git a/src/include/device/mipi_ids.h b/src/include/device/mipi_ids.h index 86b5116..951caaa 100644 --- a/src/include/device/mipi_ids.h +++ b/src/include/device/mipi_ids.h @@ -20,6 +20,7 @@ /* Contributing Members */ #define MIPI_MFG_ID_REALTEK 0x025d #define MIPI_DEV_ID_REALTEK_ALC5682 0x5682 +#define MIPI_DEV_ID_REALTEK_ALC711 0x0711
#define MIPI_MFG_ID_MAXIM 0x019f #define MIPI_DEV_ID_MAXIM_MAX98373 0x8373