• Home
  • Raw
  • Download

Lines Matching +full:1 +full:- +full:d

1 // SPDX-License-Identifier: GPL-2.0-only
3 * - GENPIX 8pks/qpsk/DCII USB2.0 DVB-S module
6 * Copyright (C) 2006,2007 Genpix Electronics (genpix@genpix-electronics.com)
12 * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
15 #include "gp8psk-fe.h"
18 static char bcm4500_firmware[] = "dvb-usb-gp8psk-02.fw";
21 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
29 static int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, in gp8psk_usb_in_op() argument
32 struct gp8psk_state *st = d->priv; in gp8psk_usb_in_op()
35 if (blen > sizeof(st->data)) in gp8psk_usb_in_op()
36 return -EIO; in gp8psk_usb_in_op()
38 if ((ret = mutex_lock_interruptible(&d->usb_mutex))) in gp8psk_usb_in_op()
42 ret = usb_control_msg(d->udev, in gp8psk_usb_in_op()
43 usb_rcvctrlpipe(d->udev,0), in gp8psk_usb_in_op()
46 value, index, st->data, blen, in gp8psk_usb_in_op()
48 deb_info("reading number %d (ret: %d)\n",try,ret); in gp8psk_usb_in_op()
53 warn("usb in %d operation failed.", req); in gp8psk_usb_in_op()
54 ret = -EIO; in gp8psk_usb_in_op()
57 memcpy(b, st->data, blen); in gp8psk_usb_in_op()
63 mutex_unlock(&d->usb_mutex); in gp8psk_usb_in_op()
68 static int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, in gp8psk_usb_out_op() argument
71 struct gp8psk_state *st = d->priv; in gp8psk_usb_out_op()
77 if (blen > sizeof(st->data)) in gp8psk_usb_out_op()
78 return -EIO; in gp8psk_usb_out_op()
80 if ((ret = mutex_lock_interruptible(&d->usb_mutex))) in gp8psk_usb_out_op()
83 memcpy(st->data, b, blen); in gp8psk_usb_out_op()
84 if (usb_control_msg(d->udev, in gp8psk_usb_out_op()
85 usb_sndctrlpipe(d->udev,0), in gp8psk_usb_out_op()
88 value, index, st->data, blen, in gp8psk_usb_out_op()
91 ret = -EIO; in gp8psk_usb_out_op()
94 mutex_unlock(&d->usb_mutex); in gp8psk_usb_out_op()
100 static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) in gp8psk_get_fw_version() argument
102 return gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6); in gp8psk_get_fw_version()
105 static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers) in gp8psk_get_fpga_version() argument
107 return gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1); in gp8psk_get_fpga_version()
110 static void gp8psk_info(struct dvb_usb_device *d) in gp8psk_info() argument
114 if (!gp8psk_get_fw_version(d, fw_vers)) in gp8psk_info()
116 fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers), in gp8psk_info()
121 if (!gp8psk_get_fpga_version(d, &fpga_vers)) in gp8psk_info()
127 static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) in gp8psk_load_bcm4500fw() argument
134 &d->udev->dev)) != 0) { in gp8psk_load_bcm4500fw()
135 …err("did not find the bcm4500 firmware file '%s' (status %d). You can use <kernel_dir>/scripts/get… in gp8psk_load_bcm4500fw()
140 ret = -EINVAL; in gp8psk_load_bcm4500fw()
142 if (gp8psk_usb_out_op(d, LOAD_BCM4500,1,0,NULL, 0)) in gp8psk_load_bcm4500fw()
147 ptr = fw->data; in gp8psk_load_bcm4500fw()
150 ret = -ENOMEM; in gp8psk_load_bcm4500fw()
156 if (ptr + buflen >= fw->data + fw->size) { in gp8psk_load_bcm4500fw()
166 if (dvb_usb_generic_write(d, buf, buflen)) { in gp8psk_load_bcm4500fw()
183 static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff) in gp8psk_power_ctrl() argument
186 int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); in gp8psk_power_ctrl()
189 gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1); in gp8psk_power_ctrl()
192 gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); in gp8psk_power_ctrl()
193 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) in gp8psk_power_ctrl()
194 return -EINVAL; in gp8psk_power_ctrl()
195 gp8psk_info(d); in gp8psk_power_ctrl()
200 if(gp8psk_load_bcm4500fw(d)) in gp8psk_power_ctrl()
201 return -EINVAL; in gp8psk_power_ctrl()
204 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0, in gp8psk_power_ctrl()
205 &buf, 1)) in gp8psk_power_ctrl()
206 return -EINVAL; in gp8psk_power_ctrl()
208 /* Set DVB mode to 1 */ in gp8psk_power_ctrl()
210 if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0)) in gp8psk_power_ctrl()
211 return -EINVAL; in gp8psk_power_ctrl()
213 if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0)) in gp8psk_power_ctrl()
214 return -EINVAL; in gp8psk_power_ctrl()
217 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)) in gp8psk_power_ctrl()
218 return -EINVAL; in gp8psk_power_ctrl()
220 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) in gp8psk_power_ctrl()
221 return -EINVAL; in gp8psk_power_ctrl()
223 gp8psk_usb_out_op(d, CW3K_INIT, 0, 0, NULL, 0); in gp8psk_power_ctrl()
228 static int gp8psk_bcm4500_reload(struct dvb_usb_device *d) in gp8psk_bcm4500_reload() argument
231 int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct); in gp8psk_bcm4500_reload()
236 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) in gp8psk_bcm4500_reload()
237 return -EINVAL; in gp8psk_bcm4500_reload()
239 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) in gp8psk_bcm4500_reload()
240 return -EINVAL; in gp8psk_bcm4500_reload()
243 if (gp8psk_load_bcm4500fw(d)) in gp8psk_bcm4500_reload()
244 return -EINVAL; in gp8psk_bcm4500_reload()
250 return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0); in gp8psk_streaming_ctrl()
253 /* Callbacks for gp8psk-fe.c */
258 struct dvb_usb_device *d = priv; in gp8psk_fe_in() local
260 return gp8psk_usb_in_op(d, req, value, index, b, blen); in gp8psk_fe_in()
266 struct dvb_usb_device *d = priv; in gp8psk_fe_out() local
268 return gp8psk_usb_out_op(d, req, value, index, b, blen); in gp8psk_fe_out()
273 struct dvb_usb_device *d = priv; in gp8psk_fe_reload() local
275 return gp8psk_bcm4500_reload(d); in gp8psk_fe_reload()
286 struct dvb_usb_device *d = adap->dev; in gp8psk_frontend_attach() local
287 int id = le16_to_cpu(d->udev->descriptor.idProduct); in gp8psk_frontend_attach()
292 adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach, in gp8psk_frontend_attach()
293 &gp8psk_fe_ops, d, is_rev1); in gp8psk_frontend_attach()
308 le16_to_cpu(udev->descriptor.idProduct)); in gp8psk_usb_probe()
326 .firmware = "dvb-usb-gp8psk-01.fw",
330 .num_adapters = 1,
333 .num_frontends = 1,
337 /* parameter for the MPEG2-data transfer */
357 { .name = "Genpix 8PSK-to-USB2 Rev.1 DVB-S receiver",
359 .warm_ids = { &gp8psk_usb_table[1], NULL },
361 { .name = "Genpix 8PSK-to-USB2 Rev.2 DVB-S receiver",
365 { .name = "Genpix SkyWalker-1 DVB-S receiver",
369 { .name = "Genpix SkyWalker-2 DVB-S receiver",
388 MODULE_DESCRIPTION("Driver for Genpix DVB-S");