22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/slab.h>
46 pr_err(
"%s: read error, err=%d\n", __func__, err);
58 pr_err(
"%s: write error, err=%d\n", __func__, err);
71 if ((err = tda8261_read(state, &result)) < 0) {
72 pr_err(
"%s: I/O Error\n", __func__);
75 if ((result >> 6) & 0x01) {
76 pr_debug(
"%s: Tuner Phase Locked\n", __func__);
83 static const u32 div_tab[] = { 2000, 1000, 500, 250, 125 };
84 static const u8 ref_div[] = { 0x00, 0x01, 0x02, 0x05, 0x07 };
101 pr_err(
"%s: Unknown parameter (param=%d)\n", __func__, param);
126 if ((frequency < 950000) || (frequency > 2150000)) {
127 pr_warn(
"%s: Frequency beyond limits, frequency=%d\n", __func__, frequency);
131 pr_debug(
"%s: Step size=%d, Divider=%d, PG=0x%02x (%d)\n",
134 buf[0] = (N >> 8) & 0xff;
136 buf[2] = (0x01 << 7) | ((ref_div[config->
step_size] & 0x07) << 1);
138 if (frequency < 1450000)
140 else if (frequency < 2000000)
142 else if (frequency < 2150000)
146 if ((err = tda8261_write(state, buf)) < 0) {
147 pr_err(
"%s: I/O Error\n", __func__);
151 pr_debug(
"%s: Waiting to Phase LOCK\n", __func__);
154 if ((err = tda8261_get_status(fe, &status)) < 0) {
155 pr_err(
"%s: I/O Error\n", __func__);
159 pr_debug(
"%s: Tuner Phase locked: status=%d\n", __func__, status);
162 pr_debug(
"%s: No Phase lock: status=%d\n", __func__, status);
165 pr_err(
"%s: Unknown parameter (param=%d)\n", __func__, param);
186 .frequency_min = 950000,
187 .frequency_max = 2150000,
191 .set_state = tda8261_set_state,
192 .get_state = tda8261_get_state,
193 .get_status = tda8261_get_status,
194 .release = tda8261_release
210 fe->
ops.tuner_ops = tda8261_ops;
212 fe->
ops.tuner_ops.info.frequency_step = div_tab[config->
step_size];
217 pr_info(
"%s: Attaching TDA8261 8PSK/QPSK tuner\n", __func__);