^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * bt856 - BT856A Digital Video Encoder (Rockwell Part)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 1999 Mike Bernson <mike@mlb.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1998 Dave Perks <dperks@ibm.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Modifications for LML33/DC10plus unified driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * This code was modify/ported from the saa7111 driver written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * by Dave Perks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * - moved over to linux>=2.4.x i2c protocol (9/9/2002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/ioctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/videodev2.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <media/v4l2-device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) MODULE_DESCRIPTION("Brooktree-856A video encoder driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) MODULE_AUTHOR("Mike Bernson & Dave Perks");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static int debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) module_param(debug, int, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) MODULE_PARM_DESC(debug, "Debug level (0-1)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* ----------------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define BT856_REG_OFFSET 0xDA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define BT856_NR_REG 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct bt856 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct v4l2_subdev sd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) unsigned char reg[BT856_NR_REG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) v4l2_std_id norm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) static inline struct bt856 *to_bt856(struct v4l2_subdev *sd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return container_of(sd, struct bt856, sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* ----------------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline int bt856_write(struct bt856 *encoder, u8 reg, u8 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct i2c_client *client = v4l2_get_subdevdata(&encoder->sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) encoder->reg[reg - BT856_REG_OFFSET] = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) return i2c_smbus_write_byte_data(client, reg, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static inline int bt856_setbit(struct bt856 *encoder, u8 reg, u8 bit, u8 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return bt856_write(encoder, reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) (encoder->reg[reg - BT856_REG_OFFSET] & ~(1 << bit)) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) (value ? (1 << bit) : 0));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static void bt856_dump(struct bt856 *encoder)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) v4l2_info(&encoder->sd, "register dump:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) for (i = 0; i < BT856_NR_REG; i += 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) printk(KERN_CONT " %02x", encoder->reg[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) printk(KERN_CONT "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* ----------------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) static int bt856_init(struct v4l2_subdev *sd, u32 arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct bt856 *encoder = to_bt856(sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* This is just for testing!!! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) v4l2_dbg(1, debug, sd, "init\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) bt856_write(encoder, 0xdc, 0x18);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) bt856_write(encoder, 0xda, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) bt856_write(encoder, 0xde, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) bt856_setbit(encoder, 0xdc, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /*bt856_setbit(encoder, 0xdc, 6, 0);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) bt856_setbit(encoder, 0xdc, 4, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) if (encoder->norm & V4L2_STD_NTSC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) bt856_setbit(encoder, 0xdc, 2, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) bt856_setbit(encoder, 0xdc, 2, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) bt856_setbit(encoder, 0xdc, 1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) bt856_setbit(encoder, 0xde, 4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) bt856_setbit(encoder, 0xde, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if (debug != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) bt856_dump(encoder);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) static int bt856_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct bt856 *encoder = to_bt856(sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (std & V4L2_STD_NTSC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) bt856_setbit(encoder, 0xdc, 2, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) } else if (std & V4L2_STD_PAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) bt856_setbit(encoder, 0xdc, 2, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) bt856_setbit(encoder, 0xda, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /*bt856_setbit(encoder, 0xda, 0, 1);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) encoder->norm = std;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (debug != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) bt856_dump(encoder);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static int bt856_s_routing(struct v4l2_subdev *sd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) u32 input, u32 output, u32 config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) struct bt856 *encoder = to_bt856(sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) v4l2_dbg(1, debug, sd, "set input %d\n", input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) /* We only have video bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * input= 0: input is from bt819
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * input= 1: input is from ZR36060 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) switch (input) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) bt856_setbit(encoder, 0xde, 4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) bt856_setbit(encoder, 0xde, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) bt856_setbit(encoder, 0xdc, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) bt856_setbit(encoder, 0xdc, 6, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) bt856_setbit(encoder, 0xde, 4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) bt856_setbit(encoder, 0xde, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) bt856_setbit(encoder, 0xdc, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) bt856_setbit(encoder, 0xdc, 6, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) case 2: /* Color bar */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) bt856_setbit(encoder, 0xdc, 3, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) bt856_setbit(encoder, 0xde, 4, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) if (debug != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) bt856_dump(encoder);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /* ----------------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static const struct v4l2_subdev_core_ops bt856_core_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) .init = bt856_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static const struct v4l2_subdev_video_ops bt856_video_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) .s_std_output = bt856_s_std_output,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) .s_routing = bt856_s_routing,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) static const struct v4l2_subdev_ops bt856_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .core = &bt856_core_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .video = &bt856_video_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /* ----------------------------------------------------------------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static int bt856_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct bt856 *encoder;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct v4l2_subdev *sd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /* Check if the adapter supports the needed features */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) v4l_info(client, "chip found @ 0x%x (%s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) client->addr << 1, client->adapter->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) encoder = devm_kzalloc(&client->dev, sizeof(*encoder), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) if (encoder == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) sd = &encoder->sd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) v4l2_i2c_subdev_init(sd, client, &bt856_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) encoder->norm = V4L2_STD_NTSC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) bt856_write(encoder, 0xdc, 0x18);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) bt856_write(encoder, 0xda, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) bt856_write(encoder, 0xde, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) bt856_setbit(encoder, 0xdc, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /*bt856_setbit(encoder, 0xdc, 6, 0);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) bt856_setbit(encoder, 0xdc, 4, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) if (encoder->norm & V4L2_STD_NTSC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) bt856_setbit(encoder, 0xdc, 2, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) bt856_setbit(encoder, 0xdc, 2, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) bt856_setbit(encoder, 0xdc, 1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) bt856_setbit(encoder, 0xde, 4, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) bt856_setbit(encoder, 0xde, 3, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if (debug != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) bt856_dump(encoder);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) static int bt856_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct v4l2_subdev *sd = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) v4l2_device_unregister_subdev(sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static const struct i2c_device_id bt856_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) { "bt856", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_DEVICE_TABLE(i2c, bt856_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static struct i2c_driver bt856_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .name = "bt856",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) .probe = bt856_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) .remove = bt856_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) .id_table = bt856_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) module_i2c_driver(bt856_driver);