aboutsummaryrefslogtreecommitdiffstats
path: root/net
ModeNameSize
d---------802376logstatsplain
d---------8021q373logstatsplain
d---------9p405logstatsplain
-rw-r--r--Kconfig8640logstatsplainblame
-rw-r--r--Makefile1748logstatsplainblame
-rw-r--r--TUNABLE2239logstatsplainblame
d---------appletalk222logstatsplain
d---------atm1049logstatsplain
d---------ax25824logstatsplain
d---------bluetooth532logstatsplain
d---------bridge810logstatsplain
d---------can243logstatsplain
-rw-r--r--compat.c23218logstatsplainblame
d---------core1170logstatsplain
d---------dcb106logstatsplain
d---------dccp769logstatsplain
d---------decnet600logstatsplain
d---------dsa494logstatsplain
d---------econet110logstatsplain
d---------ethernet102logstatsplain
d---------ipv43003logstatsplain
d---------ipv61988logstatsplain
d---------ipx228logstatsplain
d---------irda1002logstatsplain
d---------iucv142logstatsplain
d---------key72logstatsplain
d---------lapb265logstatsplain
d---------llc723logstatsplain
d---------mac802112040logstatsplain
d---------netfilter3758logstatsplain
d---------netlabel668logstatsplain
d---------netlink149logstatsplain
d---------netrom383logstatsplain
-rw-r--r--nonet.c528logstatsplainblame
d---------packet110logstatsplain
d---------phonet367logstatsplain
d---------rfkill191logstatsplain
d---------rose432logstatsplain
d---------rxrpc807logstatsplain
d---------sched1792logstatsplain
d---------sctp1088logstatsplain
-rw-r--r--socket.c58332logstatsplainblame
d---------sunrpc952logstatsplain
-rw-r--r--sysctl_net.c3068logstatsplainblame
d---------tipc1646logstatsplain
d---------unix190logstatsplain
d---------wanrouter183logstatsplain
d---------wimax380logstatsplain
d---------wireless680logstatsplain
d---------x25538logstatsplain
d---------xfrm510logstatsplain
="hl opt">*client = v4l2_get_subdevdata(sd); struct tda7432 *t = to_state(sd); unsigned char buf[16]; v4l2_dbg(1, debug, sd, "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n", t->input, t->volume, t->bass, t->treble, t->lf, t->lr, t->rf, t->rr, t->loud); buf[0] = TDA7432_IN; buf[1] = t->input; buf[2] = t->volume; buf[3] = t->bass; buf[4] = t->treble; buf[5] = t->lf; buf[6] = t->lr; buf[7] = t->rf; buf[8] = t->rr; buf[9] = t->loud; if (10 != i2c_master_send(client, buf, 10)) { v4l2_err(sd, "I/O error, trying tda7432_set\n"); return -1; } return 0; } static void do_tda7432_init(struct v4l2_subdev *sd) { struct tda7432 *t = to_state(sd); v4l2_dbg(2, debug, sd, "In tda7432_init\n"); t->input = TDA7432_STEREO_IN | /* Main (stereo) input */ TDA7432_BASS_SYM | /* Symmetric bass cut */ TDA7432_BASS_NORM; /* Normal bass range */ t->volume = 0x3b ; /* -27dB Volume */ if (loudness) /* Turn loudness on? */ t->volume |= TDA7432_LD_ON; t->muted = 1; t->treble = TDA7432_TREBLE_0DB; /* 0dB Treble */ t->bass = TDA7432_BASS_0DB; /* 0dB Bass */ t->lf = TDA7432_ATTEN_0DB; /* 0dB attenuation */ t->lr = TDA7432_ATTEN_0DB; /* 0dB attenuation */ t->rf = TDA7432_ATTEN_0DB; /* 0dB attenuation */ t->rr = TDA7432_ATTEN_0DB; /* 0dB attenuation */ t->loud = loudness; /* insmod parameter */ tda7432_set(sd); } static int tda7432_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { struct tda7432 *t = to_state(sd); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: ctrl->value=t->muted; return 0; case V4L2_CID_AUDIO_VOLUME: if (!maxvol){ /* max +20db */ ctrl->value = ( 0x6f - (t->volume & 0x7F) ) * 630; } else { /* max 0db */ ctrl->value = ( 0x6f - (t->volume & 0x7F) ) * 829; } return 0; case V4L2_CID_AUDIO_BALANCE: { if ( (t->lf) < (t->rf) ) /* right is attenuated, balance shifted left */ ctrl->value = (32768 - 1057*(t->rf)); else /* left is attenuated, balance shifted right */ ctrl->value = (32768 + 1057*(t->lf)); return 0; } case V4L2_CID_AUDIO_BASS: { /* Bass/treble 4 bits each */ int bass=t->bass; if(bass >= 0x8) bass = ~(bass - 0x8) & 0xf; ctrl->value = (bass << 12)+(bass << 8)+(bass << 4)+(bass); return 0; } case V4L2_CID_AUDIO_TREBLE: { int treble=t->treble; if(treble >= 0x8) treble = ~(treble - 0x8) & 0xf; ctrl->value = (treble << 12)+(treble << 8)+(treble << 4)+(treble); return 0; } } return -EINVAL; } static int tda7432_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { struct tda7432 *t = to_state(sd); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: t->muted=ctrl->value; break; case V4L2_CID_AUDIO_VOLUME: if(!maxvol){ /* max +20db */ t->volume = 0x6f - ((ctrl->value)/630); } else { /* max 0db */ t->volume = 0x6f - ((ctrl->value)/829); } if (loudness) /* Turn on the loudness bit */ t->volume |= TDA7432_LD_ON; tda7432_write(sd, TDA7432_VL, t->volume); return 0; case V4L2_CID_AUDIO_BALANCE: if (ctrl->value < 32768) { /* shifted to left, attenuate right */ t->rr = (32768 - ctrl->value)/1057; t->rf = t->rr; t->lr = TDA7432_ATTEN_0DB; t->lf = TDA7432_ATTEN_0DB; } else if(ctrl->value > 32769) { /* shifted to right, attenuate left */ t->lf = (ctrl->value - 32768)/1057; t->lr = t->lf; t->rr = TDA7432_ATTEN_0DB; t->rf = TDA7432_ATTEN_0DB; } else { /* centered */ t->rr = TDA7432_ATTEN_0DB; t->rf = TDA7432_ATTEN_0DB; t->lf = TDA7432_ATTEN_0DB; t->lr = TDA7432_ATTEN_0DB; } break; case V4L2_CID_AUDIO_BASS: t->bass = ctrl->value >> 12; if(t->bass>= 0x8) t->bass = (~t->bass & 0xf) + 0x8 ; tda7432_write(sd, TDA7432_TN, 0x10 | (t->bass << 4) | t->treble); return 0; case V4L2_CID_AUDIO_TREBLE: t->treble= ctrl->value >> 12; if(t->treble>= 0x8) t->treble = (~t->treble & 0xf) + 0x8 ; tda7432_write(sd, TDA7432_TN, 0x10 | (t->bass << 4) | t->treble); return 0; default: return -EINVAL; } /* Used for both mute and balance changes */ if (t->muted) { /* Mute & update balance*/ tda7432_write(sd, TDA7432_LF, t->lf | TDA7432_MUTE); tda7432_write(sd, TDA7432_LR, t->lr | TDA7432_MUTE); tda7432_write(sd, TDA7432_RF, t->rf | TDA7432_MUTE); tda7432_write(sd, TDA7432_RR, t->rr | TDA7432_MUTE); } else { tda7432_write(sd, TDA7432_LF, t->lf); tda7432_write(sd, TDA7432_LR, t->lr); tda7432_write(sd, TDA7432_RF, t->rf); tda7432_write(sd, TDA7432_RR, t->rr); } return 0; } static int tda7432_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) { switch (qc->id) { case V4L2_CID_AUDIO_VOLUME: return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880); case V4L2_CID_AUDIO_MUTE: return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0); case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BASS: case V4L2_CID_AUDIO_TREBLE: return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768); } return -EINVAL; } /* ----------------------------------------------------------------------- */ static const struct v4l2_subdev_core_ops tda7432_core_ops = { .queryctrl = tda7432_queryctrl, .g_ctrl = tda7432_g_ctrl, .s_ctrl = tda7432_s_ctrl, }; static const struct v4l2_subdev_ops tda7432_ops = { .core = &tda7432_core_ops, }; /* ----------------------------------------------------------------------- */ /* *********************** * * i2c interface functions * * *********************** */ static int tda7432_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct tda7432 *t; struct v4l2_subdev *sd; v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); t = kzalloc(sizeof(*t), GFP_KERNEL); if (!t) return -ENOMEM; sd = &t->sd; v4l2_i2c_subdev_init(sd, client, &tda7432_ops); if (loudness < 0 || loudness > 15) { v4l2_warn(sd, "loudness parameter must be between 0 and 15\n"); if (loudness < 0) loudness = 0; if (loudness > 15) loudness = 15; } do_tda7432_init(sd); return 0; } static int tda7432_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); do_tda7432_init(sd); v4l2_device_unregister_subdev(sd); kfree(to_state(sd)); return 0; } static const struct i2c_device_id tda7432_id[] = { { "tda7432", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, tda7432_id); static struct i2c_driver tda7432_driver = { .driver = { .owner = THIS_MODULE, .name = "tda7432", }, .probe = tda7432_probe, .remove = tda7432_remove, .id_table = tda7432_id, }; module_i2c_driver(tda7432_driver);