Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver fixes from Greg KH:
"Here are some staging and IIO driver fixes for 5.4-rc3.

The "biggest" thing here is a removal of the fbtft device and flexfb
code as they have been abandoned by their authors and are no longer
needed for that hardware.

Other than that, the usual amount of staging driver and iio driver
fixes for reported issues, and some speakup sysfs file documentation,
which has been long awaited for.

All have been in linux-next with no reported issues"

* tag 'staging-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (32 commits)
iio: Fix an undefied reference error in noa1305_probe
iio: light: opt3001: fix mutex unlock race
iio: adc: ad799x: fix probe error handling
iio: light: add missing vcnl4040 of_compatible
iio: light: fix vcnl4000 devicetree hooks
iio: imu: st_lsm6dsx: fix waitime for st_lsm6dsx i2c controller
iio: adc: axp288: Override TS pin bias current for some models
iio: imu: adis16400: fix memory leak
iio: imu: adis16400: release allocated memory on failure
iio: adc: stm32-adc: fix a race when using several adcs with dma and irq
iio: adc: stm32-adc: move registers definitions
iio: accel: adxl372: Perform a reset at start up
iio: accel: adxl372: Fix push to buffers lost samples
iio: accel: adxl372: Fix/remove limitation for FIFO samples
iio: adc: hx711: fix bug in sampling of data
staging: vt6655: Fix memory leak in vt6655_probe
staging: exfat: Use kvzalloc() instead of kzalloc() for exfat_sb_info
Staging: fbtft: fix memory leak in fbtft_framebuffer_alloc
staging: speakup: document sysfs attributes
staging: rtl8188eu: fix HighestRate check in odm_ARFBRefresh_8188E()
...

