18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * mxl111sf-phy.c - driver for the MaxLinear MXL111SF 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2010-2014 Michael Krufky <mkrufky@linuxtv.org> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include "mxl111sf-phy.h" 98c2ecf20Sopenharmony_ci#include "mxl111sf-reg.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciint mxl111sf_init_tuner_demod(struct mxl111sf_state *state) 128c2ecf20Sopenharmony_ci{ 138c2ecf20Sopenharmony_ci struct mxl111sf_reg_ctrl_info mxl_111_overwrite_default[] = { 148c2ecf20Sopenharmony_ci {0x07, 0xff, 0x0c}, 158c2ecf20Sopenharmony_ci {0x58, 0xff, 0x9d}, 168c2ecf20Sopenharmony_ci {0x09, 0xff, 0x00}, 178c2ecf20Sopenharmony_ci {0x06, 0xff, 0x06}, 188c2ecf20Sopenharmony_ci {0xc8, 0xff, 0x40}, /* ED_LE_WIN_OLD = 0 */ 198c2ecf20Sopenharmony_ci {0x8d, 0x01, 0x01}, /* NEGATE_Q */ 208c2ecf20Sopenharmony_ci {0x32, 0xff, 0xac}, /* DIG_RFREFSELECT = 12 */ 218c2ecf20Sopenharmony_ci {0x42, 0xff, 0x43}, /* DIG_REG_AMP = 4 */ 228c2ecf20Sopenharmony_ci {0x74, 0xff, 0xc4}, /* SSPUR_FS_PRIO = 4 */ 238c2ecf20Sopenharmony_ci {0x71, 0xff, 0xe6}, /* SPUR_ROT_PRIO_VAL = 1 */ 248c2ecf20Sopenharmony_ci {0x83, 0xff, 0x64}, /* INF_FILT1_THD_SC = 100 */ 258c2ecf20Sopenharmony_ci {0x85, 0xff, 0x64}, /* INF_FILT2_THD_SC = 100 */ 268c2ecf20Sopenharmony_ci {0x88, 0xff, 0xf0}, /* INF_THD = 240 */ 278c2ecf20Sopenharmony_ci {0x6f, 0xf0, 0xb0}, /* DFE_DLY = 11 */ 288c2ecf20Sopenharmony_ci {0x00, 0xff, 0x01}, /* Change to page 1 */ 298c2ecf20Sopenharmony_ci {0x81, 0xff, 0x11}, /* DSM_FERR_BYPASS = 1 */ 308c2ecf20Sopenharmony_ci {0xf4, 0xff, 0x07}, /* DIG_FREQ_CORR = 1 */ 318c2ecf20Sopenharmony_ci {0xd4, 0x1f, 0x0f}, /* SPUR_TEST_NOISE_TH = 15 */ 328c2ecf20Sopenharmony_ci {0xd6, 0xff, 0x0c}, /* SPUR_TEST_NOISE_PAPR = 12 */ 338c2ecf20Sopenharmony_ci {0x00, 0xff, 0x00}, /* Change to page 0 */ 348c2ecf20Sopenharmony_ci {0, 0, 0} 358c2ecf20Sopenharmony_ci }; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci mxl_debug("()"); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci return mxl111sf_ctrl_program_regs(state, mxl_111_overwrite_default); 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciint mxl1x1sf_soft_reset(struct mxl111sf_state *state) 438c2ecf20Sopenharmony_ci{ 448c2ecf20Sopenharmony_ci int ret; 458c2ecf20Sopenharmony_ci mxl_debug("()"); 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 0xff, 0x00); /* AIC */ 488c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 498c2ecf20Sopenharmony_ci goto fail; 508c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 0x02, 0x01); /* get out of reset */ 518c2ecf20Sopenharmony_ci mxl_fail(ret); 528c2ecf20Sopenharmony_cifail: 538c2ecf20Sopenharmony_ci return ret; 548c2ecf20Sopenharmony_ci} 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciint mxl1x1sf_set_device_mode(struct mxl111sf_state *state, int mode) 578c2ecf20Sopenharmony_ci{ 588c2ecf20Sopenharmony_ci int ret; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci mxl_debug("(%s)", MXL_SOC_MODE == mode ? 618c2ecf20Sopenharmony_ci "MXL_SOC_MODE" : "MXL_TUNER_MODE"); 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci /* set device mode */ 648c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 0x03, 658c2ecf20Sopenharmony_ci MXL_SOC_MODE == mode ? 0x01 : 0x00); 668c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 678c2ecf20Sopenharmony_ci goto fail; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg_mask(state, 708c2ecf20Sopenharmony_ci 0x7d, 0x40, MXL_SOC_MODE == mode ? 718c2ecf20Sopenharmony_ci 0x00 : /* enable impulse noise filter, 728c2ecf20Sopenharmony_ci INF_BYP = 0 */ 738c2ecf20Sopenharmony_ci 0x40); /* disable impulse noise filter, 748c2ecf20Sopenharmony_ci INF_BYP = 1 */ 758c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 768c2ecf20Sopenharmony_ci goto fail; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci state->device_mode = mode; 798c2ecf20Sopenharmony_cifail: 808c2ecf20Sopenharmony_ci return ret; 818c2ecf20Sopenharmony_ci} 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* power up tuner */ 848c2ecf20Sopenharmony_ciint mxl1x1sf_top_master_ctrl(struct mxl111sf_state *state, int onoff) 858c2ecf20Sopenharmony_ci{ 868c2ecf20Sopenharmony_ci mxl_debug("(%d)", onoff); 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci return mxl111sf_write_reg(state, 0x01, onoff ? 0x01 : 0x00); 898c2ecf20Sopenharmony_ci} 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ciint mxl111sf_disable_656_port(struct mxl111sf_state *state) 928c2ecf20Sopenharmony_ci{ 938c2ecf20Sopenharmony_ci mxl_debug("()"); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci return mxl111sf_write_reg_mask(state, 0x12, 0x04, 0x00); 968c2ecf20Sopenharmony_ci} 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ciint mxl111sf_enable_usb_output(struct mxl111sf_state *state) 998c2ecf20Sopenharmony_ci{ 1008c2ecf20Sopenharmony_ci mxl_debug("()"); 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci return mxl111sf_write_reg_mask(state, 0x17, 0x40, 0x00); 1038c2ecf20Sopenharmony_ci} 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci/* initialize TSIF as input port of MxL1X1SF for MPEG2 data transfer */ 1068c2ecf20Sopenharmony_ciint mxl111sf_config_mpeg_in(struct mxl111sf_state *state, 1078c2ecf20Sopenharmony_ci unsigned int parallel_serial, 1088c2ecf20Sopenharmony_ci unsigned int msb_lsb_1st, 1098c2ecf20Sopenharmony_ci unsigned int clock_phase, 1108c2ecf20Sopenharmony_ci unsigned int mpeg_valid_pol, 1118c2ecf20Sopenharmony_ci unsigned int mpeg_sync_pol) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci int ret; 1148c2ecf20Sopenharmony_ci u8 mode, tmp; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci mxl_debug("(%u,%u,%u,%u,%u)", parallel_serial, msb_lsb_1st, 1178c2ecf20Sopenharmony_ci clock_phase, mpeg_valid_pol, mpeg_sync_pol); 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci /* Enable PIN MUX */ 1208c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_PIN_MUX_MODE_REG, V6_ENABLE_PIN_MUX); 1218c2ecf20Sopenharmony_ci mxl_fail(ret); 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci /* Configure MPEG Clock phase */ 1248c2ecf20Sopenharmony_ci mxl111sf_read_reg(state, V6_MPEG_IN_CLK_INV_REG, &mode); 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci if (clock_phase == TSIF_NORMAL) 1278c2ecf20Sopenharmony_ci mode &= ~V6_INVERTED_CLK_PHASE; 1288c2ecf20Sopenharmony_ci else 1298c2ecf20Sopenharmony_ci mode |= V6_INVERTED_CLK_PHASE; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_MPEG_IN_CLK_INV_REG, mode); 1328c2ecf20Sopenharmony_ci mxl_fail(ret); 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci /* Configure data input mode, MPEG Valid polarity, MPEG Sync polarity 1358c2ecf20Sopenharmony_ci * Get current configuration */ 1368c2ecf20Sopenharmony_ci ret = mxl111sf_read_reg(state, V6_MPEG_IN_CTRL_REG, &mode); 1378c2ecf20Sopenharmony_ci mxl_fail(ret); 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci /* Data Input mode */ 1408c2ecf20Sopenharmony_ci if (parallel_serial == TSIF_INPUT_PARALLEL) { 1418c2ecf20Sopenharmony_ci /* Disable serial mode */ 1428c2ecf20Sopenharmony_ci mode &= ~V6_MPEG_IN_DATA_SERIAL; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci /* Enable Parallel mode */ 1458c2ecf20Sopenharmony_ci mode |= V6_MPEG_IN_DATA_PARALLEL; 1468c2ecf20Sopenharmony_ci } else { 1478c2ecf20Sopenharmony_ci /* Disable Parallel mode */ 1488c2ecf20Sopenharmony_ci mode &= ~V6_MPEG_IN_DATA_PARALLEL; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /* Enable Serial Mode */ 1518c2ecf20Sopenharmony_ci mode |= V6_MPEG_IN_DATA_SERIAL; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci /* If serial interface is chosen, configure 1548c2ecf20Sopenharmony_ci MSB or LSB order in transmission */ 1558c2ecf20Sopenharmony_ci ret = mxl111sf_read_reg(state, 1568c2ecf20Sopenharmony_ci V6_MPEG_INOUT_BIT_ORDER_CTRL_REG, 1578c2ecf20Sopenharmony_ci &tmp); 1588c2ecf20Sopenharmony_ci mxl_fail(ret); 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci if (msb_lsb_1st == MPEG_SER_MSB_FIRST_ENABLED) 1618c2ecf20Sopenharmony_ci tmp |= V6_MPEG_SER_MSB_FIRST; 1628c2ecf20Sopenharmony_ci else 1638c2ecf20Sopenharmony_ci tmp &= ~V6_MPEG_SER_MSB_FIRST; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 1668c2ecf20Sopenharmony_ci V6_MPEG_INOUT_BIT_ORDER_CTRL_REG, 1678c2ecf20Sopenharmony_ci tmp); 1688c2ecf20Sopenharmony_ci mxl_fail(ret); 1698c2ecf20Sopenharmony_ci } 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci /* MPEG Sync polarity */ 1728c2ecf20Sopenharmony_ci if (mpeg_sync_pol == TSIF_NORMAL) 1738c2ecf20Sopenharmony_ci mode &= ~V6_INVERTED_MPEG_SYNC; 1748c2ecf20Sopenharmony_ci else 1758c2ecf20Sopenharmony_ci mode |= V6_INVERTED_MPEG_SYNC; 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci /* MPEG Valid polarity */ 1788c2ecf20Sopenharmony_ci if (mpeg_valid_pol == 0) 1798c2ecf20Sopenharmony_ci mode &= ~V6_INVERTED_MPEG_VALID; 1808c2ecf20Sopenharmony_ci else 1818c2ecf20Sopenharmony_ci mode |= V6_INVERTED_MPEG_VALID; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_MPEG_IN_CTRL_REG, mode); 1848c2ecf20Sopenharmony_ci mxl_fail(ret); 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci return ret; 1878c2ecf20Sopenharmony_ci} 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ciint mxl111sf_init_i2s_port(struct mxl111sf_state *state, u8 sample_size) 1908c2ecf20Sopenharmony_ci{ 1918c2ecf20Sopenharmony_ci static struct mxl111sf_reg_ctrl_info init_i2s[] = { 1928c2ecf20Sopenharmony_ci {0x1b, 0xff, 0x1e}, /* pin mux mode, Choose 656/I2S input */ 1938c2ecf20Sopenharmony_ci {0x15, 0x60, 0x60}, /* Enable I2S */ 1948c2ecf20Sopenharmony_ci {0x17, 0xe0, 0x20}, /* Input, MPEG MODE USB, 1958c2ecf20Sopenharmony_ci Inverted 656 Clock, I2S_SOFT_RESET, 1968c2ecf20Sopenharmony_ci 0 : Normal operation, 1 : Reset State */ 1978c2ecf20Sopenharmony_ci#if 0 1988c2ecf20Sopenharmony_ci {0x12, 0x01, 0x00}, /* AUDIO_IRQ_CLR (Overflow Indicator) */ 1998c2ecf20Sopenharmony_ci#endif 2008c2ecf20Sopenharmony_ci {0x00, 0xff, 0x02}, /* Change to Control Page */ 2018c2ecf20Sopenharmony_ci {0x26, 0x0d, 0x0d}, /* I2S_MODE & BT656_SRC_SEL for FPGA only */ 2028c2ecf20Sopenharmony_ci {0x00, 0xff, 0x00}, 2038c2ecf20Sopenharmony_ci {0, 0, 0} 2048c2ecf20Sopenharmony_ci }; 2058c2ecf20Sopenharmony_ci int ret; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci mxl_debug("(0x%02x)", sample_size); 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci ret = mxl111sf_ctrl_program_regs(state, init_i2s); 2108c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2118c2ecf20Sopenharmony_ci goto fail; 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_I2S_NUM_SAMPLES_REG, sample_size); 2148c2ecf20Sopenharmony_ci mxl_fail(ret); 2158c2ecf20Sopenharmony_cifail: 2168c2ecf20Sopenharmony_ci return ret; 2178c2ecf20Sopenharmony_ci} 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ciint mxl111sf_disable_i2s_port(struct mxl111sf_state *state) 2208c2ecf20Sopenharmony_ci{ 2218c2ecf20Sopenharmony_ci static struct mxl111sf_reg_ctrl_info disable_i2s[] = { 2228c2ecf20Sopenharmony_ci {0x15, 0x40, 0x00}, 2238c2ecf20Sopenharmony_ci {0, 0, 0} 2248c2ecf20Sopenharmony_ci }; 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci mxl_debug("()"); 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci return mxl111sf_ctrl_program_regs(state, disable_i2s); 2298c2ecf20Sopenharmony_ci} 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ciint mxl111sf_config_i2s(struct mxl111sf_state *state, 2328c2ecf20Sopenharmony_ci u8 msb_start_pos, u8 data_width) 2338c2ecf20Sopenharmony_ci{ 2348c2ecf20Sopenharmony_ci int ret; 2358c2ecf20Sopenharmony_ci u8 tmp; 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci mxl_debug("(0x%02x, 0x%02x)", msb_start_pos, data_width); 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci ret = mxl111sf_read_reg(state, V6_I2S_STREAM_START_BIT_REG, &tmp); 2408c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2418c2ecf20Sopenharmony_ci goto fail; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci tmp &= 0xe0; 2448c2ecf20Sopenharmony_ci tmp |= msb_start_pos; 2458c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_I2S_STREAM_START_BIT_REG, tmp); 2468c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2478c2ecf20Sopenharmony_ci goto fail; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci ret = mxl111sf_read_reg(state, V6_I2S_STREAM_END_BIT_REG, &tmp); 2508c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2518c2ecf20Sopenharmony_ci goto fail; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci tmp &= 0xe0; 2548c2ecf20Sopenharmony_ci tmp |= data_width; 2558c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_I2S_STREAM_END_BIT_REG, tmp); 2568c2ecf20Sopenharmony_ci mxl_fail(ret); 2578c2ecf20Sopenharmony_cifail: 2588c2ecf20Sopenharmony_ci return ret; 2598c2ecf20Sopenharmony_ci} 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ciint mxl111sf_config_spi(struct mxl111sf_state *state, int onoff) 2628c2ecf20Sopenharmony_ci{ 2638c2ecf20Sopenharmony_ci u8 val; 2648c2ecf20Sopenharmony_ci int ret; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci mxl_debug("(%d)", onoff); 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 0x00, 0x02); 2698c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2708c2ecf20Sopenharmony_ci goto fail; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci ret = mxl111sf_read_reg(state, V8_SPI_MODE_REG, &val); 2738c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2748c2ecf20Sopenharmony_ci goto fail; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci if (onoff) 2778c2ecf20Sopenharmony_ci val |= 0x04; 2788c2ecf20Sopenharmony_ci else 2798c2ecf20Sopenharmony_ci val &= ~0x04; 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V8_SPI_MODE_REG, val); 2828c2ecf20Sopenharmony_ci if (mxl_fail(ret)) 2838c2ecf20Sopenharmony_ci goto fail; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, 0x00, 0x00); 2868c2ecf20Sopenharmony_ci mxl_fail(ret); 2878c2ecf20Sopenharmony_cifail: 2888c2ecf20Sopenharmony_ci return ret; 2898c2ecf20Sopenharmony_ci} 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ciint mxl111sf_idac_config(struct mxl111sf_state *state, 2928c2ecf20Sopenharmony_ci u8 control_mode, u8 current_setting, 2938c2ecf20Sopenharmony_ci u8 current_value, u8 hysteresis_value) 2948c2ecf20Sopenharmony_ci{ 2958c2ecf20Sopenharmony_ci int ret; 2968c2ecf20Sopenharmony_ci u8 val; 2978c2ecf20Sopenharmony_ci /* current value will be set for both automatic & manual IDAC control */ 2988c2ecf20Sopenharmony_ci val = current_value; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci if (control_mode == IDAC_MANUAL_CONTROL) { 3018c2ecf20Sopenharmony_ci /* enable manual control of IDAC */ 3028c2ecf20Sopenharmony_ci val |= IDAC_MANUAL_CONTROL_BIT_MASK; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci if (current_setting == IDAC_CURRENT_SINKING_ENABLE) 3058c2ecf20Sopenharmony_ci /* enable current sinking in manual mode */ 3068c2ecf20Sopenharmony_ci val |= IDAC_CURRENT_SINKING_BIT_MASK; 3078c2ecf20Sopenharmony_ci else 3088c2ecf20Sopenharmony_ci /* disable current sinking in manual mode */ 3098c2ecf20Sopenharmony_ci val &= ~IDAC_CURRENT_SINKING_BIT_MASK; 3108c2ecf20Sopenharmony_ci } else { 3118c2ecf20Sopenharmony_ci /* disable manual control of IDAC */ 3128c2ecf20Sopenharmony_ci val &= ~IDAC_MANUAL_CONTROL_BIT_MASK; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci /* set hysteresis value reg: 0x0B<5:0> */ 3158c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_IDAC_HYSTERESIS_REG, 3168c2ecf20Sopenharmony_ci (hysteresis_value & 0x3F)); 3178c2ecf20Sopenharmony_ci mxl_fail(ret); 3188c2ecf20Sopenharmony_ci } 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci ret = mxl111sf_write_reg(state, V6_IDAC_SETTINGS_REG, val); 3218c2ecf20Sopenharmony_ci mxl_fail(ret); 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci return ret; 3248c2ecf20Sopenharmony_ci} 325