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

ASoC: davinci-mcasp: Implement configurable dismod handling

If the dismod is specified in the DT node, use the specified custom value
to configure the drive on state of the inactive TX slots.

If the dismod is not present or booted in legacy mode, the dismod is set
to low as it was the original behavior.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
bc184549 a3641b30

+20 -1
+1
include/linux/platform_data/davinci_asp.h
··· 79 79 /* McASP specific fields */ 80 80 int tdm_slots; 81 81 u8 op_mode; 82 + u8 dismod; 82 83 u8 num_serializer; 83 84 u8 *serial_dir; 84 85 u8 version;
+18 -1
sound/soc/davinci/davinci-mcasp.c
··· 85 85 u32 tdm_mask[2]; 86 86 int slot_width; 87 87 u8 op_mode; 88 + u8 dismod; 88 89 u8 num_serializer; 89 90 u8 *serial_dir; 90 91 u8 version; ··· 835 834 if (mcasp->serial_dir[i] == TX_MODE && 836 835 tx_ser < max_active_serializers) { 837 836 mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i), 838 - DISMOD_LOW, DISMOD_MASK); 837 + mcasp->dismod, DISMOD_MASK); 839 838 set_bit(PIN_BIT_AXR(i), &mcasp->pdir); 840 839 tx_ser++; 841 840 } else if (mcasp->serial_dir[i] == RX_MODE && ··· 848 847 clear_bit(PIN_BIT_AXR(i), &mcasp->pdir); 849 848 } else if (mcasp->serial_dir[i] == TX_MODE) { 850 849 /* Unused TX pins, clear PDIR */ 850 + mcasp_mod_bits(mcasp, DAVINCI_MCASP_XRSRCTL_REG(i), 851 + mcasp->dismod, DISMOD_MASK); 851 852 clear_bit(PIN_BIT_AXR(i), &mcasp->pdir); 852 853 } 853 854 } ··· 1712 1709 1713 1710 if (pdev->dev.platform_data) { 1714 1711 pdata = pdev->dev.platform_data; 1712 + pdata->dismod = DISMOD_LOW; 1715 1713 return pdata; 1716 1714 } else if (match) { 1717 1715 pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata), ··· 1801 1797 ret = of_property_read_u32(np, "sram-size-capture", &val); 1802 1798 if (ret >= 0) 1803 1799 pdata->sram_size_capture = val; 1800 + 1801 + ret = of_property_read_u32(np, "dismod", &val); 1802 + if (ret >= 0) { 1803 + if (val == 0 || val == 2 || val == 3) { 1804 + pdata->dismod = DISMOD_VAL(val); 1805 + } else { 1806 + dev_warn(&pdev->dev, "Invalid dismod value: %u\n", val); 1807 + pdata->dismod = DISMOD_LOW; 1808 + } 1809 + } else { 1810 + pdata->dismod = DISMOD_LOW; 1811 + } 1804 1812 1805 1813 return pdata; 1806 1814 ··· 1989 1973 mcasp->version = pdata->version; 1990 1974 mcasp->txnumevt = pdata->txnumevt; 1991 1975 mcasp->rxnumevt = pdata->rxnumevt; 1976 + mcasp->dismod = pdata->dismod; 1992 1977 1993 1978 mcasp->dev = &pdev->dev; 1994 1979
+1
sound/soc/davinci/davinci-mcasp.h
··· 209 209 #define DISMOD_3STATE (0x0) 210 210 #define DISMOD_LOW (0x2 << 2) 211 211 #define DISMOD_HIGH (0x3 << 2) 212 + #define DISMOD_VAL(x) ((x) << 2) 212 213 #define DISMOD_MASK DISMOD_HIGH 213 214 #define TXSTATE BIT(4) 214 215 #define RXSTATE BIT(5)