lkml.org 
[lkml]   [2020]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[gustavoars-linux:for-next/clang-ft 2/3] drivers/media/dvb-frontends/m88ds3103.c:910:2: warning: unannotated fall-through between switch labels
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git for-next/clang-ft
head: de6b606b07e40c037ed4f83b53ee541692a78c6e
commit: 7d30604536de43168b1eae0a4a938bcbca7786d2 [2/3] Revert "kbuild: Do not enable -Wimplicit-fallthrough for clang for now"
config: x86_64-randconfig-a003-20201009 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4cfc4025cc1433ca5ef1c526053fc9c4bfe64109)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=7d30604536de43168b1eae0a4a938bcbca7786d2
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux for-next/clang-ft
git checkout 7d30604536de43168b1eae0a4a938bcbca7786d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

In file included from drivers/media/dvb-frontends/m88ds3103.c:8:
In file included from drivers/media/dvb-frontends/m88ds3103_priv.h:11:
In file included from include/media/dvb_frontend.h:48:
In file included from include/media/dvbdev.h:23:
In file included from include/linux/poll.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
>> drivers/media/dvb-frontends/m88ds3103.c:910:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/media/dvb-frontends/m88ds3103.c:910:2: note: insert '__attribute__((fallthrough));' to silence this warning
default:
^
__attribute__((fallthrough));
drivers/media/dvb-frontends/m88ds3103.c:910:2: note: insert 'break;' to avoid fall-through
default:
^
break;
3 warnings generated.
--
In file included from drivers/media/cec/core/cec-pin.c:10:
In file included from include/media/cec-pin.h:12:
In file included from include/media/cec.h:11:
In file included from include/linux/poll.h:10:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:241:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:241:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:241:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
include/linux/signal.h:253:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1: ;
^
include/linux/signal.h:253:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1: ;
^
__attribute__((fallthrough));
include/linux/signal.h:253:2: note: insert 'break;' to avoid fall-through
case 1: ;
^
break;
>> drivers/media/cec/core/cec-pin.c:421:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case CEC_ST_TX_DATA_BIT_0_HIGH:
^
drivers/media/cec/core/cec-pin.c:421:2: note: insert '__attribute__((fallthrough));' to silence this warning
case CEC_ST_TX_DATA_BIT_0_HIGH:
^
__attribute__((fallthrough));
drivers/media/cec/core/cec-pin.c:421:2: note: insert 'break;' to avoid fall-through
case CEC_ST_TX_DATA_BIT_0_HIGH:
^
break;
drivers/media/cec/core/cec-pin.c:449:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case CEC_ST_TX_DATA_BIT_HIGH_CUSTOM:
^
drivers/media/cec/core/cec-pin.c:449:2: note: insert '__attribute__((fallthrough));' to silence this warning
case CEC_ST_TX_DATA_BIT_HIGH_CUSTOM:
^
__attribute__((fallthrough));
drivers/media/cec/core/cec-pin.c:449:2: note: insert 'break;' to avoid fall-through
case CEC_ST_TX_DATA_BIT_HIGH_CUSTOM:
^
break;
drivers/media/cec/core/cec-pin.c:463:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case CEC_ST_TX_START_BIT_HIGH:
^
drivers/media/cec/core/cec-pin.c:463:2: note: insert '__attribute__((fallthrough));' to silence this warning
case CEC_ST_TX_START_BIT_HIGH:
^
__attribute__((fallthrough));
drivers/media/cec/core/cec-pin.c:463:2: note: insert 'break;' to avoid fall-through
case CEC_ST_TX_START_BIT_HIGH:
^
break;
5 warnings generated.
--
>> drivers/media/test-drivers/vivid/vivid-vbi-gen.c:302:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
case 1 ... 7:
^
drivers/media/test-drivers/vivid/vivid-vbi-gen.c:302:2: note: insert '__attribute__((fallthrough));' to silence this warning
case 1 ... 7:
^
__attribute__((fallthrough));
drivers/media/test-drivers/vivid/vivid-vbi-gen.c:302:2: note: insert 'break;' to avoid fall-through
case 1 ... 7:
^
break;
1 warning generated.

vim +910 drivers/media/dvb-frontends/m88ds3103.c

