Lines Matching +full:16 +full:- +full:byte
1 // SPDX-License-Identifier: GPL-2.0
3 // I2C address is always 0x20 (0x10 at 7-bit mode).
5 // Copyright (c) 2005-2007 Mauro Carvalho Chehab <[email protected]>
12 #include "tuner-i2c.h"
32 /* INTREG - Read: bytes 0 and 1 / Write: byte 0 */
34 /* first byte for reading */
40 /* second byte for reading / byte for writing */
46 /* FRQSET - Read: bytes 2 and 3 / Write: byte 1 and 2 */
48 /* First byte */
52 /* Bits 0-5 for divider MSB */
54 /* Second byte */
55 /* Bits 0-7 for divider LSB */
57 /* TNCTRL - Read: bytes 4 and 5 / Write: Bytes 3 and 4 */
59 /* first byte */
69 /* second byte */
80 /* FRQCHECK - Read: bytes 6 and 7 */
81 /* First byte */
83 /* Bits 0-5 for divider MSB */
85 /* Second byte */
86 /* Bits 0-7 for divider LSB */
88 /* TUNCHECK - Read: bytes 8 and 9 */
90 /* First byte */
94 /* Second byte */
99 /* TESTREG - Read: bytes 10 and 11 / Write: bytes 5 and 6 */
103 /* MANID - Read: bytes 12 and 13 */
105 /* First byte - should be 0x10 */
107 #define TEA5767_MANID_ID_MSB_MASK 0x0f /* Manufacurer ID - should be 0 */
109 /* Second byte - Should be 0x2b */
111 #define TEA5767_MANID_ID_LSB_MASK 0xfe /* Manufacturer ID - should be 0x15 */
114 /* Chip ID - Read: bytes 14 and 15 */
116 /* First byte - should be 0x57 */
118 /* Second byte - should be 0x61 */
140 struct tea5761_priv *priv = fe->tuner_priv; in __set_radio_freq()
148 if (priv->standby) { in __set_radio_freq()
163 div = (1000 * (frq * 4 / 16 + 700 + 225) ) >> 15; in __set_radio_freq()
170 if (7 != (rc = tuner_i2c_xfer_send(&priv->i2c_props, buffer, 7))) in __set_radio_freq()
173 priv->frequency = frq * 125 / 2; in __set_radio_freq()
181 struct tea5761_priv *priv = fe->analog_demod_priv; in set_radio_freq()
183 priv->standby = false; in set_radio_freq()
185 return __set_radio_freq(fe, params->frequency, in set_radio_freq()
186 params->audmode == V4L2_TUNER_MODE_MONO); in set_radio_freq()
191 struct tea5761_priv *priv = fe->analog_demod_priv; in set_radio_sleep()
193 priv->standby = true; in set_radio_sleep()
195 return __set_radio_freq(fe, priv->frequency, false); in set_radio_sleep()
200 struct tea5761_priv *priv = fe->tuner_priv; in tea5761_read_status()
203 memset(buffer, 0, 16); in tea5761_read_status()
204 if (16 != (rc = tuner_i2c_xfer_recv(&priv->i2c_props, buffer, 16))) { in tea5761_read_status()
205 tuner_warn("i2c i/o error: rc == %d (should be 16)\n", rc); in tea5761_read_status()
206 return -EREMOTEIO; in tea5761_read_status()
214 struct tea5761_priv *priv = fe->tuner_priv; in tea5761_signal()
216 int signal = ((buffer[9] & TEA5761_TUNCHECK_LEV_MASK) << (13 - 4)); in tea5761_signal()
225 struct tea5761_priv *priv = fe->tuner_priv; in tea5761_stereo()
236 unsigned char buffer[16]; in tea5761_get_status()
252 unsigned char buffer[16]; in tea5761_get_rf_strength()
264 unsigned char buffer[16]; in tea5761_autodetection()
268 if (16 != (rc = tuner_i2c_xfer_recv(&i2c, buffer, 16))) { in tea5761_autodetection()
270 return -EINVAL; in tea5761_autodetection()
276 return -EINVAL; in tea5761_autodetection()
286 kfree(fe->tuner_priv); in tea5761_release()
287 fe->tuner_priv = NULL; in tea5761_release()
292 struct tea5761_priv *priv = fe->tuner_priv; in tea5761_get_frequency()
293 *frequency = priv->frequency; in tea5761_get_frequency()
321 fe->tuner_priv = priv; in tea5761_attach()
323 priv->i2c_props.addr = i2c_addr; in tea5761_attach()
324 priv->i2c_props.adap = i2c_adap; in tea5761_attach()
325 priv->i2c_props.name = "tea5761"; in tea5761_attach()
327 memcpy(&fe->ops.tuner_ops, &tea5761_tuner_ops, in tea5761_attach()