18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * lnbp21.h - driver for lnb supply and control ic lnbp21
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2006 Oliver Endriss
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * the project's page is at https://linuxtv.org
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _LNBP21_H
118c2ecf20Sopenharmony_ci#define _LNBP21_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* system register bits */
148c2ecf20Sopenharmony_ci/* [RO] 0=OK; 1=over current limit flag */
158c2ecf20Sopenharmony_ci#define LNBP21_OLF	0x01
168c2ecf20Sopenharmony_ci/* [RO] 0=OK; 1=over temperature flag (150 C) */
178c2ecf20Sopenharmony_ci#define LNBP21_OTF	0x02
188c2ecf20Sopenharmony_ci/* [RW] 0=disable LNB power, enable loopthrough
198c2ecf20Sopenharmony_ci	1=enable LNB power, disable loopthrough */
208c2ecf20Sopenharmony_ci#define LNBP21_EN	0x04
218c2ecf20Sopenharmony_ci/* [RW] 0=low voltage (13/14V, vert pol)
228c2ecf20Sopenharmony_ci	1=high voltage (18/19V,horiz pol) */
238c2ecf20Sopenharmony_ci#define LNBP21_VSEL	0x08
248c2ecf20Sopenharmony_ci/* [RW] increase LNB voltage by 1V:
258c2ecf20Sopenharmony_ci	0=13/18V; 1=14/19V */
268c2ecf20Sopenharmony_ci#define LNBP21_LLC	0x10
278c2ecf20Sopenharmony_ci/* [RW] 0=tone controlled by DSQIN pin
288c2ecf20Sopenharmony_ci	1=tone enable, disable DSQIN */
298c2ecf20Sopenharmony_ci#define LNBP21_TEN	0x20
308c2ecf20Sopenharmony_ci/* [RW] current limit select:
318c2ecf20Sopenharmony_ci	0:Iout=500-650mA Isc=300mA
328c2ecf20Sopenharmony_ci	1:Iout=400-550mA Isc=200mA */
338c2ecf20Sopenharmony_ci#define LNBP21_ISEL	0x40
348c2ecf20Sopenharmony_ci/* [RW] short-circuit protect:
358c2ecf20Sopenharmony_ci	0=pulsed (dynamic) curr limiting
368c2ecf20Sopenharmony_ci	1=static curr limiting */
378c2ecf20Sopenharmony_ci#define LNBP21_PCL	0x80
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_LNBP21)
428c2ecf20Sopenharmony_ci/* override_set and override_clear control which
438c2ecf20Sopenharmony_ci system register bits (above) to always set & clear */
448c2ecf20Sopenharmony_ciextern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,
458c2ecf20Sopenharmony_ci				struct i2c_adapter *i2c, u8 override_set,
468c2ecf20Sopenharmony_ci				u8 override_clear);
478c2ecf20Sopenharmony_ci#else
488c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,
498c2ecf20Sopenharmony_ci				struct i2c_adapter *i2c, u8 override_set,
508c2ecf20Sopenharmony_ci				u8 override_clear)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
538c2ecf20Sopenharmony_ci	return NULL;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci#endif
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#endif
58