[PATCH v5 5/5] drm/bridge: anx7625: add HDMI audio function
kernel test robot
lkp at intel.com
Fri Mar 19 05:34:41 UTC 2021
Hi Xin,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210318]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-randconfig-r014-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project fcc1ce00931751ac02498986feb37744e9ace8de)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/ea2fa662ee036a3e1e2e25233653d7227b510b48
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xin-Ji/Add-MIPI-rx-DPI-support/20210319-104013
git checkout ea2fa662ee036a3e1e2e25233653d7227b510b48
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/bridge/analogix/anx7625.c:1496:6: warning: variable 'mipi_lanes' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ep0) {
^~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1506:22: note: uninitialized use occurs here
pdata->mipi_lanes = mipi_lanes;
^~~~~~~~~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1496:2: note: remove the 'if' if its condition is always true
if (ep0) {
^~~~~~~~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1484:26: note: initialize the variable 'mipi_lanes' to silence this warning
int bus_type, mipi_lanes;
^
= 0
drivers/gpu/drm/bridge/analogix/anx7625.c:1496:6: warning: variable 'bus_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ep0) {
^~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1503:6: note: uninitialized use occurs here
if (bus_type == 5) /* bus type is Parallel(DSI) */
^~~~~~~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1496:2: note: remove the 'if' if its condition is always true
if (ep0) {
^~~~~~~~~
drivers/gpu/drm/bridge/analogix/anx7625.c:1484:14: note: initialize the variable 'bus_type' to silence this warning
int bus_type, mipi_lanes;
^
= 0
>> drivers/gpu/drm/bridge/analogix/anx7625.c:1588:5: warning: no previous prototype for function 'anx7625_audio_hw_params' [-Wmissing-prototypes]
int anx7625_audio_hw_params(struct device *dev, void *data,
^
drivers/gpu/drm/bridge/analogix/anx7625.c:1588:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int anx7625_audio_hw_params(struct device *dev, void *data,
^
static
3 warnings generated.
vim +/anx7625_audio_hw_params +1588 drivers/gpu/drm/bridge/analogix/anx7625.c
1477
1478 static int anx7625_parse_dt(struct device *dev,
1479 struct anx7625_platform_data *pdata)
1480 {
1481 struct device_node *np = dev->of_node, *ep0;
1482 struct drm_panel *panel;
1483 int ret;
1484 int bus_type, mipi_lanes;
1485
1486 anx7625_get_swing_setting(dev, pdata);
1487
1488 pdata->is_dpi = 1; /* default dpi mode */
1489 pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0);
1490 if (!pdata->mipi_host_node) {
1491 DRM_DEV_ERROR(dev, "fail to get internal panel.\n");
1492 return -ENODEV;
1493 }
1494
1495 ep0 = of_graph_get_endpoint_by_regs(np, 0, 0);
> 1496 if (ep0) {
1497 if (of_property_read_u32(ep0, "bus-type", &bus_type))
1498 bus_type = 0;
1499
1500 mipi_lanes = of_property_count_u32_elems(ep0, "data-lanes");
1501 }
1502
1503 if (bus_type == 5) /* bus type is Parallel(DSI) */
1504 pdata->is_dpi = 0;
1505
1506 pdata->mipi_lanes = mipi_lanes;
1507 if (pdata->mipi_lanes > MAX_LANES_SUPPORT || pdata->mipi_lanes <= 0)
1508 pdata->mipi_lanes = MAX_LANES_SUPPORT;
1509
1510 if (pdata->is_dpi)
1511 DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DPI host node.\n");
1512 else
1513 DRM_DEV_DEBUG_DRIVER(dev, "found MIPI DSI host node.\n");
1514
1515 if (of_property_read_bool(np, "analogix,audio-enable"))
1516 pdata->audio_en = 1;
1517
1518 ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
1519 if (ret < 0) {
1520 if (ret == -ENODEV)
1521 return 0;
1522 return ret;
1523 }
1524 if (!panel)
1525 return -ENODEV;
1526
1527 pdata->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
1528 if (IS_ERR(pdata->panel_bridge))
1529 return PTR_ERR(pdata->panel_bridge);
1530 DRM_DEV_DEBUG_DRIVER(dev, "get panel node.\n");
1531
1532 return 0;
1533 }
1534
1535 static inline struct anx7625_data *bridge_to_anx7625(struct drm_bridge *bridge)
1536 {
1537 return container_of(bridge, struct anx7625_data, bridge);
1538 }
1539
1540 static struct edid *anx7625_get_edid(struct anx7625_data *ctx)
1541 {
1542 struct device *dev = &ctx->client->dev;
1543 struct s_edid_data *p_edid = &ctx->slimport_edid_p;
1544 int edid_num;
1545 u8 *edid;
1546
1547 edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL);
1548 if (!edid) {
1549 DRM_DEV_ERROR(dev, "Fail to allocate buffer\n");
1550 return NULL;
1551 }
1552
1553 if (ctx->slimport_edid_p.edid_block_num > 0) {
1554 memcpy(edid, ctx->slimport_edid_p.edid_raw_data,
1555 FOUR_BLOCK_SIZE);
1556 return (struct edid *)edid;
1557 }
1558
1559 anx7625_low_power_mode_check(ctx, 1);
1560 edid_num = sp_tx_edid_read(ctx, p_edid->edid_raw_data);
1561 anx7625_low_power_mode_check(ctx, 0);
1562
1563 if (edid_num < 1) {
1564 DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num);
1565 kfree(edid);
1566 return NULL;
1567 }
1568
1569 p_edid->edid_block_num = edid_num;
1570
1571 memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE);
1572 return (struct edid *)edid;
1573 }
1574
1575 static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
1576 {
1577 struct device *dev = &ctx->client->dev;
1578
1579 DRM_DEV_DEBUG_DRIVER(dev, "sink detect\n");
1580
1581 if (ctx->pdata.panel_bridge)
1582 return connector_status_connected;
1583
1584 return ctx->hpd_status ? connector_status_connected :
1585 connector_status_disconnected;
1586 }
1587
> 1588 int anx7625_audio_hw_params(struct device *dev, void *data,
1589 struct hdmi_codec_daifmt *fmt,
1590 struct hdmi_codec_params *params)
1591 {
1592 struct anx7625_data *ctx = dev_get_drvdata(dev);
1593 int wl, ch, rate;
1594 int ret = 0;
1595
1596 if (fmt->fmt != HDMI_DSP_A) {
1597 DRM_DEV_ERROR(dev, "only supports DSP_A\n");
1598 return -EINVAL;
1599 }
1600
1601 DRM_DEV_DEBUG_DRIVER(dev, "setting %d Hz, %d bit, %d channels\n",
1602 params->sample_rate, params->sample_width,
1603 params->cea.channels);
1604
1605 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1606 AUDIO_CHANNEL_STATUS_6,
1607 ~I2S_SLAVE_MODE,
1608 TDM_SLAVE_MODE);
1609
1610 /* Word length */
1611 switch (params->sample_width) {
1612 case 16:
1613 wl = AUDIO_W_LEN_16_20MAX;
1614 break;
1615 case 18:
1616 wl = AUDIO_W_LEN_18_20MAX;
1617 break;
1618 case 20:
1619 wl = AUDIO_W_LEN_20_20MAX;
1620 break;
1621 case 24:
1622 wl = AUDIO_W_LEN_24_24MAX;
1623 break;
1624 default:
1625 DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support",
1626 params->sample_width);
1627 return -EINVAL;
1628 }
1629 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1630 AUDIO_CHANNEL_STATUS_5,
1631 0xf0, wl);
1632
1633 /* Channel num */
1634 switch (params->cea.channels) {
1635 case 2:
1636 ch = I2S_CH_2;
1637 break;
1638 case 4:
1639 ch = TDM_CH_4;
1640 break;
1641 case 6:
1642 ch = TDM_CH_6;
1643 break;
1644 case 8:
1645 ch = TDM_CH_8;
1646 break;
1647 default:
1648 DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support",
1649 params->cea.channels);
1650 return -EINVAL;
1651 }
1652 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1653 AUDIO_CHANNEL_STATUS_6, 0x1f, ch << 5);
1654 if (ch > I2S_CH_2)
1655 ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
1656 AUDIO_CHANNEL_STATUS_6, AUDIO_LAYOUT);
1657 else
1658 ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
1659 AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
1660
1661 /* FS */
1662 switch (params->sample_rate) {
1663 case 32000:
1664 rate = AUDIO_FS_32K;
1665 break;
1666 case 44100:
1667 rate = AUDIO_FS_441K;
1668 break;
1669 case 48000:
1670 rate = AUDIO_FS_48K;
1671 break;
1672 case 88200:
1673 rate = AUDIO_FS_882K;
1674 break;
1675 case 96000:
1676 rate = AUDIO_FS_96K;
1677 break;
1678 case 176400:
1679 rate = AUDIO_FS_1764K;
1680 break;
1681 case 192000:
1682 rate = AUDIO_FS_192K;
1683 break;
1684 default:
1685 DRM_DEV_DEBUG_DRIVER(dev, "sample rate: %d not support",
1686 params->sample_rate);
1687 return -EINVAL;
1688 }
1689 ret |= anx7625_write_and_or(ctx, ctx->i2c.tx_p2_client,
1690 AUDIO_CHANNEL_STATUS_4,
1691 0xf0, rate);
1692 ret |= anx7625_write_or(ctx, ctx->i2c.rx_p0_client,
1693 AP_AV_STATUS, AP_AUDIO_CHG);
1694 if (ret < 0) {
1695 DRM_DEV_ERROR(dev, "IO error : config audio.\n");
1696 return -EIO;
1697 }
1698
1699 return 0;
1700 }
1701
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29670 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20210319/2aa84c24/attachment-0001.bin>
More information about the devel
mailing list