Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: hdac_hdmi: remove hdac_hdmi_jack[_port]_init()

No one is using hdac_hdmi_jack[_port]_init(). Remove it and its
related functions.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87o6v3j73q.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
039de8f5 bb4a0f49

-307
-297
sound/soc/codecs/hdac_hdmi.c
··· 25 25 #include <sound/pcm_drm_eld.h> 26 26 #include <sound/hda_chmap.h> 27 27 #include "../../hda/local.h" 28 - #include "hdac_hdmi.h" 29 28 30 29 #define NAME_SIZE 32 31 30 ··· 1430 1431 1431 1432 } 1432 1433 1433 - static int hdac_hdmi_eld_ctl_info(struct snd_kcontrol *kcontrol, 1434 - struct snd_ctl_elem_info *uinfo) 1435 - { 1436 - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 1437 - struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); 1438 - struct hdac_hdmi_pcm *pcm; 1439 - struct hdac_hdmi_port *port; 1440 - struct hdac_hdmi_eld *eld; 1441 - 1442 - uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; 1443 - uinfo->count = 0; 1444 - 1445 - pcm = get_hdmi_pcm_from_id(hdmi, kcontrol->id.device); 1446 - if (!pcm) { 1447 - dev_dbg(component->dev, "%s: no pcm, device %d\n", __func__, 1448 - kcontrol->id.device); 1449 - return 0; 1450 - } 1451 - 1452 - if (list_empty(&pcm->port_list)) { 1453 - dev_dbg(component->dev, "%s: empty port list, device %d\n", 1454 - __func__, kcontrol->id.device); 1455 - return 0; 1456 - } 1457 - 1458 - mutex_lock(&hdmi->pin_mutex); 1459 - 1460 - list_for_each_entry(port, &pcm->port_list, head) { 1461 - eld = &port->eld; 1462 - 1463 - if (eld->eld_valid) { 1464 - uinfo->count = eld->eld_size; 1465 - break; 1466 - } 1467 - } 1468 - 1469 - mutex_unlock(&hdmi->pin_mutex); 1470 - 1471 - return 0; 1472 - } 1473 - 1474 - static int hdac_hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, 1475 - struct snd_ctl_elem_value *ucontrol) 1476 - { 1477 - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 1478 - struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); 1479 - struct hdac_hdmi_pcm *pcm; 1480 - struct hdac_hdmi_port *port; 1481 - struct hdac_hdmi_eld *eld; 1482 - 1483 - memset(ucontrol->value.bytes.data, 0, sizeof(ucontrol->value.bytes.data)); 1484 - 1485 - pcm = get_hdmi_pcm_from_id(hdmi, kcontrol->id.device); 1486 - if (!pcm) { 1487 - dev_dbg(component->dev, "%s: no pcm, device %d\n", __func__, 1488 - kcontrol->id.device); 1489 - return 0; 1490 - } 1491 - 1492 - if (list_empty(&pcm->port_list)) { 1493 - dev_dbg(component->dev, "%s: empty port list, device %d\n", 1494 - __func__, kcontrol->id.device); 1495 - return 0; 1496 - } 1497 - 1498 - mutex_lock(&hdmi->pin_mutex); 1499 - 1500 - list_for_each_entry(port, &pcm->port_list, head) { 1501 - eld = &port->eld; 1502 - 1503 - if (!eld->eld_valid) 1504 - continue; 1505 - 1506 - if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || 1507 - eld->eld_size > ELD_MAX_SIZE) { 1508 - mutex_unlock(&hdmi->pin_mutex); 1509 - 1510 - dev_err(component->dev, "%s: buffer too small, device %d eld_size %d\n", 1511 - __func__, kcontrol->id.device, eld->eld_size); 1512 - snd_BUG(); 1513 - return -EINVAL; 1514 - } 1515 - 1516 - memcpy(ucontrol->value.bytes.data, eld->eld_buffer, 1517 - eld->eld_size); 1518 - break; 1519 - } 1520 - 1521 - mutex_unlock(&hdmi->pin_mutex); 1522 - 1523 - return 0; 1524 - } 1525 - 1526 - static int hdac_hdmi_create_eld_ctl(struct snd_soc_component *component, struct hdac_hdmi_pcm *pcm) 1527 - { 1528 - struct snd_kcontrol *kctl; 1529 - struct snd_kcontrol_new hdmi_eld_ctl = { 1530 - .access = SNDRV_CTL_ELEM_ACCESS_READ | 1531 - SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1532 - .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1533 - .name = "ELD", 1534 - .info = hdac_hdmi_eld_ctl_info, 1535 - .get = hdac_hdmi_eld_ctl_get, 1536 - .device = pcm->pcm_id, 1537 - }; 1538 - 1539 - /* add ELD ctl with the device number corresponding to the PCM stream */ 1540 - kctl = snd_ctl_new1(&hdmi_eld_ctl, component); 1541 - if (!kctl) 1542 - return -ENOMEM; 1543 - 1544 - pcm->eld_ctl = kctl; 1545 - 1546 - return snd_ctl_add(component->card->snd_card, kctl); 1547 - } 1548 - 1549 1434 static const struct snd_soc_dai_ops hdmi_dai_ops = { 1550 1435 .startup = hdac_hdmi_pcm_open, 1551 1436 .shutdown = hdac_hdmi_pcm_close, ··· 1636 1753 .pin2port = hdac_hdmi_pin2port, 1637 1754 .pin_eld_notify = hdac_hdmi_eld_notify_cb, 1638 1755 }; 1639 - 1640 - static struct snd_pcm *hdac_hdmi_get_pcm_from_id(struct snd_soc_card *card, 1641 - int device) 1642 - { 1643 - struct snd_soc_pcm_runtime *rtd; 1644 - 1645 - for_each_card_rtds(card, rtd) { 1646 - if (rtd->pcm && (rtd->pcm->device == device)) 1647 - return rtd->pcm; 1648 - } 1649 - 1650 - return NULL; 1651 - } 1652 - 1653 - /* create jack pin kcontrols */ 1654 - static int create_fill_jack_kcontrols(struct snd_soc_card *card, 1655 - struct hdac_device *hdev) 1656 - { 1657 - struct hdac_hdmi_pin *pin; 1658 - struct snd_kcontrol_new *kc; 1659 - char *name; 1660 - int i = 0, j; 1661 - struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); 1662 - struct snd_soc_component *component = hdmi->component; 1663 - 1664 - kc = devm_kcalloc(component->dev, hdmi->num_ports, 1665 - sizeof(*kc), GFP_KERNEL); 1666 - 1667 - if (!kc) 1668 - return -ENOMEM; 1669 - 1670 - list_for_each_entry(pin, &hdmi->pin_list, head) { 1671 - for (j = 0; j < pin->num_ports; j++) { 1672 - name = devm_kasprintf(component->dev, GFP_KERNEL, 1673 - "hif%d-%d Jack", 1674 - pin->nid, pin->ports[j].id); 1675 - if (!name) 1676 - return -ENOMEM; 1677 - 1678 - kc[i].name = devm_kasprintf(component->dev, GFP_KERNEL, 1679 - "%s Switch", name); 1680 - if (!kc[i].name) 1681 - return -ENOMEM; 1682 - 1683 - kc[i].private_value = (unsigned long)name; 1684 - kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1685 - kc[i].access = 0; 1686 - kc[i].info = snd_soc_dapm_info_pin_switch; 1687 - kc[i].put = snd_soc_dapm_put_pin_switch; 1688 - kc[i].get = snd_soc_dapm_get_pin_switch; 1689 - i++; 1690 - } 1691 - } 1692 - 1693 - return snd_soc_add_card_controls(card, kc, i); 1694 - } 1695 - 1696 - int hdac_hdmi_jack_port_init(struct snd_soc_component *component, 1697 - struct snd_soc_dapm_context *dapm) 1698 - { 1699 - struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); 1700 - struct hdac_device *hdev = hdmi->hdev; 1701 - struct hdac_hdmi_pin *pin; 1702 - struct snd_soc_dapm_widget *widgets; 1703 - struct snd_soc_dapm_route *route; 1704 - char w_name[NAME_SIZE]; 1705 - int i = 0, j, ret; 1706 - 1707 - widgets = devm_kcalloc(dapm->dev, hdmi->num_ports, 1708 - sizeof(*widgets), GFP_KERNEL); 1709 - 1710 - if (!widgets) 1711 - return -ENOMEM; 1712 - 1713 - route = devm_kcalloc(dapm->dev, hdmi->num_ports, 1714 - sizeof(*route), GFP_KERNEL); 1715 - if (!route) 1716 - return -ENOMEM; 1717 - 1718 - /* create Jack DAPM widget */ 1719 - list_for_each_entry(pin, &hdmi->pin_list, head) { 1720 - for (j = 0; j < pin->num_ports; j++) { 1721 - snprintf(w_name, sizeof(w_name), "hif%d-%d Jack", 1722 - pin->nid, pin->ports[j].id); 1723 - 1724 - ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i], 1725 - snd_soc_dapm_spk, NULL, 1726 - w_name, NULL, NULL, 0, NULL, 0); 1727 - if (ret < 0) 1728 - return ret; 1729 - 1730 - pin->ports[j].jack_pin = widgets[i].name; 1731 - pin->ports[j].dapm = dapm; 1732 - 1733 - /* add to route from Jack widget to output */ 1734 - hdac_hdmi_fill_route(&route[i], pin->ports[j].jack_pin, 1735 - NULL, pin->ports[j].output_pin, NULL); 1736 - 1737 - i++; 1738 - } 1739 - } 1740 - 1741 - /* Add Route from Jack widget to the output widget */ 1742 - ret = snd_soc_dapm_new_controls(dapm, widgets, hdmi->num_ports); 1743 - if (ret < 0) 1744 - return ret; 1745 - 1746 - ret = snd_soc_dapm_add_routes(dapm, route, hdmi->num_ports); 1747 - if (ret < 0) 1748 - return ret; 1749 - 1750 - ret = snd_soc_dapm_new_widgets(dapm->card); 1751 - if (ret < 0) 1752 - return ret; 1753 - 1754 - /* Add Jack Pin switch Kcontrol */ 1755 - ret = create_fill_jack_kcontrols(dapm->card, hdev); 1756 - 1757 - if (ret < 0) 1758 - return ret; 1759 - 1760 - /* default set the Jack Pin switch to OFF */ 1761 - list_for_each_entry(pin, &hdmi->pin_list, head) { 1762 - for (j = 0; j < pin->num_ports; j++) 1763 - snd_soc_dapm_disable_pin(pin->ports[j].dapm, 1764 - pin->ports[j].jack_pin); 1765 - } 1766 - 1767 - return 0; 1768 - } 1769 - EXPORT_SYMBOL_GPL(hdac_hdmi_jack_port_init); 1770 - 1771 - int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device, 1772 - struct snd_soc_jack *jack) 1773 - { 1774 - struct snd_soc_component *component = dai->component; 1775 - struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); 1776 - struct hdac_device *hdev = hdmi->hdev; 1777 - struct hdac_hdmi_pcm *pcm; 1778 - struct snd_pcm *snd_pcm; 1779 - int err; 1780 - 1781 - /* 1782 - * this is a new PCM device, create new pcm and 1783 - * add to the pcm list 1784 - */ 1785 - pcm = devm_kzalloc(&hdev->dev, sizeof(*pcm), GFP_KERNEL); 1786 - if (!pcm) 1787 - return -ENOMEM; 1788 - pcm->pcm_id = device; 1789 - pcm->cvt = hdmi->dai_map[dai->id].cvt; 1790 - pcm->jack_event = 0; 1791 - pcm->jack = jack; 1792 - mutex_init(&pcm->lock); 1793 - INIT_LIST_HEAD(&pcm->port_list); 1794 - snd_pcm = hdac_hdmi_get_pcm_from_id(dai->component->card, device); 1795 - if (snd_pcm) { 1796 - err = snd_hdac_add_chmap_ctls(snd_pcm, device, &hdmi->chmap); 1797 - if (err < 0) { 1798 - dev_err(&hdev->dev, 1799 - "chmap control add failed with err: %d for pcm: %d\n", 1800 - err, device); 1801 - return err; 1802 - } 1803 - } 1804 - 1805 - /* add control for ELD Bytes */ 1806 - err = hdac_hdmi_create_eld_ctl(component, pcm); 1807 - if (err < 0) { 1808 - dev_err(&hdev->dev, 1809 - "eld control add failed with err: %d for pcm: %d\n", 1810 - err, device); 1811 - return err; 1812 - } 1813 - 1814 - list_add_tail(&pcm->head, &hdmi->pcm_list); 1815 - 1816 - return 0; 1817 - } 1818 - EXPORT_SYMBOL_GPL(hdac_hdmi_jack_init); 1819 1756 1820 1757 static void hdac_hdmi_present_sense_all_pins(struct hdac_device *hdev, 1821 1758 struct hdac_hdmi_priv *hdmi, bool detect_pin_caps)
-10
sound/soc/codecs/hdac_hdmi.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __HDAC_HDMI_H__ 3 - #define __HDAC_HDMI_H__ 4 - 5 - int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device, 6 - struct snd_soc_jack *jack); 7 - 8 - int hdac_hdmi_jack_port_init(struct snd_soc_component *component, 9 - struct snd_soc_dapm_context *dapm); 10 - #endif /* __HDAC_HDMI_H__ */