e6089feca460cb4 Brad Love 2020-02-01 621
395d00d1ca89478 Antti Palosaari 2013-02-25 622 static int m88ds3103_set_frontend(struct dvb_frontend *fe)
395d00d1ca89478 Antti Palosaari 2013-02-25 623 {
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 624 struct m88ds3103_dev *dev = fe->demodulator_priv;
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 625 struct i2c_client *client = dev->client;
395d00d1ca89478 Antti Palosaari 2013-02-25 626 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
06487dee53ae157 Antti Palosaari 2013-12-02 627 int ret, len;
395d00d1ca89478 Antti Palosaari 2013-02-25 628 const struct m88ds3103_reg_val *init;
b6851419409664b nibble.max 2014-11-05 629 u8 u8tmp, u8tmp1 = 0, u8tmp2 = 0; /* silence compiler warning */
f4df95bcbb7b142 nibble.max 2014-10-30 630 u8 buf[3];
334ef18e879980e Antti Palosaari 2016-06-29 631 u16 u16tmp;
e6089feca460cb4 Brad Love 2020-02-01 632 u32 tuner_frequency_khz, target_mclk, u32tmp;
395d00d1ca89478 Antti Palosaari 2013-02-25 633 s32 s32tmp;
981fbe3da20a6f3 James Hutchinson 2019-01-13 634 static const struct reg_sequence reset_buf[] = {
981fbe3da20a6f3 James Hutchinson 2019-01-13 635 {0x07, 0x80}, {0x07, 0x00}
981fbe3da20a6f3 James Hutchinson 2019-01-13 636 };
41b9aa0040526d1 Antti Palosaari 2014-08-21 637
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 638 dev_dbg(&client->dev,
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 639 "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n",
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 640 c->delivery_system, c->modulation, c->frequency, c->symbol_rate,
395d00d1ca89478 Antti Palosaari 2013-02-25 641 c->inversion, c->pilot, c->rolloff);
395d00d1ca89478 Antti Palosaari 2013-02-25 642
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 643 if (!dev->warm) {
395d00d1ca89478 Antti Palosaari 2013-02-25 644 ret = -EAGAIN;
395d00d1ca89478 Antti Palosaari 2013-02-25 645 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 646 }
395d00d1ca89478 Antti Palosaari 2013-02-25 647
f4df95bcbb7b142 nibble.max 2014-10-30 648 /* reset */
981fbe3da20a6f3 James Hutchinson 2019-01-13 649 ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2);
f4df95bcbb7b142 nibble.max 2014-10-30 650 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 651 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 652
f4df95bcbb7b142 nibble.max 2014-10-30 653 /* Disable demod clock path */
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 654 if (dev->chip_id == M88RS6000_CHIP_ID) {
e6089feca460cb4 Brad Love 2020-02-01 655 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 656 ret = regmap_read(dev->regmap, 0xb2, &u32tmp);
e6089feca460cb4 Brad Love 2020-02-01 657 if (ret)
e6089feca460cb4 Brad Love 2020-02-01 658 goto err;
e6089feca460cb4 Brad Love 2020-02-01 659 if (u32tmp == 0x01) {
e6089feca460cb4 Brad Love 2020-02-01 660 ret = regmap_write(dev->regmap, 0x00, 0x00);
e6089feca460cb4 Brad Love 2020-02-01 661 if (ret)
e6089feca460cb4 Brad Love 2020-02-01 662 goto err;
e6089feca460cb4 Brad Love 2020-02-01 663 ret = regmap_write(dev->regmap, 0xb2, 0x00);
e6089feca460cb4 Brad Love 2020-02-01 664 if (ret)
e6089feca460cb4 Brad Love 2020-02-01 665 goto err;
e6089feca460cb4 Brad Love 2020-02-01 666 }
e6089feca460cb4 Brad Love 2020-02-01 667 }
e6089feca460cb4 Brad Love 2020-02-01 668
478932b16052f5d Antti Palosaari 2015-04-16 669 ret = regmap_write(dev->regmap, 0x06, 0xe0);
f4df95bcbb7b142 nibble.max 2014-10-30 670 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 671 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 672 }
f4df95bcbb7b142 nibble.max 2014-10-30 673
395d00d1ca89478 Antti Palosaari 2013-02-25 674 /* program tuner */
395d00d1ca89478 Antti Palosaari 2013-02-25 675 if (fe->ops.tuner_ops.set_params) {
395d00d1ca89478 Antti Palosaari 2013-02-25 676 ret = fe->ops.tuner_ops.set_params(fe);
395d00d1ca89478 Antti Palosaari 2013-02-25 677 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 678 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 679 }
395d00d1ca89478 Antti Palosaari 2013-02-25 680
395d00d1ca89478 Antti Palosaari 2013-02-25 681 if (fe->ops.tuner_ops.get_frequency) {
f5d9b88db7222bf Antti Palosaari 2016-06-29 682 ret = fe->ops.tuner_ops.get_frequency(fe, &tuner_frequency_khz);
395d00d1ca89478 Antti Palosaari 2013-02-25 683 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 684 goto err;
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 685 } else {
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 686 /*
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 687 * Use nominal target frequency as tuner driver does not provide
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 688 * actual frequency used. Carrier offset calculation is not
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 689 * valid.
2f9dff3f39f0d6d Antti Palosaari 2014-02-01 690 */
f5d9b88db7222bf Antti Palosaari 2016-06-29 691 tuner_frequency_khz = c->frequency;
395d00d1ca89478 Antti Palosaari 2013-02-25 692 }
395d00d1ca89478 Antti Palosaari 2013-02-25 693
e6089feca460cb4 Brad Love 2020-02-01 694 /* set M88RS6000/DS3103B demod main mclk and ts mclk from tuner die */
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 695 if (dev->chip_id == M88RS6000_CHIP_ID) {
f4df95bcbb7b142 nibble.max 2014-10-30 696 if (c->symbol_rate > 45010000)
f5d9b88db7222bf Antti Palosaari 2016-06-29 697 dev->mclk = 110250000;
f4df95bcbb7b142 nibble.max 2014-10-30 698 else
f5d9b88db7222bf Antti Palosaari 2016-06-29 699 dev->mclk = 96000000;
395d00d1ca89478 Antti Palosaari 2013-02-25 700
f4df95bcbb7b142 nibble.max 2014-10-30 701 if (c->delivery_system == SYS_DVBS)
f5d9b88db7222bf Antti Palosaari 2016-06-29 702 target_mclk = 96000000;
f4df95bcbb7b142 nibble.max 2014-10-30 703 else
f5d9b88db7222bf Antti Palosaari 2016-06-29 704 target_mclk = 144000000;
395d00d1ca89478 Antti Palosaari 2013-02-25 705
e6089feca460cb4 Brad Love 2020-02-01 706 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 707 m88ds3103b_select_mclk(dev);
e6089feca460cb4 Brad Love 2020-02-01 708 m88ds3103b_set_mclk(dev, target_mclk / 1000);
e6089feca460cb4 Brad Love 2020-02-01 709 }
e6089feca460cb4 Brad Love 2020-02-01 710
f4df95bcbb7b142 nibble.max 2014-10-30 711 /* Enable demod clock path */
478932b16052f5d Antti Palosaari 2015-04-16 712 ret = regmap_write(dev->regmap, 0x06, 0x00);
395d00d1ca89478 Antti Palosaari 2013-02-25 713 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 714 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 715 usleep_range(10000, 20000);
f4df95bcbb7b142 nibble.max 2014-10-30 716 } else {
f4df95bcbb7b142 nibble.max 2014-10-30 717 /* set M88DS3103 mclk and ts mclk. */
f5d9b88db7222bf Antti Palosaari 2016-06-29 718 dev->mclk = 96000000;
395d00d1ca89478 Antti Palosaari 2013-02-25 719
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 720 switch (dev->cfg->ts_mode) {
395d00d1ca89478 Antti Palosaari 2013-02-25 721 case M88DS3103_TS_SERIAL:
395d00d1ca89478 Antti Palosaari 2013-02-25 722 case M88DS3103_TS_SERIAL_D7:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 723 target_mclk = dev->cfg->ts_clk;
395d00d1ca89478 Antti Palosaari 2013-02-25 724 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 725 case M88DS3103_TS_PARALLEL:
395d00d1ca89478 Antti Palosaari 2013-02-25 726 case M88DS3103_TS_CI:
b6851419409664b nibble.max 2014-11-05 727 if (c->delivery_system == SYS_DVBS)
f5d9b88db7222bf Antti Palosaari 2016-06-29 728 target_mclk = 96000000;
b6851419409664b nibble.max 2014-11-05 729 else {
395d00d1ca89478 Antti Palosaari 2013-02-25 730 if (c->symbol_rate < 18000000)
f5d9b88db7222bf Antti Palosaari 2016-06-29 731 target_mclk = 96000000;
395d00d1ca89478 Antti Palosaari 2013-02-25 732 else if (c->symbol_rate < 28000000)
f5d9b88db7222bf Antti Palosaari 2016-06-29 733 target_mclk = 144000000;
395d00d1ca89478 Antti Palosaari 2013-02-25 734 else
f5d9b88db7222bf Antti Palosaari 2016-06-29 735 target_mclk = 192000000;
b6851419409664b nibble.max 2014-11-05 736 }
395d00d1ca89478 Antti Palosaari 2013-02-25 737 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 738 default:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 739 dev_dbg(&client->dev, "invalid ts_mode\n");
395d00d1ca89478 Antti Palosaari 2013-02-25 740 ret = -EINVAL;
395d00d1ca89478 Antti Palosaari 2013-02-25 741 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 742 }
f4df95bcbb7b142 nibble.max 2014-10-30 743
f4df95bcbb7b142 nibble.max 2014-10-30 744 switch (target_mclk) {
f5d9b88db7222bf Antti Palosaari 2016-06-29 745 case 96000000:
f4df95bcbb7b142 nibble.max 2014-10-30 746 u8tmp1 = 0x02; /* 0b10 */
f4df95bcbb7b142 nibble.max 2014-10-30 747 u8tmp2 = 0x01; /* 0b01 */
f4df95bcbb7b142 nibble.max 2014-10-30 748 break;
f5d9b88db7222bf Antti Palosaari 2016-06-29 749 case 144000000:
f4df95bcbb7b142 nibble.max 2014-10-30 750 u8tmp1 = 0x00; /* 0b00 */
f4df95bcbb7b142 nibble.max 2014-10-30 751 u8tmp2 = 0x01; /* 0b01 */
f4df95bcbb7b142 nibble.max 2014-10-30 752 break;
f5d9b88db7222bf Antti Palosaari 2016-06-29 753 case 192000000:
f4df95bcbb7b142 nibble.max 2014-10-30 754 u8tmp1 = 0x03; /* 0b11 */
f4df95bcbb7b142 nibble.max 2014-10-30 755 u8tmp2 = 0x00; /* 0b00 */
f4df95bcbb7b142 nibble.max 2014-10-30 756 break;
f4df95bcbb7b142 nibble.max 2014-10-30 757 }
56ea37da3b93dfe Antti Palosaari 2015-10-03 758 ret = m88ds3103_update_bits(dev, 0x22, 0xc0, u8tmp1 << 6);
f4df95bcbb7b142 nibble.max 2014-10-30 759 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 760 goto err;
56ea37da3b93dfe Antti Palosaari 2015-10-03 761 ret = m88ds3103_update_bits(dev, 0x24, 0xc0, u8tmp2 << 6);
f4df95bcbb7b142 nibble.max 2014-10-30 762 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 763 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 764 }
f4df95bcbb7b142 nibble.max 2014-10-30 765
478932b16052f5d Antti Palosaari 2015-04-16 766 ret = regmap_write(dev->regmap, 0xb2, 0x01);
f4df95bcbb7b142 nibble.max 2014-10-30 767 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 768 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 769
478932b16052f5d Antti Palosaari 2015-04-16 770 ret = regmap_write(dev->regmap, 0x00, 0x01);
f4df95bcbb7b142 nibble.max 2014-10-30 771 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 772 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 773
f4df95bcbb7b142 nibble.max 2014-10-30 774 switch (c->delivery_system) {
f4df95bcbb7b142 nibble.max 2014-10-30 775 case SYS_DVBS:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 776 if (dev->chip_id == M88RS6000_CHIP_ID) {
f4df95bcbb7b142 nibble.max 2014-10-30 777 len = ARRAY_SIZE(m88rs6000_dvbs_init_reg_vals);
f4df95bcbb7b142 nibble.max 2014-10-30 778 init = m88rs6000_dvbs_init_reg_vals;
f4df95bcbb7b142 nibble.max 2014-10-30 779 } else {
f4df95bcbb7b142 nibble.max 2014-10-30 780 len = ARRAY_SIZE(m88ds3103_dvbs_init_reg_vals);
f4df95bcbb7b142 nibble.max 2014-10-30 781 init = m88ds3103_dvbs_init_reg_vals;
f4df95bcbb7b142 nibble.max 2014-10-30 782 }
f4df95bcbb7b142 nibble.max 2014-10-30 783 break;
f4df95bcbb7b142 nibble.max 2014-10-30 784 case SYS_DVBS2:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 785 if (dev->chip_id == M88RS6000_CHIP_ID) {
f4df95bcbb7b142 nibble.max 2014-10-30 786 len = ARRAY_SIZE(m88rs6000_dvbs2_init_reg_vals);
f4df95bcbb7b142 nibble.max 2014-10-30 787 init = m88rs6000_dvbs2_init_reg_vals;
f4df95bcbb7b142 nibble.max 2014-10-30 788 } else {
f4df95bcbb7b142 nibble.max 2014-10-30 789 len = ARRAY_SIZE(m88ds3103_dvbs2_init_reg_vals);
f4df95bcbb7b142 nibble.max 2014-10-30 790 init = m88ds3103_dvbs2_init_reg_vals;
f4df95bcbb7b142 nibble.max 2014-10-30 791 }
395d00d1ca89478 Antti Palosaari 2013-02-25 792 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 793 default:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 794 dev_dbg(&client->dev, "invalid delivery_system\n");
395d00d1ca89478 Antti Palosaari 2013-02-25 795 ret = -EINVAL;
395d00d1ca89478 Antti Palosaari 2013-02-25 796 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 797 }
395d00d1ca89478 Antti Palosaari 2013-02-25 798
395d00d1ca89478 Antti Palosaari 2013-02-25 799 /* program init table */
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 800 if (c->delivery_system != dev->delivery_system) {
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 801 ret = m88ds3103_wr_reg_val_tab(dev, init, len);
395d00d1ca89478 Antti Palosaari 2013-02-25 802 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 803 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 804 }
395d00d1ca89478 Antti Palosaari 2013-02-25 805
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 806 if (dev->chip_id == M88RS6000_CHIP_ID) {
f5d9b88db7222bf Antti Palosaari 2016-06-29 807 if (c->delivery_system == SYS_DVBS2 &&
f5d9b88db7222bf Antti Palosaari 2016-06-29 808 c->symbol_rate <= 5000000) {
478932b16052f5d Antti Palosaari 2015-04-16 809 ret = regmap_write(dev->regmap, 0xc0, 0x04);
f4df95bcbb7b142 nibble.max 2014-10-30 810 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 811 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 812 buf[0] = 0x09;
f4df95bcbb7b142 nibble.max 2014-10-30 813 buf[1] = 0x22;
f4df95bcbb7b142 nibble.max 2014-10-30 814 buf[2] = 0x88;
478932b16052f5d Antti Palosaari 2015-04-16 815 ret = regmap_bulk_write(dev->regmap, 0x8a, buf, 3);
f4df95bcbb7b142 nibble.max 2014-10-30 816 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 817 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 818 }
56ea37da3b93dfe Antti Palosaari 2015-10-03 819 ret = m88ds3103_update_bits(dev, 0x9d, 0x08, 0x08);
f4df95bcbb7b142 nibble.max 2014-10-30 820 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 821 goto err;
e6089feca460cb4 Brad Love 2020-02-01 822
e6089feca460cb4 Brad Love 2020-02-01 823 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 824 buf[0] = m88ds3103b_dt_read(dev, 0x15);
e6089feca460cb4 Brad Love 2020-02-01 825 buf[1] = m88ds3103b_dt_read(dev, 0x16);
e6089feca460cb4 Brad Love 2020-02-01 826
e6089feca460cb4 Brad Love 2020-02-01 827 if (c->symbol_rate > 45010000) {
e6089feca460cb4 Brad Love 2020-02-01 828 buf[0] &= ~0x03;
e6089feca460cb4 Brad Love 2020-02-01 829 buf[0] |= 0x02;
e6089feca460cb4 Brad Love 2020-02-01 830 buf[0] |= ((147 - 32) >> 8) & 0x01;
e6089feca460cb4 Brad Love 2020-02-01 831 buf[1] = (147 - 32) & 0xFF;
e6089feca460cb4 Brad Love 2020-02-01 832
e6089feca460cb4 Brad Love 2020-02-01 833 dev->mclk = 110250 * 1000;
e6089feca460cb4 Brad Love 2020-02-01 834 } else {
e6089feca460cb4 Brad Love 2020-02-01 835 buf[0] &= ~0x03;
e6089feca460cb4 Brad Love 2020-02-01 836 buf[0] |= ((128 - 32) >> 8) & 0x01;
e6089feca460cb4 Brad Love 2020-02-01 837 buf[1] = (128 - 32) & 0xFF;
e6089feca460cb4 Brad Love 2020-02-01 838
e6089feca460cb4 Brad Love 2020-02-01 839 dev->mclk = 96000 * 1000;
e6089feca460cb4 Brad Love 2020-02-01 840 }
e6089feca460cb4 Brad Love 2020-02-01 841 m88ds3103b_dt_write(dev, 0x15, buf[0]);
e6089feca460cb4 Brad Love 2020-02-01 842 m88ds3103b_dt_write(dev, 0x16, buf[1]);
e6089feca460cb4 Brad Love 2020-02-01 843
e6089feca460cb4 Brad Love 2020-02-01 844 regmap_read(dev->regmap, 0x30, &u32tmp);
e6089feca460cb4 Brad Love 2020-02-01 845 u32tmp &= ~0x80;
e6089feca460cb4 Brad Love 2020-02-01 846 regmap_write(dev->regmap, 0x30, u32tmp & 0xff);
e6089feca460cb4 Brad Love 2020-02-01 847 }
e6089feca460cb4 Brad Love 2020-02-01 848
478932b16052f5d Antti Palosaari 2015-04-16 849 ret = regmap_write(dev->regmap, 0xf1, 0x01);
f4df95bcbb7b142 nibble.max 2014-10-30 850 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 851 goto err;
e6089feca460cb4 Brad Love 2020-02-01 852
e6089feca460cb4 Brad Love 2020-02-01 853 if (dev->chiptype != M88DS3103_CHIPTYPE_3103B) {
56ea37da3b93dfe Antti Palosaari 2015-10-03 854 ret = m88ds3103_update_bits(dev, 0x30, 0x80, 0x80);
f4df95bcbb7b142 nibble.max 2014-10-30 855 if (ret)
f4df95bcbb7b142 nibble.max 2014-10-30 856 goto err;
f4df95bcbb7b142 nibble.max 2014-10-30 857 }
e6089feca460cb4 Brad Love 2020-02-01 858 }
f4df95bcbb7b142 nibble.max 2014-10-30 859
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 860 switch (dev->cfg->ts_mode) {
395d00d1ca89478 Antti Palosaari 2013-02-25 861 case M88DS3103_TS_SERIAL:
395d00d1ca89478 Antti Palosaari 2013-02-25 862 u8tmp1 = 0x00;
79d0933032d657e nibble.max 2014-08-11 863 u8tmp = 0x06;
395d00d1ca89478 Antti Palosaari 2013-02-25 864 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 865 case M88DS3103_TS_SERIAL_D7:
395d00d1ca89478 Antti Palosaari 2013-02-25 866 u8tmp1 = 0x20;
79d0933032d657e nibble.max 2014-08-11 867 u8tmp = 0x06;
395d00d1ca89478 Antti Palosaari 2013-02-25 868 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 869 case M88DS3103_TS_PARALLEL:
79d0933032d657e nibble.max 2014-08-11 870 u8tmp = 0x02;
e6089feca460cb4 Brad Love 2020-02-01 871 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 872 u8tmp = 0x01;
e6089feca460cb4 Brad Love 2020-02-01 873 u8tmp1 = 0x01;
e6089feca460cb4 Brad Love 2020-02-01 874 }
395d00d1ca89478 Antti Palosaari 2013-02-25 875 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 876 case M88DS3103_TS_CI:
79d0933032d657e nibble.max 2014-08-11 877 u8tmp = 0x03;
395d00d1ca89478 Antti Palosaari 2013-02-25 878 break;
395d00d1ca89478 Antti Palosaari 2013-02-25 879 default:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 880 dev_dbg(&client->dev, "invalid ts_mode\n");
395d00d1ca89478 Antti Palosaari 2013-02-25 881 ret = -EINVAL;
395d00d1ca89478 Antti Palosaari 2013-02-25 882 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 883 }
395d00d1ca89478 Antti Palosaari 2013-02-25 884
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 885 if (dev->cfg->ts_clk_pol)
79d0933032d657e nibble.max 2014-08-11 886 u8tmp |= 0x40;
79d0933032d657e nibble.max 2014-08-11 887
395d00d1ca89478 Antti Palosaari 2013-02-25 888 /* TS mode */
478932b16052f5d Antti Palosaari 2015-04-16 889 ret = regmap_write(dev->regmap, 0xfd, u8tmp);
395d00d1ca89478 Antti Palosaari 2013-02-25 890 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 891 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 892
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 893 switch (dev->cfg->ts_mode) {
395d00d1ca89478 Antti Palosaari 2013-02-25 894 case M88DS3103_TS_SERIAL:
395d00d1ca89478 Antti Palosaari 2013-02-25 895 case M88DS3103_TS_SERIAL_D7:
56ea37da3b93dfe Antti Palosaari 2015-10-03 896 ret = m88ds3103_update_bits(dev, 0x29, 0x20, u8tmp1);
395d00d1ca89478 Antti Palosaari 2013-02-25 897 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 898 goto err;
334ef18e879980e Antti Palosaari 2016-06-29 899 u16tmp = 0;
334ef18e879980e Antti Palosaari 2016-06-29 900 u8tmp1 = 0x3f;
334ef18e879980e Antti Palosaari 2016-06-29 901 u8tmp2 = 0x3f;
b6851419409664b nibble.max 2014-11-05 902 break;
e6089feca460cb4 Brad Love 2020-02-01 903 case M88DS3103_TS_PARALLEL:
e6089feca460cb4 Brad Love 2020-02-01 904 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 905 ret = m88ds3103_update_bits(dev, 0x29, 0x01, u8tmp1);
e6089feca460cb4 Brad Love 2020-02-01 906 if (ret)
e6089feca460cb4 Brad Love 2020-02-01 907 goto err;
e6089feca460cb4 Brad Love 2020-02-01 908 }
e6089feca460cb4 Brad Love 2020-02-01 909 /* fall through */
b6851419409664b nibble.max 2014-11-05 @910 default:
334ef18e879980e Antti Palosaari 2016-06-29 911 u16tmp = DIV_ROUND_UP(target_mclk, dev->cfg->ts_clk);
334ef18e879980e Antti Palosaari 2016-06-29 912 u8tmp1 = u16tmp / 2 - 1;
334ef18e879980e Antti Palosaari 2016-06-29 913 u8tmp2 = DIV_ROUND_UP(u16tmp, 2) - 1;
395d00d1ca89478 Antti Palosaari 2013-02-25 914 }
395d00d1ca89478 Antti Palosaari 2013-02-25 915
f5d9b88db7222bf Antti Palosaari 2016-06-29 916 dev_dbg(&client->dev, "target_mclk=%u ts_clk=%u ts_clk_divide_ratio=%u\n",
334ef18e879980e Antti Palosaari 2016-06-29 917 target_mclk, dev->cfg->ts_clk, u16tmp);
395d00d1ca89478 Antti Palosaari 2013-02-25 918
395d00d1ca89478 Antti Palosaari 2013-02-25 919 /* u8tmp1[5:2] => fe[3:0], u8tmp1[1:0] => ea[7:6] */
395d00d1ca89478 Antti Palosaari 2013-02-25 920 /* u8tmp2[5:0] => ea[5:0] */
334ef18e879980e Antti Palosaari 2016-06-29 921 u8tmp = (u8tmp1 >> 2) & 0x0f;
334ef18e879980e Antti Palosaari 2016-06-29 922 ret = regmap_update_bits(dev->regmap, 0xfe, 0x0f, u8tmp);
395d00d1ca89478 Antti Palosaari 2013-02-25 923 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 924 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 925 u8tmp = ((u8tmp1 & 0x03) << 6) | u8tmp2 >> 0;
478932b16052f5d Antti Palosaari 2015-04-16 926 ret = regmap_write(dev->regmap, 0xea, u8tmp);
395d00d1ca89478 Antti Palosaari 2013-02-25 927 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 928 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 929
395d00d1ca89478 Antti Palosaari 2013-02-25 930 if (c->symbol_rate <= 3000000)
395d00d1ca89478 Antti Palosaari 2013-02-25 931 u8tmp = 0x20;
395d00d1ca89478 Antti Palosaari 2013-02-25 932 else if (c->symbol_rate <= 10000000)
395d00d1ca89478 Antti Palosaari 2013-02-25 933 u8tmp = 0x10;
395d00d1ca89478 Antti Palosaari 2013-02-25 934 else
395d00d1ca89478 Antti Palosaari 2013-02-25 935 u8tmp = 0x06;
395d00d1ca89478 Antti Palosaari 2013-02-25 936
e6089feca460cb4 Brad Love 2020-02-01 937 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B)
e6089feca460cb4 Brad Love 2020-02-01 938 m88ds3103b_set_mclk(dev, target_mclk / 1000);
e6089feca460cb4 Brad Love 2020-02-01 939
478932b16052f5d Antti Palosaari 2015-04-16 940 ret = regmap_write(dev->regmap, 0xc3, 0x08);
395d00d1ca89478 Antti Palosaari 2013-02-25 941 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 942 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 943
478932b16052f5d Antti Palosaari 2015-04-16 944 ret = regmap_write(dev->regmap, 0xc8, u8tmp);
395d00d1ca89478 Antti Palosaari 2013-02-25 945 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 946 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 947
478932b16052f5d Antti Palosaari 2015-04-16 948 ret = regmap_write(dev->regmap, 0xc4, 0x08);
395d00d1ca89478 Antti Palosaari 2013-02-25 949 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 950 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 951
478932b16052f5d Antti Palosaari 2015-04-16 952 ret = regmap_write(dev->regmap, 0xc7, 0x00);
395d00d1ca89478 Antti Palosaari 2013-02-25 953 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 954 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 955
f5d9b88db7222bf Antti Palosaari 2016-06-29 956 u16tmp = DIV_ROUND_CLOSEST_ULL((u64)c->symbol_rate * 0x10000, dev->mclk);
395d00d1ca89478 Antti Palosaari 2013-02-25 957 buf[0] = (u16tmp >> 0) & 0xff;
395d00d1ca89478 Antti Palosaari 2013-02-25 958 buf[1] = (u16tmp >> 8) & 0xff;
478932b16052f5d Antti Palosaari 2015-04-16 959 ret = regmap_bulk_write(dev->regmap, 0x61, buf, 2);
395d00d1ca89478 Antti Palosaari 2013-02-25 960 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 961 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 962
56ea37da3b93dfe Antti Palosaari 2015-10-03 963 ret = m88ds3103_update_bits(dev, 0x4d, 0x02, dev->cfg->spec_inv << 1);
395d00d1ca89478 Antti Palosaari 2013-02-25 964 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 965 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 966
56ea37da3b93dfe Antti Palosaari 2015-10-03 967 ret = m88ds3103_update_bits(dev, 0x30, 0x10, dev->cfg->agc_inv << 4);
395d00d1ca89478 Antti Palosaari 2013-02-25 968 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 969 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 970
478932b16052f5d Antti Palosaari 2015-04-16 971 ret = regmap_write(dev->regmap, 0x33, dev->cfg->agc);
395d00d1ca89478 Antti Palosaari 2013-02-25 972 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 973 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 974
e6089feca460cb4 Brad Love 2020-02-01 975 if (dev->chiptype == M88DS3103_CHIPTYPE_3103B) {
e6089feca460cb4 Brad Love 2020-02-01 976 /* enable/disable 192M LDPC clock */
e6089feca460cb4 Brad Love 2020-02-01 977 ret = m88ds3103_update_bits(dev, 0x29, 0x10,
e6089feca460cb4 Brad Love 2020-02-01 978 (c->delivery_system == SYS_DVBS) ? 0x10 : 0x0);
e6089feca460cb4 Brad Love 2020-02-01 979 if (ret)
e6089feca460cb4 Brad Love 2020-02-01 980 goto err;
e6089feca460cb4 Brad Love 2020-02-01 981
e6089feca460cb4 Brad Love 2020-02-01 982 ret = m88ds3103_update_bits(dev, 0xc9, 0x08, 0x08);
c4ed27cfed45c16 Sean Young 2020-04-16 983 if (ret)
c4ed27cfed45c16 Sean Young 2020-04-16 984 goto err;
e6089feca460cb4 Brad Love 2020-02-01 985 }
e6089feca460cb4 Brad Love 2020-02-01 986
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 987 dev_dbg(&client->dev, "carrier offset=%d\n",
f5d9b88db7222bf Antti Palosaari 2016-06-29 988 (tuner_frequency_khz - c->frequency));
395d00d1ca89478 Antti Palosaari 2013-02-25 989
f5d9b88db7222bf Antti Palosaari 2016-06-29 990 /* Use 32-bit calc as there is no s64 version of DIV_ROUND_CLOSEST() */
f5d9b88db7222bf Antti Palosaari 2016-06-29 991 s32tmp = 0x10000 * (tuner_frequency_khz - c->frequency);
f5d9b88db7222bf Antti Palosaari 2016-06-29 992 s32tmp = DIV_ROUND_CLOSEST(s32tmp, dev->mclk / 1000);
395d00d1ca89478 Antti Palosaari 2013-02-25 993 buf[0] = (s32tmp >> 0) & 0xff;
395d00d1ca89478 Antti Palosaari 2013-02-25 994 buf[1] = (s32tmp >> 8) & 0xff;
478932b16052f5d Antti Palosaari 2015-04-16 995 ret = regmap_bulk_write(dev->regmap, 0x5e, buf, 2);
395d00d1ca89478 Antti Palosaari 2013-02-25 996 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 997 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 998
478932b16052f5d Antti Palosaari 2015-04-16 999 ret = regmap_write(dev->regmap, 0x00, 0x00);
395d00d1ca89478 Antti Palosaari 2013-02-25 1000 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 1001 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 1002
478932b16052f5d Antti Palosaari 2015-04-16 1003 ret = regmap_write(dev->regmap, 0xb2, 0x00);
395d00d1ca89478 Antti Palosaari 2013-02-25 1004 if (ret)
395d00d1ca89478 Antti Palosaari 2013-02-25 1005 goto err;
395d00d1ca89478 Antti Palosaari 2013-02-25 1006
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 1007 dev->delivery_system = c->delivery_system;
395d00d1ca89478 Antti Palosaari 2013-02-25 1008
395d00d1ca89478 Antti Palosaari 2013-02-25 1009 return 0;
395d00d1ca89478 Antti Palosaari 2013-02-25 1010 err:
7978b8a1bc8ae0f Antti Palosaari 2015-04-16 1011 dev_dbg(&client->dev, "failed=%d\n", ret);
395d00d1ca89478 Antti Palosaari 2013-02-25 1012 return ret;
395d00d1ca89478 Antti Palosaari 2013-02-25 1013 }
395d00d1ca89478 Antti Palosaari 2013-02-25 1014

:::::: The code at line 910 was first introduced by commit
:::::: b6851419409664bc564ce5148bbec1141944c710 [media] m88ds3103: change ts clock config for serial mode

:::::: TO: nibble.max <nibble.max@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-10-09 07:21    [W:3.829 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site