+695 -2333
+17 -5
drivers/iio/accel/adxl372.c
··· 474 474 if (ret < 0) 475 475 return ret; 476 476 477 - fifo_samples = st->watermark & 0xFF; 477 + /* 478 + * watermark stores the number of sets; we need to write the FIFO 479 + * registers with the number of samples 480 + */ 481 + fifo_samples = (st->watermark * st->fifo_set_size); 478 482 fifo_ctl = ADXL372_FIFO_CTL_FORMAT_MODE(st->fifo_format) | 479 483 ADXL372_FIFO_CTL_MODE_MODE(st->fifo_mode) | 480 - ADXL372_FIFO_CTL_SAMPLES_MODE(st->watermark); 484 + ADXL372_FIFO_CTL_SAMPLES_MODE(fifo_samples); 481 485 482 - ret = regmap_write(st->regmap, ADXL372_FIFO_SAMPLES, fifo_samples); 486 + ret = regmap_write(st->regmap, 487 + ADXL372_FIFO_SAMPLES, fifo_samples & 0xFF); 483 488 if (ret < 0) 484 489 return ret; 485 490 ··· 553 548 goto err; 554 549 555 550 /* Each sample is 2 bytes */ 556 - for (i = 0; i < fifo_entries * sizeof(u16); 557 - i += st->fifo_set_size * sizeof(u16)) 551 + for (i = 0; i < fifo_entries; i += st->fifo_set_size) 558 552 iio_push_to_buffers(indio_dev, &st->fifo_buf[i]); 559 553 } 560 554 err: ··· 574 570 dev_err(st->dev, "Invalid chip id %x\n", regval); 575 571 return -ENODEV; 576 572 } 573 + 574 + /* 575 + * Perform a software reset to make sure the device is in a consistent 576 + * state after start up. 577 + */ 578 + ret = regmap_write(st->regmap, ADXL372_RESET, ADXL372_RESET_CODE); 579 + if (ret < 0) 580 + return ret; 577 581 578 582 ret = adxl372_set_op_mode(st, ADXL372_STANDBY); 579 583 if (ret < 0)
+1 -1
drivers/iio/accel/bmc150-accel-core.c
··· 117 117 #define BMC150_ACCEL_SLEEP_1_SEC 0x0F 118 118 119 119 #define BMC150_ACCEL_REG_TEMP 0x08 120 - #define BMC150_ACCEL_TEMP_CENTER_VAL 24 120 + #define BMC150_ACCEL_TEMP_CENTER_VAL 23 121 121 122 122 #define BMC150_ACCEL_AXIS_TO_REG(axis) (BMC150_ACCEL_REG_XOUT_L + (axis * 2)) 123 123 #define BMC150_AUTO_SUSPEND_DELAY_MS 2000
+2 -2
drivers/iio/adc/ad799x.c
··· 810 810 811 811 ret = ad799x_write_config(st, st->chip_config->default_config); 812 812 if (ret < 0) 813 - goto error_disable_reg; 813 + goto error_disable_vref; 814 814 ret = ad799x_read_config(st); 815 815 if (ret < 0) 816 - goto error_disable_reg; 816 + goto error_disable_vref; 817 817 st->config = ret; 818 818 819 819 ret = iio_triggered_buffer_setup(indio_dev, NULL,
+32
drivers/iio/adc/axp288_adc.c
··· 7 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 8 */ 9 9 10 + #include <linux/dmi.h> 10 11 #include <linux/module.h> 11 12 #include <linux/kernel.h> 12 13 #include <linux/device.h> ··· 26 25 #define AXP288_ADC_EN_MASK 0xF0 27 26 #define AXP288_ADC_TS_ENABLE 0x01 28 27 28 + #define AXP288_ADC_TS_BIAS_MASK GENMASK(5, 4) 29 + #define AXP288_ADC_TS_BIAS_20UA (0 << 4) 30 + #define AXP288_ADC_TS_BIAS_40UA (1 << 4) 31 + #define AXP288_ADC_TS_BIAS_60UA (2 << 4) 32 + #define AXP288_ADC_TS_BIAS_80UA (3 << 4) 29 33 #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) 30 34 #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) 31 35 #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) ··· 183 177 return ret; 184 178 } 185 179 180 + /* 181 + * We rely on the machine's firmware to correctly setup the TS pin bias current 182 + * at boot. This lists systems with broken fw where we need to set it ourselves. 183 + */ 184 + static const struct dmi_system_id axp288_adc_ts_bias_override[] = { 185 + { 186 + /* Lenovo Ideapad 100S (11 inch) */ 187 + .matches = { 188 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 189 + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad 100S-11IBY"), 190 + }, 191 + .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, 192 + }, 193 + {} 194 + }; 195 + 186 196 static int axp288_adc_initialize(struct axp288_adc_info *info) 187 197 { 198 + const struct dmi_system_id *bias_override; 188 199 int ret, adc_enable_val; 200 + 201 + bias_override = dmi_first_match(axp288_adc_ts_bias_override); 202 + if (bias_override) { 203 + ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, 204 + AXP288_ADC_TS_BIAS_MASK, 205 + (uintptr_t)bias_override->driver_data); 206 + if (ret) 207 + return ret; 208 + } 189 209 190 210 /* 191 211 * Determine if the TS pin is enabled and set the TS current-source
+5 -5
drivers/iio/adc/hx711.c
··· 100 100 101 101 static int hx711_cycle(struct hx711_data *hx711_data) 102 102 { 103 - int val; 103 + unsigned long flags; 104 104 105 105 /* 106 106 * if preempted for more then 60us while PD_SCK is high: 107 107 * hx711 is going in reset 108 108 * ==> measuring is false 109 109 */ 110 - preempt_disable(); 110 + local_irq_save(flags); 111 111 gpiod_set_value(hx711_data->gpiod_pd_sck, 1); 112 112 113 113 /* ··· 117 117 */ 118 118 ndelay(hx711_data->data_ready_delay_ns); 119 119 120 - val = gpiod_get_value(hx711_data->gpiod_dout); 121 120 /* 122 121 * here we are not waiting for 0.2 us as suggested by the datasheet, 123 122 * because the oscilloscope showed in a test scenario ··· 124 125 * and 0.56 us for PD_SCK low on TI Sitara with 800 MHz 125 126 */ 126 127 gpiod_set_value(hx711_data->gpiod_pd_sck, 0); 127 - preempt_enable(); 128 + local_irq_restore(flags); 128 129 129 130 /* 130 131 * make it a square wave for addressing cases with capacitance on ··· 132 133 */ 133 134 ndelay(hx711_data->data_ready_delay_ns); 134 135 135 - return val; 136 + /* sample as late as possible */ 137 + return gpiod_get_value(hx711_data->gpiod_dout); 136 138 } 137 139 138 140 static int hx711_read(struct hx711_data *hx711_data)
+5 -5
drivers/iio/adc/meson_saradc.c
··· 1219 1219 if (IS_ERR(base)) 1220 1220 return PTR_ERR(base); 1221 1221 1222 + priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, 1223 + priv->param->regmap_config); 1224 + if (IS_ERR(priv->regmap)) 1225 + return PTR_ERR(priv->regmap); 1226 + 1222 1227 irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 1223 1228 if (!irq) 1224 1229 return -EINVAL; ··· 1232 1227 dev_name(&pdev->dev), indio_dev); 1233 1228 if (ret) 1234 1229 return ret; 1235 - 1236 - priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, 1237 - priv->param->regmap_config); 1238 - if (IS_ERR(priv->regmap)) 1239 - return PTR_ERR(priv->regmap); 1240 1230 1241 1231 priv->clkin = devm_clk_get(&pdev->dev, "clkin"); 1242 1232 if (IS_ERR(priv->clkin)) {
+40 -30
drivers/iio/adc/stm32-adc-core.c
··· 24 24 25 25 #include "stm32-adc-core.h" 26 26 27 - /* STM32F4 - common registers for all ADC instances: 1, 2 & 3 */ 28 - #define STM32F4_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) 29 - #define STM32F4_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x04) 30 - 31 - /* STM32F4_ADC_CSR - bit fields */ 32 - #define STM32F4_EOC3 BIT(17) 33 - #define STM32F4_EOC2 BIT(9) 34 - #define STM32F4_EOC1 BIT(1) 35 - 36 - /* STM32F4_ADC_CCR - bit fields */ 37 - #define STM32F4_ADC_ADCPRE_SHIFT 16 38 - #define STM32F4_ADC_ADCPRE_MASK GENMASK(17, 16) 39 - 40 - /* STM32H7 - common registers for all ADC instances */ 41 - #define STM32H7_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) 42 - #define STM32H7_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x08) 43 - 44 - /* STM32H7_ADC_CSR - bit fields */ 45 - #define STM32H7_EOC_SLV BIT(18) 46 - #define STM32H7_EOC_MST BIT(2) 47 - 48 - /* STM32H7_ADC_CCR - bit fields */ 49 - #define STM32H7_PRESC_SHIFT 18 50 - #define STM32H7_PRESC_MASK GENMASK(21, 18) 51 - #define STM32H7_CKMODE_SHIFT 16 52 - #define STM32H7_CKMODE_MASK GENMASK(17, 16) 53 - 54 27 #define STM32_ADC_CORE_SLEEP_DELAY_MS 2000 55 28 56 29 /* SYSCFG registers */ ··· 44 71 * @eoc1: adc1 end of conversion flag in @csr 45 72 * @eoc2: adc2 end of conversion flag in @csr 46 73 * @eoc3: adc3 end of conversion flag in @csr 74 + * @ier: interrupt enable register offset for each adc 75 + * @eocie_msk: end of conversion interrupt enable mask in @ier 47 76 */ 48 77 struct stm32_adc_common_regs { 49 78 u32 csr; ··· 53 78 u32 eoc1_msk; 54 79 u32 eoc2_msk; 55 80 u32 eoc3_msk; 81 + u32 ier; 82 + u32 eocie_msk; 56 83 }; 57 84 58 85 struct stm32_adc_priv; ··· 280 303 .eoc1_msk = STM32F4_EOC1, 281 304 .eoc2_msk = STM32F4_EOC2, 282 305 .eoc3_msk = STM32F4_EOC3, 306 + .ier = STM32F4_ADC_CR1, 307 + .eocie_msk = STM32F4_EOCIE, 283 308 }; 284 309 285 310 /* STM32H7 common registers definitions */ ··· 290 311 .ccr = STM32H7_ADC_CCR, 291 312 .eoc1_msk = STM32H7_EOC_MST, 292 313 .eoc2_msk = STM32H7_EOC_SLV, 314 + .ier = STM32H7_ADC_IER, 315 + .eocie_msk = STM32H7_EOCIE, 293 316 }; 317 + 318 + static const unsigned int stm32_adc_offset[STM32_ADC_MAX_ADCS] = { 319 + 0, STM32_ADC_OFFSET, STM32_ADC_OFFSET * 2, 320 + }; 321 + 322 + static unsigned int stm32_adc_eoc_enabled(struct stm32_adc_priv *priv, 323 + unsigned int adc) 324 + { 325 + u32 ier, offset = stm32_adc_offset[adc]; 326 + 327 + ier = readl_relaxed(priv->common.base + offset + priv->cfg->regs->ier); 328 + 329 + return ier & priv->cfg->regs->eocie_msk; 330 + } 294 331 295 332 /* ADC common interrupt for all instances */ 296 333 static void stm32_adc_irq_handler(struct irq_desc *desc) ··· 318 323 chained_irq_enter(chip, desc); 319 324 status = readl_relaxed(priv->common.base + priv->cfg->regs->csr); 320 325 321 - if (status & priv->cfg->regs->eoc1_msk) 326 + /* 327 + * End of conversion may be handled by using IRQ or DMA. There may be a 328 + * race here when two conversions complete at the same time on several 329 + * ADCs. EOC may be read 'set' for several ADCs, with: 330 + * - an ADC configured to use DMA (EOC triggers the DMA request, and 331 + * is then automatically cleared by DR read in hardware) 332 + * - an ADC configured to use IRQs (EOCIE bit is set. The handler must 333 + * be called in this case) 334 + * So both EOC status bit in CSR and EOCIE control bit must be checked 335 + * before invoking the interrupt handler (e.g. call ISR only for 336 + * IRQ-enabled ADCs). 337 + */ 338 + if (status & priv->cfg->regs->eoc1_msk && 339 + stm32_adc_eoc_enabled(priv, 0)) 322 340 generic_handle_irq(irq_find_mapping(priv->domain, 0)); 323 341 324 - if (status & priv->cfg->regs->eoc2_msk) 342 + if (status & priv->cfg->regs->eoc2_msk && 343 + stm32_adc_eoc_enabled(priv, 1)) 325 344 generic_handle_irq(irq_find_mapping(priv->domain, 1)); 326 345 327 - if (status & priv->cfg->regs->eoc3_msk) 346 + if (status & priv->cfg->regs->eoc3_msk && 347 + stm32_adc_eoc_enabled(priv, 2)) 328 348 generic_handle_irq(irq_find_mapping(priv->domain, 2)); 329 349 330 350 chained_irq_exit(chip, desc);
+137
drivers/iio/adc/stm32-adc-core.h
··· 25 25 * -------------------------------------------------------- 26 26 */ 27 27 #define STM32_ADC_MAX_ADCS 3 28 + #define STM32_ADC_OFFSET 0x100 28 29 #define STM32_ADCX_COMN_OFFSET 0x300 30 + 31 + /* STM32F4 - Registers for each ADC instance */ 32 + #define STM32F4_ADC_SR 0x00 33 + #define STM32F4_ADC_CR1 0x04 34 + #define STM32F4_ADC_CR2 0x08 35 + #define STM32F4_ADC_SMPR1 0x0C 36 + #define STM32F4_ADC_SMPR2 0x10 37 + #define STM32F4_ADC_HTR 0x24 38 + #define STM32F4_ADC_LTR 0x28 39 + #define STM32F4_ADC_SQR1 0x2C 40 + #define STM32F4_ADC_SQR2 0x30 41 + #define STM32F4_ADC_SQR3 0x34 42 + #define STM32F4_ADC_JSQR 0x38 43 + #define STM32F4_ADC_JDR1 0x3C 44 + #define STM32F4_ADC_JDR2 0x40 45 + #define STM32F4_ADC_JDR3 0x44 46 + #define STM32F4_ADC_JDR4 0x48 47 + #define STM32F4_ADC_DR 0x4C 48 + 49 + /* STM32F4 - common registers for all ADC instances: 1, 2 & 3 */ 50 + #define STM32F4_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) 51 + #define STM32F4_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x04) 52 + 53 + /* STM32F4_ADC_SR - bit fields */ 54 + #define STM32F4_STRT BIT(4) 55 + #define STM32F4_EOC BIT(1) 56 + 57 + /* STM32F4_ADC_CR1 - bit fields */ 58 + #define STM32F4_RES_SHIFT 24 59 + #define STM32F4_RES_MASK GENMASK(25, 24) 60 + #define STM32F4_SCAN BIT(8) 61 + #define STM32F4_EOCIE BIT(5) 62 + 63 + /* STM32F4_ADC_CR2 - bit fields */ 64 + #define STM32F4_SWSTART BIT(30) 65 + #define STM32F4_EXTEN_SHIFT 28 66 + #define STM32F4_EXTEN_MASK GENMASK(29, 28) 67 + #define STM32F4_EXTSEL_SHIFT 24 68 + #define STM32F4_EXTSEL_MASK GENMASK(27, 24) 69 + #define STM32F4_EOCS BIT(10) 70 + #define STM32F4_DDS BIT(9) 71 + #define STM32F4_DMA BIT(8) 72 + #define STM32F4_ADON BIT(0) 73 + 74 + /* STM32F4_ADC_CSR - bit fields */ 75 + #define STM32F4_EOC3 BIT(17) 76 + #define STM32F4_EOC2 BIT(9) 77 + #define STM32F4_EOC1 BIT(1) 78 + 79 + /* STM32F4_ADC_CCR - bit fields */ 80 + #define STM32F4_ADC_ADCPRE_SHIFT 16 81 + #define STM32F4_ADC_ADCPRE_MASK GENMASK(17, 16) 82 + 83 + /* STM32H7 - Registers for each ADC instance */ 84 + #define STM32H7_ADC_ISR 0x00 85 + #define STM32H7_ADC_IER 0x04 86 + #define STM32H7_ADC_CR 0x08 87 + #define STM32H7_ADC_CFGR 0x0C 88 + #define STM32H7_ADC_SMPR1 0x14 89 + #define STM32H7_ADC_SMPR2 0x18 90 + #define STM32H7_ADC_PCSEL 0x1C 91 + #define STM32H7_ADC_SQR1 0x30 92 + #define STM32H7_ADC_SQR2 0x34 93 + #define STM32H7_ADC_SQR3 0x38 94 + #define STM32H7_ADC_SQR4 0x3C 95 + #define STM32H7_ADC_DR 0x40 96 + #define STM32H7_ADC_DIFSEL 0xC0 97 + #define STM32H7_ADC_CALFACT 0xC4 98 + #define STM32H7_ADC_CALFACT2 0xC8 99 + 100 + /* STM32H7 - common registers for all ADC instances */ 101 + #define STM32H7_ADC_CSR (STM32_ADCX_COMN_OFFSET + 0x00) 102 + #define STM32H7_ADC_CCR (STM32_ADCX_COMN_OFFSET + 0x08) 103 + 104 + /* STM32H7_ADC_ISR - bit fields */ 105 + #define STM32MP1_VREGREADY BIT(12) 106 + #define STM32H7_EOC BIT(2) 107 + #define STM32H7_ADRDY BIT(0) 108 + 109 + /* STM32H7_ADC_IER - bit fields */ 110 + #define STM32H7_EOCIE STM32H7_EOC 111 + 112 + /* STM32H7_ADC_CR - bit fields */ 113 + #define STM32H7_ADCAL BIT(31) 114 + #define STM32H7_ADCALDIF BIT(30) 115 + #define STM32H7_DEEPPWD BIT(29) 116 + #define STM32H7_ADVREGEN BIT(28) 117 + #define STM32H7_LINCALRDYW6 BIT(27) 118 + #define STM32H7_LINCALRDYW5 BIT(26) 119 + #define STM32H7_LINCALRDYW4 BIT(25) 120 + #define STM32H7_LINCALRDYW3 BIT(24) 121 + #define STM32H7_LINCALRDYW2 BIT(23) 122 + #define STM32H7_LINCALRDYW1 BIT(22) 123 + #define STM32H7_ADCALLIN BIT(16) 124 + #define STM32H7_BOOST BIT(8) 125 + #define STM32H7_ADSTP BIT(4) 126 + #define STM32H7_ADSTART BIT(2) 127 + #define STM32H7_ADDIS BIT(1) 128 + #define STM32H7_ADEN BIT(0) 129 + 130 + /* STM32H7_ADC_CFGR bit fields */ 131 + #define STM32H7_EXTEN_SHIFT 10 132 + #define STM32H7_EXTEN_MASK GENMASK(11, 10) 133 + #define STM32H7_EXTSEL_SHIFT 5 134 + #define STM32H7_EXTSEL_MASK GENMASK(9, 5) 135 + #define STM32H7_RES_SHIFT 2 136 + #define STM32H7_RES_MASK GENMASK(4, 2) 137 + #define STM32H7_DMNGT_SHIFT 0 138 + #define STM32H7_DMNGT_MASK GENMASK(1, 0) 139 + 140 + enum stm32h7_adc_dmngt { 141 + STM32H7_DMNGT_DR_ONLY, /* Regular data in DR only */ 142 + STM32H7_DMNGT_DMA_ONESHOT, /* DMA one shot mode */ 143 + STM32H7_DMNGT_DFSDM, /* DFSDM mode */ 144 + STM32H7_DMNGT_DMA_CIRC, /* DMA circular mode */ 145 + }; 146 + 147 + /* STM32H7_ADC_CALFACT - bit fields */ 148 + #define STM32H7_CALFACT_D_SHIFT 16 149 + #define STM32H7_CALFACT_D_MASK GENMASK(26, 16) 150 + #define STM32H7_CALFACT_S_SHIFT 0 151 + #define STM32H7_CALFACT_S_MASK GENMASK(10, 0) 152 + 153 + /* STM32H7_ADC_CALFACT2 - bit fields */ 154 + #define STM32H7_LINCALFACT_SHIFT 0 155 + #define STM32H7_LINCALFACT_MASK GENMASK(29, 0) 156 + 157 + /* STM32H7_ADC_CSR - bit fields */ 158 + #define STM32H7_EOC_SLV BIT(18) 159 + #define STM32H7_EOC_MST BIT(2) 160 + 161 + /* STM32H7_ADC_CCR - bit fields */ 162 + #define STM32H7_PRESC_SHIFT 18 163 + #define STM32H7_PRESC_MASK GENMASK(21, 18) 164 + #define STM32H7_CKMODE_SHIFT 16 165 + #define STM32H7_CKMODE_MASK GENMASK(17, 16) 29 166 30 167 /** 31 168 * struct stm32_adc_common - stm32 ADC driver common data (for all instances)
-109
drivers/iio/adc/stm32-adc.c
··· 28 28 29 29 #include "stm32-adc-core.h" 30 30 31 - /* STM32F4 - Registers for each ADC instance */ 32 - #define STM32F4_ADC_SR 0x00 33 - #define STM32F4_ADC_CR1 0x04 34 - #define STM32F4_ADC_CR2 0x08 35 - #define STM32F4_ADC_SMPR1 0x0C 36 - #define STM32F4_ADC_SMPR2 0x10 37 - #define STM32F4_ADC_HTR 0x24 38 - #define STM32F4_ADC_LTR 0x28 39 - #define STM32F4_ADC_SQR1 0x2C 40 - #define STM32F4_ADC_SQR2 0x30 41 - #define STM32F4_ADC_SQR3 0x34 42 - #define STM32F4_ADC_JSQR 0x38 43 - #define STM32F4_ADC_JDR1 0x3C 44 - #define STM32F4_ADC_JDR2 0x40 45 - #define STM32F4_ADC_JDR3 0x44 46 - #define STM32F4_ADC_JDR4 0x48 47 - #define STM32F4_ADC_DR 0x4C 48 - 49 - /* STM32F4_ADC_SR - bit fields */ 50 - #define STM32F4_STRT BIT(4) 51 - #define STM32F4_EOC BIT(1) 52 - 53 - /* STM32F4_ADC_CR1 - bit fields */ 54 - #define STM32F4_RES_SHIFT 24 55 - #define STM32F4_RES_MASK GENMASK(25, 24) 56 - #define STM32F4_SCAN BIT(8) 57 - #define STM32F4_EOCIE BIT(5) 58 - 59 - /* STM32F4_ADC_CR2 - bit fields */ 60 - #define STM32F4_SWSTART BIT(30) 61 - #define STM32F4_EXTEN_SHIFT 28 62 - #define STM32F4_EXTEN_MASK GENMASK(29, 28) 63 - #define STM32F4_EXTSEL_SHIFT 24 64 - #define STM32F4_EXTSEL_MASK GENMASK(27, 24) 65 - #define STM32F4_EOCS BIT(10) 66 - #define STM32F4_DDS BIT(9) 67 - #define STM32F4_DMA BIT(8) 68 - #define STM32F4_ADON BIT(0) 69 - 70 - /* STM32H7 - Registers for each ADC instance */ 71 - #define STM32H7_ADC_ISR 0x00 72 - #define STM32H7_ADC_IER 0x04 73 - #define STM32H7_ADC_CR 0x08 74 - #define STM32H7_ADC_CFGR 0x0C 75 - #define STM32H7_ADC_SMPR1 0x14 76 - #define STM32H7_ADC_SMPR2 0x18 77 - #define STM32H7_ADC_PCSEL 0x1C 78 - #define STM32H7_ADC_SQR1 0x30 79 - #define STM32H7_ADC_SQR2 0x34 80 - #define STM32H7_ADC_SQR3 0x38 81 - #define STM32H7_ADC_SQR4 0x3C 82 - #define STM32H7_ADC_DR 0x40 83 - #define STM32H7_ADC_DIFSEL 0xC0 84 - #define STM32H7_ADC_CALFACT 0xC4 85 - #define STM32H7_ADC_CALFACT2 0xC8 86 - 87 - /* STM32H7_ADC_ISR - bit fields */ 88 - #define STM32MP1_VREGREADY BIT(12) 89 - #define STM32H7_EOC BIT(2) 90 - #define STM32H7_ADRDY BIT(0) 91 - 92 - /* STM32H7_ADC_IER - bit fields */ 93 - #define STM32H7_EOCIE STM32H7_EOC 94 - 95 - /* STM32H7_ADC_CR - bit fields */ 96 - #define STM32H7_ADCAL BIT(31) 97 - #define STM32H7_ADCALDIF BIT(30) 98 - #define STM32H7_DEEPPWD BIT(29) 99 - #define STM32H7_ADVREGEN BIT(28) 100 - #define STM32H7_LINCALRDYW6 BIT(27) 101 - #define STM32H7_LINCALRDYW5 BIT(26) 102 - #define STM32H7_LINCALRDYW4 BIT(25) 103 - #define STM32H7_LINCALRDYW3 BIT(24) 104 - #define STM32H7_LINCALRDYW2 BIT(23) 105 - #define STM32H7_LINCALRDYW1 BIT(22) 106 - #define STM32H7_ADCALLIN BIT(16) 107 - #define STM32H7_BOOST BIT(8) 108 - #define STM32H7_ADSTP BIT(4) 109 - #define STM32H7_ADSTART BIT(2) 110 - #define STM32H7_ADDIS BIT(1) 111 - #define STM32H7_ADEN BIT(0) 112 - 113 - /* STM32H7_ADC_CFGR bit fields */ 114 - #define STM32H7_EXTEN_SHIFT 10 115 - #define STM32H7_EXTEN_MASK GENMASK(11, 10) 116 - #define STM32H7_EXTSEL_SHIFT 5 117 - #define STM32H7_EXTSEL_MASK GENMASK(9, 5) 118 - #define STM32H7_RES_SHIFT 2 119 - #define STM32H7_RES_MASK GENMASK(4, 2) 120 - #define STM32H7_DMNGT_SHIFT 0 121 - #define STM32H7_DMNGT_MASK GENMASK(1, 0) 122 - 123 - enum stm32h7_adc_dmngt { 124 - STM32H7_DMNGT_DR_ONLY, /* Regular data in DR only */ 125 - STM32H7_DMNGT_DMA_ONESHOT, /* DMA one shot mode */ 126 - STM32H7_DMNGT_DFSDM, /* DFSDM mode */ 127 - STM32H7_DMNGT_DMA_CIRC, /* DMA circular mode */ 128 - }; 129 - 130 - /* STM32H7_ADC_CALFACT - bit fields */ 131 - #define STM32H7_CALFACT_D_SHIFT 16 132 - #define STM32H7_CALFACT_D_MASK GENMASK(26, 16) 133 - #define STM32H7_CALFACT_S_SHIFT 0 134 - #define STM32H7_CALFACT_S_MASK GENMASK(10, 0) 135 - 136 - /* STM32H7_ADC_CALFACT2 - bit fields */ 137 - #define STM32H7_LINCALFACT_SHIFT 0 138 - #define STM32H7_LINCALFACT_MASK GENMASK(29, 0) 139 - 140 31 /* Number of linear calibration shadow registers / LINCALRDYW control bits */ 141 32 #define STM32H7_LINCALFACT_NUM 6 142 33
+8 -2
drivers/iio/imu/adis_buffer.c
··· 35 35 return -ENOMEM; 36 36 37 37 adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL); 38 - if (!adis->buffer) 38 + if (!adis->buffer) { 39 + kfree(adis->xfer); 40 + adis->xfer = NULL; 39 41 return -ENOMEM; 42 + } 40 43 41 44 tx = adis->buffer + burst_length; 42 45 tx[0] = ADIS_READ_REG(adis->burst->reg_cmd); ··· 81 78 return -ENOMEM; 82 79 83 80 adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL); 84 - if (!adis->buffer) 81 + if (!adis->buffer) { 82 + kfree(adis->xfer); 83 + adis->xfer = NULL; 85 84 return -ENOMEM; 85 + } 86 86 87 87 rx = adis->buffer; 88 88 tx = rx + scan_count;
+2
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
··· 99 99 #define ST_LSM6DSX_FS_LIST_SIZE 4 100 100 struct st_lsm6dsx_fs_table_entry { 101 101 struct st_lsm6dsx_reg reg; 102 + 102 103 struct st_lsm6dsx_fs fs_avl[ST_LSM6DSX_FS_LIST_SIZE]; 104 + int fs_len; 103 105 }; 104 106 105 107 /**
+19 -9
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 145 145 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 146 146 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 147 147 .fs_avl[3] = { IIO_G_TO_M_S_2(732), 0x1 }, 148 + .fs_len = 4, 148 149 }, 149 150 [ST_LSM6DSX_ID_GYRO] = { 150 151 .reg = { ··· 155 154 .fs_avl[0] = { IIO_DEGREE_TO_RAD(245), 0x0 }, 156 155 .fs_avl[1] = { IIO_DEGREE_TO_RAD(500), 0x1 }, 157 156 .fs_avl[2] = { IIO_DEGREE_TO_RAD(2000), 0x3 }, 157 + .fs_len = 3, 158 158 }, 159 159 }, 160 160 }, ··· 217 215 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 218 216 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 219 217 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 218 + .fs_len = 4, 220 219 }, 221 220 [ST_LSM6DSX_ID_GYRO] = { 222 221 .reg = { ··· 228 225 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 229 226 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 230 227 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 228 + .fs_len = 4, 231 229 }, 232 230 }, 233 231 .decimator = { ··· 331 327 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 332 328 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 333 329 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 330 + .fs_len = 4, 334 331 }, 335 332 [ST_LSM6DSX_ID_GYRO] = { 336 333 .reg = { ··· 342 337 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 343 338 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 344 339 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 340 + .fs_len = 4, 345 341 }, 346 342 }, 347 343 .decimator = { ··· 454 448 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 455 449 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 456 450 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 451 + .fs_len = 4, 457 452 }, 458 453 [ST_LSM6DSX_ID_GYRO] = { 459 454 .reg = { ··· 465 458 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 466 459 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 467 460 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 461 + .fs_len = 4, 468 462 }, 469 463 }, 470 464 .decimator = { ··· 571 563 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 572 564 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 573 565 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 566 + .fs_len = 4, 574 567 }, 575 568 [ST_LSM6DSX_ID_GYRO] = { 576 569 .reg = { ··· 582 573 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 583 574 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 584 575 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 576 + .fs_len = 4, 585 577 }, 586 578 }, 587 579 .batch = { ··· 703 693 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 704 694 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 705 695 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 696 + .fs_len = 4, 706 697 }, 707 698 [ST_LSM6DSX_ID_GYRO] = { 708 699 .reg = { ··· 714 703 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 715 704 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 716 705 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 706 + .fs_len = 4, 717 707 }, 718 708 }, 719 709 .batch = { ··· 812 800 .fs_avl[1] = { IIO_G_TO_M_S_2(122), 0x2 }, 813 801 .fs_avl[2] = { IIO_G_TO_M_S_2(244), 0x3 }, 814 802 .fs_avl[3] = { IIO_G_TO_M_S_2(488), 0x1 }, 803 + .fs_len = 4, 815 804 }, 816 805 [ST_LSM6DSX_ID_GYRO] = { 817 806 .reg = { ··· 823 810 .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, 824 811 .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, 825 812 .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, 813 + .fs_len = 4, 826 814 }, 827 815 }, 828 816 .batch = { ··· 947 933 int i, err; 948 934 949 935 fs_table = &sensor->hw->settings->fs_table[sensor->id]; 950 - for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) 936 + for (i = 0; i < fs_table->fs_len; i++) { 951 937 if (fs_table->fs_avl[i].gain == gain) 952 938 break; 939 + } 953 940 954 - if (i == ST_LSM6DSX_FS_LIST_SIZE) 941 + if (i == fs_table->fs_len) 955 942 return -EINVAL; 956 943 957 944 data = ST_LSM6DSX_SHIFT_VAL(fs_table->fs_avl[i].val, ··· 1211 1196 { 1212 1197 struct st_lsm6dsx_sensor *sensor = iio_priv(dev_get_drvdata(dev)); 1213 1198 const struct st_lsm6dsx_fs_table_entry *fs_table; 1214 - enum st_lsm6dsx_sensor_id id = sensor->id; 1215 1199 struct st_lsm6dsx_hw *hw = sensor->hw; 1216 1200 int i, len = 0; 1217 1201 1218 - fs_table = &hw->settings->fs_table[id]; 1219 - for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) { 1220 - if (!fs_table->fs_avl[i].gain) 1221 - break; 1222 - 1202 + fs_table = &hw->settings->fs_table[sensor->id]; 1203 + for (i = 0; i < fs_table->fs_len; i++) 1223 1204 len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", 1224 1205 fs_table->fs_avl[i].gain); 1225 - } 1226 1206 buf[len - 1] = '\n'; 1227 1207 1228 1208 return len;
+7 -8
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
··· 61 61 .gain = 1500, 62 62 .val = 0x0, 63 63 }, /* 1500 uG/LSB */ 64 + .fs_len = 1, 64 65 }, 65 66 .temp_comp = { 66 67 .addr = 0x60, ··· 93 92 static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw) 94 93 { 95 94 struct st_lsm6dsx_sensor *sensor; 95 + u16 odr; 96 96 97 97 sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); 98 - msleep((2000U / sensor->odr) + 1); 98 + odr = (hw->enable_mask & BIT(ST_LSM6DSX_ID_ACC)) ? sensor->odr : 13; 99 + msleep((2000U / odr) + 1); 99 100 } 100 101 101 102 /** ··· 558 555 int i, len = 0; 559 556 560 557 settings = sensor->ext_info.settings; 561 - for (i = 0; i < ST_LSM6DSX_FS_LIST_SIZE; i++) { 562 - u16 val = settings->fs_table.fs_avl[i].gain; 563 - 564 - if (val > 0) 565 - len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", 566 - val); 567 - } 558 + for (i = 0; i < settings->fs_table.fs_len; i++) 559 + len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06u ", 560 + settings->fs_table.fs_avl[i].gain); 568 561 buf[len - 1] = '\n'; 569 562 570 563 return len;
+1
drivers/iio/light/Kconfig
··· 314 314 config NOA1305 315 315 tristate "ON Semiconductor NOA1305 ambient light sensor" 316 316 depends on I2C 317 + select REGMAP_I2C 317 318 help 318 319 Say Y here if you want to build support for the ON Semiconductor 319 320 NOA1305 ambient light sensor.
+5 -1
drivers/iio/light/opt3001.c
··· 686 686 struct iio_dev *iio = _iio; 687 687 struct opt3001 *opt = iio_priv(iio); 688 688 int ret; 689 + bool wake_result_ready_queue = false; 689 690 690 691 if (!opt->ok_to_ignore_lock) 691 692 mutex_lock(&opt->lock); ··· 721 720 } 722 721 opt->result = ret; 723 722 opt->result_ready = true; 724 - wake_up(&opt->result_ready_queue); 723 + wake_result_ready_queue = true; 725 724 } 726 725 727 726 out: 728 727 if (!opt->ok_to_ignore_lock) 729 728 mutex_unlock(&opt->lock); 729 + 730 + if (wake_result_ready_queue) 731 + wake_up(&opt->result_ready_queue); 730 732 731 733 return IRQ_HANDLED; 732 734 }
+9 -5
drivers/iio/light/vcnl4000.c
··· 398 398 static const struct of_device_id vcnl_4000_of_match[] = { 399 399 { 400 400 .compatible = "vishay,vcnl4000", 401 - .data = "VCNL4000", 401 + .data = (void *)VCNL4000, 402 402 }, 403 403 { 404 404 .compatible = "vishay,vcnl4010", 405 - .data = "VCNL4010", 405 + .data = (void *)VCNL4010, 406 406 }, 407 407 { 408 - .compatible = "vishay,vcnl4010", 409 - .data = "VCNL4020", 408 + .compatible = "vishay,vcnl4020", 409 + .data = (void *)VCNL4010, 410 + }, 411 + { 412 + .compatible = "vishay,vcnl4040", 413 + .data = (void *)VCNL4040, 410 414 }, 411 415 { 412 416 .compatible = "vishay,vcnl4200", 413 - .data = "VCNL4200", 417 + .data = (void *)VCNL4200, 414 418 }, 415 419 {}, 416 420 };
+2 -1
drivers/staging/exfat/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0 1 2 config EXFAT_FS 2 3 tristate "exFAT fs support" 3 4 depends on BLOCK ··· 7 6 This adds support for the exFAT file system. 8 7 9 8 config EXFAT_DONT_MOUNT_VFAT 10 - bool "Prohibit mounting of fat/vfat filesysems by exFAT" 9 + bool "Prohibit mounting of fat/vfat filesystems by exFAT" 11 10 depends on EXFAT_FS 12 11 default y 13 12 help
+1 -1
drivers/staging/exfat/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 1 + # SPDX-License-Identifier: GPL-2.0-or-later 2 2 3 3 obj-$(CONFIG_EXFAT_FS) += exfat.o 4 4
+1 -1
drivers/staging/exfat/exfat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+1 -1
drivers/staging/exfat/exfat_blkdev.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+1 -1
drivers/staging/exfat/exfat_cache.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+1 -1
drivers/staging/exfat/exfat_core.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+1 -1
drivers/staging/exfat/exfat_nls.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+4 -3
drivers/staging/exfat/exfat_super.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */ ··· 7 7 #include <linux/init.h> 8 8 #include <linux/time.h> 9 9 #include <linux/slab.h> 10 + #include <linux/mm.h> 10 11 #include <linux/seq_file.h> 11 12 #include <linux/pagemap.h> 12 13 #include <linux/mpage.h> ··· 3451 3450 kfree(sbi->options.iocharset); 3452 3451 /* mutex_init is in exfat_fill_super function. only for 3.7+ */ 3453 3452 mutex_destroy(&sbi->s_lock); 3454 - kfree(sbi); 3453 + kvfree(sbi); 3455 3454 } 3456 3455 3457 3456 static void exfat_put_super(struct super_block *sb) ··· 3846 3845 * the filesystem, since we're only just about to mount 3847 3846 * it and have no inodes etc active! 3848 3847 */ 3849 - sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); 3848 + sbi = kvzalloc(sizeof(*sbi), GFP_KERNEL); 3850 3849 if (!sbi) 3851 3850 return -ENOMEM; 3852 3851 mutex_init(&sbi->s_lock);
+1 -1
drivers/staging/exfat/exfat_upcase.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd. 4 4 */
+1 -11
drivers/staging/fbtft/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 menuconfig FB_TFT 3 3 tristate "Support for small TFT LCD display modules" 4 - depends on FB && SPI 4 + depends on FB && SPI && OF 5 5 depends on GPIOLIB || COMPILE_TEST 6 6 select FB_SYS_FILLRECT 7 7 select FB_SYS_COPYAREA ··· 199 199 depends on FB_TFT 200 200 help 201 201 Generic Framebuffer support for WATTEROTT 202 - 203 - config FB_FLEX 204 - tristate "Generic FB driver for TFT LCD displays" 205 - depends on FB_TFT 206 - help 207 - Generic Framebuffer support for TFT LCD displays. 208 - 209 - config FB_TFT_FBTFT_DEVICE 210 - tristate "Module to for adding FBTFT devices" 211 - depends on FB_TFT
-4
drivers/staging/fbtft/Makefile
··· 36 36 obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o 37 37 obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o 38 38 obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o 39 - obj-$(CONFIG_FB_FLEX) += flexfb.o 40 - 41 - # Device modules 42 - obj-$(CONFIG_FB_TFT_FBTFT_DEVICE) += fbtft_device.o
+5 -2
drivers/staging/fbtft/fbtft-core.c
··· 714 714 if (par->gamma.curves && gamma) { 715 715 if (fbtft_gamma_parse_str(par, par->gamma.curves, gamma, 716 716 strlen(gamma))) 717 - goto alloc_fail; 717 + goto release_framebuf; 718 718 } 719 719 720 720 /* Transmit buffer */ ··· 731 731 if (txbuflen > 0) { 732 732 txbuf = devm_kzalloc(par->info->device, txbuflen, GFP_KERNEL); 733 733 if (!txbuf) 734 - goto alloc_fail; 734 + goto release_framebuf; 735 735 par->txbuf.buf = txbuf; 736 736 par->txbuf.len = txbuflen; 737 737 } ··· 752 752 fbtft_merge_fbtftops(&par->fbtftops, &display->fbtftops); 753 753 754 754 return info; 755 + 756 + release_framebuf: 757 + framebuffer_release(info); 755 758 756 759 alloc_fail: 757 760 vfree(vmem);
-1261
drivers/staging/fbtft/fbtft_device.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * 4 - * Copyright (C) 2013, Noralf Tronnes 5 - */ 6 - 7 - #define pr_fmt(fmt) "fbtft_device: " fmt 8 - #include <linux/module.h> 9 - #include <linux/kernel.h> 10 - #include <linux/init.h> 11 - #include <linux/gpio/consumer.h> 12 - #include <linux/spi/spi.h> 13 - #include <video/mipi_display.h> 14 - 15 - #include "fbtft.h" 16 - 17 - #define MAX_GPIOS 32 18 - 19 - static struct spi_device *spi_device; 20 - static struct platform_device *p_device; 21 - 22 - static char *name; 23 - module_param(name, charp, 0000); 24 - MODULE_PARM_DESC(name, 25 - "Devicename (required). name=list => list all supported devices."); 26 - 27 - static unsigned int rotate; 28 - module_param(rotate, uint, 0000); 29 - MODULE_PARM_DESC(rotate, 30 - "Angle to rotate display counter clockwise: 0, 90, 180, 270"); 31 - 32 - static unsigned int busnum; 33 - module_param(busnum, uint, 0000); 34 - MODULE_PARM_DESC(busnum, "SPI bus number (default=0)"); 35 - 36 - static unsigned int cs; 37 - module_param(cs, uint, 0000); 38 - MODULE_PARM_DESC(cs, "SPI chip select (default=0)"); 39 - 40 - static unsigned int speed; 41 - module_param(speed, uint, 0000); 42 - MODULE_PARM_DESC(speed, "SPI speed (override device default)"); 43 - 44 - static int mode = -1; 45 - module_param(mode, int, 0000); 46 - MODULE_PARM_DESC(mode, "SPI mode (override device default)"); 47 - 48 - static unsigned int fps; 49 - module_param(fps, uint, 0000); 50 - MODULE_PARM_DESC(fps, "Frames per second (override driver default)"); 51 - 52 - static char *gamma; 53 - module_param(gamma, charp, 0000); 54 - MODULE_PARM_DESC(gamma, 55 - "String representation of Gamma Curve(s). Driver specific."); 56 - 57 - static int txbuflen; 58 - module_param(txbuflen, int, 0000); 59 - MODULE_PARM_DESC(txbuflen, "txbuflen (override driver default)"); 60 - 61 - static int bgr = -1; 62 - module_param(bgr, int, 0000); 63 - MODULE_PARM_DESC(bgr, 64 - "BGR bit (supported by some drivers)."); 65 - 66 - static unsigned int startbyte; 67 - module_param(startbyte, uint, 0000); 68 - MODULE_PARM_DESC(startbyte, "Sets the Start byte used by some SPI displays."); 69 - 70 - static bool custom; 71 - module_param(custom, bool, 0000); 72 - MODULE_PARM_DESC(custom, "Add a custom display device. Use speed= argument to make it a SPI device, else platform_device"); 73 - 74 - static unsigned int width; 75 - module_param(width, uint, 0000); 76 - MODULE_PARM_DESC(width, "Display width, used with the custom argument"); 77 - 78 - static unsigned int height; 79 - module_param(height, uint, 0000); 80 - MODULE_PARM_DESC(height, "Display height, used with the custom argument"); 81 - 82 - static unsigned int buswidth = 8; 83 - module_param(buswidth, uint, 0000); 84 - MODULE_PARM_DESC(buswidth, "Display bus width, used with the custom argument"); 85 - 86 - static s16 init[FBTFT_MAX_INIT_SEQUENCE]; 87 - static int init_num; 88 - module_param_array(init, short, &init_num, 0000); 89 - MODULE_PARM_DESC(init, "Init sequence, used with the custom argument"); 90 - 91 - static unsigned long debug; 92 - module_param(debug, ulong, 0000); 93 - MODULE_PARM_DESC(debug, 94 - "level: 0-7 (the remaining 29 bits is for advanced usage)"); 95 - 96 - static unsigned int verbose = 3; 97 - module_param(verbose, uint, 0000); 98 - MODULE_PARM_DESC(verbose, 99 - "0 silent, >1 show devices, >2 show devices before (default=3)"); 100 - 101 - struct fbtft_device_display { 102 - char *name; 103 - struct spi_board_info *spi; 104 - struct platform_device *pdev; 105 - }; 106 - 107 - static void fbtft_device_pdev_release(struct device *dev); 108 - 109 - static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len); 110 - static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, 111 - int xs, int ys, int xe, int ye); 112 - 113 - #define ADAFRUIT18_GAMMA \ 114 - "02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10\n" \ 115 - "03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10" 116 - 117 - #define CBERRY28_GAMMA \ 118 - "D0 00 14 15 13 2C 42 43 4E 09 16 14 18 21\n" \ 119 - "D0 00 14 15 13 0B 43 55 53 0C 17 14 23 20" 120 - 121 - static const s16 cberry28_init_sequence[] = { 122 - /* turn off sleep mode */ 123 - -1, MIPI_DCS_EXIT_SLEEP_MODE, 124 - -2, 120, 125 - 126 - /* set pixel format to RGB-565 */ 127 - -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT, 128 - 129 - -1, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33, 130 - 131 - /* 132 - * VGH = 13.26V 133 - * VGL = -10.43V 134 - */ 135 - -1, 0xB7, 0x35, 136 - 137 - /* 138 - * VDV and VRH register values come from command write 139 - * (instead of NVM) 140 - */ 141 - -1, 0xC2, 0x01, 0xFF, 142 - 143 - /* 144 - * VAP = 4.7V + (VCOM + VCOM offset + 0.5 * VDV) 145 - * VAN = -4.7V + (VCOM + VCOM offset + 0.5 * VDV) 146 - */ 147 - -1, 0xC3, 0x17, 148 - 149 - /* VDV = 0V */ 150 - -1, 0xC4, 0x20, 151 - 152 - /* VCOM = 0.675V */ 153 - -1, 0xBB, 0x17, 154 - 155 - /* VCOM offset = 0V */ 156 - -1, 0xC5, 0x20, 157 - 158 - /* 159 - * AVDD = 6.8V 160 - * AVCL = -4.8V 161 - * VDS = 2.3V 162 - */ 163 - -1, 0xD0, 0xA4, 0xA1, 164 - 165 - -1, MIPI_DCS_SET_DISPLAY_ON, 166 - 167 - -3, 168 - }; 169 - 170 - static const s16 hy28b_init_sequence[] = { 171 - -1, 0x00e7, 0x0010, -1, 0x0000, 0x0001, 172 - -1, 0x0001, 0x0100, -1, 0x0002, 0x0700, 173 - -1, 0x0003, 0x1030, -1, 0x0004, 0x0000, 174 - -1, 0x0008, 0x0207, -1, 0x0009, 0x0000, 175 - -1, 0x000a, 0x0000, -1, 0x000c, 0x0001, 176 - -1, 0x000d, 0x0000, -1, 0x000f, 0x0000, 177 - -1, 0x0010, 0x0000, -1, 0x0011, 0x0007, 178 - -1, 0x0012, 0x0000, -1, 0x0013, 0x0000, 179 - -2, 50, -1, 0x0010, 0x1590, -1, 0x0011, 180 - 0x0227, -2, 50, -1, 0x0012, 0x009c, -2, 50, 181 - -1, 0x0013, 0x1900, -1, 0x0029, 0x0023, 182 - -1, 0x002b, 0x000e, -2, 50, 183 - -1, 0x0020, 0x0000, -1, 0x0021, 0x0000, 184 - -2, 50, -1, 0x0050, 0x0000, 185 - -1, 0x0051, 0x00ef, -1, 0x0052, 0x0000, 186 - -1, 0x0053, 0x013f, -1, 0x0060, 0xa700, 187 - -1, 0x0061, 0x0001, -1, 0x006a, 0x0000, 188 - -1, 0x0080, 0x0000, -1, 0x0081, 0x0000, 189 - -1, 0x0082, 0x0000, -1, 0x0083, 0x0000, 190 - -1, 0x0084, 0x0000, -1, 0x0085, 0x0000, 191 - -1, 0x0090, 0x0010, -1, 0x0092, 0x0000, 192 - -1, 0x0093, 0x0003, -1, 0x0095, 0x0110, 193 - -1, 0x0097, 0x0000, -1, 0x0098, 0x0000, 194 - -1, 0x0007, 0x0133, -1, 0x0020, 0x0000, 195 - -1, 0x0021, 0x0000, -2, 100, -3 }; 196 - 197 - #define HY28B_GAMMA \ 198 - "04 1F 4 7 7 0 7 7 6 0\n" \ 199 - "0F 00 1 7 4 0 0 0 6 7" 200 - 201 - static const s16 pitft_init_sequence[] = { 202 - -1, MIPI_DCS_SOFT_RESET, 203 - -2, 5, 204 - -1, MIPI_DCS_SET_DISPLAY_OFF, 205 - -1, 0xEF, 0x03, 0x80, 0x02, 206 - -1, 0xCF, 0x00, 0xC1, 0x30, 207 - -1, 0xED, 0x64, 0x03, 0x12, 0x81, 208 - -1, 0xE8, 0x85, 0x00, 0x78, 209 - -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, 210 - -1, 0xF7, 0x20, 211 - -1, 0xEA, 0x00, 0x00, 212 - -1, 0xC0, 0x23, 213 - -1, 0xC1, 0x10, 214 - -1, 0xC5, 0x3E, 0x28, 215 - -1, 0xC7, 0x86, 216 - -1, MIPI_DCS_SET_PIXEL_FORMAT, 0x55, 217 - -1, 0xB1, 0x00, 0x18, 218 - -1, 0xB6, 0x08, 0x82, 0x27, 219 - -1, 0xF2, 0x00, 220 - -1, MIPI_DCS_SET_GAMMA_CURVE, 0x01, 221 - -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 222 - 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, 223 - -1, 0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 224 - 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, 225 - -1, MIPI_DCS_EXIT_SLEEP_MODE, 226 - -2, 100, 227 - -1, MIPI_DCS_SET_DISPLAY_ON, 228 - -2, 20, 229 - -3 230 - }; 231 - 232 - static const s16 waveshare32b_init_sequence[] = { 233 - -1, 0xCB, 0x39, 0x2C, 0x00, 0x34, 0x02, 234 - -1, 0xCF, 0x00, 0xC1, 0x30, 235 - -1, 0xE8, 0x85, 0x00, 0x78, 236 - -1, 0xEA, 0x00, 0x00, 237 - -1, 0xED, 0x64, 0x03, 0x12, 0x81, 238 - -1, 0xF7, 0x20, 239 - -1, 0xC0, 0x23, 240 - -1, 0xC1, 0x10, 241 - -1, 0xC5, 0x3E, 0x28, 242 - -1, 0xC7, 0x86, 243 - -1, MIPI_DCS_SET_ADDRESS_MODE, 0x28, 244 - -1, MIPI_DCS_SET_PIXEL_FORMAT, 0x55, 245 - -1, 0xB1, 0x00, 0x18, 246 - -1, 0xB6, 0x08, 0x82, 0x27, 247 - -1, 0xF2, 0x00, 248 - -1, MIPI_DCS_SET_GAMMA_CURVE, 0x01, 249 - -1, 0xE0, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 250 - 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, 251 - -1, 0xE1, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 252 - 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, 253 - -1, MIPI_DCS_EXIT_SLEEP_MODE, 254 - -2, 120, 255 - -1, MIPI_DCS_SET_DISPLAY_ON, 256 - -1, MIPI_DCS_WRITE_MEMORY_START, 257 - -3 258 - }; 259 - 260 - #define PIOLED_GAMMA "0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 " \ 261 - "2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " \ 262 - "3 3 3 4 4 4 4 4 4 4 4 4 4 4 4" 263 - 264 - /* Supported displays in alphabetical order */ 265 - static struct fbtft_device_display displays[] = { 266 - { 267 - .name = "adafruit18", 268 - .spi = &(struct spi_board_info) { 269 - .modalias = "fb_st7735r", 270 - .max_speed_hz = 32000000, 271 - .mode = SPI_MODE_0, 272 - .platform_data = &(struct fbtft_platform_data) { 273 - .display = { 274 - .buswidth = 8, 275 - .backlight = 1, 276 - }, 277 - .gamma = ADAFRUIT18_GAMMA, 278 - } 279 - } 280 - }, { 281 - .name = "adafruit18_green", 282 - .spi = &(struct spi_board_info) { 283 - .modalias = "fb_st7735r", 284 - .max_speed_hz = 4000000, 285 - .mode = SPI_MODE_0, 286 - .platform_data = &(struct fbtft_platform_data) { 287 - .display = { 288 - .buswidth = 8, 289 - .backlight = 1, 290 - .fbtftops.set_addr_win = 291 - adafruit18_green_tab_set_addr_win, 292 - }, 293 - .bgr = true, 294 - .gamma = ADAFRUIT18_GAMMA, 295 - } 296 - } 297 - }, { 298 - .name = "adafruit22", 299 - .spi = &(struct spi_board_info) { 300 - .modalias = "fb_hx8340bn", 301 - .max_speed_hz = 32000000, 302 - .mode = SPI_MODE_0, 303 - .platform_data = &(struct fbtft_platform_data) { 304 - .display = { 305 - .buswidth = 9, 306 - .backlight = 1, 307 - }, 308 - .bgr = true, 309 - } 310 - } 311 - }, { 312 - .name = "adafruit22a", 313 - .spi = &(struct spi_board_info) { 314 - .modalias = "fb_ili9340", 315 - .max_speed_hz = 32000000, 316 - .mode = SPI_MODE_0, 317 - .platform_data = &(struct fbtft_platform_data) { 318 - .display = { 319 - .buswidth = 8, 320 - .backlight = 1, 321 - }, 322 - .bgr = true, 323 - } 324 - } 325 - }, { 326 - .name = "adafruit28", 327 - .spi = &(struct spi_board_info) { 328 - .modalias = "fb_ili9341", 329 - .max_speed_hz = 32000000, 330 - .mode = SPI_MODE_0, 331 - .platform_data = &(struct fbtft_platform_data) { 332 - .display = { 333 - .buswidth = 8, 334 - .backlight = 1, 335 - }, 336 - .bgr = true, 337 - } 338 - } 339 - }, { 340 - .name = "adafruit13m", 341 - .spi = &(struct spi_board_info) { 342 - .modalias = "fb_ssd1306", 343 - .max_speed_hz = 16000000, 344 - .mode = SPI_MODE_0, 345 - .platform_data = &(struct fbtft_platform_data) { 346 - .display = { 347 - .buswidth = 8, 348 - }, 349 - } 350 - } 351 - }, { 352 - .name = "admatec_c-berry28", 353 - .spi = &(struct spi_board_info) { 354 - .modalias = "fb_st7789v", 355 - .max_speed_hz = 48000000, 356 - .mode = SPI_MODE_0, 357 - .platform_data = &(struct fbtft_platform_data) { 358 - .display = { 359 - .buswidth = 8, 360 - .backlight = 1, 361 - .init_sequence = cberry28_init_sequence, 362 - }, 363 - .gamma = CBERRY28_GAMMA, 364 - } 365 - } 366 - }, { 367 - .name = "agm1264k-fl", 368 - .pdev = &(struct platform_device) { 369 - .name = "fb_agm1264k-fl", 370 - .id = 0, 371 - .dev = { 372 - .release = fbtft_device_pdev_release, 373 - .platform_data = &(struct fbtft_platform_data) { 374 - .display = { 375 - .buswidth = 8, 376 - .backlight = FBTFT_ONBOARD_BACKLIGHT, 377 - }, 378 - }, 379 - } 380 - } 381 - }, { 382 - .name = "dogs102", 383 - .spi = &(struct spi_board_info) { 384 - .modalias = "fb_uc1701", 385 - .max_speed_hz = 8000000, 386 - .mode = SPI_MODE_0, 387 - .platform_data = &(struct fbtft_platform_data) { 388 - .display = { 389 - .buswidth = 8, 390 - }, 391 - .bgr = true, 392 - } 393 - } 394 - }, { 395 - .name = "er_tftm050_2", 396 - .spi = &(struct spi_board_info) { 397 - .modalias = "fb_ra8875", 398 - .max_speed_hz = 5000000, 399 - .mode = SPI_MODE_3, 400 - .platform_data = &(struct fbtft_platform_data) { 401 - .display = { 402 - .buswidth = 8, 403 - .backlight = 1, 404 - .width = 480, 405 - .height = 272, 406 - }, 407 - .bgr = true, 408 - } 409 - } 410 - }, { 411 - .name = "er_tftm070_5", 412 - .spi = &(struct spi_board_info) { 413 - .modalias = "fb_ra8875", 414 - .max_speed_hz = 5000000, 415 - .mode = SPI_MODE_3, 416 - .platform_data = &(struct fbtft_platform_data) { 417 - .display = { 418 - .buswidth = 8, 419 - .backlight = 1, 420 - .width = 800, 421 - .height = 480, 422 - }, 423 - .bgr = true, 424 - } 425 - } 426 - }, { 427 - .name = "ew24ha0", 428 - .spi = &(struct spi_board_info) { 429 - .modalias = "fb_uc1611", 430 - .max_speed_hz = 32000000, 431 - .mode = SPI_MODE_3, 432 - .platform_data = &(struct fbtft_platform_data) { 433 - .display = { 434 - .buswidth = 8, 435 - }, 436 - } 437 - } 438 - }, { 439 - .name = "ew24ha0_9bit", 440 - .spi = &(struct spi_board_info) { 441 - .modalias = "fb_uc1611", 442 - .max_speed_hz = 32000000, 443 - .mode = SPI_MODE_3, 444 - .platform_data = &(struct fbtft_platform_data) { 445 - .display = { 446 - .buswidth = 9, 447 - }, 448 - } 449 - } 450 - }, { 451 - .name = "flexfb", 452 - .spi = &(struct spi_board_info) { 453 - .modalias = "flexfb", 454 - .max_speed_hz = 32000000, 455 - .mode = SPI_MODE_0, 456 - } 457 - }, { 458 - .name = "flexpfb", 459 - .pdev = &(struct platform_device) { 460 - .name = "flexpfb", 461 - .id = 0, 462 - .dev = { 463 - .release = fbtft_device_pdev_release, 464 - } 465 - } 466 - }, { 467 - .name = "freetronicsoled128", 468 - .spi = &(struct spi_board_info) { 469 - .modalias = "fb_ssd1351", 470 - .max_speed_hz = 20000000, 471 - .mode = SPI_MODE_0, 472 - .platform_data = &(struct fbtft_platform_data) { 473 - .display = { 474 - .buswidth = 8, 475 - .backlight = FBTFT_ONBOARD_BACKLIGHT, 476 - }, 477 - .bgr = true, 478 - } 479 - } 480 - }, { 481 - .name = "hx8353d", 482 - .spi = &(struct spi_board_info) { 483 - .modalias = "fb_hx8353d", 484 - .max_speed_hz = 16000000, 485 - .mode = SPI_MODE_0, 486 - .platform_data = &(struct fbtft_platform_data) { 487 - .display = { 488 - .buswidth = 8, 489 - .backlight = 1, 490 - }, 491 - } 492 - } 493 - }, { 494 - .name = "hy28a", 495 - .spi = &(struct spi_board_info) { 496 - .modalias = "fb_ili9320", 497 - .max_speed_hz = 32000000, 498 - .mode = SPI_MODE_3, 499 - .platform_data = &(struct fbtft_platform_data) { 500 - .display = { 501 - .buswidth = 8, 502 - .backlight = 1, 503 - }, 504 - .startbyte = 0x70, 505 - .bgr = true, 506 - } 507 - } 508 - }, { 509 - .name = "hy28b", 510 - .spi = &(struct spi_board_info) { 511 - .modalias = "fb_ili9325", 512 - .max_speed_hz = 48000000, 513 - .mode = SPI_MODE_3, 514 - .platform_data = &(struct fbtft_platform_data) { 515 - .display = { 516 - .buswidth = 8, 517 - .backlight = 1, 518 - .init_sequence = hy28b_init_sequence, 519 - }, 520 - .startbyte = 0x70, 521 - .bgr = true, 522 - .fps = 50, 523 - .gamma = HY28B_GAMMA, 524 - } 525 - } 526 - }, { 527 - .name = "ili9481", 528 - .spi = &(struct spi_board_info) { 529 - .modalias = "fb_ili9481", 530 - .max_speed_hz = 32000000, 531 - .mode = SPI_MODE_0, 532 - .platform_data = &(struct fbtft_platform_data) { 533 - .display = { 534 - .regwidth = 16, 535 - .buswidth = 8, 536 - .backlight = 1, 537 - }, 538 - .bgr = true, 539 - } 540 - } 541 - }, { 542 - .name = "itdb24", 543 - .pdev = &(struct platform_device) { 544 - .name = "fb_s6d1121", 545 - .id = 0, 546 - .dev = { 547 - .release = fbtft_device_pdev_release, 548 - .platform_data = &(struct fbtft_platform_data) { 549 - .display = { 550 - .buswidth = 8, 551 - .backlight = 1, 552 - }, 553 - .bgr = false, 554 - }, 555 - } 556 - } 557 - }, { 558 - .name = "itdb28", 559 - .pdev = &(struct platform_device) { 560 - .name = "fb_ili9325", 561 - .id = 0, 562 - .dev = { 563 - .release = fbtft_device_pdev_release, 564 - .platform_data = &(struct fbtft_platform_data) { 565 - .display = { 566 - .buswidth = 8, 567 - .backlight = 1, 568 - }, 569 - .bgr = true, 570 - }, 571 - } 572 - } 573 - }, { 574 - .name = "itdb28_spi", 575 - .spi = &(struct spi_board_info) { 576 - .modalias = "fb_ili9325", 577 - .max_speed_hz = 32000000, 578 - .mode = SPI_MODE_0, 579 - .platform_data = &(struct fbtft_platform_data) { 580 - .display = { 581 - .buswidth = 8, 582 - .backlight = 1, 583 - }, 584 - .bgr = true, 585 - } 586 - } 587 - }, { 588 - .name = "mi0283qt-2", 589 - .spi = &(struct spi_board_info) { 590 - .modalias = "fb_hx8347d", 591 - .max_speed_hz = 32000000, 592 - .mode = SPI_MODE_0, 593 - .platform_data = &(struct fbtft_platform_data) { 594 - .display = { 595 - .buswidth = 8, 596 - .backlight = 1, 597 - }, 598 - .startbyte = 0x70, 599 - .bgr = true, 600 - } 601 - } 602 - }, { 603 - .name = "mi0283qt-9a", 604 - .spi = &(struct spi_board_info) { 605 - .modalias = "fb_ili9341", 606 - .max_speed_hz = 32000000, 607 - .mode = SPI_MODE_0, 608 - .platform_data = &(struct fbtft_platform_data) { 609 - .display = { 610 - .buswidth = 9, 611 - .backlight = 1, 612 - }, 613 - .bgr = true, 614 - } 615 - } 616 - }, { 617 - .name = "mi0283qt-v2", 618 - .spi = &(struct spi_board_info) { 619 - .modalias = "fb_watterott", 620 - .max_speed_hz = 4000000, 621 - .mode = SPI_MODE_3, 622 - .platform_data = &(struct fbtft_platform_data) { 623 - } 624 - } 625 - }, { 626 - .name = "nokia3310", 627 - .spi = &(struct spi_board_info) { 628 - .modalias = "fb_pcd8544", 629 - .max_speed_hz = 400000, 630 - .mode = SPI_MODE_0, 631 - .platform_data = &(struct fbtft_platform_data) { 632 - .display = { 633 - .buswidth = 8, 634 - }, 635 - } 636 - } 637 - }, { 638 - .name = "nokia3310a", 639 - .spi = &(struct spi_board_info) { 640 - .modalias = "fb_tls8204", 641 - .max_speed_hz = 1000000, 642 - .mode = SPI_MODE_0, 643 - .platform_data = &(struct fbtft_platform_data) { 644 - .display = { 645 - .buswidth = 8, 646 - }, 647 - } 648 - } 649 - }, { 650 - .name = "nokia5110", 651 - .spi = &(struct spi_board_info) { 652 - .modalias = "fb_ili9163", 653 - .max_speed_hz = 12000000, 654 - .mode = SPI_MODE_0, 655 - .platform_data = &(struct fbtft_platform_data) { 656 - .display = { 657 - .buswidth = 8, 658 - .backlight = 1, 659 - }, 660 - .bgr = true, 661 - } 662 - } 663 - }, { 664 - .name = "piscreen", 665 - .spi = &(struct spi_board_info) { 666 - .modalias = "fb_ili9486", 667 - .max_speed_hz = 32000000, 668 - .mode = SPI_MODE_0, 669 - .platform_data = &(struct fbtft_platform_data) { 670 - .display = { 671 - .regwidth = 16, 672 - .buswidth = 8, 673 - .backlight = 1, 674 - }, 675 - .bgr = true, 676 - } 677 - } 678 - }, { 679 - .name = "pitft", 680 - .spi = &(struct spi_board_info) { 681 - .modalias = "fb_ili9340", 682 - .max_speed_hz = 32000000, 683 - .mode = SPI_MODE_0, 684 - .chip_select = 0, 685 - .platform_data = &(struct fbtft_platform_data) { 686 - .display = { 687 - .buswidth = 8, 688 - .backlight = 1, 689 - .init_sequence = pitft_init_sequence, 690 - }, 691 - .bgr = true, 692 - } 693 - } 694 - }, { 695 - .name = "pioled", 696 - .spi = &(struct spi_board_info) { 697 - .modalias = "fb_ssd1351", 698 - .max_speed_hz = 20000000, 699 - .mode = SPI_MODE_0, 700 - .platform_data = &(struct fbtft_platform_data) { 701 - .display = { 702 - .buswidth = 8, 703 - }, 704 - .bgr = true, 705 - .gamma = PIOLED_GAMMA 706 - } 707 - } 708 - }, { 709 - .name = "rpi-display", 710 - .spi = &(struct spi_board_info) { 711 - .modalias = "fb_ili9341", 712 - .max_speed_hz = 32000000, 713 - .mode = SPI_MODE_0, 714 - .platform_data = &(struct fbtft_platform_data) { 715 - .display = { 716 - .buswidth = 8, 717 - .backlight = 1, 718 - }, 719 - .bgr = true, 720 - } 721 - } 722 - }, { 723 - .name = "s6d02a1", 724 - .spi = &(struct spi_board_info) { 725 - .modalias = "fb_s6d02a1", 726 - .max_speed_hz = 32000000, 727 - .mode = SPI_MODE_0, 728 - .platform_data = &(struct fbtft_platform_data) { 729 - .display = { 730 - .buswidth = 8, 731 - .backlight = 1, 732 - }, 733 - .bgr = true, 734 - } 735 - } 736 - }, { 737 - .name = "sainsmart18", 738 - .spi = &(struct spi_board_info) { 739 - .modalias = "fb_st7735r", 740 - .max_speed_hz = 32000000, 741 - .mode = SPI_MODE_0, 742 - .platform_data = &(struct fbtft_platform_data) { 743 - .display = { 744 - .buswidth = 8, 745 - }, 746 - } 747 - } 748 - }, { 749 - .name = "sainsmart32", 750 - .pdev = &(struct platform_device) { 751 - .name = "fb_ssd1289", 752 - .id = 0, 753 - .dev = { 754 - .release = fbtft_device_pdev_release, 755 - .platform_data = &(struct fbtft_platform_data) { 756 - .display = { 757 - .buswidth = 16, 758 - .txbuflen = -2, /* disable buffer */ 759 - .backlight = 1, 760 - .fbtftops.write = write_gpio16_wr_slow, 761 - }, 762 - .bgr = true, 763 - }, 764 - }, 765 - } 766 - }, { 767 - .name = "sainsmart32_fast", 768 - .pdev = &(struct platform_device) { 769 - .name = "fb_ssd1289", 770 - .id = 0, 771 - .dev = { 772 - .release = fbtft_device_pdev_release, 773 - .platform_data = &(struct fbtft_platform_data) { 774 - .display = { 775 - .buswidth = 16, 776 - .txbuflen = -2, /* disable buffer */ 777 - .backlight = 1, 778 - }, 779 - .bgr = true, 780 - }, 781 - }, 782 - } 783 - }, { 784 - .name = "sainsmart32_latched", 785 - .pdev = &(struct platform_device) { 786 - .name = "fb_ssd1289", 787 - .id = 0, 788 - .dev = { 789 - .release = fbtft_device_pdev_release, 790 - .platform_data = &(struct fbtft_platform_data) { 791 - .display = { 792 - .buswidth = 16, 793 - .txbuflen = -2, /* disable buffer */ 794 - .backlight = 1, 795 - .fbtftops.write = 796 - fbtft_write_gpio16_wr_latched, 797 - }, 798 - .bgr = true, 799 - }, 800 - }, 801 - } 802 - }, { 803 - .name = "sainsmart32_spi", 804 - .spi = &(struct spi_board_info) { 805 - .modalias = "fb_ssd1289", 806 - .max_speed_hz = 16000000, 807 - .mode = SPI_MODE_0, 808 - .platform_data = &(struct fbtft_platform_data) { 809 - .display = { 810 - .buswidth = 8, 811 - .backlight = 1, 812 - }, 813 - .bgr = true, 814 - } 815 - } 816 - }, { 817 - .name = "spidev", 818 - .spi = &(struct spi_board_info) { 819 - .modalias = "spidev", 820 - .max_speed_hz = 500000, 821 - .bus_num = 0, 822 - .chip_select = 0, 823 - .mode = SPI_MODE_0, 824 - .platform_data = &(struct fbtft_platform_data) { 825 - } 826 - } 827 - }, { 828 - .name = "ssd1331", 829 - .spi = &(struct spi_board_info) { 830 - .modalias = "fb_ssd1331", 831 - .max_speed_hz = 20000000, 832 - .mode = SPI_MODE_3, 833 - .platform_data = &(struct fbtft_platform_data) { 834 - .display = { 835 - .buswidth = 8, 836 - }, 837 - } 838 - } 839 - }, { 840 - .name = "tinylcd35", 841 - .spi = &(struct spi_board_info) { 842 - .modalias = "fb_tinylcd", 843 - .max_speed_hz = 32000000, 844 - .mode = SPI_MODE_0, 845 - .platform_data = &(struct fbtft_platform_data) { 846 - .display = { 847 - .buswidth = 8, 848 - .backlight = 1, 849 - }, 850 - .bgr = true, 851 - } 852 - } 853 - }, { 854 - .name = "tm022hdh26", 855 - .spi = &(struct spi_board_info) { 856 - .modalias = "fb_ili9341", 857 - .max_speed_hz = 32000000, 858 - .mode = SPI_MODE_0, 859 - .platform_data = &(struct fbtft_platform_data) { 860 - .display = { 861 - .buswidth = 8, 862 - .backlight = 1, 863 - }, 864 - .bgr = true, 865 - } 866 - } 867 - }, { 868 - .name = "tontec35_9481", /* boards before 02 July 2014 */ 869 - .spi = &(struct spi_board_info) { 870 - .modalias = "fb_ili9481", 871 - .max_speed_hz = 128000000, 872 - .mode = SPI_MODE_3, 873 - .platform_data = &(struct fbtft_platform_data) { 874 - .display = { 875 - .buswidth = 8, 876 - .backlight = 1, 877 - }, 878 - .bgr = true, 879 - } 880 - } 881 - }, { 882 - .name = "tontec35_9486", /* boards after 02 July 2014 */ 883 - .spi = &(struct spi_board_info) { 884 - .modalias = "fb_ili9486", 885 - .max_speed_hz = 128000000, 886 - .mode = SPI_MODE_3, 887 - .platform_data = &(struct fbtft_platform_data) { 888 - .display = { 889 - .buswidth = 8, 890 - .backlight = 1, 891 - }, 892 - .bgr = true, 893 - } 894 - } 895 - }, { 896 - .name = "upd161704", 897 - .spi = &(struct spi_board_info) { 898 - .modalias = "fb_upd161704", 899 - .max_speed_hz = 32000000, 900 - .mode = SPI_MODE_0, 901 - .platform_data = &(struct fbtft_platform_data) { 902 - .display = { 903 - .buswidth = 8, 904 - }, 905 - } 906 - } 907 - }, { 908 - .name = "waveshare32b", 909 - .spi = &(struct spi_board_info) { 910 - .modalias = "fb_ili9340", 911 - .max_speed_hz = 48000000, 912 - .mode = SPI_MODE_0, 913 - .platform_data = &(struct fbtft_platform_data) { 914 - .display = { 915 - .buswidth = 8, 916 - .backlight = 1, 917 - .init_sequence = 918 - waveshare32b_init_sequence, 919 - }, 920 - .bgr = true, 921 - } 922 - } 923 - }, { 924 - .name = "waveshare22", 925 - .spi = &(struct spi_board_info) { 926 - .modalias = "fb_bd663474", 927 - .max_speed_hz = 32000000, 928 - .mode = SPI_MODE_3, 929 - .platform_data = &(struct fbtft_platform_data) { 930 - .display = { 931 - .buswidth = 8, 932 - }, 933 - } 934 - } 935 - }, { 936 - /* This should be the last item. 937 - * Used with the custom argument 938 - */ 939 - .name = "", 940 - .spi = &(struct spi_board_info) { 941 - .modalias = "", 942 - .max_speed_hz = 0, 943 - .mode = SPI_MODE_0, 944 - .platform_data = &(struct fbtft_platform_data) { 945 - } 946 - }, 947 - .pdev = &(struct platform_device) { 948 - .name = "", 949 - .id = 0, 950 - .dev = { 951 - .release = fbtft_device_pdev_release, 952 - .platform_data = &(struct fbtft_platform_data) { 953 - }, 954 - }, 955 - }, 956 - } 957 - }; 958 - 959 - static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len) 960 - { 961 - u16 data; 962 - int i; 963 - #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO 964 - static u16 prev_data; 965 - #endif 966 - 967 - fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, 968 - "%s(len=%zu): ", __func__, len); 969 - 970 - while (len) { 971 - data = *(u16 *)buf; 972 - 973 - /* Start writing by pulling down /WR */ 974 - gpiod_set_value(par->gpio.wr, 0); 975 - 976 - /* Set data */ 977 - #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO 978 - if (data == prev_data) { 979 - gpiod_set_value(par->gpio.wr, 0); /* used as delay */ 980 - } else { 981 - for (i = 0; i < 16; i++) { 982 - if ((data & 1) != (prev_data & 1)) 983 - gpiod_set_value(par->gpio.db[i], 984 - data & 1); 985 - data >>= 1; 986 - prev_data >>= 1; 987 - } 988 - } 989 - #else 990 - for (i = 0; i < 16; i++) { 991 - gpiod_set_value(par->gpio.db[i], data & 1); 992 - data >>= 1; 993 - } 994 - #endif 995 - 996 - /* Pullup /WR */ 997 - gpiod_set_value(par->gpio.wr, 1); 998 - 999 - #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO 1000 - prev_data = *(u16 *)buf; 1001 - #endif 1002 - buf += 2; 1003 - len -= 2; 1004 - } 1005 - 1006 - return 0; 1007 - } 1008 - 1009 - static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, 1010 - int xs, int ys, int xe, int ye) 1011 - { 1012 - write_reg(par, 0x2A, 0, xs + 2, 0, xe + 2); 1013 - write_reg(par, 0x2B, 0, ys + 1, 0, ye + 1); 1014 - write_reg(par, 0x2C); 1015 - } 1016 - 1017 - static void fbtft_device_pdev_release(struct device *dev) 1018 - { 1019 - /* Needed to silence this message: 1020 - * Device 'xxx' does not have a release() function, 1021 - * it is broken and must be fixed 1022 - */ 1023 - } 1024 - 1025 - static int spi_device_found(struct device *dev, void *data) 1026 - { 1027 - struct spi_device *spi = to_spi_device(dev); 1028 - 1029 - dev_info(dev, "%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias, 1030 - dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word, 1031 - spi->mode); 1032 - 1033 - return 0; 1034 - } 1035 - 1036 - static void pr_spi_devices(void) 1037 - { 1038 - pr_debug("SPI devices registered:\n"); 1039 - bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found); 1040 - } 1041 - 1042 - static int p_device_found(struct device *dev, void *data) 1043 - { 1044 - struct platform_device 1045 - *pdev = to_platform_device(dev); 1046 - 1047 - if (strstr(pdev->name, "fb")) 1048 - dev_info(dev, "%s id=%d pdata? %s\n", pdev->name, pdev->id, 1049 - pdev->dev.platform_data ? "yes" : "no"); 1050 - 1051 - return 0; 1052 - } 1053 - 1054 - static void pr_p_devices(void) 1055 - { 1056 - pr_debug("'fb' Platform devices registered:\n"); 1057 - bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found); 1058 - } 1059 - 1060 - #ifdef MODULE 1061 - static void fbtft_device_spi_delete(struct spi_master *master, unsigned int cs) 1062 - { 1063 - struct device *dev; 1064 - char str[32]; 1065 - 1066 - snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), cs); 1067 - 1068 - dev = bus_find_device_by_name(&spi_bus_type, NULL, str); 1069 - if (dev) { 1070 - if (verbose) 1071 - dev_info(dev, "Deleting %s\n", str); 1072 - device_del(dev); 1073 - } 1074 - } 1075 - 1076 - static int fbtft_device_spi_device_register(struct spi_board_info *spi) 1077 - { 1078 - struct spi_master *master; 1079 - 1080 - master = spi_busnum_to_master(spi->bus_num); 1081 - if (!master) { 1082 - pr_err("spi_busnum_to_master(%d) returned NULL\n", 1083 - spi->bus_num); 1084 - return -EINVAL; 1085 - } 1086 - /* make sure it's available */ 1087 - fbtft_device_spi_delete(master, spi->chip_select); 1088 - spi_device = spi_new_device(master, spi); 1089 - put_device(&master->dev); 1090 - if (!spi_device) { 1091 - dev_err(&master->dev, "spi_new_device() returned NULL\n"); 1092 - return -EPERM; 1093 - } 1094 - return 0; 1095 - } 1096 - #else 1097 - static int fbtft_device_spi_device_register(struct spi_board_info *spi) 1098 - { 1099 - return spi_register_board_info(spi, 1); 1100 - } 1101 - #endif 1102 - 1103 - static int __init fbtft_device_init(void) 1104 - { 1105 - struct spi_board_info *spi = NULL; 1106 - struct fbtft_platform_data *pdata; 1107 - bool found = false; 1108 - int i = 0; 1109 - int ret = 0; 1110 - 1111 - if (!name) { 1112 - #ifdef MODULE 1113 - pr_err("missing module parameter: 'name'\n"); 1114 - return -EINVAL; 1115 - #else 1116 - return 0; 1117 - #endif 1118 - } 1119 - 1120 - if (init_num > FBTFT_MAX_INIT_SEQUENCE) { 1121 - pr_err("init parameter: exceeded max array size: %d\n", 1122 - FBTFT_MAX_INIT_SEQUENCE); 1123 - return -EINVAL; 1124 - } 1125 - 1126 - if (verbose > 2) { 1127 - pr_spi_devices(); /* print list of registered SPI devices */ 1128 - pr_p_devices(); /* print list of 'fb' platform devices */ 1129 - } 1130 - 1131 - pr_debug("name='%s', busnum=%d, cs=%d\n", name, busnum, cs); 1132 - 1133 - if (rotate > 0 && rotate < 4) { 1134 - rotate = (4 - rotate) * 90; 1135 - pr_warn("argument 'rotate' should be an angle. Values 1-3 is deprecated. Setting it to %d.\n", 1136 - rotate); 1137 - } 1138 - if (rotate != 0 && rotate != 90 && rotate != 180 && rotate != 270) { 1139 - pr_warn("argument 'rotate' illegal value: %d. Setting it to 0.\n", 1140 - rotate); 1141 - rotate = 0; 1142 - } 1143 - 1144 - /* name=list lists all supported displays */ 1145 - if (strcmp(name, "list") == 0) { 1146 - pr_info("Supported displays:\n"); 1147 - 1148 - for (i = 0; i < ARRAY_SIZE(displays); i++) 1149 - pr_info("%s\n", displays[i].name); 1150 - return -ECANCELED; 1151 - } 1152 - 1153 - if (custom) { 1154 - i = ARRAY_SIZE(displays) - 1; 1155 - displays[i].name = name; 1156 - if (speed == 0) { 1157 - displays[i].pdev->name = name; 1158 - displays[i].spi = NULL; 1159 - } else { 1160 - size_t len; 1161 - 1162 - len = strlcpy(displays[i].spi->modalias, name, 1163 - SPI_NAME_SIZE); 1164 - if (len >= SPI_NAME_SIZE) 1165 - pr_warn("modalias (name) truncated to: %s\n", 1166 - displays[i].spi->modalias); 1167 - displays[i].pdev = NULL; 1168 - } 1169 - } 1170 - 1171 - for (i = 0; i < ARRAY_SIZE(displays); i++) { 1172 - if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) { 1173 - if (displays[i].spi) { 1174 - spi = displays[i].spi; 1175 - spi->chip_select = cs; 1176 - spi->bus_num = busnum; 1177 - if (speed) 1178 - spi->max_speed_hz = speed; 1179 - if (mode != -1) 1180 - spi->mode = mode; 1181 - pdata = (void *)spi->platform_data; 1182 - } else if (displays[i].pdev) { 1183 - p_device = displays[i].pdev; 1184 - pdata = p_device->dev.platform_data; 1185 - } else { 1186 - pr_err("broken displays array\n"); 1187 - return -EINVAL; 1188 - } 1189 - 1190 - pdata->rotate = rotate; 1191 - if (bgr == 0) 1192 - pdata->bgr = false; 1193 - else if (bgr == 1) 1194 - pdata->bgr = true; 1195 - if (startbyte) 1196 - pdata->startbyte = startbyte; 1197 - if (gamma) 1198 - pdata->gamma = gamma; 1199 - pdata->display.debug = debug; 1200 - if (fps) 1201 - pdata->fps = fps; 1202 - if (txbuflen) 1203 - pdata->txbuflen = txbuflen; 1204 - if (init_num) 1205 - pdata->display.init_sequence = init; 1206 - if (custom) { 1207 - pdata->display.width = width; 1208 - pdata->display.height = height; 1209 - pdata->display.buswidth = buswidth; 1210 - pdata->display.backlight = 1; 1211 - } 1212 - 1213 - if (displays[i].spi) { 1214 - ret = fbtft_device_spi_device_register(spi); 1215 - if (ret) { 1216 - pr_err("failed to register SPI device\n"); 1217 - return ret; 1218 - } 1219 - } else { 1220 - ret = platform_device_register(p_device); 1221 - if (ret < 0) { 1222 - pr_err("platform_device_register() returned %d\n", 1223 - ret); 1224 - return ret; 1225 - } 1226 - } 1227 - found = true; 1228 - break; 1229 - } 1230 - } 1231 - 1232 - if (!found) { 1233 - pr_err("display not supported: '%s'\n", name); 1234 - return -EINVAL; 1235 - } 1236 - 1237 - if (spi_device && (verbose > 1)) 1238 - pr_spi_devices(); 1239 - if (p_device && (verbose > 1)) 1240 - pr_p_devices(); 1241 - 1242 - return 0; 1243 - } 1244 - 1245 - static void __exit fbtft_device_exit(void) 1246 - { 1247 - if (spi_device) { 1248 - device_del(&spi_device->dev); 1249 - kfree(spi_device); 1250 - } 1251 - 1252 - if (p_device) 1253 - platform_device_unregister(p_device); 1254 - } 1255 - 1256 - arch_initcall(fbtft_device_init); 1257 - module_exit(fbtft_device_exit); 1258 - 1259 - MODULE_DESCRIPTION("Add a FBTFT device."); 1260 - MODULE_AUTHOR("Noralf Tronnes"); 1261 - MODULE_LICENSE("GPL");
-851
drivers/staging/fbtft/flexfb.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * Generic FB driver for TFT LCD displays 4 - * 5 - * Copyright (C) 2013 Noralf Tronnes 6 - */ 7 - 8 - #include <linux/module.h> 9 - #include <linux/kernel.h> 10 - #include <linux/init.h> 11 - #include <linux/vmalloc.h> 12 - #include <linux/gpio/consumer.h> 13 - #include <linux/spi/spi.h> 14 - #include <linux/delay.h> 15 - 16 - #include "fbtft.h" 17 - 18 - #define DRVNAME "flexfb" 19 - 20 - static char *chip; 21 - module_param(chip, charp, 0000); 22 - MODULE_PARM_DESC(chip, "LCD controller"); 23 - 24 - static unsigned int width; 25 - module_param(width, uint, 0000); 26 - MODULE_PARM_DESC(width, "Display width"); 27 - 28 - static unsigned int height; 29 - module_param(height, uint, 0000); 30 - MODULE_PARM_DESC(height, "Display height"); 31 - 32 - static s16 init[512]; 33 - static int init_num; 34 - module_param_array(init, short, &init_num, 0000); 35 - MODULE_PARM_DESC(init, "Init sequence"); 36 - 37 - static unsigned int setaddrwin; 38 - module_param(setaddrwin, uint, 0000); 39 - MODULE_PARM_DESC(setaddrwin, "Which set_addr_win() implementation to use"); 40 - 41 - static unsigned int buswidth = 8; 42 - module_param(buswidth, uint, 0000); 43 - MODULE_PARM_DESC(buswidth, "Width of databus (default: 8)"); 44 - 45 - static unsigned int regwidth = 8; 46 - module_param(regwidth, uint, 0000); 47 - MODULE_PARM_DESC(regwidth, "Width of controller register (default: 8)"); 48 - 49 - static bool nobacklight; 50 - module_param(nobacklight, bool, 0000); 51 - MODULE_PARM_DESC(nobacklight, "Turn off backlight functionality."); 52 - 53 - static bool latched; 54 - module_param(latched, bool, 0000); 55 - MODULE_PARM_DESC(latched, "Use with latched 16-bit databus"); 56 - 57 - static const s16 *initp; 58 - static int initp_num; 59 - 60 - /* default init sequences */ 61 - static const s16 st7735r_init[] = { 62 - -1, 0x01, 63 - -2, 150, 64 - -1, 0x11, 65 - -2, 500, 66 - -1, 0xB1, 0x01, 0x2C, 0x2D, 67 - -1, 0xB2, 0x01, 0x2C, 0x2D, 68 - -1, 0xB3, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, 69 - -1, 0xB4, 0x07, 70 - -1, 0xC0, 0xA2, 0x02, 0x84, 71 - -1, 0xC1, 0xC5, 72 - -1, 0xC2, 0x0A, 0x00, 73 - -1, 0xC3, 0x8A, 0x2A, 74 - -1, 0xC4, 0x8A, 0xEE, 75 - -1, 0xC5, 0x0E, 76 - -1, 0x20, 77 - -1, 0x36, 0xC0, 78 - -1, 0x3A, 0x05, 79 - -1, 0xE0, 0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, 80 - 0x1f, 0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10, 81 - -1, 0xE1, 0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, 82 - 0x30, 0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10, 83 - -1, 0x29, 84 - -2, 100, 85 - -1, 0x13, 86 - -2, 10, 87 - -3 88 - }; 89 - 90 - static const s16 ssd1289_init[] = { 91 - -1, 0x00, 0x0001, 92 - -1, 0x03, 0xA8A4, 93 - -1, 0x0C, 0x0000, 94 - -1, 0x0D, 0x080C, 95 - -1, 0x0E, 0x2B00, 96 - -1, 0x1E, 0x00B7, 97 - -1, 0x01, 0x2B3F, 98 - -1, 0x02, 0x0600, 99 - -1, 0x10, 0x0000, 100 - -1, 0x11, 0x6070, 101 - -1, 0x05, 0x0000, 102 - -1, 0x06, 0x0000, 103 - -1, 0x16, 0xEF1C, 104 - -1, 0x17, 0x0003, 105 - -1, 0x07, 0x0233, 106 - -1, 0x0B, 0x0000, 107 - -1, 0x0F, 0x0000, 108 - -1, 0x41, 0x0000, 109 - -1, 0x42, 0x0000, 110 - -1, 0x48, 0x0000, 111 - -1, 0x49, 0x013F, 112 - -1, 0x4A, 0x0000, 113 - -1, 0x4B, 0x0000, 114 - -1, 0x44, 0xEF00, 115 - -1, 0x45, 0x0000, 116 - -1, 0x46, 0x013F, 117 - -1, 0x30, 0x0707, 118 - -1, 0x31, 0x0204, 119 - -1, 0x32, 0x0204, 120 - -1, 0x33, 0x0502, 121 - -1, 0x34, 0x0507, 122 - -1, 0x35, 0x0204, 123 - -1, 0x36, 0x0204, 124 - -1, 0x37, 0x0502, 125 - -1, 0x3A, 0x0302, 126 - -1, 0x3B, 0x0302, 127 - -1, 0x23, 0x0000, 128 - -1, 0x24, 0x0000, 129 - -1, 0x25, 0x8000, 130 - -1, 0x4f, 0x0000, 131 - -1, 0x4e, 0x0000, 132 - -1, 0x22, 133 - -3 134 - }; 135 - 136 - static const s16 hx8340bn_init[] = { 137 - -1, 0xC1, 0xFF, 0x83, 0x40, 138 - -1, 0x11, 139 - -2, 150, 140 - -1, 0xCA, 0x70, 0x00, 0xD9, 141 - -1, 0xB0, 0x01, 0x11, 142 - -1, 0xC9, 0x90, 0x49, 0x10, 0x28, 0x28, 0x10, 0x00, 0x06, 143 - -2, 20, 144 - -1, 0xC2, 0x60, 0x71, 0x01, 0x0E, 0x05, 0x02, 0x09, 0x31, 0x0A, 145 - -1, 0xC3, 0x67, 0x30, 0x61, 0x17, 0x48, 0x07, 0x05, 0x33, 146 - -2, 10, 147 - -1, 0xB5, 0x35, 0x20, 0x45, 148 - -1, 0xB4, 0x33, 0x25, 0x4C, 149 - -2, 10, 150 - -1, 0x3A, 0x05, 151 - -1, 0x29, 152 - -2, 10, 153 - -3 154 - }; 155 - 156 - static const s16 ili9225_init[] = { 157 - -1, 0x0001, 0x011C, 158 - -1, 0x0002, 0x0100, 159 - -1, 0x0003, 0x1030, 160 - -1, 0x0008, 0x0808, 161 - -1, 0x000C, 0x0000, 162 - -1, 0x000F, 0x0A01, 163 - -1, 0x0020, 0x0000, 164 - -1, 0x0021, 0x0000, 165 - -2, 50, 166 - -1, 0x0010, 0x0A00, 167 - -1, 0x0011, 0x1038, 168 - -2, 50, 169 - -1, 0x0012, 0x1121, 170 - -1, 0x0013, 0x004E, 171 - -1, 0x0014, 0x676F, 172 - -1, 0x0030, 0x0000, 173 - -1, 0x0031, 0x00DB, 174 - -1, 0x0032, 0x0000, 175 - -1, 0x0033, 0x0000, 176 - -1, 0x0034, 0x00DB, 177 - -1, 0x0035, 0x0000, 178 - -1, 0x0036, 0x00AF, 179 - -1, 0x0037, 0x0000, 180 - -1, 0x0038, 0x00DB, 181 - -1, 0x0039, 0x0000, 182 - -1, 0x0050, 0x0000, 183 - -1, 0x0051, 0x060A, 184 - -1, 0x0052, 0x0D0A, 185 - -1, 0x0053, 0x0303, 186 - -1, 0x0054, 0x0A0D, 187 - -1, 0x0055, 0x0A06, 188 - -1, 0x0056, 0x0000, 189 - -1, 0x0057, 0x0303, 190 - -1, 0x0058, 0x0000, 191 - -1, 0x0059, 0x0000, 192 - -2, 50, 193 - -1, 0x0007, 0x1017, 194 - -2, 50, 195 - -3 196 - }; 197 - 198 - static const s16 ili9320_init[] = { 199 - -1, 0x00E5, 0x8000, 200 - -1, 0x0000, 0x0001, 201 - -1, 0x0001, 0x0100, 202 - -1, 0x0002, 0x0700, 203 - -1, 0x0003, 0x1030, 204 - -1, 0x0004, 0x0000, 205 - -1, 0x0008, 0x0202, 206 - -1, 0x0009, 0x0000, 207 - -1, 0x000A, 0x0000, 208 - -1, 0x000C, 0x0000, 209 - -1, 0x000D, 0x0000, 210 - -1, 0x000F, 0x0000, 211 - -1, 0x0010, 0x0000, 212 - -1, 0x0011, 0x0007, 213 - -1, 0x0012, 0x0000, 214 - -1, 0x0013, 0x0000, 215 - -2, 200, 216 - -1, 0x0010, 0x17B0, 217 - -1, 0x0011, 0x0031, 218 - -2, 50, 219 - -1, 0x0012, 0x0138, 220 - -2, 50, 221 - -1, 0x0013, 0x1800, 222 - -1, 0x0029, 0x0008, 223 - -2, 50, 224 - -1, 0x0020, 0x0000, 225 - -1, 0x0021, 0x0000, 226 - -1, 0x0030, 0x0000, 227 - -1, 0x0031, 0x0505, 228 - -1, 0x0032, 0x0004, 229 - -1, 0x0035, 0x0006, 230 - -1, 0x0036, 0x0707, 231 - -1, 0x0037, 0x0105, 232 - -1, 0x0038, 0x0002, 233 - -1, 0x0039, 0x0707, 234 - -1, 0x003C, 0x0704, 235 - -1, 0x003D, 0x0807, 236 - -1, 0x0050, 0x0000, 237 - -1, 0x0051, 0x00EF, 238 - -1, 0x0052, 0x0000, 239 - -1, 0x0053, 0x013F, 240 - -1, 0x0060, 0x2700, 241 - -1, 0x0061, 0x0001, 242 - -1, 0x006A, 0x0000, 243 - -1, 0x0080, 0x0000, 244 - -1, 0x0081, 0x0000, 245 - -1, 0x0082, 0x0000, 246 - -1, 0x0083, 0x0000, 247 - -1, 0x0084, 0x0000, 248 - -1, 0x0085, 0x0000, 249 - -1, 0x0090, 0x0010, 250 - -1, 0x0092, 0x0000, 251 - -1, 0x0093, 0x0003, 252 - -1, 0x0095, 0x0110, 253 - -1, 0x0097, 0x0000, 254 - -1, 0x0098, 0x0000, 255 - -1, 0x0007, 0x0173, 256 - -3 257 - }; 258 - 259 - static const s16 ili9325_init[] = { 260 - -1, 0x00E3, 0x3008, 261 - -1, 0x00E7, 0x0012, 262 - -1, 0x00EF, 0x1231, 263 - -1, 0x0001, 0x0100, 264 - -1, 0x0002, 0x0700, 265 - -1, 0x0003, 0x1030, 266 - -1, 0x0004, 0x0000, 267 - -1, 0x0008, 0x0207, 268 - -1, 0x0009, 0x0000, 269 - -1, 0x000A, 0x0000, 270 - -1, 0x000C, 0x0000, 271 - -1, 0x000D, 0x0000, 272 - -1, 0x000F, 0x0000, 273 - -1, 0x0010, 0x0000, 274 - -1, 0x0011, 0x0007, 275 - -1, 0x0012, 0x0000, 276 - -1, 0x0013, 0x0000, 277 - -2, 200, 278 - -1, 0x0010, 0x1690, 279 - -1, 0x0011, 0x0223, 280 - -2, 50, 281 - -1, 0x0012, 0x000D, 282 - -2, 50, 283 - -1, 0x0013, 0x1200, 284 - -1, 0x0029, 0x000A, 285 - -1, 0x002B, 0x000C, 286 - -2, 50, 287 - -1, 0x0020, 0x0000, 288 - -1, 0x0021, 0x0000, 289 - -1, 0x0030, 0x0000, 290 - -1, 0x0031, 0x0506, 291 - -1, 0x0032, 0x0104, 292 - -1, 0x0035, 0x0207, 293 - -1, 0x0036, 0x000F, 294 - -1, 0x0037, 0x0306, 295 - -1, 0x0038, 0x0102, 296 - -1, 0x0039, 0x0707, 297 - -1, 0x003C, 0x0702, 298 - -1, 0x003D, 0x1604, 299 - -1, 0x0050, 0x0000, 300 - -1, 0x0051, 0x00EF, 301 - -1, 0x0052, 0x0000, 302 - -1, 0x0053, 0x013F, 303 - -1, 0x0060, 0xA700, 304 - -1, 0x0061, 0x0001, 305 - -1, 0x006A, 0x0000, 306 - -1, 0x0080, 0x0000, 307 - -1, 0x0081, 0x0000, 308 - -1, 0x0082, 0x0000, 309 - -1, 0x0083, 0x0000, 310 - -1, 0x0084, 0x0000, 311 - -1, 0x0085, 0x0000, 312 - -1, 0x0090, 0x0010, 313 - -1, 0x0092, 0x0600, 314 - -1, 0x0007, 0x0133, 315 - -3 316 - }; 317 - 318 - static const s16 ili9341_init[] = { 319 - -1, 0x28, 320 - -2, 20, 321 - -1, 0xCF, 0x00, 0x83, 0x30, 322 - -1, 0xED, 0x64, 0x03, 0x12, 0x81, 323 - -1, 0xE8, 0x85, 0x01, 0x79, 324 - -1, 0xCB, 0x39, 0x2c, 0x00, 0x34, 0x02, 325 - -1, 0xF7, 0x20, 326 - -1, 0xEA, 0x00, 0x00, 327 - -1, 0xC0, 0x26, 328 - -1, 0xC1, 0x11, 329 - -1, 0xC5, 0x35, 0x3E, 330 - -1, 0xC7, 0xBE, 331 - -1, 0xB1, 0x00, 0x1B, 332 - -1, 0xB6, 0x0a, 0x82, 0x27, 0x00, 333 - -1, 0xB7, 0x07, 334 - -1, 0x3A, 0x55, 335 - -1, 0x36, 0x48, 336 - -1, 0x11, 337 - -2, 120, 338 - -1, 0x29, 339 - -2, 20, 340 - -3 341 - }; 342 - 343 - static const s16 ssd1351_init[] = { 344 - -1, 0xfd, 0x12, 345 - -1, 0xfd, 0xb1, 346 - -1, 0xae, 347 - -1, 0xb3, 0xf1, 348 - -1, 0xca, 0x7f, 349 - -1, 0xa0, 0x74, 350 - -1, 0x15, 0x00, 0x7f, 351 - -1, 0x75, 0x00, 0x7f, 352 - -1, 0xa1, 0x00, 353 - -1, 0xa2, 0x00, 354 - -1, 0xb5, 0x00, 355 - -1, 0xab, 0x01, 356 - -1, 0xb1, 0x32, 357 - -1, 0xb4, 0xa0, 0xb5, 0x55, 358 - -1, 0xbb, 0x17, 359 - -1, 0xbe, 0x05, 360 - -1, 0xc1, 0xc8, 0x80, 0xc8, 361 - -1, 0xc7, 0x0f, 362 - -1, 0xb6, 0x01, 363 - -1, 0xa6, 364 - -1, 0xaf, 365 - -3 366 - }; 367 - 368 - /** 369 - * struct flexfb_lcd_controller - Describes the LCD controller properties 370 - * @name: Model name of the chip 371 - * @width: Width of display in pixels 372 - * @height: Height of display in pixels 373 - * @setaddrwin: Which set_addr_win() implementation to use 374 - * @regwidth: LCD Controller Register width in bits 375 - * @init_seq: LCD initialization sequence 376 - * @init_seq_sz: Size of LCD initialization sequence 377 - */ 378 - struct flexfb_lcd_controller { 379 - const char *name; 380 - unsigned int width; 381 - unsigned int height; 382 - unsigned int setaddrwin; 383 - unsigned int regwidth; 384 - const s16 *init_seq; 385 - int init_seq_sz; 386 - }; 387 - 388 - static const struct flexfb_lcd_controller flexfb_chip_table[] = { 389 - { 390 - .name = "st7735r", 391 - .width = 120, 392 - .height = 160, 393 - .init_seq = st7735r_init, 394 - .init_seq_sz = ARRAY_SIZE(st7735r_init), 395 - }, 396 - { 397 - .name = "hx8340bn", 398 - .width = 176, 399 - .height = 220, 400 - .init_seq = hx8340bn_init, 401 - .init_seq_sz = ARRAY_SIZE(hx8340bn_init), 402 - }, 403 - { 404 - .name = "ili9225", 405 - .width = 176, 406 - .height = 220, 407 - .regwidth = 16, 408 - .init_seq = ili9225_init, 409 - .init_seq_sz = ARRAY_SIZE(ili9225_init), 410 - }, 411 - { 412 - .name = "ili9320", 413 - .width = 240, 414 - .height = 320, 415 - .setaddrwin = 1, 416 - .regwidth = 16, 417 - .init_seq = ili9320_init, 418 - .init_seq_sz = ARRAY_SIZE(ili9320_init), 419 - }, 420 - { 421 - .name = "ili9325", 422 - .width = 240, 423 - .height = 320, 424 - .setaddrwin = 1, 425 - .regwidth = 16, 426 - .init_seq = ili9325_init, 427 - .init_seq_sz = ARRAY_SIZE(ili9325_init), 428 - }, 429 - { 430 - .name = "ili9341", 431 - .width = 240, 432 - .height = 320, 433 - .init_seq = ili9341_init, 434 - .init_seq_sz = ARRAY_SIZE(ili9341_init), 435 - }, 436 - { 437 - .name = "ssd1289", 438 - .width = 240, 439 - .height = 320, 440 - .setaddrwin = 2, 441 - .regwidth = 16, 442 - .init_seq = ssd1289_init, 443 - .init_seq_sz = ARRAY_SIZE(ssd1289_init), 444 - }, 445 - { 446 - .name = "ssd1351", 447 - .width = 128, 448 - .height = 128, 449 - .setaddrwin = 3, 450 - .init_seq = ssd1351_init, 451 - .init_seq_sz = ARRAY_SIZE(ssd1351_init), 452 - }, 453 - }; 454 - 455 - /* ili9320, ili9325 */ 456 - static void flexfb_set_addr_win_1(struct fbtft_par *par, 457 - int xs, int ys, int xe, int ye) 458 - { 459 - switch (par->info->var.rotate) { 460 - /* R20h = Horizontal GRAM Start Address */ 461 - /* R21h = Vertical GRAM Start Address */ 462 - case 0: 463 - write_reg(par, 0x0020, xs); 464 - write_reg(par, 0x0021, ys); 465 - break; 466 - case 180: 467 - write_reg(par, 0x0020, width - 1 - xs); 468 - write_reg(par, 0x0021, height - 1 - ys); 469 - break; 470 - case 270: 471 - write_reg(par, 0x0020, width - 1 - ys); 472 - write_reg(par, 0x0021, xs); 473 - break; 474 - case 90: 475 - write_reg(par, 0x0020, ys); 476 - write_reg(par, 0x0021, height - 1 - xs); 477 - break; 478 - } 479 - write_reg(par, 0x0022); /* Write Data to GRAM */ 480 - } 481 - 482 - /* ssd1289 */ 483 - static void flexfb_set_addr_win_2(struct fbtft_par *par, 484 - int xs, int ys, int xe, int ye) 485 - { 486 - switch (par->info->var.rotate) { 487 - /* R4Eh - Set GDDRAM X address counter */ 488 - /* R4Fh - Set GDDRAM Y address counter */ 489 - case 0: 490 - write_reg(par, 0x4e, xs); 491 - write_reg(par, 0x4f, ys); 492 - break; 493 - case 180: 494 - write_reg(par, 0x4e, par->info->var.xres - 1 - xs); 495 - write_reg(par, 0x4f, par->info->var.yres - 1 - ys); 496 - break; 497 - case 270: 498 - write_reg(par, 0x4e, par->info->var.yres - 1 - ys); 499 - write_reg(par, 0x4f, xs); 500 - break; 501 - case 90: 502 - write_reg(par, 0x4e, ys); 503 - write_reg(par, 0x4f, par->info->var.xres - 1 - xs); 504 - break; 505 - } 506 - 507 - /* R22h - RAM data write */ 508 - write_reg(par, 0x22, 0); 509 - } 510 - 511 - /* ssd1351 */ 512 - static void set_addr_win_3(struct fbtft_par *par, 513 - int xs, int ys, int xe, int ye) 514 - { 515 - write_reg(par, 0x15, xs, xe); 516 - write_reg(par, 0x75, ys, ye); 517 - write_reg(par, 0x5C); 518 - } 519 - 520 - static int flexfb_verify_gpios_dc(struct fbtft_par *par) 521 - { 522 - fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); 523 - 524 - if (!par->gpio.dc) { 525 - dev_err(par->info->device, 526 - "Missing info about 'dc' gpio. Aborting.\n"); 527 - return -EINVAL; 528 - } 529 - 530 - return 0; 531 - } 532 - 533 - static int flexfb_verify_gpios_db(struct fbtft_par *par) 534 - { 535 - int i; 536 - int num_db = buswidth; 537 - 538 - fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); 539 - 540 - if (!par->gpio.dc) { 541 - dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); 542 - return -EINVAL; 543 - } 544 - if (!par->gpio.wr) { 545 - dev_err(par->info->device, "Missing info about 'wr' gpio. Aborting.\n"); 546 - return -EINVAL; 547 - } 548 - if (latched && !par->gpio.latch) { 549 - dev_err(par->info->device, "Missing info about 'latch' gpio. Aborting.\n"); 550 - return -EINVAL; 551 - } 552 - if (latched) 553 - num_db = buswidth / 2; 554 - for (i = 0; i < num_db; i++) { 555 - if (!par->gpio.db[i]) { 556 - dev_err(par->info->device, 557 - "Missing info about 'db%02d' gpio. Aborting.\n", 558 - i); 559 - return -EINVAL; 560 - } 561 - } 562 - 563 - return 0; 564 - } 565 - 566 - static void flexfb_chip_load_param(const struct flexfb_lcd_controller *chip) 567 - { 568 - if (!width) 569 - width = chip->width; 570 - if (!height) 571 - height = chip->height; 572 - setaddrwin = chip->setaddrwin; 573 - if (chip->regwidth) 574 - regwidth = chip->regwidth; 575 - if (!init_num) { 576 - initp = chip->init_seq; 577 - initp_num = chip->init_seq_sz; 578 - } 579 - } 580 - 581 - static struct fbtft_display flex_display = { }; 582 - 583 - static int flexfb_chip_init(const struct device *dev) 584 - { 585 - int i; 586 - 587 - for (i = 0; i < ARRAY_SIZE(flexfb_chip_table); i++) 588 - if (!strcmp(chip, flexfb_chip_table[i].name)) { 589 - flexfb_chip_load_param(&flexfb_chip_table[i]); 590 - return 0; 591 - } 592 - 593 - dev_err(dev, "chip=%s is not supported\n", chip); 594 - 595 - return -EINVAL; 596 - } 597 - 598 - static int flexfb_probe_common(struct spi_device *sdev, 599 - struct platform_device *pdev) 600 - { 601 - struct device *dev; 602 - struct fb_info *info; 603 - struct fbtft_par *par; 604 - int ret; 605 - 606 - initp = init; 607 - initp_num = init_num; 608 - 609 - if (sdev) 610 - dev = &sdev->dev; 611 - else 612 - dev = &pdev->dev; 613 - 614 - fbtft_init_dbg(dev, "%s(%s)\n", __func__, 615 - sdev ? "'SPI device'" : "'Platform device'"); 616 - 617 - if (chip) { 618 - ret = flexfb_chip_init(dev); 619 - if (ret) 620 - return ret; 621 - } 622 - 623 - if (width == 0 || height == 0) { 624 - dev_err(dev, "argument(s) missing: width and height has to be set.\n"); 625 - return -EINVAL; 626 - } 627 - flex_display.width = width; 628 - flex_display.height = height; 629 - fbtft_init_dbg(dev, "Display resolution: %dx%d\n", width, height); 630 - fbtft_init_dbg(dev, "chip = %s\n", chip ? chip : "not set"); 631 - fbtft_init_dbg(dev, "setaddrwin = %d\n", setaddrwin); 632 - fbtft_init_dbg(dev, "regwidth = %d\n", regwidth); 633 - fbtft_init_dbg(dev, "buswidth = %d\n", buswidth); 634 - 635 - info = fbtft_framebuffer_alloc(&flex_display, dev, dev->platform_data); 636 - if (!info) 637 - return -ENOMEM; 638 - 639 - par = info->par; 640 - if (sdev) 641 - par->spi = sdev; 642 - else 643 - par->pdev = pdev; 644 - if (!par->init_sequence) 645 - par->init_sequence = initp; 646 - par->fbtftops.init_display = fbtft_init_display; 647 - 648 - /* registerwrite functions */ 649 - switch (regwidth) { 650 - case 8: 651 - par->fbtftops.write_register = fbtft_write_reg8_bus8; 652 - break; 653 - case 16: 654 - par->fbtftops.write_register = fbtft_write_reg16_bus8; 655 - break; 656 - default: 657 - dev_err(dev, 658 - "argument 'regwidth': %d is not supported.\n", 659 - regwidth); 660 - return -EINVAL; 661 - } 662 - 663 - /* bus functions */ 664 - if (sdev) { 665 - par->fbtftops.write = fbtft_write_spi; 666 - switch (buswidth) { 667 - case 8: 668 - par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; 669 - if (!par->startbyte) 670 - par->fbtftops.verify_gpios = flexfb_verify_gpios_dc; 671 - break; 672 - case 9: 673 - if (regwidth == 16) { 674 - dev_err(dev, "argument 'regwidth': %d is not supported with buswidth=%d and SPI.\n", 675 - regwidth, buswidth); 676 - return -EINVAL; 677 - } 678 - par->fbtftops.write_register = fbtft_write_reg8_bus9; 679 - par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; 680 - if (par->spi->master->bits_per_word_mask 681 - & SPI_BPW_MASK(9)) { 682 - par->spi->bits_per_word = 9; 683 - break; 684 - } 685 - 686 - dev_warn(dev, 687 - "9-bit SPI not available, emulating using 8-bit.\n"); 688 - /* allocate buffer with room for dc bits */ 689 - par->extra = devm_kzalloc(par->info->device, 690 - par->txbuf.len 691 - + (par->txbuf.len / 8) + 8, 692 - GFP_KERNEL); 693 - if (!par->extra) { 694 - ret = -ENOMEM; 695 - goto out_release; 696 - } 697 - par->fbtftops.write = fbtft_write_spi_emulate_9; 698 - 699 - break; 700 - default: 701 - dev_err(dev, 702 - "argument 'buswidth': %d is not supported with SPI.\n", 703 - buswidth); 704 - return -EINVAL; 705 - } 706 - } else { 707 - par->fbtftops.verify_gpios = flexfb_verify_gpios_db; 708 - switch (buswidth) { 709 - case 8: 710 - par->fbtftops.write = fbtft_write_gpio8_wr; 711 - par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; 712 - break; 713 - case 16: 714 - par->fbtftops.write_register = fbtft_write_reg16_bus16; 715 - if (latched) 716 - par->fbtftops.write = fbtft_write_gpio16_wr_latched; 717 - else 718 - par->fbtftops.write = fbtft_write_gpio16_wr; 719 - par->fbtftops.write_vmem = fbtft_write_vmem16_bus16; 720 - break; 721 - default: 722 - dev_err(dev, 723 - "argument 'buswidth': %d is not supported with parallel.\n", 724 - buswidth); 725 - return -EINVAL; 726 - } 727 - } 728 - 729 - /* set_addr_win function */ 730 - switch (setaddrwin) { 731 - case 0: 732 - /* use default */ 733 - break; 734 - case 1: 735 - par->fbtftops.set_addr_win = flexfb_set_addr_win_1; 736 - break; 737 - case 2: 738 - par->fbtftops.set_addr_win = flexfb_set_addr_win_2; 739 - break; 740 - case 3: 741 - par->fbtftops.set_addr_win = set_addr_win_3; 742 - break; 743 - default: 744 - dev_err(dev, "argument 'setaddrwin': unknown value %d.\n", 745 - setaddrwin); 746 - return -EINVAL; 747 - } 748 - 749 - if (!nobacklight) 750 - par->fbtftops.register_backlight = fbtft_register_backlight; 751 - 752 - ret = fbtft_register_framebuffer(info); 753 - if (ret < 0) 754 - goto out_release; 755 - 756 - return 0; 757 - 758 - out_release: 759 - fbtft_framebuffer_release(info); 760 - 761 - return ret; 762 - } 763 - 764 - static int flexfb_remove_common(struct device *dev, struct fb_info *info) 765 - { 766 - struct fbtft_par *par; 767 - 768 - if (!info) 769 - return -EINVAL; 770 - par = info->par; 771 - if (par) 772 - fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, "%s()\n", 773 - __func__); 774 - fbtft_unregister_framebuffer(info); 775 - fbtft_framebuffer_release(info); 776 - 777 - return 0; 778 - } 779 - 780 - static int flexfb_probe_spi(struct spi_device *spi) 781 - { 782 - return flexfb_probe_common(spi, NULL); 783 - } 784 - 785 - static int flexfb_remove_spi(struct spi_device *spi) 786 - { 787 - struct fb_info *info = spi_get_drvdata(spi); 788 - 789 - return flexfb_remove_common(&spi->dev, info); 790 - } 791 - 792 - static int flexfb_probe_pdev(struct platform_device *pdev) 793 - { 794 - return flexfb_probe_common(NULL, pdev); 795 - } 796 - 797 - static int flexfb_remove_pdev(struct platform_device *pdev) 798 - { 799 - struct fb_info *info = platform_get_drvdata(pdev); 800 - 801 - return flexfb_remove_common(&pdev->dev, info); 802 - } 803 - 804 - static struct spi_driver flexfb_spi_driver = { 805 - .driver = { 806 - .name = DRVNAME, 807 - }, 808 - .probe = flexfb_probe_spi, 809 - .remove = flexfb_remove_spi, 810 - }; 811 - 812 - static const struct platform_device_id flexfb_platform_ids[] = { 813 - { "flexpfb", 0 }, 814 - { }, 815 - }; 816 - MODULE_DEVICE_TABLE(platform, flexfb_platform_ids); 817 - 818 - static struct platform_driver flexfb_platform_driver = { 819 - .driver = { 820 - .name = DRVNAME, 821 - }, 822 - .id_table = flexfb_platform_ids, 823 - .probe = flexfb_probe_pdev, 824 - .remove = flexfb_remove_pdev, 825 - }; 826 - 827 - static int __init flexfb_init(void) 828 - { 829 - int ret, ret2; 830 - 831 - ret = spi_register_driver(&flexfb_spi_driver); 832 - ret2 = platform_driver_register(&flexfb_platform_driver); 833 - if (ret < 0) 834 - return ret; 835 - return ret2; 836 - } 837 - 838 - static void __exit flexfb_exit(void) 839 - { 840 - spi_unregister_driver(&flexfb_spi_driver); 841 - platform_driver_unregister(&flexfb_platform_driver); 842 - } 843 - 844 - /* ------------------------------------------------------------------------- */ 845 - 846 - module_init(flexfb_init); 847 - module_exit(flexfb_exit); 848 - 849 - MODULE_DESCRIPTION("Generic FB driver for TFT LCD displays"); 850 - MODULE_AUTHOR("Noralf Tronnes"); 851 - MODULE_LICENSE("GPL");
+5 -4
drivers/staging/octeon/ethernet-tx.c
··· 261 261 /* Build the PKO buffer pointer */ 262 262 hw_buffer.u64 = 0; 263 263 if (skb_shinfo(skb)->nr_frags == 0) { 264 - hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data); 264 + hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data); 265 265 hw_buffer.s.pool = 0; 266 266 hw_buffer.s.size = skb->len; 267 267 } else { 268 - hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data); 268 + hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data); 269 269 hw_buffer.s.pool = 0; 270 270 hw_buffer.s.size = skb_headlen(skb); 271 271 CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64; ··· 273 273 skb_frag_t *fs = skb_shinfo(skb)->frags + i; 274 274 275 275 hw_buffer.s.addr = 276 - XKPHYS_TO_PHYS((u64)skb_frag_address(fs)); 276 + XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs)); 277 277 hw_buffer.s.size = skb_frag_size(fs); 278 278 CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64; 279 279 } 280 - hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)CVM_OCT_SKB_CB(skb)); 280 + hw_buffer.s.addr = 281 + XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb)); 281 282 hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1; 282 283 pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1; 283 284 pko_command.s.gather = 1;
+1 -1
drivers/staging/octeon/octeon-stubs.h
··· 1202 1202 1203 1203 static inline void *cvmx_phys_to_ptr(uint64_t physical_address) 1204 1204 { 1205 - return (void *)(physical_address); 1205 + return (void *)(uintptr_t)(physical_address); 1206 1206 } 1207 1207 1208 1208 static inline uint64_t cvmx_ptr_to_phys(void *ptr)
+1 -1
drivers/staging/rtl8188eu/hal/hal8188e_rate_adaptive.c
··· 409 409 pRaInfo->PTModeSS = 3; 410 410 else if (pRaInfo->HighestRate > 0x0b) 411 411 pRaInfo->PTModeSS = 2; 412 - else if (pRaInfo->HighestRate > 0x0b) 412 + else if (pRaInfo->HighestRate > 0x03) 413 413 pRaInfo->PTModeSS = 1; 414 414 else 415 415 pRaInfo->PTModeSS = 0;
+4 -2
drivers/staging/rtl8188eu/os_dep/usb_intf.c
··· 348 348 } 349 349 350 350 padapter->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); 351 - if (!padapter->HalData) 352 - DBG_88E("cant not alloc memory for HAL DATA\n"); 351 + if (!padapter->HalData) { 352 + DBG_88E("Failed to allocate memory for HAL data\n"); 353 + goto free_adapter; 354 + } 353 355 354 356 /* step read_chip_version */ 355 357 rtw_hal_read_chip_version(padapter);
+369
drivers/staging/speakup/sysfs-driver-speakup
··· 1 + What: /sys/accessibility/speakup/attrib_bleep 2 + KernelVersion: 2.6 3 + Contact: speakup@linux-speakup.org 4 + Description: Beeps the PC speaker when there is an attribute change such as 5 + foreground or background color when using speakup review 6 + commands. One = on, zero = off. 7 + 8 + What: /sys/accessibility/speakup/bell_pos 9 + KernelVersion: 2.6 10 + Contact: speakup@linux-speakup.org 11 + Description: This works much like a typewriter bell. If for example 72 is 12 + echoed to bell_pos, it will beep the PC speaker when typing on 13 + a line past character 72. 14 + 15 + What: /sys/accessibility/speakup/bleeps 16 + KernelVersion: 2.6 17 + Contact: speakup@linux-speakup.org 18 + Description: This controls whether one hears beeps through the PC speaker 19 + when using speakup's review commands. 20 + TODO: what values does it accept? 21 + 22 + What: /sys/accessibility/speakup/bleep_time 23 + KernelVersion: 2.6 24 + Contact: speakup@linux-speakup.org 25 + Description: This controls the duration of the PC speaker beeps speakup 26 + produces. 27 + TODO: What are the units? Jiffies? 28 + 29 + What: /sys/accessibility/speakup/cursor_time 30 + KernelVersion: 2.6 31 + Contact: speakup@linux-speakup.org 32 + Description: This controls cursor delay when using arrow keys. When a 33 + connection is very slow, with the default setting, when moving 34 + with the arrows, or backspacing etc. speakup says the incorrect 35 + characters. Set this to a higher value to adjust for the delay 36 + and better synchronisation between cursor position and speech. 37 + 38 + What: /sys/accessibility/speakup/delimiters 39 + KernelVersion: 2.6 40 + Contact: speakup@linux-speakup.org 41 + Description: Delimit a word from speakup. 42 + TODO: add more info 43 + 44 + What: /sys/accessibility/speakup/ex_num 45 + KernelVersion: 2.6 46 + Contact: speakup@linux-speakup.org 47 + Description: TODO: 48 + 49 + What: /sys/accessibility/speakup/key_echo 50 + KernelVersion: 2.6 51 + Contact: speakup@linux-speakup.org 52 + Description: Controls if speakup speaks keys when they are typed. One = on, 53 + zero = off or don't echo keys. 54 + 55 + What: /sys/accessibility/speakup/keymap 56 + KernelVersion: 2.6 57 + Contact: speakup@linux-speakup.org 58 + Description: Speakup keymap remaps keys to Speakup functions. 59 + It uses a binary 60 + format. A special program called genmap is needed to compile a 61 + textual keymap into the binary format which is then loaded into 62 + /sys/accessibility/speakup/keymap. 63 + 64 + What: /sys/accessibility/speakup/no_interrupt 65 + KernelVersion: 2.6 66 + Contact: speakup@linux-speakup.org 67 + Description: Controls if typing interrupts output from speakup. With 68 + no_interrupt set to zero, typing on the keyboard will interrupt 69 + speakup if for example 70 + the say screen command is used before the 71 + entire screen is read. 72 + With no_interrupt set to one, if the say 73 + screen command is used, and one then types on the keyboard, 74 + speakup will continue to say the whole screen regardless until 75 + it finishes. 76 + 77 + What: /sys/accessibility/speakup/punc_all 78 + KernelVersion: 2.6 79 + Contact: speakup@linux-speakup.org 80 + Description: This is a list of all the punctuation speakup should speak when 81 + punc_level is set to four. 82 + 83 + What: /sys/accessibility/speakup/punc_level 84 + KernelVersion: 2.6 85 + Contact: speakup@linux-speakup.org 86 + Description: Controls the level of punctuation spoken as the screen is 87 + displayed, not reviewed. Levels range from zero no punctuation, 88 + to four, all punctuation. One corresponds to punc_some, two 89 + corresponds to punc_most, and three as well as four both 90 + correspond to punc_all. Some hardware synthesizers may have 91 + different levels each corresponding to three and four for 92 + punc_level. Also note that if punc_level is set to zero, and 93 + key_echo is set to one, typed punctuation is still spoken as it 94 + is typed. 95 + 96 + What: /sys/accessibility/speakup/punc_most 97 + KernelVersion: 2.6 98 + Contact: speakup@linux-speakup.org 99 + Description: This is a list of all the punctuation speakup should speak when 100 + punc_level is set to two. 101 + 102 + What: /sys/accessibility/speakup/punc_some 103 + KernelVersion: 2.6 104 + Contact: speakup@linux-speakup.org 105 + Description: This is a list of all the punctuation speakup should speak when 106 + punc_level is set to one. 107 + 108 + What: /sys/accessibility/speakup/reading_punc 109 + KernelVersion: 2.6 110 + Contact: speakup@linux-speakup.org 111 + Description: Almost the same as punc_level, the differences being that 112 + reading_punc controls the level of punctuation when reviewing 113 + the screen with speakup's screen review commands. The other 114 + difference is that reading_punc set to three speaks punc_all, 115 + and reading_punc set to four speaks all punctuation, including 116 + spaces. 117 + 118 + What: /sys/accessibility/speakup/repeats 119 + KernelVersion: 2.6 120 + Contact: speakup@linux-speakup.org 121 + Description: A list of characters speakup repeats. Normally, when there are 122 + more than three characters in a row, speakup 123 + just reads three of 124 + those characters. For example, "......" would be read as dot, 125 + dot, dot. If a . is added to the list of characters in repeats, 126 + "......" would be read as dot, dot, dot, times six. 127 + 128 + What: /sys/accessibility/speakup/say_control 129 + KernelVersion: 2.6 130 + Contact: speakup@linux-speakup.org 131 + Description: If set to one, speakup speaks shift, alt and control when those 132 + keys are pressed. If say_control is set to zero, shift, ctrl, 133 + and alt are not spoken when they are pressed. 134 + 135 + What: /sys/accessibility/speakup/say_word_ctl 136 + KernelVersion: 2.6 137 + Contact: speakup@linux-speakup.org 138 + Description: TODO: 139 + 140 + What: /sys/accessibility/speakup/silent 141 + KernelVersion: 2.6 142 + Contact: speakup@linux-speakup.org 143 + Description: TODO: 144 + 145 + What: /sys/accessibility/speakup/spell_delay 146 + KernelVersion: 2.6 147 + Contact: speakup@linux-speakup.org 148 + Description: This controls how fast a word is spelled 149 + when speakup's say word 150 + review command is pressed twice quickly to speak the current 151 + word being reviewed. Zero just speaks the letters one after 152 + another, while values one through four 153 + seem to introduce more of 154 + a pause between the spelling of each letter by speakup. 155 + 156 + What: /sys/accessibility/speakup/synth 157 + KernelVersion: 2.6 158 + Contact: speakup@linux-speakup.org 159 + Description: Gets or sets the synthesizer driver currently in use. Reading 160 + synth returns the synthesizer driver currently in use. Writing 161 + synth switches to the given synthesizer driver, provided it is 162 + either built into the kernel, or already loaded as a module. 163 + 164 + What: /sys/accessibility/speakup/synth_direct 165 + KernelVersion: 2.6 166 + Contact: speakup@linux-speakup.org 167 + Description: Sends whatever is written to synth_direct 168 + directly to the speech synthesizer in use, bypassing speakup. 169 + This could be used to make the synthesizer speak 170 + a string, or to 171 + send control sequences to the synthesizer to change how the 172 + synthesizer behaves. 173 + 174 + What: /sys/accessibility/speakup/version 175 + KernelVersion: 2.6 176 + Contact: speakup@linux-speakup.org 177 + Description: Reading version returns the version of speakup, and the version 178 + of the synthesizer driver currently in use. 179 + 180 + What: /sys/accessibility/speakup/i18n/announcements 181 + KernelVersion: 2.6 182 + Contact: speakup@linux-speakup.org 183 + Description: This file contains various general announcements, most of which 184 + cannot be categorized. You will find messages such as "You 185 + killed Speakup", "I'm alive", "leaving help", "parked", 186 + "unparked", and others. You will also find the names of the 187 + screen edges and cursor tracking modes here. 188 + 189 + What: /sys/accessibility/speakup/i18n/chartab 190 + KernelVersion: 2.6 191 + Contact: speakup@linux-speakup.org 192 + Description: TODO 193 + 194 + What: /sys/accessibility/speakup/i18n/ctl_keys 195 + KernelVersion: 2.6 196 + Contact: speakup@linux-speakup.org 197 + Description: Here, you will find names of control keys. These are used with 198 + Speakup's say_control feature. 199 + 200 + What: /sys/accessibility/speakup/i18n/function_names 201 + KernelVersion: 2.6 202 + Contact: speakup@linux-speakup.org 203 + Description: Here, you will find a list of names for Speakup functions. 204 + These are used by the help system. For example, suppose that 205 + you have activated help mode, and you pressed 206 + keypad 3. Speakup 207 + says: "keypad 3 is character, say next." 208 + The message "character, say next" names a Speakup function, and 209 + it comes from this function_names file. 210 + 211 + What: /sys/accessibility/speakup/i18n/states 212 + KernelVersion: 2.6 213 + Contact: speakup@linux-speakup.org 214 + Description: This file contains names for key states. 215 + Again, these are part of the help system. For instance, if you 216 + had pressed speakup + keypad 3, you would hear: 217 + "speakup keypad 3 is go to bottom edge." 218 + The speakup key is depressed, so the name of the key state is 219 + speakup. 220 + This part of the message comes from the states collection. 221 + 222 + What: /sys/accessibility/speakup/i18n/characters 223 + KernelVersion: 2.6 224 + Contact: speakup@linux-speakup.org 225 + Description: Through this sys entry, Speakup gives you the ability to change 226 + how Speakup pronounces a given character. You could, for 227 + example, change how some punctuation characters are spoken. You 228 + can even change how Speakup will pronounce certain letters. For 229 + further details see '12. Changing the Pronunciation of 230 + Characters' in Speakup User's Guide (file spkguide.txt in 231 + source). 232 + 233 + What: /sys/accessibility/speakup/i18n/colors 234 + KernelVersion: 2.6 235 + Contact: speakup@linux-speakup.org 236 + Description: When you use the "say attributes" function, Speakup says the 237 + name of the foreground and background colors. These names come 238 + from the i18n/colors file. 239 + 240 + What: /sys/accessibility/speakup/i18n/formatted 241 + KernelVersion: 2.6 242 + Contact: speakup@linux-speakup.org 243 + Description: This group of messages contains embedded formatting codes, to 244 + specify the type and width of displayed data. If you change 245 + these, you must preserve all of the formatting codes, and they 246 + must appear in the order used by the default messages. 247 + 248 + What: /sys/accessibility/speakup/i18n/key_names 249 + KernelVersion: 2.6 250 + Contact: speakup@linux-speakup.org 251 + Description: Again, key_names is used by Speakup's help system. In the 252 + previous example, Speakup said that you pressed "keypad 3." 253 + This name came from the key_names file. 254 + 255 + What: /sys/accessibility/speakup/<synth-name>/ 256 + KernelVersion: 2.6 257 + Contact: speakup@linux-speakup.org 258 + Description: In `/sys/accessibility/speakup` is a directory corresponding to 259 + the synthesizer driver currently in use (E.G) `soft` for the 260 + soft driver. This directory contains files which control the 261 + speech synthesizer itself, 262 + as opposed to controlling the speakup 263 + screen reader. The parameters in this directory have the same 264 + names and functions across all 265 + supported synthesizers. The range 266 + of values for freq, pitch, rate, and vol is the same for all 267 + supported synthesizers, with the given range being internally 268 + mapped by the driver to more or less fit the range of values 269 + supported for a given parameter by the individual synthesizer. 270 + Below is a description of values and parameters for soft 271 + synthesizer, which is currently the most commonly used. 272 + 273 + What: /sys/accessibility/speakup/soft/caps_start 274 + KernelVersion: 2.6 275 + Contact: speakup@linux-speakup.org 276 + Description: This is the string that is sent to the synthesizer to cause it 277 + to start speaking uppercase letters. For the soft synthesizer 278 + and most others, this causes the pitch of the voice to rise 279 + above the currently set pitch. 280 + 281 + What: /sys/accessibility/speakup/soft/caps_stop 282 + KernelVersion: 2.6 283 + Contact: speakup@linux-speakup.org 284 + Description: This is the string sent to the synthesizer to cause it to stop 285 + speaking uppercase letters. In the case of the soft synthesizer 286 + and most others, this returns the pitch of the voice 287 + down to the 288 + currently set pitch. 289 + 290 + What: /sys/accessibility/speakup/soft/delay_time 291 + KernelVersion: 2.6 292 + Contact: speakup@linux-speakup.org 293 + Description: TODO: 294 + 295 + What: /sys/accessibility/speakup/soft/direct 296 + KernelVersion: 2.6 297 + Contact: speakup@linux-speakup.org 298 + Description: Controls if punctuation is spoken by speakup, or by the 299 + synthesizer. 300 + For example, speakup speaks ">" as "greater", while 301 + the espeak synthesizer used by the soft driver speaks "greater 302 + than". Zero lets speakup speak the punctuation. One lets the 303 + synthesizer itself speak punctuation. 304 + 305 + What: /sys/accessibility/speakup/soft/freq 306 + KernelVersion: 2.6 307 + Contact: speakup@linux-speakup.org 308 + Description: Gets or sets the frequency of the speech synthesizer. Range is 309 + 0-9. 310 + 311 + What: /sys/accessibility/speakup/soft/full_time 312 + KernelVersion: 2.6 313 + Contact: speakup@linux-speakup.org 314 + Description: TODO: 315 + 316 + What: /sys/accessibility/speakup/soft/jiffy_delta 317 + KernelVersion: 2.6 318 + Contact: speakup@linux-speakup.org 319 + Description: This controls how many jiffys the kernel gives to the 320 + synthesizer. Setting this too high can make a system unstable, 321 + or even crash it. 322 + 323 + What: /sys/accessibility/speakup/soft/pitch 324 + KernelVersion: 2.6 325 + Contact: speakup@linux-speakup.org 326 + Description: Gets or sets the pitch of the synthesizer. The range is 0-9. 327 + 328 + What: /sys/accessibility/speakup/soft/punct 329 + KernelVersion: 2.6 330 + Contact: speakup@linux-speakup.org 331 + Description: Gets or sets the amount of punctuation spoken by the 332 + synthesizer. The range for the soft driver seems to be 0-2. 333 + TODO: How is this related to speakup's punc_level, or 334 + reading_punc. 335 + 336 + What: /sys/accessibility/speakup/soft/rate 337 + KernelVersion: 2.6 338 + Contact: speakup@linux-speakup.org 339 + Description: Gets or sets the rate of the synthesizer. Range is from zero 340 + slowest, to nine fastest. 341 + 342 + What: /sys/accessibility/speakup/soft/tone 343 + KernelVersion: 2.6 344 + Contact: speakup@linux-speakup.org 345 + Description: Gets or sets the tone of the speech synthesizer. The range for 346 + the soft driver seems to be 0-2. This seems to make no 347 + difference if using espeak and the espeakup connector. 348 + TODO: does espeakup support different tonalities? 349 + 350 + What: /sys/accessibility/speakup/soft/trigger_time 351 + KernelVersion: 2.6 352 + Contact: speakup@linux-speakup.org 353 + Description: TODO: 354 + 355 + What: /sys/accessibility/speakup/soft/voice 356 + KernelVersion: 2.6 357 + Contact: speakup@linux-speakup.org 358 + Description: Gets or sets the voice used by the synthesizer if the 359 + synthesizer can speak in more than one voice. The range for the 360 + soft driver is 0-7. Note that while espeak supports multiple 361 + voices, this parameter will not set the voice when the espeakup 362 + connector is used between speakup and espeak. 363 + 364 + What: /sys/accessibility/speakup/soft/vol 365 + KernelVersion: 2.6 366 + Contact: speakup@linux-speakup.org 367 + Description: Gets or sets the volume of the speech synthesizer. Range is 0-9, 368 + with zero being the softest, and nine being the loudest. 369 +
+2 -2
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
··· 12 12 static const struct snd_pcm_hardware snd_bcm2835_playback_hw = { 13 13 .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | 14 14 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 15 - SNDRV_PCM_INFO_DRAIN_TRIGGER | SNDRV_PCM_INFO_SYNC_APPLPTR), 15 + SNDRV_PCM_INFO_SYNC_APPLPTR), 16 16 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 17 17 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 18 18 .rate_min = 8000, ··· 29 29 static const struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { 30 30 .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | 31 31 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 32 - SNDRV_PCM_INFO_DRAIN_TRIGGER | SNDRV_PCM_INFO_SYNC_APPLPTR), 32 + SNDRV_PCM_INFO_SYNC_APPLPTR), 33 33 .formats = SNDRV_PCM_FMTBIT_S16_LE, 34 34 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | 35 35 SNDRV_PCM_RATE_48000,
+1
drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
··· 289 289 VC_AUDIO_MSG_TYPE_STOP, false); 290 290 } 291 291 292 + /* FIXME: this doesn't seem working as expected for "draining" */ 292 293 int bcm2835_audio_drain(struct bcm2835_alsa_stream *alsa_stream) 293 294 { 294 295 struct vc_audio_msg m = {
+3 -1
drivers/staging/vt6655/device_main.c
··· 1748 1748 1749 1749 priv->hw->max_signal = 100; 1750 1750 1751 - if (vnt_init(priv)) 1751 + if (vnt_init(priv)) { 1752 + device_free_info(priv); 1752 1753 return -ENODEV; 1754 + } 1753 1755 1754 1756 device_print_info(priv); 1755 1757 pci_set_drvdata(pcid, priv);